1

我有package.json这样的内容:

{
  "name": "smoketest",
  "version": "0.0.1",
  "main": "dist/index.js",
  "files": [
    "dist"
  ],
  "scripts": {
    "run": "node dist/index.js",
    "build": "rm -rf dist && NODE_ENV=production rollup -c",
    "dev": "rm -rf dist && rollup -c -w"
  },
  "dependencies": {
    "jest-cli": "^27.2.5"
  },
  "devDependencies": {
    "@babel/plugin-proposal-class-properties": "^7.14.5",
    "@babel/plugin-proposal-decorators": "^7.15.8",
    "@babel/plugin-proposal-private-methods": "^7.14.5",
    "@babel/preset-env": "^7.15.8",
    "@babel/preset-typescript": "^7.15.0",
    "@rollup/plugin-babel": "^5.3.0",
    "@rollup/plugin-commonjs": "^21.0.0",
    "@rollup/plugin-json": "^4.1.0",
    "@rollup/plugin-node-resolve": "^13.0.5",
    "@rollup/plugin-run": "^2.1.0",
    "@types/minimist": "^1.2.2",
    "babel-plugin-transform-typescript-metadata": "^0.3.2",
    "babel-plugin-tsconfig-paths": "^1.0.2",
    "cross-fetch": "^3.1.4",
    "minimist": "^1.2.5",
    "rollup": "^2.58.0",
    "rollup-plugin-multi-input": "^1.3.1"
  }
}

npm pack用来创建档案。这很好用。但是,我想删除开发特定的东西:

{
  "name": "smoketest",
  "version": "0.0.1",
  "main": "dist/index.js",
  "files": [
    "dist"
  ],
  "scripts": {
    "run": "node dist/index.js",
  },
  "dependencies": {
    "jest-cli": "^27.2.5"
  }
}

是否可以指定不同的 package.json 或指定要删除的某些键?

任何解决方案npmpnpm对我有用。

4

0 回答 0