Skip to content

Commit

Permalink
chore(internal): enable building when git installed (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Feb 2, 2024
1 parent 46f8c28 commit 3065001
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -9,14 +9,15 @@
"repository": "github:anthropics/anthropic-sdk-typescript",
"license": "MIT",
"packageManager": "yarn@1.22.21",
"files": ["*"],
"private": false,
"scripts": {
"test": "bin/check-test-server && yarn jest",
"build": "bash ./build",
"prepack": "echo 'to pack, run yarn build && (cd dist; yarn pack)' && exit 1",
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
"format": "prettier --write --cache --cache-strategy metadata . !dist",
"prepare": "if [ $(basename $(dirname $PWD)) = 'node_modules' ]; then npm run build; fi",
"prepare": "if ./scripts/check-is-in-git-install.sh; then npm run build; fi",
"tsn": "ts-node -r tsconfig-paths/register",
"lint": "eslint --ext ts,js .",
"fix": "eslint --fix --ext ts,js ."
Expand Down
9 changes: 9 additions & 0 deletions scripts/check-is-in-git-install.sh
@@ -0,0 +1,9 @@
#!/bin/bash
# Check if you happen to call prepare for a repository that's already in node_modules.
[ "$(basename "$(dirname "$PWD")")" = 'node_modules' ] ||
# The name of the containing directory that 'npm` uses, which looks like
# $HOME/.npm/_cacache/git-cloneXXXXXX
[ "$(basename "$(dirname "$PWD")")" = 'tmp' ] ||
# The name of the containing directory that 'yarn` uses, which looks like
# $(yarn cache dir)/.tmp/XXXXX
[ "$(basename "$(dirname "$PWD")")" = '.tmp' ]

0 comments on commit 3065001

Please sign in to comment.