How to npm publish specific folder but as package root

后端 未结 10 1284
后悔当初
后悔当初 2020-12-13 01:10

I have a project that include a gulp task for building and packaging the sources and release in a directory called dist. My goal is publish it as a npm package,

10条回答
  •  醉话见心
    2020-12-13 01:48

    If you are (and I recommend) using semantic-release, add the pkgRoot option in the .releaserc.json file:

    {
      "pkgRoot": "dist",
      "plugins": [
        "@semantic-release/commit-analyzer",
        "@semantic-release/release-notes-generator",
        "@semantic-release/npm",
        [
          "@semantic-release/exec",
          {
            "prepareCmd": "npx rjp package.json version nextRelease.version"
          }
        ],
        [
          "@semantic-release/git",
          {
            "assets": ["package.json"]
          }
        ],
    
      ],
    }
    

    That'll take care of the problem. Just make sure your dist folder contains a package.json file. You can easily do that by adding a cp to your postbuild script. Also install rjp

提交回复
热议问题