package.json

How to define a custom console.log if a script in package.json throws an error?

守給你的承諾、 提交于 2020-01-04 01:28:05
问题 Is it possible to add a custom console.log if my custom npm script throws an error? Or is it at all possible to add custom console.log to a script? I have this entry in my scripts object of package.json : "check": "npm list --depth=0 | grep" And need a console.log specifically for this script. 来源: https://stackoverflow.com/questions/48006553/how-to-define-a-custom-console-log-if-a-script-in-package-json-throws-an-error

Setting the “root” of a published npm project

只谈情不闲聊 提交于 2020-01-03 19:15:45
问题 I'm publishing an npm package named foo to the npm registry. I wrote the package using a compile-to-js language. For sanity, I put the compiled output into the dist/ folder of the project directory. My package.json lists the entrypoint as dist/entry.js : { "name": "foo", "main": "dist/entry.js", } Sometimes, I want to use files within the package that are not part of the entry point. For example, there is a very useful export called whatever inside of dist/util.js : import { whatever } from

Get value of package.json in gitLab CI YML

我们两清 提交于 2020-01-01 08:56:22
问题 I'm using gitLab CI for my nodejs application. In my YML file I need to call a script to build a docker image. But instead of using latest I need to use the current version of the project. This version value can be find in the package.json file of the repository. Is it possible to read the version value of the package.json file to replace latest by the current version? # ... variables: CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest # need version value instead of latest build: stage:

Angular5 :polyfills.ts & \main.ts is missing from the TypeScript compilation

笑着哭i 提交于 2020-01-01 08:20:00
问题 This is my Angular5 project structure. Both tsconfig.app.json and package.json contain this section "include": [ "/src/main.ts", "/src/polyfills.ts" ] But no matter what I try I still get this error: \polyfills.ts & \main.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. Anyone has idea what's missing here? tsconfig.json { "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "sourceMap": true,

Angular5 :polyfills.ts & \main.ts is missing from the TypeScript compilation

喜欢而已 提交于 2020-01-01 08:19:30
问题 This is my Angular5 project structure. Both tsconfig.app.json and package.json contain this section "include": [ "/src/main.ts", "/src/polyfills.ts" ] But no matter what I try I still get this error: \polyfills.ts & \main.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. Anyone has idea what's missing here? tsconfig.json { "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "sourceMap": true,

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

橙三吉。 提交于 2020-01-01 05:33:08
问题 This question already has an answer here : What are the main uses for the NPM package.json file? (1 answer) Closed 3 years ago . 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

How to update all Node.js modules automatically?

て烟熏妆下的殇ゞ 提交于 2019-12-30 00:42:48
问题 During my work with the Node.js environment, I faced the issue of version maintenance of Node.js modules. I would like to be sure that all internal Node.js modules are updated. Many of existing manuals focus just on how to update Node.js modules, but not how to automate such routine. The question: How to update all Node.js modules automatically to the latest version? Ideally, it should be some script, job, or task. 回答1: To update all Node.js modules manually: Open console with administrative

I can't make package .js npm and get errors

∥☆過路亽.° 提交于 2019-12-25 17:27:10
问题 C:\Program Files\nodejs\MangaBackEnd>npm init This utility will walk you through creating a package.json file. It only covers the most common items, and tries to guess sensible defaults. See `npm help json` for definitive documentation on these fields and exactly what they do. Use `npm install <pkg>` afterwards to install a package and save it as a dependency in the package.json file. Press ^C at any time to quit. package name: (mangabackend) mangabackend version: (1.0.0) 1.0.0 description:

NPM link done at install time inside package.json

本秂侑毒 提交于 2019-12-25 09:08:54
问题 I'm in the process of creating 2 projects. Project 1 will be like a library. Project 2 will be an application which uses Project 1's library code. So I wish to do a npm link from Project 1 to Project 2. I can do this at the command line using the follow: cd ../project1 npm link cd ../project2 npm link project1_name and it works fine. But I don't wish to do that, I want when I install the package.json to not only set up the various dependencies to also set up the link. So how would I do that

Send package.json [version] to Angularjs Front end for display purposes

拟墨画扇 提交于 2019-12-25 07:59:08
问题 Is there a simple way to send the package.json file to the front end which is Angular js 1. I need to show the version the project is at. Using Gulp on a MEAN stack. Currently I have not found a way to do this. Edit. Not using Gulp on MEAN stack to get it I am just stating what is being used for the project to run. I though this might help. 回答1: So I tried and this works for me. Create a global variable in you app.js file, global.__base = __dirname + '/'; Create a router like this, app.get('