package.json

Run script on change in nodemon

≡放荡痞女 提交于 2020-08-07 08:15:07
问题 Is it possible to run a script on change using nodemon? Is it possible to do something like this: nodemon --watch src --exec yarn run my-script ? So, ideally I'd like to run a script only when there're changes in a src folder 回答1: As indicated in the Nodemon docs you can add a restart event command in nodemon.json : { "events": { "restart": "yarn my-script" } } 回答2: Just put quotes around your script that you want to execute nodemon --watch src --exec "yarn run my-script" 来源: https:/

How to continue running scripts defined in package.json in case one fails?

旧城冷巷雨未停 提交于 2020-07-22 05:15:41
问题 I have this in package.json file: { "name": "test demo", "version": "1.0.0", "description": "test demo scripts", "scripts": { "test:v1": "wdio src/resources/config/wdio.chrome.conf.js --spec test/Tests.spec.ts", "test:v2": "wdio src/resources/config/wdio.firefox.conf.js --spec test/Tests.spec.ts", "test": "npm run test:v1 && npm run test:v2" }, ... } When run this command: npm run test then if test:v1 fails, then test:v2 script is not executed at all. Is there a way to configure this so that

Setting an env var in package.json for use with electron-reload?

和自甴很熟 提交于 2020-07-21 07:40:19
问题 I usually develop on macOS but I've moved the project over to Windows 10 in order to work on some Windows-specific issues. I use electron-reload to reload the app when changes are made. It's been working wonderfully on macOS but breaks on Windows. Using the setup below, and npm start to start the app, on Windows it throws an error: "'APP__DEV' is not recognized as an internal or external command" Am I doing this wrong and macOS is just more "forgiving"? I saw this question: Setting process

Setting an env var in package.json for use with electron-reload?

别来无恙 提交于 2020-07-21 07:40:07
问题 I usually develop on macOS but I've moved the project over to Windows 10 in order to work on some Windows-specific issues. I use electron-reload to reload the app when changes are made. It's been working wonderfully on macOS but breaks on Windows. Using the setup below, and npm start to start the app, on Windows it throws an error: "'APP__DEV' is not recognized as an internal or external command" Am I doing this wrong and macOS is just more "forgiving"? I saw this question: Setting process

Git repository to a dependency in package.json

断了今生、忘了曾经 提交于 2020-06-28 10:18:11
问题 I am having a git repository and want to use this repository as a dependency in package.json file of some other project so that it can be downloaded as we run npm command. can anyone help me out? 回答1: Try this. "dependencies": { "<repo>": "<user>/<repo>#<branch>", } Example: "dependencies": { "botkit": "jonchurch/botkit#master", } Reference is here! 回答2: From the NPM docs: Git URLs as Dependencies git://github.com/user/project.git#commit-ish git+ssh://user@hostname:project.git#commit-ish git

Error when I run npm install Error: 404 Not Found: 7zip-bin@~4.1.0

早过忘川 提交于 2020-06-27 18:46:12
问题 When I run npm install I see this error 3 verbose stack Error: 404 Not Found: 7zip-bin@~4.1.0 2293 verbose stack at fetch.then.res (C:\cygwin64\home\licbuild\ANSYSDev\LicensingPortal\node\node-v8.12.0-win-x64\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:42:19) 2293 verbose stack at tryCatcher (C:\cygwin64\home\licbuild\ANSYSDev\LicensingPortal\node\node-v8.12.0-win-x64\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23) 2293 verbose stack at Promise.

Error when I run npm install Error: 404 Not Found: 7zip-bin@~4.1.0

北城余情 提交于 2020-06-27 18:45:09
问题 When I run npm install I see this error 3 verbose stack Error: 404 Not Found: 7zip-bin@~4.1.0 2293 verbose stack at fetch.then.res (C:\cygwin64\home\licbuild\ANSYSDev\LicensingPortal\node\node-v8.12.0-win-x64\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:42:19) 2293 verbose stack at tryCatcher (C:\cygwin64\home\licbuild\ANSYSDev\LicensingPortal\node\node-v8.12.0-win-x64\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23) 2293 verbose stack at Promise.

Move files to root when my NPM package is installed

故事扮演 提交于 2020-06-26 04:48:51
问题 I currently have my repo https://github.com/Aotik/Blossom which I'm working on at the moment. It is a NPM published package named blossom-ui My question is, is there a way to move the files out of node_modules/blossom-ui into the root of the folder outside node_modules when the package is installed? So it would look something like blossom-ui css / styl / fonts / js / node_modules ... 回答1: This can be done in a postinstall script in npm. postinstall is executed automatically by npm each time

Node Environmental variable on Windows

痞子三分冷 提交于 2020-06-18 13:18:32
问题 I noticed this strange behavior which is not a big deal, but bugging the heck out of me. In my package.json file, under the "scripts" section, I have a "start" entry. It looks like this: "scripts": { "start": "APPLICATION_ENV=development nodemon app.js" } typing npm start on a Mac terminal works fine, and nodemon runs the app with the correct APPLICATION_ENV variable as expected. When I try the same on a Windows environment, I get the following error: "'APPLICATION_ENV' is not recognized as

Node Environmental variable on Windows

情到浓时终转凉″ 提交于 2020-06-18 13:17:27
问题 I noticed this strange behavior which is not a big deal, but bugging the heck out of me. In my package.json file, under the "scripts" section, I have a "start" entry. It looks like this: "scripts": { "start": "APPLICATION_ENV=development nodemon app.js" } typing npm start on a Mac terminal works fine, and nodemon runs the app with the correct APPLICATION_ENV variable as expected. When I try the same on a Windows environment, I get the following error: "'APPLICATION_ENV' is not recognized as