-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for npm_package_config_* variables #73
Comments
I had no idea this exists but I will add support for it. I saw references to the environment variables in npm & pnpm's code, but hadn't seen any usages of For now, you can use a For example: TS_NODE_PROJECT="tsconfig.common.json some-bundler" This can be in any of:
|
I can work on it! seems like a good issue for me |
Hi Bun team, |
Hi @Jarred-Sumner, "scripts": {
"typeorm": "ts-node ./node_modules/typeorm/cli",
"typeorm:run-migrations": "npm run typeorm migration:run -- -d ./typeOrm.config.ts",
"typeorm:generate-migration": "npm run typeorm -- -d ./typeOrm.config.ts migration:generate ./migrations/$npm_config_name",
"typeorm:create-migration": "npm run typeorm -- migration:create ./migrations/$npm_config_name",
"typeorm:revert-migration": "npm run typeorm -- -d ./typeOrm.config.ts migration:revert",
...
} |
+1 This would be helpful |
Is there any solution for this? |
Even though you can't currently use npm_package_config_* there are still ways to pass arguments to scripts like below. "scripts": {
"scriptName": "echo $argumentName"
} You can then do |
Yes. Rewrite the variable in your script this way: {
"...": "...",
"typeorm:generate-migration": "npm run typeorm -- -d ./typeOrm.config.ts migration:generate ./migrations/$(echo $NAME)",
"...": "...",
} Then pass it $ NAME=SomeName npm run typeorm:generate-migration |
To minimise repetition in package.json scripts, it'd be useful to support the
$npm_package_config_
prefix enabling:For
npm run build:dev
,yarn run build:dev
andpnpm run build:dev
the result is:For
bun
, the output is currently 😢The text was updated successfully, but these errors were encountered: