All Questions
Tagged with npm-scripts bash
37 questions
0
votes
0
answers
108
views
Preserving colours for text in bash script executing from an npm script
I have a bash script where I echo out some coloured text at the start like so:
echo "\033[1;31mACTION REQUIRED: \033[0m"
And I see that coloured as expected when I run the script from my ...
2
votes
1
answer
941
views
How do you pass an environment variable from a script to a React Native file?
I feel like I'm doing everything right but I must be going wrong somewhere. I'm not using Expo or create-react-app. I'm on a Macbook.
First, I run npm run start, which runs a script. The script looks ...
0
votes
1
answer
305
views
Create npm script to run `tsc` and then something else, regardless of fail?
So this is my setup in my package.json:
"scripts": {
"build": "tsc",
"test": "npm run build ; node --test ./dist/test"
},
I have heard in bash, ...
0
votes
1
answer
175
views
Execute multiple JS file on NPM script NodeJS
I have a NodeJS app for HTTP call managment
I must execute one JS file (./src/starter.js) before real app starts (./src/boot/index.js)
This is my package.json file:
"engines": {
"node&...
0
votes
0
answers
154
views
Part of the command is not executed in bash script
I added to command this line
ALLURE_RESULTS_DIR=allure-test
Here is this piece of code
if [[ "$has_specific_tests" == "true" ]]; then
information_message "Starting ...
0
votes
1
answer
531
views
Node scripts resetting ENV variables between script commands
I'm trying to set NODE_EXTRA_CA_CERTS in a node script like so:
// package.json
"scripts": {
"load-cert": "export NODE_EXTRA_CA_CERTS=cert.pem",
"start":...
0
votes
1
answer
304
views
How to join two npm commands in fish shell to avoid yarn install warnings?
I want to ignore yarn errors using this method
yarn install 2> >(grep -v warning 1>&2)
As I am using fish shell I did figure out that this command has to become yarn install 2> "&...
1
vote
1
answer
166
views
Change value of shell variables as an argument of npm run command
I am trying to accomplish the following -> Right now I use cypress to run e2e tests. It is being launched by npm command. I have several environments and different user permission. I created a ...
2
votes
2
answers
4k
views
Provide custom parameters ($npm_config_) to npm scripts on Windows
I have npm scripts in the package.json, I would like to provide custom parameter from the command line. I found many stackoverflow questions and answers but none of them works. I tried this solution:
...
0
votes
1
answer
430
views
How do you run pyenv commands from an npm script?
I'd like to have an npm script in package.json that is like:
"scripts": {
"activate": "pyenv activate mypythonenvironment"
}
If I simply run
pyenv activate ...
1
vote
0
answers
606
views
How to pass dotenv variables to npm script?
I need to read a variable from .env file and pass it to an npm script (or make it available for the script).
I tried it like this with dotenv library:
dotenv -e .env -- graphql-faker api-extension.gql ...
4
votes
1
answer
1k
views
How execute bash Command Substitution in npm script
I want to execute linter only on staged files.
For this i wrote inside package.json the command(inside scripts):
"fix-lint": "tslint $(git diff --name-only --staged) "
Execute it:
...
0
votes
2
answers
265
views
Terminal script involving 2 terminals
Is it possible to make a command that does something, Opens another terminal and then does something there?
Im trying to combine the start up of a server and its api.
"god": "next dev &...
0
votes
2
answers
1k
views
Write input of a npm command to a variable but only a specific part
On my root directory of my project, I have a package.json. While doing the CI build, I am trying to capture the version properties from the file. Since I am running on a node container, the following ...
0
votes
1
answer
197
views
How to pass `--` when used with pre npm scripts
How to pass others flags into npm command that has pre config
"prebuild": "npm run build:vendor",
"build": "cross-env NODE_ENV=production webpack --env.production -p",
When I run npm run build -- --...