dhoulb / multi-semantic-release

Proof of concept that wraps semantic-release to work with monorepos.
BSD Zero Clause License
200 stars 37 forks source link

Strange behaviour when using this package: npm install is invoked on prepare step #151

Closed bryanjtc closed 8 months ago

bryanjtc commented 8 months ago

I noticed that a npm install ran on the prepare step. Should this happen? This didn't happened when I used a the package semantic-release-monorepo.

[3:26:13 AM] › ℹ  msr: multi-semantic-release version: 1.0.2
[3:26:13 AM] › ℹ  msr: semantic-release version: 22.0.5
[3:26:13 AM] › 🎉  msr: Started multirelease! Loading 1 packages...
(node:75) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:75) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
[3:26:14 AM] › ✔  msr: Loaded package @tech-ayudinga/react-library
[3:26:14 AM] › 🎉  msr: Queued 1 packages! Starting release...
[3:26:14 AM] [@tech-ayudinga/react-library] › ℹ  Running semantic-release version 22.0.5
[3:26:14 AM] [@tech-ayudinga/react-library] › ✔  Loaded plugin "addChannel" from "@semantic-release/npm"
[3:26:14 AM] [@tech-ayudinga/react-library] › ✔  Loaded plugin "success" from "@semantic-release/gitlab"
[3:26:14 AM] [@tech-ayudinga/react-library] › ✔  Loaded plugin "fail" from "@semantic-release/gitlab"
[3:27:19 AM] [@tech-ayudinga/react-library] › ✔  Run automated release from branch dev on repository [https://gitlab-ci-token:[secure]@gitlab.com/tech-ayudinga/frontend/design-system.git](https://gitlab-ci-token:%5Bsecure%5D@gitlab.com/tech-ayudinga/frontend/design-system.git)
[3:27:19 AM] [@tech-ayudinga/react-library] › ✔  Allowed to push to the Git repository
[3:27:19 AM] [@tech-ayudinga/react-library] › ℹ  Start step "verifyConditions" of plugin "Inline plugin"
[3:27:19 AM] [@tech-ayudinga/react-library] › ✔  Completed step "verifyConditions" of plugin "Inline plugin"
[3:27:19 AM] [@tech-ayudinga/react-library] › ℹ  Found git tag @tech-ayudinga/react-library-v1.2.7 associated with version 1.2.7 on branch dev
[3:27:19 AM] [@tech-ayudinga/react-library] › ℹ  Found 1 commits since last release
[3:27:19 AM] [@tech-ayudinga/react-library] › ℹ  Start step "analyzeCommits" of plugin "Inline plugin"
[3:27:20 AM] [@tech-ayudinga/react-library] › ✔  Completed step "analyzeCommits" of plugin "Inline plugin"
[3:27:20 AM] [@tech-ayudinga/react-library] › ℹ  The next release version is 1.2.8
[3:27:20 AM] [@tech-ayudinga/react-library] › ℹ  Start step "generateNotes" of plugin "Inline plugin"
[3:27:20 AM] [@tech-ayudinga/react-library] › ✔  Completed step "generateNotes" of plugin "Inline plugin"
[3:27:20 AM] [@tech-ayudinga/react-library] › ℹ  Start step "prepare" of plugin "Inline plugin"
@tech-ayudinga/react-library
v1.2.8
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @joshwooding/vite-plugin-react-docgen-typescript@0.3.0
npm WARN Found: vite@4.5.0
npm WARN node_modules/@joshwooding/vite-plugin-react-docgen-typescript/node_modules/vite
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer vite@"^3.0.0 || ^4.0.0 || ^5.0.0" from @joshwooding/vite-plugin-react-docgen-typescript@0.3.0
npm WARN node_modules/@joshwooding/vite-plugin-react-docgen-typescript
npm WARN   @joshwooding/vite-plugin-react-docgen-typescript@"0.3.0" from @storybook/react-vite@7.5.1
npm WARN   node_modules/@storybook/react-vite
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @storybook/builder-vite@7.5.1
npm WARN Found: vite@4.5.0
npm WARN node_modules/@storybook/builder-vite/node_modules/vite
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer vite@"^3.0.0 || ^4.0.0 || ^5.0.0" from @storybook/builder-vite@7.5.1
npm WARN node_modules/@storybook/builder-vite
npm WARN   @storybook/builder-vite@"7.5.1" from @storybook/react-vite@7.5.1
npm WARN   node_modules/@storybook/react-vite
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @storybook/react-vite@7.5.1
npm WARN Found: vite@4.5.0
npm WARN node_modules/@storybook/react-vite/node_modules/vite
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer vite@"^3.0.0 || ^4.0.0 || ^5.0.0" from @storybook/react-vite@7.5.1
npm WARN node_modules/@storybook/react-vite
npm WARN   dev @storybook/react-vite@"7.5.1" from the root project
npm WARN   1 more (@tech-ayudinga/react-library)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @vitejs/plugin-react@3.1.0
npm WARN Found: vite@4.5.0
npm WARN node_modules/@vitejs/plugin-react/node_modules/vite
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer vite@"^4.1.0-beta.0" from @vitejs/plugin-react@3.1.0
npm WARN node_modules/@vitejs/plugin-react
npm WARN   @vitejs/plugin-react@"^3.0.1" from @storybook/react-vite@7.5.1
npm WARN   node_modules/@storybook/react-vite
added 18 packages, removed [222](https://gitlab.com/tech-ayudinga/frontend/design-system/-/jobs/5441649794#L222) packages, and changed 70 packages in 16s
359 packages are looking for funding
  run `npm fund` for details
[3:27:38 AM] [@tech-ayudinga/react-library] › ✔  Completed step "prepare" of plugin "Inline plugin"
[3:27:38 AM] [@tech-ayudinga/react-library] › ℹ  Start step "generateNotes" of plugin "Inline plugin"
[3:27:38 AM] [@tech-ayudinga/react-library] › ✔  Completed step "generateNotes" of plugin "Inline plugin"
[3:27:40 AM] [@tech-ayudinga/react-library] › ✔  Created tag @tech-ayudinga/react-library-v1.2.8
[3:27:40 AM] [@tech-ayudinga/react-library] › ℹ  Start step "publish" of plugin "Inline plugin"

here is my config

{
  "branches": ["dev"],
  "plugins": [
    [
      "semantic-release-gitmoji",
      {
        "releaseRules": {
          "major": [":boom:"],
          "minor": [":sparkles:"],
          "patch": [
            ":zap:",
            ":bug:",
            ":ambulance:",
            ":lipstick:",
            ":lock:",
            ":arrow_down:",
            ":arrow_up:",
            ":pushpin:",
            ":chart_with_upwards_trend:",
            ":heavy_plus_sign:",
            ":heavy_minus_sign:",
            ":wrench:",
            ":globe_with_meridians:",
            ":pencil2:",
            ":rewind:",
            ":package:",
            ":alien:",
            ":children_crossing:",
            ":iphone:",
            ":egg:",
            ":alembic:",
            ":mag:",
            ":label:",
            ":triangular_flag_on_post:",
            ":goal_net:",
            ":dizzy:",
            ":wastebasket:",
            ":passport_control:",
            ":adhesive_bandage:",
            ":necktie:",
            ":bento:",
            ":wheelchair:",
            ":speech_balloon:",
            ":card_file_box:"
          ]
        },
        "releaseNotes": {
          "semver": true
        }
      }
    ],
    "@semantic-release/gitlab",
    "@semantic-release/npm",
    "@semantic-release/changelog",
    [
      "@semantic-release/git",
      {
        "message": "🚀 RELEASE: chore(release) - ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
      }
    ]
  ]
}
antongolub commented 8 months ago

@bryanjtc,

It's a design difference. msr just invokes plugin pipelines as is while semantic-release-monorepo wraps plugin steps with hooks to tweak up the release flow.

bryanjtc commented 8 months ago

Which plugin do you think is running npm install in the prepare step? The npm plugin? I can't find the command in their prepare step.

antongolub commented 8 months ago

npm plugin triggers npm cli at some points:

Maybe npm install is a side effect of these calls, I can not say exactly.

bryanjtc commented 8 months ago

I ran the commands locally and npm is running npm install inside my workspace when npm version is executed. I will check on the npm repo for a workaround.

bryanjtc commented 8 months ago

Here is the solution. Disable workspaces-update option in the .npmrc config file. The npm plugin will read this config file. https://docs.npmjs.com/cli/v8/commands/npm-version#workspaces-update