How do I add comments to package.json for npm install?

后端 未结 20 1384
悲哀的现实
悲哀的现实 2020-12-07 07:30

I\'ve got a simple package.json file and I want to add a comment. Is there a way to do this, or are there any hacks to make this work?



        
20条回答
  •  我在风中等你
    2020-12-07 08:02

    I ended up with a scripts like that:

      "scripts": {
        "//-1a": "---------------------------------------------------------------",
        "//-1b": "---------------------- from node_modules ----------------------",
        "//-1c": "---------------------------------------------------------------",
        "ng": "ng",
        "prettier": "prettier",
        "tslint": "tslint",
        "//-2a": "---------------------------------------------------------------",
        "//-2b": "--------------------------- backend ---------------------------",
        "//-2c": "---------------------------------------------------------------",
        "back:start": "node backend/index.js",
        "back:start:watch": "nodemon",
        "back:build:prod": "tsc -p backend/tsconfig.json",
        "back:serve:prod": "NODE_ENV=production node backend/dist/main.js",
        "back:lint:check": "tslint -c ./backend/tslint.json './backend/src/**/*.ts'",
        "back:lint:fix": "yarn run back:lint:check --fix",
        "back:check": "yarn run back:lint:check && yarn run back:prettier:check",
        "back:check:fix": "yarn run back:lint:fix; yarn run back:prettier:fix",
        "back:prettier:base-files": "yarn run prettier './backend/**/*.ts'",
        "back:prettier:fix": "yarn run back:prettier:base-files --write",
        "back:prettier:check": "yarn run back:prettier:base-files -l",
        "back:test": "ts-node --project backend/tsconfig.json node_modules/jasmine/bin/jasmine ./backend/**/*spec.ts",
        "back:test:watch": "watch 'yarn run back:test' backend",
        "back:test:coverage": "echo TODO",
        "//-3a": "---------------------------------------------------------------",
        "//-3b": "-------------------------- frontend ---------------------------",
        "//-3c": "---------------------------------------------------------------",
        "front:start": "yarn run ng serve",
        "front:test": "yarn run ng test",
        "front:test:ci": "yarn run front:test --single-run --progress=false",
        "front:e2e": "yarn run ng e2e",
        "front:e2e:ci": "yarn run ng e2e --prod --progress=false",
        "front:build:prod": "yarn run ng build --prod --e=prod --no-sourcemap --build-optimizer",
        "front:lint:check": "yarn run ng lint --type-check",
        "front:lint:fix": "yarn run front:lint:check --fix",
        "front:check": "yarn run front:lint:check && yarn run front:prettier:check",
        "front:check:fix": "yarn run front:lint:fix; yarn run front:prettier:fix",
        "front:prettier:base-files": "yarn run prettier \"./frontend/{e2e,src}/**/*.{scss,ts}\"",
        "front:prettier:fix": "yarn run front:prettier:base-files --write",
        "front:prettier:check": "yarn run front:prettier:base-files -l",
        "front:postbuild": "gulp compress",
        "//-4a": "---------------------------------------------------------------",
        "//-4b": "--------------------------- cypress ---------------------------",
        "//-4c": "---------------------------------------------------------------",
        "cy:open": "cypress open",
        "cy:headless": "cypress run",
        "cy:prettier:base-files": "yarn run prettier \"./cypress/**/*.{js,ts}\"",
        "cy:prettier:fix": "yarn run front:prettier:base-files --write",
        "cy:prettier:check": "yarn run front:prettier:base-files -l",
        "//-5a": "---------------------------------------------------------------",
        "//-5b": "--------------------------- common ----------------------------",
        "//-5c": "---------------------------------------------------------------",
        "all:check": "yarn run back:check && yarn run front:check && yarn run cy:prettier:check",
        "all:check:fix": "yarn run back:check:fix && yarn run front:check:fix && yarn run cy:prettier:fix",
        "//-6a": "---------------------------------------------------------------",
        "//-6b": "--------------------------- hooks -----------------------------",
        "//-6c": "---------------------------------------------------------------",
        "precommit": "lint-staged",
        "prepush": "yarn run back:lint:check && yarn run front:lint:check"
      },
    

    My intent here is not to clarify one line, just to have some sort of delimiters between my scripts for backend, frontend, all, etc.

    I'm not a huge fan of 1a, 1b, 1c, 2a, ... but the keys are different and I do not have any problem at all like that.

提交回复
热议问题