package.json

npm publish - removing scripts from package.json?

故事扮演 提交于 2019-12-10 22:41:34
问题 Before publishing my script, I have a number of scripts under the package.json to compile coffeescript, typescript and developer only commands - which make no sense once it's published. I was wondering if there is a procedure for removing certain scripts under the package.json ? Considering that when publishing your package, it also publishes package.json. Would this be possible to kind of remove scripts before publishing the package? Once I publish my script, I remove a lot of the typescript

NPM Run Build Always Builds Production and Never Development

笑着哭i 提交于 2019-12-10 21:57:37
问题 On an inherited project I have, I am trying to get the build command to build a version other than Production . I have attempted to change the alias in the script section in package.json to pass in extra variables such as --dev and --configuration=dev to no avail. The project has these json data files: env.dev env.development env.production with the package.json has this build alias build:dev which I run npm run build:dev : "scripts": { "start": "NODE_ENV=dev && react-scripts start", … "build

How to include external JS file to angular5?

喜夏-厌秋 提交于 2019-12-10 15:28:29
问题 I am new to angular and started learning angular5 from this tutorial . I am converting normal HTML template to Angular 5 version now I am facing difficulties when adding external JS file to angular 5 project. Can anyone help me to add external js file to angular5 project ? Here is my updated angular.json file. still not working for me. /*angular.json*/ { "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", "projects": { "minimus-master":

Match multiple file extensions in npm script

空扰寡人 提交于 2019-12-10 13:25:32
问题 I have an npm script where I want to match both ts and tsx file extensions... something like below: "test": "mocha ..... app/test/**/*.spec.{ts,tsx}" However, the above syntax doesn't work. What's the correct syntax for doing this? 回答1: Your pattern is correct. Your problem is that your shell is attempting to expand your glob for you instead of letting mocha expand it. To fix this, you need to double-quote your glob (note that double-quotes must be JSON-escaped with \ ): "test": "mocha .....

root directory for node module

人盡茶涼 提交于 2019-12-09 14:21:46
问题 I have a pretty standard node module using babel to transpile our code which is then output to a 'lib' folder. the package.json points 'main' to 'lib/index.js' so that people can just require('my-module') However, if I have a subdirectory (say my-module/server for example) then when they use my-module they have to do require('my-module/lib/server') . I've seen people put post build steps that will copy package.json into lib, but that just feels hacky and wrong to me. Is there any way in npm

sync yarn.lock back into package.json and lock

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-09 05:25:20
问题 I have package.json and yarn.lock files. yarn.lock has versions locked in, I would like to sync, and lock(without the ^) all the versions in yarn.lock, back into package.json. is there any easy way to do that? in the end I would like to not have "^" in my package.json at all as it leads to too many troubles, and I would like to upgrade packages specificly and not unknowingly when I run a fresh yarn install. is there any tool or way to quickly replace the versions in package.json with those

Pass command line — argument to child script in Yarn

跟風遠走 提交于 2019-12-08 19:04:10
问题 I have a package.json that looks similar to this: "scripts": { "dev": "cross-env BABEL_ENV=client webpack --config webpack/client.development.js && yarn dev:stub-server | cross-env BABEL_ENV=server babel-node src/server/server.js", "dev:stub-server": "./node_modules/.bin/robohydra ./stubs/robohydra-config.json -p 3100" } I added some logic in the code to change the way the dev:stub-server is configured depending on a command line argument. So, whenever I run the following I get what I expect:

error TS2300: Duplicate identifier 'PropertyKey' in node_modules/@types/core-js/index.d.ts

人盡茶涼 提交于 2019-12-08 18:53:37
问题 I have these errors in node_modules/@types/core-js/index.d.ts in Visual Studio Code IDE: When I run npm start to serve the app, I get: node_modules/@types/core-js/index.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'. node_modules/@types/core-js/index.d.ts(85,5): error TS2687: All declarations of 'name' must have identical modifiers. node_modules/@types/core-js/index.d.ts(145,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol

NPM: Missing dist and src directories when trying to install directly from a github url

放肆的年华 提交于 2019-12-08 16:12:30
问题 An npm package I am using has been forked on github with some bug fixes and I now want to use the forked code in my project until the fork is merged. In my package.json I change the reference in dependencies from e.g. “cool-package”: "^0.10.0" to “cool-package“: "git://github.com/developer-who-forked/cool-package.git" but this doesn’t work. If I run npm install after updating the package.json and then go in to node_modules/cool-package/ I don’t see any /src folder or any /dist folder (all the

NODE_ENV is not recognised as an internal or external command

陌路散爱 提交于 2019-12-08 15:21:12
问题 I am developing in node.js and wanted to take into account both production and development environment. I found out that setting NODE_ENV while running the node.js server does the job. However when I try to set it in package.json script it gives me the error: NODE_ENV is not recognised as an internal or external command Below is my package.json { "name": "NODEAPT", "version": "0.0.0", "private": true, "scripts": { "start": "NODE_ENV=development node ./bin/server", "qa2": "NODE_ENV=qa2 node .