Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepack run twice when set tarballDir #535

Open
atian25 opened this issue Dec 12, 2022 · 1 comment
Open

prepack run twice when set tarballDir #535

atian25 opened this issue Dec 12, 2022 · 1 comment

Comments

@atian25
Copy link

atian25 commented Dec 12, 2022

module.exports = {
  plugins: [
    [ '@semantic-release/commit-analyzer', { } ],
    [ '@semantic-release/release-notes-generator', { } ],
    [ '@semantic-release/changelog', {
      changelogTitle: '# Changelog',
    } ],
    [ '@semantic-release/npm', {
      tarballDir: '.semantic-release',
    } ],
    [ '@semantic-release/exec', {
      'publishCmd': 'ls -l dist && ls -l .semantic-release && tar -ztvf .semantic-release/*.tgz',
    } ],
    [ '@semantic-release/git', { } ],
    [ '@semantic-release/github', {
      addReleases: 'bottom',
      assets: '.semantic-release/*.tgz',
    } ],
  ],
};

see the log: https://github.com/atian25/github-actions-test/actions/runs/3672673923/jobs/6209067073

the reason is when set tarballDir, this plugin will exec npm pack first then npm publish (see https://github.com/semantic-release/npm/blob/master/lib/prepare.js#LL24C20-L24C20)

Suggest: when set tarballDir, then just npm publish {path/to/pack_dist}.tgz , so the npm publish will not trigger prepack again

@atian25
Copy link
Author

atian25 commented Dec 18, 2022

and when the prepack fail, the rest plugin's fail step can't process with it, due to un-wrapped error

svnv added a commit to Dintero/Dintero.Checkout.Web.SDK that referenced this issue Feb 27, 2024
Fixes #331
Ref. #330
Rel. semantic-release/npm#535
Rel. https://github.com/Dintero/Dintero.Checkout.Web.SDK/actions/runs/8045967660/job/21972265552

The previous config change did not work as intended. The npm plugin for semantic release seems to be running twice and the .tgz is not present in the dist folder, and from the logs it does not even look like the package created contains the actual build files either. Instead of trying to make sense of the npm plugin we try using the exec plugin to run npm pack before the github plugin creates is release.
cwillisf added a commit to scratchfoundation/scratch-semantic-release-config that referenced this issue Sep 10, 2024
There's an issue where the `npm` plugin for `semantic-release`
effectively runs `npm prepack` twice when `tarballDir` is set. Worse, if
the `tarballDir` is within the package directory and not excluded (by
`.npmignore`, for example) then the tarball from the first `prepack`
will end up inside the tarball for the second `prepack`, effectively
doubling the package size.

See semantic-release/npm#535
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant