Skip to content

Commit

Permalink
chore(internal): enable building when git installed (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored Feb 2, 2024
1 parent 21ae54e commit 8c80a7d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
"repository": "github:openai/openai-node",
"license": "Apache-2.0",
"packageManager": "[email protected]",
"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
Original file line number Diff line number Diff line change
@@ -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 8c80a7d

Please sign in to comment.