Skip to content

Commit 4eda2d2

Browse files
committed
chore(internal): enable building when git installed (#657)
1 parent a5ec493 commit 4eda2d2

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99
"repository": "github:openai/openai-node",
1010
"license": "Apache-2.0",
1111
"packageManager": "[email protected]",
12+
"files": [
13+
"*"
14+
],
1215
"private": false,
1316
"scripts": {
1417
"test": "bin/check-test-server && yarn jest",
1518
"build": "bash ./build",
1619
"prepack": "echo 'to pack, run yarn build && (cd dist; yarn pack)' && exit 1",
1720
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
1821
"format": "prettier --write --cache --cache-strategy metadata . !dist",
19-
"prepare": "if [ $(basename $(dirname $PWD)) = 'node_modules' ]; then npm run build; fi",
22+
"prepare": "if ./scripts/check-is-in-git-install.sh; then npm run build; fi",
2023
"tsn": "ts-node -r tsconfig-paths/register",
2124
"lint": "eslint --ext ts,js .",
2225
"fix": "eslint --fix --ext ts,js ."

scripts/check-is-in-git-install.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# Check if you happen to call prepare for a repository that's already in node_modules.
3+
[ "$(basename "$(dirname "$PWD")")" = 'node_modules' ] ||
4+
# The name of the containing directory that 'npm` uses, which looks like
5+
# $HOME/.npm/_cacache/git-cloneXXXXXX
6+
[ "$(basename "$(dirname "$PWD")")" = 'tmp' ] ||
7+
# The name of the containing directory that 'yarn` uses, which looks like
8+
# $(yarn cache dir)/.tmp/XXXXX
9+
[ "$(basename "$(dirname "$PWD")")" = '.tmp' ]

0 commit comments

Comments
 (0)