package.json

root directory for node module

为君一笑 提交于 2019-12-03 23:25:41
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 to specify a main directory whereby any require()'s of my module would start at that directory? Then I

Create package.json from package-lock.json

故事扮演 提交于 2019-12-03 22:23:37
I downloaded a theme and it has a package-lock.json file but no package.json file. Is there a way I can generate the package.json from the package-lock.json file. How do I install the node modules with just the package-lock.json file. Is there a way to do that? VeeeneX Install the latest npm with npm install -g npm Run npm init and respond to the questions. The above command will generate a package.json and include the existing packages listed in package-lock.json package-lock.json file relies on the presence of a package.json file, So it's not possible to retrieve package.json (happy to be

How to override package.json main field

送分小仙女□ 提交于 2019-12-03 17:28:34
How can I override the main field of package.json like in bower? "overrides": { "highcharts": { "main": "highcharts.js" } } Try creating an alias with the same name as the module in your Webpack config. module.exports = { ... resolve: { alias: { "highcharts": path.resolve(__dirname, "path/to/file") } }, ... }; 来源: https://stackoverflow.com/questions/35989956/how-to-override-package-json-main-field

package.json start script, babel-node: not found on heroku deploy

眉间皱痕 提交于 2019-12-03 16:16:56
问题 When I run heroku local or when I just do npm start locally, my app builds and runs fine. However when I deploy to heroku, the app crashes saying it cannot find babel-node. Here is the log output: 2016-04-21T22:20:44.320025+00:00 heroku[api]: Deploy 5d9a9da by eagsalazar@gmail.com 2016-04-21T22:20:44.320084+00:00 heroku[api]: Release v9 created by eagsalazar@gmail.com 2016-04-21T22:20:44.542062+00:00 heroku[slug-compiler]: Slug compilation started 2016-04-21T22:20:44.542069+00:00 heroku[slug

Why do we need to use package.json? [duplicate]

喜夏-厌秋 提交于 2019-12-03 16:11:56
This question already has an answer here: What are the main uses for the NPM package.json file? 1 answer I am new in programming languages. I was trying to learn web socket with java script to this site , but i am not understanding something that why i need to use package.json . This is my package.json file code `{ "name": "module-name", "version": "10.3.1", "description": "An example module to illustrate the usage of a package.json", "author": "Your Name <you.name@example.org>", "contributors": [{ "name": "Foo Bar", "email": "foo.bar@example.com" }], "bin": { "module-name": "./bin/module-name

Root directory in package.json

那年仲夏 提交于 2019-12-03 14:17:50
问题 My question concerns an existing library that I wish to publish as an NPM module. The library is already in use, and currently require d via the local file system. How can I specify the root directory of my module's files? If I have a structure like: . ├── package.json ├── src | ├── js | └────── lib | └───────── my | └───────────── thing.js | └───────────── that.js How do I specify that the root of my module, and accessible files is src/js/lib/my/ ? I would like to use as follows from an

How to run typescript compiler as a package.json script without grunt or gulp

本秂侑毒 提交于 2019-12-03 09:29:05
I don't want to use grunt or gulp to compile ts files. I just want to do it in my package.json something like this: "scripts": { "build": "tsc main.ts dist/" }, is it possible? basarat "build": "tsc main.ts dist/" Highly recommend you use tsconfig.json and then the -p compiler option to build your code. Look at: Compilation-Context Setup Here is the setup for using tsc with NPM scripts init npm init npm install typescript --save And then in your package.json add some scripts : "scripts": { "build": "tsc -p ./src", "start": "npm run build -- -w" }, Use For build only: npm run build For building

sync yarn.lock back into package.json and lock

老子叫甜甜 提交于 2019-12-03 06:29:58
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 exsisting inside yarn.lock? I ended up making something myself: sync-yarnlock-into-packagejson its a tiny

Github potential security vulnerability error for hoek node module

▼魔方 西西 提交于 2019-12-03 05:49:31
问题 Today github is showing following error on my github repository: We found a potential security vulnerability in one of your dependencies. A dependency defined in ./package-lock.json has known security vulnerabilities and should be updated. On clicking on Review vulnerable dependency button following message was displayed: hoek node module before 5.0.3 suffers from a Modification of Assumed-Immutable Data (MAID) vulnerability via 'merge' Till yesterday it was not showing such error. I have not

package.json start script, babel-node: not found on heroku deploy

两盒软妹~` 提交于 2019-12-03 05:24:50
When I run heroku local or when I just do npm start locally, my app builds and runs fine. However when I deploy to heroku, the app crashes saying it cannot find babel-node. Here is the log output: 2016-04-21T22:20:44.320025+00:00 heroku[api]: Deploy 5d9a9da by eagsalazar@gmail.com 2016-04-21T22:20:44.320084+00:00 heroku[api]: Release v9 created by eagsalazar@gmail.com 2016-04-21T22:20:44.542062+00:00 heroku[slug-compiler]: Slug compilation started 2016-04-21T22:20:44.542069+00:00 heroku[slug-compiler]: Slug compilation finished 2016-04-21T22:20:44.501025+00:00 heroku[web.1]: State changed from