Coder Social home page Coder Social logo

nx-semantic-release's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nx-semantic-release's Issues

Affected files not working correctly when monorepo is nested in repository

Hey!

Firstly, Awesome plugin :)

I found that the affected files (and therefore release generation) does not work correctly when the nx monorepo is nested inside the git repository. For example:

backend/
frontend/
    packages/
        one/
            file.js
            package.json
        two/
            package.json
    package.json

The affected files calls here, will not return any files being touched in one or two, because the root of the paths in affectedFiles are the git root, not the nx root.

In the above structure, if the last commit touches file.js, affected files will be:
affectedFiles: [ 'frontend/packages/one/file.js' ]
And the filteredGraph will be empty.

I hacked in some code in the node_modules and confirmed that the generation is fine after removing the frontend/ path prefix.

You can see it in my test project here: Weetbix/nx-monorepo-example@83955e4

Invalid host defined options

For some reason I'm getting this error when trying to run nx g @theunderscorer/nx-semantic-release:install --verbose:

✔ Would you want to enforce conventional commits? (Y/n) · true
✔ What is the remote repository url? (example: https://github.com/TheUnderScorer/nx-semantic-release) · https://github.com/tyteen4a03/myrepo
✔ Would you want to create github releases? (Y/n) · true
✔ Would you want to create changelog file? (Y/n) · true
✔ Would you want to create npm releases? (Y/n) · false

 >  NX   Invalid host defined options


TypeError: Invalid host defined options
    at Object.<anonymous> (/Users/tyteen4a03/Documents/myrepo/node_modules/prettier/index.cjs:600:23)
    at Module._compile (/Users/tyteen4a03/.config/yarn/global/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at Mod.require (/Users/tyteen4a03/Documents/myrepo/node_modules/nx/bin/init-local.js:207:36)
    at require (/Users/tyteen4a03/.config/yarn/global/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at /Users/tyteen4a03/Documents/myrepo/node_modules/@theunderscorer/nx-semantic-release/node_modules/@nx/devkit/src/generators/format-files.js:18:59
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Allow specifying presetConfig for @semantic-release/release-notes-generator

Hey,

From what I've saw in source code there should be a possibility to pass presetConfig to @semantic-release/release-notes-generator but it seems it is ignored / overwritten.

Consider nxrelease.config.js file as follows

releaseRules: [
   // ...
    { type: 'build', release: 'patch' },
],
presetConfig: {
    types: [
     // ...
      { type: 'build', section: 'Build config' },
      // ...
    ],
  },

I've observed that although "build commit" triggers patch release it does not create "Build config" section in CHANGELOG nor put that "build commit" into the CHANGELOG at all.
After releasing CHANGELOG has just an empty section as shown below.

"new-version" (2023-XX-XX)

"previous-version" (2023-XX-XX)

Bug Fixes
  - Some bug fix commit
  - ...

📃 Documentation & Usage

I landed here from google search. Thanks for the great effort.

From the first sight I couldn't know where to add the following inside the project.json

{
  "semantic-release": {
    "executor": "@theunderscorer/nx-semantic-release:semantic-release"
  }
}

And then after some Search, I found that I should add it to the options object.

Here the problem, after all that i tried

$ npx nx run nx-angular13:semantic-release                                                                   

> nx run nx-angular13:semantic-release

Cannot find module 'nx/src/generators/utils/project-configuration'
Require stack:
- /Users/hatem/Desktop/hx/node_modules/@theunderscorer/nx-semantic-release/node_modules/@nrwl/devkit/nx-reexports-pre16.js
- /Users/hatem/Desktop/hx/node_modules/@theunderscorer/nx-semantic-release/node_modules/@nrwl/devkit/index.js
- /Users/hatem/Desktop/hx/node_modules/@theunderscorer/nx-semantic-release/src/executors/semantic-release/semantic-release.js
- /Users/hatem/Desktop/hx/node_modules/@theunderscorer/nx-semantic-release/src/executors/semantic-release/executor.js
- /Users/hatem/Desktop/hx/node_modules/nx/src/config/workspaces.js
- /Users/hatem/Desktop/hx/node_modules/nx/src/command-line/run.js
- /Users/hatem/Desktop/hx/node_modules/nx/bin/run-executor.js

 ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Running target "nx-angular13:semantic-release" failed

   Failed tasks:
   
   - nx-angular13:semantic-release

Could you please help

Plugin name incorrectly logged

When I launch a release, I don't see the name of the plugin that will be executed for the following steps (in red):

  • analyzeCommits
  • generateNotes
  • prepare
  • success

But it's okay for the other steps (in green).
image
image

Is it possible to have the plugin name and not "[Function: nx-semantic-release]"?

Tag format not being respected?

Hey - thanks for this plugin, it's great! This is my .nxreleaserc.json:

{
  "changelog": true,
  "npm": false,
  "github": true,
  "repositoryUrl": "https://github.com/<repo>",
  "branches": ["main", { "name": "rc-*", "prerelease": true }],
  "tagFormat": "${PROJECT_NAME}-v${version}"
}

...but for some reason, the tag that gets created with the prerelease is ${PROJECT_NAME}-v${version}-{branchName}.<some-num>. I thought if I hardcoded in the tagFormat as I did there it wouldn't append anything to it; how do I prevent that?

analyzeCommits fails to Error: spawn EBADF

Analyze commits step fails to "Error: spawn EBADF". This seems to be related to spawning child processes when it executes the git commands. The analyzer has 3440 commits to analyze.

Versions:

  • "@theunderscorer/nx-semantic-release": "2.7.0",
  • "nx": "16.6.0",
  • nodejs v18.15.0
  • Operating system: MacOS Sonoma 14.0
auth-client: [9:33:26 AM] [semantic-release] › ✘  An error occurred while running semantic-release: Error: spawn EBADF
auth-client:     at ChildProcess.spawn (node:internal/child_process:413:11)
auth-client:     at spawn (node:child_process:757:9)
auth-client:     at Object.execFile (node:child_process:348:17)
auth-client:     at Object.exec (node:child_process:232:25)
auth-client:     at /XXX/node_modules/@theunderscorer/nx-semantic-release/src/utils/exec.js:28:42
auth-client:     at new Promise (<anonymous>)
auth-client:     at exec (/XXX/node_modules/@theunderscorer/nx-semantic-release/src/utils/exec.js:18:62)
auth-client:     at listAffectedFilesInCommit (/XXX/node_modules/@theunderscorer/nx-semantic-release/src/common/git.js:63:41)
auth-client:     at isCommitAffectingProjects (/XXX/node_modules/@theunderscorer/nx-semantic-release/src/common/git.js:18:33)
auth-client:     at /XXX/node_modules/@theunderscorer/nx-semantic-release/src/semantic-release-plugin/analyze-commits.js:31:119 {
auth-client:   errno: -9,
auth-client:   code: 'EBADF',
auth-client:   syscall: 'spawn',
auth-client:   pluginName: '[Function: nx-semantic-release]'
auth-client: }
auth-client:  >  NX   spawn EBADF
auth-client:    Pass --verbose to see the stacktrace.

[Bug] --git cli flag is not a part of schema

Running npm run affected:release -- --changelog=false --github=false --git=false still adds git step, since --git is not a part of schema and therefore becomes "false" (string) instead of false (boolean).

Authentication Error

since this week we are receiving this error from github actions using action nx-semantic-release (it was working normally before)

[1:07:46 PM] [semantic-release] › ℹ  Running semantic-release version 19.0.3
[1:07:46 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/changelog"
[1:07:46 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/npm"
[1:07:46 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/npm"
[1:07:46 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/git"
[1:07:46 PM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github"
[1:07:47 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/npm"
[1:07:47 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/npm"
[1:07:47 PM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github"
[1:07:47 PM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/npm"
[1:07:47 PM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/npm"
[1:07:47 PM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/github"
[1:07:47 PM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[1:07:47 PM] [semantic-release] › ✖  An error occurred while running semantic-release: Error: Command failed with exit code 128: git ls-remote --heads https://x-access-token:[secure]@github.com/kovihq/nestjs-modules.git
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/kovihq/nestjs-modules.git/'
    at makeError (/home/runner/work/nestjs-modules/nestjs-modules/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/home/runner/work/nestjs-modules/nestjs-modules/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async getBranches (/home/runner/work/nestjs-modules/nestjs-modules/node_modules/semantic-release/lib/git.js:66:11)
    at async module.exports (/home/runner/work/nestjs-modules/nestjs-modules/node_modules/semantic-release/lib/branches/expand.js:6:23)
    at async module.exports (/home/runner/work/nestjs-modules/nestjs-modules/node_modules/semantic-release/lib/branches/index.js:14:26)
    at async run (/home/runner/work/nestjs-modules/nestjs-modules/node_modules/semantic-release/index.js:65:22)
    at async module.exports (/home/runner/work/nestjs-modules/nestjs-modules/node_modules/semantic-release/index.js:269:22)
    at async semanticRelease (/home/runner/work/nestjs-modules/nestjs-modules/node_modules/@theunderscorer/nx-semantic-release/src/executors/semantic-release/semantic-release.js:33:5) {
  shortMessage: 'Command failed with exit code 128: git ls-remote --heads https://x-access-token:[secure]@github.com/kovihq/nestjs-modules.git',
  command: 'git ls-remote --heads https://x-access-token:[secure]@github.com/kovihq/nestjs-modules.git',
  escapedCommand: 'git ls-remote --heads "https://x-access-token:[secure]@github.com/kovihq/nestjs-modules.git"',
  exitCode: 128,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: 'remote: Invalid username or password.\n' +
    "fatal: Authentication failed for 'https://github.com/kovihq/nestjs-modules.git/'",
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}


The step is

      
      - name: release
        if: github.event_name == 'push'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          HUSKY: 0
        run: |
          npx nx affected --target=semantic-release --parallel=1

I tried to use a PAT with full access, but the error persists

Some idea to fix this? There is something wrong with my step?

Tks

Conditionally load plugin per package ?

Hey,

I'm trying to implement semantic release on an NX monorepo that contains both javascript and python packages, this is achieved on the python side using @nxlv/python and hopefully semantic-release-pypi

However, it seems that the pypi plugin is picking up the javascript packages.

Is there a way to tell nx-semantic-release to only load the pypi plugin on specific packages (via project tag or something) ?

More generally, is it possible to conditionally load plugins per package ?

Thanks

internal dependencies bumps

I have a monorepo with :

  • packages/common
  • packages/lib-a
  • packages/lib-b
  • packages/lib-c

lib-a, lib-b and lib-c have a dependency on common, and lib-c also has a dependency on lib-a.

Now, I commit a fix in packages/common, pushes, and nx-semantic-release goes to do its job, and does 4 commits, add 4 tags and publish 4 the packages have new versions.

But the dependencies lines in all lib-*/package.json (and all their generated packages) still have the old common version, and get re-released without any change except their version bump.

I have a feeling that, either I skipped a step, or something is missing somewhere, and those dependencies should somehow auto-update themselves.
In my example, lib-a and lib-b should have the new common version, and lib-c should have the new common and lib-a version automagically updated in their dependencies.
Because, otherwise, why release new versions of those packages.
I mean, if the only reason to release a new lib-a is because common has a new version, then the new version of lib-a should depend on the new version of common.

https://github.com/semantic-release/npm not working with yarn berry

Hello,

I'm trying to use this package to raise versions within my package.json files of the applications. After getting help in this issue I was on a good track, until I ran into a new issue that is related to my use of yarn berry:

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @formkit/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/unocss
npm WARN   peer unocss@">=0.44.0" from [email protected]
npm WARN   node_modules/unocss-preset-better-nested-colors
npm WARN     dev unocss-preset-better-nested-colors@"^1.0.0" from the root project
npm WARN   5 more (unocss-preset-scrollbar, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peerOptional unocss@"^0.31.0" from @formkit/[email protected]
npm WARN node_modules/@formkit/themes
npm WARN   @formkit/themes@"1.0.0-beta.9-f64c966" from @formkit/[email protected]
npm WARN   node_modules/@formkit/vue
npm WARN 
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/unocss
npm WARN   peerOptional unocss@"^0.31.0" from @formkit/[email protected]
npm WARN   node_modules/@formkit/themes
npm WARN     @formkit/themes@"1.0.0-beta.9-f64c966" from @formkit/[email protected]
npm WARN     node_modules/@formkit/vue
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @intlify/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/vite
npm WARN   peer vite@"^2.9.0 || ^3.0.0 || ^4.0.0" from [email protected]
npm WARN   node_modules/histoire
npm WARN     histoire@"^0.12.0" from the root project
npm WARN   10 more (vite-plugin-checker, vite-plugin-eslint, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer vite@"^2.9.0" from @intlify/[email protected]
npm WARN node_modules/@intlify/vite-plugin-vue-i18n
npm WARN   @intlify/vite-plugin-vue-i18n@"4.0.0" from @intlify/[email protected]
npm WARN   node_modules/@intlify/nuxt3
npm WARN 
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/vite
npm WARN   peer vite@"^2.9.0" from @intlify/[email protected]
npm WARN   node_modules/@intlify/vite-plugin-vue-i18n
npm WARN     @intlify/vite-plugin-vue-i18n@"4.0.0" from @intlify/[email protected]
npm WARN     node_modules/@intlify/nuxt3
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @nrwl/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/vitest
npm WARN   dev vitest@"^0.26.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer vitest@"^0.25.1" from @nrwl/[email protected]
npm WARN node_modules/@nrwl/vite
npm WARN   @nrwl/vite@"15.3.3" from @nrwl/[email protected]
npm WARN   node_modules/@nrwl/web
npm WARN 
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/vitest
npm WARN   peer vitest@"^0.25.1" from @nrwl/[email protected]
npm WARN   node_modules/@nrwl/vite
npm WARN     @nrwl/vite@"15.3.3" from @nrwl/[email protected]
npm WARN     node_modules/@nrwl/web
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @nxtend/[email protected]
npm ERR! Found: @nrwl/[email protected]
npm ERR! node_modules/@nrwl/workspace
npm ERR!   dev @nrwl/workspace@"^15.3.3" from the root project
npm ERR!   @nrwl/workspace@"15.3.3" from @nrwl/[email protected]
npm ERR!   node_modules/@nrwl/angular
npm ERR!     @nrwl/angular@"^15.3.3" from the root project
npm ERR!   12 more (@nrwl/cypress, @nrwl/js, @nrwl/next, @nrwl/react, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nrwl/workspace@"^12.0.0" from @nxtend/[email protected]
npm ERR! node_modules/@nxtend/firebase
npm ERR!   dev @nxtend/firebase@"^12.1.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @nrwl/[email protected]
npm ERR! node_modules/@nrwl/workspace
npm ERR!   peer @nrwl/workspace@"^12.0.0" from @nxtend/[email protected]
npm ERR!   node_modules/@nxtend/firebase
npm ERR!     dev @nxtend/firebase@"^12.1.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/runner/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-12-20T10_11_36_651Z-debug-0.log
[10:12:02 AM] [semantic-release] › ✖  Failed step "prepare" of plugin "[Function: nx-semantic-release]"
[10:12:02 AM] [semantic-release] › ✖  An error occurred while running semantic-release: Error: Command failed with exit code 1: npm version 1.0.2 --userconfig /tmp/cba51df5dc588064896a6130283b4f4a/.npmrc --no-git-tag-version --allow-same-version
npm WARN ERESOLVE overriding peer dependency

It seems the npm package https://github.com/semantic-release/npm does not support Yarn and has the npm command wired in without respecting the underlying package manager.

There are several open issues like this one semantic-release/semantic-release#2351
and it seems there is no official solution for Yarn v2 7/ v3 yet, but I've found this package https://github.com/fekide/semantic-release-yarn which is a replacement for the npm package.

Is it somehow possible, to use it with nx-semantic-release?

I know there is the plugin:[] option, but wouldn't I then have to remove the npm package somehow?

Allow disabling `@semantic-release/git` plugin

I have a release flow where I don't want to push any commits to git. Instead, I'm relying only on git tags made by @semantic-release/gitlab. The @semantic-release/git plugin is unnecessary for this release flow and would need to be disabled. Currently there doesn't seem to be a way to do it.

Proposal is to add a configuration option which could be used to disable the plugin.

Cannot find file template.hbs

I keep running into an issue where in CI the plugin doesn't find the template.hbs file from conventional changelog writer.

    at async next (file:///home/runner/work/forgerock-javascript-sdk/forgerock-javascript-sdk/node_modules/@theunderscorer/nx-semantic-release/node_modules/p-reduce/index.js:15:44) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/home/runner/work/forgerock-javascript-sdk/forgerock-javascript-sdk/node_modules/conventional-changelog-writer/templates/template.hbs',
  pluginName: '[Function: nx-semantic-release]'
}

 >  NX   ENOENT: no such file or directory, open '/home/runner/work/forgerock-javascript-sdk/forgerock-javascript-sdk/node_modules/conventional-changelog-writer/templates/template.hbs'

I've tried installing the package itself in CI as well, and i've verified in my local node_modules that this does exist so its odd but i dont think i can get around this without not generating changelog?

Unknown branch name appended to release tag and tilte

When generating a release, the tag is made as ${PROJECT_NAME}-v${version}-${branchName} which is not in my configuration.

Current Config:

{
  ...
  "branches": ["main", { "name": "rc-*", "channel": "rc", "prerelease": true }],
  "tagFormat": "${PROJECT_NAME}-v${version}"
}

Screenshot 2023-12-07 at 11 56 09 AM

workspace.json is deprecated

Hi,

The documentation in the README recommended installation process by using workspace.json, however has been deprecated.

What is the recommended installation instructions for the project?

New Options

Add support for following in options

In Commit Analyzer

  • releaseRules

In Release Notes Generator

  • linkCompare
  • linkReferences
Note: I already have PR ready to go for this, but figured it would be good to come right on the heals of the Global Options one.

Allow JavaScript Config at Project Level

Is there a way to use a javascript config for the release options at the project level?

I need to do some computation when releasing an expo app and can't do that in the project.json:

    "semantic-release": {
      "executor": "@theunderscorer/nx-semantic-release:semantic-release",
      "options": {
        "npm": false,
        "tagFormat": "app-v${VERSION}",
        "gitAssets": [
          "package.json",
          "app.json",
          "CHANGELOG.md"
        ],
        "plugins": [
          [
            "@google/semantic-release-replace-plugin",
            {
              "replacements": [
                {
                  "files": ["package.json"],
                  "from": "\"version\": \".*\"",
                  "to": "\"version\": \"${nextRelease.version}\""
                },
                {
                  "files": ["app.json"],
                  "from": "\"buildNumber\": \".*\"",
                  "to": "\"buildNumber\": \"${nextRelease.version}\""
                },
                {
                  "files": ["app.json"],
                  "from": "\"versionCode\": [^\n]*",
                  // this line here
                  "to": (match) => `"versionCode": ${parseInt(match.split(':')[1].trim()) + 1}`,
              }
              ]
            }
          ]
        ]
      }
    }

In general it would be nice to allow an additional standard release.config.js at the project level to customize all options of the plugins.

New projects analyze all previous commits

Just want to say, your library is fantastic, I have been using it for many projects, big and small. Although this is one issue that has been bothering me.

If I add a new project to my Nx monorepo, semantic-release will retrieve all previous commits if no git tag or previous release is found. If my new project depends on another project that has a previous release, it will analyze and add any commits of the dependency to the initial release of my new project.

For example, I have a project bloc that has many releases. When I added a new project bloc-devtools to my monorepo, it depends on the bloc package, this is the log entry during my release workflow for the initial commit of bloc-devtools:

[7:24:15 PM] [semantic-release] › ℹ  No git tag version found on branch main
[7:24:15 PM] [semantic-release] › ℹ  No previous release found, retrieving all commits
[7:24:15 PM] [semantic-release] › ℹ  Found 150 commits since last release
[7:24:15 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "[Function: nx-semantic-release]"
[7:24:15 PM] [semantic-release] [[Function: nx-semantic-release]] › ℹ  Found following dependencies: "bloc" for project "bloc-devtools"

A release is created and everything works fine, I have many projects that also depend on bloc. The problem lies in the changelogs. For each new project that depends on another project, the first changelog entry always adds every single dependency commit.

For example here is what the first changelog entry looks like for bloc-devtools:

Notice the first entry, v1.0.0 shows all commits for bloc.

Here is a link to the repo, you will see that most projects in the packages directory depend on bloc, and the changelogs all have this behavior for the first release.

It would be nice if only the inital commit for a new project is shown, and not all of the previous commits for any projects it depends on within the first changelog entry.

CHANGELOG.md

npm will not publish unless nx project name matches folder name

Hey!

When the project name in project.json does not match the folder name, npm publish will not run during release, with this output:

[@semantic-release/npm] › ℹ  Skip publishing to npm registry as npmPublish is false

Imagine the setup like this:

.
└── packages/
    └── full-project-name/
        ├── package.json (name: "full-project-name")
        └── project.json (name: "short-name")

I think its due to this logic here but I did not confirm: https://github.dev/TheUnderScorer/nx-semantic-release/blob/55df58ca8416acaa61268e82c31c91ff623223fb/packages/nx-semantic-release/src/executors/semantic-release/plugins.ts#L22

Changing the nx project name to match the folder and package name solved the issue, but it would be nice to be able to use a shorthand name sometimes.

release commit in ci fails

I've tried to configure the plugin in an example repo and I receive an error in the ci when I try to create the release:

[10:51:31 PM] [semantic-release] [[Function: nx-semantic-release]] › ℹ  Found 1 file(s) to commit
[10:51:32 PM] [semantic-release] › ✖  Failed step "prepare" of plugin "[Function: nx-semantic-release]"
[10:51:32 PM] [semantic-release] › ✖  An error occurred while running semantic-release: Error: Command failed with exit code 1: git commit -m chore(release): 1.0.0 [skip ci]
# 1.0.0 (2022-07-21)
### Features
* remove nx welcome ([08dcf26](https://github.com/daton89/nx-standard-version/commit/08dcf26ea81e6156ac02d5eb9693f9fca0741d2a))
⧗   input: chore(release): 1.0.0 [skip ci]
* remove nx welcome ([08dcf26](https://github.com/daton89/nx-standard-version/commit/08dcf26ea81e6156ac02d5eb9693f9fca0741d2a))
✖   body's lines must not be longer than 100 characters [body-max-line-length]
✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

https://github.com/daton89/nx-standard-version/runs/7459254047?check_suite_focus=true

changelog not respecting releaseRules `release: false`

With the semantic-release/commit-analyzer releaseRules options, we can add do this:

"releaseRules": [
  {"scope": "no-release", "release": false}
]

https://github.com/semantic-release/commit-analyzer#releaserules

Currently, adding "release": false throws a schema exception.

But even going into node_modules and modifying the schema.json, the scope that was put as "release": false still shows up in the change log.

I would expect that the change log not include these types of commits.

BUG: Missing dependency on `es6-weak-map` prevents the module from working

Hi @TheUnderScorer!

nx-semantic-release version 2.6.0 introduced a dependency on deep-map
Since deep-map relies on es6-weak-map, but doesn't specify it in its prod dependencies (see mcmath/deep-map#14), any consuming module must add a dependency on es6-weak-map itself.

However, even though nx-semantic-release module specifies this dependency, the package.json file produced as a result of its build process DOES NOT (see package.json on npmjs.com):

{
  "name": "@theunderscorer/nx-semantic-release",
  "version": "2.6.0",
  "description": "Semantic release for NX.",
  "publishConfig": {
    "access": "public",
    "registry": "https://registry.npmjs.org/"
  },
  "dependencies": {
    "@nx/devkit": "16.0.0",
    "@semantic-release/changelog": "^6.0.2",
    "@semantic-release/exec": "^6.0.3",
    "@semantic-release/git": "^10.0.1",
    "@semantic-release/github": "^8.0.7",
    "@semantic-release/npm": "^9.0.2",
    "cosmiconfig": "^7.0.1",
    "deep-map": "^2.0.0",
    "remeda": "^0.0.32",
    "semantic-release": "20.1.0",
    "semantic-release-plugin-decorators": "3.0.1"
  },
  "private": false,
  "author": {
    "email": "[REDACTED]",
    "name": "[REDACTED]"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/TheUnderScorer/nx-semantic-release"
  },
  "engines": {
    "node": ">=16.0.0"
  },
  "license": "MIT",
  "builders": "./builders.json",
  "executors": "./builders.json",
  "generators": "./generators.json",
  "main": "./src/index.js",
  "types": "./src/index.d.ts"
}

Missing dependency on es6-weak-map prevents nx-semantic-release 2.6.0 from working:

   Require stack:
   - /home/runner/work/my-namespace/my-project/node_modules/deep-map/lib/deep-map.js
   - /home/runner/work/my-namespace/my-project/node_modules/deep-map/lib/index.js
   - /home/runner/work/my-namespace/my-project/node_modules/@theunderscorer/nx-semantic-release/src/config/apply-tokens.js
   - /home/runner/work/my-namespace/my-project/node_modules/@theunderscorer/nx-semantic-release/src/executors/semantic-release/semantic-release.js
   - /home/runner/work/my-namespace/my-project/node_modules/@theunderscorer/nx-semantic-release/src/executors/semantic-release/executor.js
   - /home/runner/work/my-namespace/my-project/node_modules/nx/src/config/schema-utils.js
   - /home/runner/work/my-namespace/my-project/node_modules/nx/src/command-line/run/executor-utils.js
   - /home/runner/work/my-namespace/my-project/node_modules/nx/src/command-line/run/run.js
   - /home/runner/work/my-namespace/my-project/node_modules/nx/bin/run-executor.js
   Pass --verbose to see the stacktrace.

As a workaround, I downgraded to 2.5.0, which works correctly.

Any way to trigger only one push for mutliple packages changed?

if more than one package changes, it currently results in multiple commits and pushes.

This causes the second push to fail, because it doesn't do a git pull --no-edit

so we'll need to do:

  • git pull origin master --no-edit
  • somehow defer pushing commits till end? maybe an option "no push" so we can use another github action to push afterwards ?

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Cannot push to the Git repository.

semantic-release cannot push the version tag to the branch master on the remote Git repository with URL https://github.com/TheUnderScorer/nx-semantic-release.

This can be caused by:


Good luck with your project ✨

Your semantic-release bot 📦🚀

Honor "dependsOn" configuration for build target

The build target in my nx configuration is a post processing step that needs to happen after the build is completed. My configuration looks something like this:
"build": {
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/blah",
"main": "libs/blah/src/index.ts",
"tsConfig": "libs/blah/tsconfig.lib.json",
"assets": ["libs/blah/*.md"]
}
},
"post-build": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"cwd": "dist/libs/blah,
"command": "npm i"
}
},
"semantic-release": {
"dependsOn": ["lint", "test", "post-build"],
"executor": "@theunderscorer/nx-semantic-release:semantic-release",
"options": {
"github": false,
"changelog": true,
"npm": true,
"tagFormat": "blah-${VERSION}",
"buildTarget": "blah:build",
"outputPath": "dist/libs/blah"
}
}

If I configure the "buildTarget" for "blah:post-build", nx-semantic-release will only run that target and not the dependent target first. If I change "buildTarget" to "blah:build", nx-semantic-release runs "build", even though "semantic-release" dependsOn "post-build" already caused it to run. Since nx-semantic-release runs "build" regardless, it wipes out the post processing step.

If I specify the "buildTarget" as I have shown, can nx-semantic-release honor the dependsOn of post-build so that the build and post build targets all run correctly?

[Question] - Publish to github packages

Hi! Is it possible to use this plugin to publish packages to https://npm.pkg.github.com ?

this is my config

"semantic-release": {
      "executor": "@theunderscorer/nx-semantic-release:semantic-release",
      "options": {
        "github": true,
        "changelog": true,
        "npm": true,
        "tagFormat": "@mycompany/mypackage@${VERSION}"
      }
    }

this is my .npmrc

@mycompany:registry=https://npm.pkg.github.com

and this is my project package.json (the same publishConfig from main package.json)

{
  "name": "@mycompany/mypackage",
  "version": "0.0.1",
  "type": "commonjs",
  "repository": {
    "type": "git",
    "url": "[email protected]/my-repo.git"
  },
  "publishConfig": {
    "registry": "https://npm.pkg.github.com"
  }
}

On ci (github action), I receive this message

[1:34:11 AM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/npm"
[1:34:11 AM] [semantic-release] [@semantic-release/npm] › ℹ  Write version 1.0.0 to package.json in /home/runner/work/my-repo/my-repo/packages/mypackage
v1.0.0
[1:34:11 AM] [semantic-release] [@semantic-release/npm] › ℹ  Skip publishing to npm registry as npmPublish is false
[1:34:11 AM] [semantic-release] › ✔  Completed step "publish" of plugin "@semantic-release/npm"

I tried to use npmPublish: true in plugin config, but i received the same message

Lack os ESM support on dependency

The semantic-release-plugin-decorators lacks support for ESM modules, there is an open issue there (pmowrer/semantic-release-plugin-decorators#32) but apparently it's not getting much traction. Is there a known workaround or a plan to avoid ESM issues going forward?

The error I get:

An error occurred while running semantic-release: Error [ERR_REQUIRE_ESM]: require() of ES Module /dev/fal-ai/serverless-js/node_modules/@semantic-release/npm/index.js from /dev/fal-ai/serverless-js/node_modules/semantic-release-plugin-decorators/src/wrapStep.js not supported.
Instead change the require of index.js in /dev/fal-ai/serverless-js/node_modules/semantic-release-plugin-decorators/src/wrapStep.js to a dynamic import() which is available in all CommonJS modules.
    at nx-semantic-release (/dev/fal-ai/serverless-js/node_modules/semantic-release-plugin-decorators/src/wrapStep.js:49:24)
    at validator (file:///dev/fal-ai/serverless-js/node_modules/@theunderscorer/nx-semantic-release/node_modules/semantic-release/lib/plugins/normalize.js:36:30)
    at file:///dev/fal-ai/serverless-js/node_modules/@theunderscorer/nx-semantic-release/node_modules/semantic-release/lib/plugins/pipeline.js:37:40
    at next (file:///dev/fal-ai/serverless-js/node_modules/p-reduce/index.js:16:10) {
  code: 'ERR_REQUIRE_ESM',
  pluginName: '[Function: nx-semantic-release]'
}

question: why do we need to add the semantic-release entry to workspace.json

Docs mention that we should add the following to our workspace.json.

{
  "$schema": "./node_modules/nx/schemas/workspace-schema.json",
  "version": 2,
  "projects": {
    ...
  },
  "release": {
    "executor": "@theunderscorer/nx-semantic-release:semantic-release"
  }
}

and the following to each of our projects that we wish to manage versions and changelogs for to their project.json:

{
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "tags": [],
  "targets": {
    "release": {
      "executor": "@theunderscorer/nx-semantic-release:semantic-release"
    }
  }
}

questions:

  1. why do we add it to the workspace.json
  2. why are we adding it at that level? I can't find documentation on https://nx.dev/ about that.

Can't publish two affected libraries at the same time

Hi there ✋

I've successfully installed your package inside my nx monorepo which contains two simple libs and one app.

I am using github actions to deploy the libs with affected command.

I ran into an error when the affected command tried to publish both libraries,

Full log from here https://github.com/tomavic/enigma-nx-angular/actions/runs/4726308148/jobs/8385752785

Any ideas on how to solve this? As this contradict with the concept of having multi packages and the possibility of publishing multi package at the time is present when you have a larger project with many teams working on the same repo.

Assets are not uploading during release

I am having trouble trying to attach built files to the release assets. They are just not present in created GitHub Release.
I get no issues with creating git tags and changelog commits with version bumps.

My project has only one package called frontend

My config files:

// apps/frontend/project.json
{
  "name": "frontend",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "targets": {
    "semantic-release": {
      "executor": "@theunderscorer/nx-semantic-release:semantic-release",
      "options": {
        "github": true,
        "changelog": true,
        "npm": true,
        "git": true,
        "buildTarget": "build",
        "tagFormat": "frontend-v${VERSION}",
        "gitAssets": ["${PROJECT_DIR}/package.json"]
      }
    }
  }
}
// apps/frontend/package.json
{
  "name": "frontend",
  "version": "1.0.15",
  "private": true,
  "scripts": {
    "build": "vite build",
  },
  "dependencies": {
    "pinia": "^2.1.4",
    "vue": "^3.3.4",
    "vue-router": "^4.2.4"
  },
  "devDependencies": {
    "@rushstack/eslint-patch": "^1.3.2",
    "@types/jsdom": "^21.1.1",
    "@types/node": "^18.17.0",
    "@vitejs/plugin-vue": "^4.2.3",
    "@vue/test-utils": "^2.4.1",
    "@vue/tsconfig": "^0.4.0",
    "eslint-plugin-vue": "^9.15.1",
    "jsdom": "^22.1.0",
    "sass": "^1.64.2",
    "vite-plugin-zip": "^1.0.1",
    "vue-tsc": "^1.8.6"
  }
}
// .nxreleaserc.json
{
  "changelog": true,
  "npm": false,
  "github": true,
  "repositoryUrl": "<private_link>",
  "branches": ["main"],
  "commitMessage": "chore(release): ${nextRelease.version}",
  "git": true
}
name: Release

on:
  push:
    branches:
      - main

permissions: write-all

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
          fetch-tags: true

      - uses: pnpm/action-setup@v2
        name: Install pnpm
        with:
          version: 8.5
          run_install: true

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 18
          cache: 'pnpm'

      - name: configure git
        run: |
          git config user.name "${GITHUB_ACTOR}"
          git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"

      - run: npx nx run-many --target=semantic-release --parallel=false --configuration=ci
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Unable to release hotfix versions for remote apps in Nx Monorepo

I'm new to Nx and I am doing a POC to adopt Nx in our organisation. I have a monorepo with module federated micro frontend remote apps (say products, carts). This is what my app structure looks like -

package.json (version 0.0.0)
yarn.lock
apps/
  products/
      src/
      ...
      project.json
  cart/
      src/
      ...
      project.json
nx.json
.nxreleaserc.json

I configured semantic-release in such a way that each remote app releases individual versions like -

products-v1.0.0
products-v1.1.0
products-v2.0.0

cart-v1.0.0
cart-v1.1.0
cart-v2.0.0

These are working fine. But there's an issue when I try to hotfix any old tag. Say I want to hotfix products-v1.1.0.

Ideally, I would create a hotfix branch and add it to the release branches with range: 1.1.x.

"branches": [
    "main",
    {
      "name": "hotfix",
      "range": "1.1.x"
    }
]

Then I add a fix commit to my branch (say fix/add-some-fix) and merge it into the hotfix branch through a pull request. This should release the next version i.e. v1.1.1.

But here I have multiple apps in the monorepo, so I added the app name as a prefix to the version. i.e.

# ./apps/products/project.json

"semantic-release": {
  "executor": "@theunderscorer/nx-semantic-release:semantic-release",
  "options": {
    "github": true,
    "changelog": false,
    "npm": false,
    "tagFormat": "products-v${VERSION}" 👈
  }
}

The problem is that the range option expects N.N.x or N.x format if I give the range as 1.1.x, it's releasing the 1.1.1 version instead of products-v1.1.1. Since I have multiple apps, there might be a possibility I want to hotfix other apps and the same 1.1.1 hotfix might be created for them.

"branches": [
    "main",
    {
      "name": "hotfix",
      "range": "products-1.1.x" // This throws the error
    }
]

All I need is for my hotfix tags to have the app name prefixed when that version/tag is created OR any other solution to manage versioning for this project.

Any help is appreciated, Thanks!

Here is my Github repo link: https://github.com/harireddy7/tech-kart-remotes

@TheUnderScorer

Unclear how to get the generated version into each application's build with nx affected

Hello,

I'm trying to understand how to use this plugin. Let's say I just want to show somewhere in my application what the current version is, then I need to pass the version information into each application's build.

My current setup is something like this:

      - name: Semantic Release
        run: nx nx affected --target=semantic-release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Deploying changed apps
         run: nx affected --target=build-and-deploy
            

How would that be possible? Is the version info stored somewhere in context of the app, or would I have to combine semantic release and build + deploy into one single script myself?

Add support for single version for all packages

In README.md, I’ve found the following note:

For now this package supports only Independent versioning mode, synced mode is planned to be added soon.

I presume that by synced mode you mean using a single version for all packages in monorepo. Now, I prefer versioning all apps in a monorepo after each commit I make to any of the packages, as the packages need to match their version when used together.

Therefore, my question is: when is the synced mode planned to be added? Thanks in advance! 🙏

[BUG]: "RangeError: Maximum call stack size exceeded"

During the semantic-release process, the following error occurred: RangeError: Maximum call stack size exceeded. The semantic-release version being used is 19.0.3 and plugins "verifyConditions" from "@semantic-release/changelog", "@semantic-release/git", and "@semantic-release/github" were loaded successfully. The automated release was run from the "master" branch on the repository.

Git authentication was successfully verified, but no git tag version was found on the branch "master". The semantic-release process retrieved all commits as no previous release was found and found 101 commits since the last release. The step "analyzeCommits" of plugin "[Function: nx-semantic-release]" failed, leading to the overall failure of the semantic-release process.

The error message also includes a stack trace with detailed information about the cause of the error. This appears to be a recursion error.

export const getProjectDependencies = async (projectName: string) => {
const graph = await createProjectGraphAsync();
return {
dependencies: getRecursiveDependencies(projectName, graph),
graph,
};
};
export const getProject = (context: GetProjectContext) =>
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
context.workspace.projects[context.projectName!];
export const getProjectRoot = (
project: ProjectConfiguration | string,
cwd: string
) => path.join(cwd, typeof project === 'string' ? project : project.root);
export const getDefaultProjectRoot = (context: GetProjectContext) =>
getProjectRoot(getProject(context), context.cwd);
export const getRecursiveDependencies = (
projectName: string,
graph: ProjectGraph
): string[] => {
const deps = graph.dependencies[projectName];
if (!deps) {
return [];
}
return pipe(
deps,
filter((dependency) => !dependency.target.startsWith('npm:')),
map((dependency) => dependency.target),
(filteredDeps: string[]) =>
filteredDeps.reduce((acc, target) => {
const targetDeps = getRecursiveDependencies(target, graph);
return [...acc, ...targetDeps];
}, filteredDeps)
);
};

Actual Result

The semantic-release process failed with the error "RangeError: Maximum call stack size exceeded".

I'm using the following:

  • NX version - 15.3.3
  • Node - v18.12.1

Additional Information

A stack trace with more detailed information about the cause of the error is included in the initial description.

[9:07:28 PM] [semantic-release] › ℹ Running semantic-release version 19.0.3
[9:07:28 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/changelog"
[9:07:28 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/git"
[9:07:28 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/github"
[9:07:29 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/github"
[9:07:29 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/github"
[9:07:29 PM] [semantic-release] › ✔ Loaded plugin "fail" from "@semantic-release/github"
[9:07:32 PM] [semantic-release] › ✔ Run automated release from branch master on repository https://github.com/org/testproject
[9:07:33 PM] [semantic-release] › ✔ Allowed to push to the Git repository
[9:07:33 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/changelog"
[9:07:33 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/changelog"
[9:07:33 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/git"
[9:07:33 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/git"
[9:07:33 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/github"
[9:07:33 PM] [semantic-release] [@semantic-release/github] › ℹ Verify GitHub authentication (https://api.github.com/)
[9:07:33 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/github"
[9:07:33 PM] [semantic-release] › ℹ No git tag version found on branch master
[9:07:33 PM] [semantic-release] › ℹ No previous release found, retrieving all commits
[9:07:33 PM] [semantic-release] › ℹ Found 101 commits since last release
[9:07:33 PM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "[Function: nx-semantic-release]"
[9:07:33 PM] [semantic-release] › ✖ Failed step "analyzeCommits" of plugin "[Function: nx-semantic-release]"
[9:07:33 PM] [semantic-release] › ✖ An error occurred

[9:08:33 PM] [semantic-release] › ✖  An error occurred while running semantic-release: RangeError: Maximum call stack size exceeded
    at Function.from (<anonymous>)
    at Object.purry (/home/runner/work/testProject/testProject/node_modules/remeda/dist/commonjs/purry.js:43:27)
    at filter (/home/runner/work/testProject/testProject/node_modules/remeda/dist/commonjs/filter.js:8:20)
    at getRecursiveDependencies (/home/runner/work/testProject/testProject/node_modules/@theunderscorer/nx-semantic-release/src/common/project.js:[31](https://github.com/org/testProject/actions/runs/4162311067/jobs/7201326903#step:5:32):57)
    at /home/runner/work/testProject/testProject/node_modules/@theunderscorer/nx-semantic-release/src/common/project.js:[32](https://github.com/testProject/testProject/actions/runs/4162311067/jobs/7201326903#step:5:33):65
    at Array.reduce (<anonymous>)
    at /home/runner/work/testProject/testProject/node_modules/@theunderscorer/nx-semantic-release/src/common/project.js:31:199
    at pipe (/home/runner/work/testProject/testProject/node_modules/remeda/dist/commonjs/pipe.js:27:19)
    at getRecursiveDependencies (/home/runner/work/testProject/testProject/node_modules/@theunderscorer/nx-semantic-release/src/common/project.js:31:30)
    at /home/runner/work/testProject/testProject/node_modules/@theunderscorer/nx-semantic-release/src/common/project.js:32:65 {
  pluginName: '[Function: nx-semantic-release]'
}

 >  NX   Maximum call stack size exceeded

Added the following workflow to test this:

name: Auto Release Version

on:
  push:
    branches:
      - 'master'

permissions:
  checks: write
  pull-requests: write
  issues: write
  contents: write


jobs:
  release:
    name: Release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
          persist-credentials: false

      - name: Configure Git User
        run: |
          git config user.name "${GITHUB_ACTOR}"
          git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
      - name: Install npm dependencies
        run:  yarn install --frozen-lockfile --non-interactive --no-progress --prefer-offline


      - name: Release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: npx nx run testApp:semantic-release

outputPath not being used?

Really want to know if I am doing something wrong here but specifying outputPath seems to not be being used?

In my libraries project.json specifying the following:

"semantic-release": {
      "executor": "@theunderscorer/nx-semantic-release:semantic-release",
      "options": {
        "github": false,
        "changelog": true,
        "npm": false,
        "tagFormat": "rhythm-v${VERSION}",
        "outputPath": "UI/dist/libs/rhythm"
      }
 }

But when this is ran it is showing this:

[4:44:46 PM] [semantic-release] [[Function: nx-semantic-release]] › ℹ  Write version 16.2.1 to package.json in /var/local/agent-manager/vsts-agent-3/_work/2/s/UI/libs/rhythm

I would have expected the above to be UI/dist/libs/rhythm right which is where this should be releasing from?
am I misunderstanding something?

Support for Nx 16

Nx 16 is going to be coming out soon, and currently we're using this plugin for Nx Console.

One of the biggest changes for Nx 16 is the rescope from @nrwl packages to @nx packages.

I'm going to create a PR to help with this migration. Basically for testing and make sure that everything is updated correctly and runs smoothly for others as well (before we go full release 🙂)

Skip publishing as npmPublish is [secure]

Not sure what the following messaging means:

[@semantic-release/npm] › ℹ Skip publishing to npm registry as npmPublish is [secure]

Does the "[secure]" value indicate something?
Should this be an error?

Thanks!

HttpError: You have exceeded a secondary rate limit. Please wait a few minutes before you try again.

Hi,
i've had this issue on other repos using Semantic Release. It's actually tracked here: semantic-release/semantic-release#2204

HttpError: You have exceeded a secondary rate limit. Please wait a few minutes before you try again.

I've solved this using semantic-release/github#299 (comment) personal fork, but there seems to be a few other solutions within that issue that we could use here in this repo for the time being until this is solved.

Support for parserOpts

I'm unfortunately work in an Azure DevOps environment and they have non-github standard naming for PRs and thusly I need to be able to configure the parserOpts. I'd love to see support for this if it's not already possible. I tried including the below in my "options" but with no luck.

"plugins": [
  [
    "@semantic-release/commit-analyzer",
    {
      "preset": "angular",
      "parserOpts": {
        "mergePattern": "/^Merged PR (\\d+): (\\w*)(?:\\(([\\w$.\\-* ]*)\\))?: (.*)$/",
        "mergeCorrespondence": ["pr", "type", "scope", "subject"],
      }
    }
  ]

Likewise I'd love to be able to configure writerOps as well.

Support inferring output path from `buildTarget`

Example build target:

  "targets": {
    "build": {
      "executor": "@nrwl/js:tsc",
      "outputs": ["{options.outputPath}"],
      "options": {
        "outputPath": "dist/packages/nx-micronaut",
        "main": "packages/nx-micronaut/src/index.ts",
        "packageJson": "packages/nx-micronaut/package.json",
        "tsConfig": "packages/nx-micronaut/tsconfig.lib.json",
        "updateBuildableProjectDepsInPackageJson": true,
        "buildableProjectDepsInPackageJsonType": "dependencies",
        "assets": [

        ]
      }
    },

`preset` configuration option from config file gets overwritten by the executor default property

Description

Even though it is not documented, it seems to be possible to set the preset option as the SemanticReleaseOptions type even defines the preset property.

export type SemanticReleaseOptions = Omit<
BaseSemanticReleaseOptions,
'extends'
> & {
npm: boolean;
github: boolean;
buildTarget?: string;
changelog?: boolean;
changelogFile?: string;
outputPath?: string;
commitMessage?: string;
gitAssets?: string[];
packageJsonDir?: string;
parserOpts?: Record<string, unknown>;
writerOpts?: Record<string, unknown>;
linkCompare?: boolean;
linkReferences?: boolean;
releaseRules?:
| string
| { release: string | boolean; [key: string]: unknown }[];
preset?: string;
presetConfig?: Record<string, unknown>;
plugins?: PluginSpec[];
};

The preset config is being correctly applied and forwarded to semantic-release when the configuration is being defined in the project.json file:

{
  "targets": {
    "semantic-release": {
      "executor": "@theunderscorer/nx-semantic-release:semantic-release",
      "options": {
        "preset": "conventionalcommits"
      }
    }
  }
}

Unfortunately is it not possible to set preset in the nxrelease config file, because that value get overwritten by the executor default property.

module.exports = {
    // ...
    preset: 'conventionalcommits', // always overwritten by 'angular'
    presetConfig,
    releaseRules
};

Workaround

Set the preset config in all project.jsons.

Global Configuration Proposal

Proposal

Problem

Currently the only way to set options for a release is in each individual NX project configuration. The more projects in a repo the more repetition and tedium.

Use case

Common Options

There are many options which are likely to be identical across projects within the repo, repositoryURL, plugins and branches for example.

Tokenized Options

Options other than the common options, could become more common with the use Tokens, similar to ${PROJECT_DIR}. Off-hand, ${PROJECT_NAME} seems good, as then buildTarget for example could be set to dist/apps/${PROJECT_NAME} globally and should be sufficient for all projects.

This proposal is about solving both these use cases.

Implementation

For backwards compatibility the options would be merge similarly to how they currently are. Currently,

(workspace | angular).json executor options > defaults

Using the global configuration would simply add another configuration in the middle,

(workspace | angular).json executor options > global > defaults

Options will NOT be deep merged. Meaning that a global plugins option would be completely overwritten by a workspace.json plugins option.

Opinionated Choices

  • Use cosmiconfig for the global configuration. This is the same tool that semantic-release uses.
  • Use nxrelease as the module name for cosmiconfig. Meaning the global options could be placed in:
    • a nxrelease property in package.json
    • a .nxreleaserc file in JSON or YAML format
    • a .nxreleaserc.json, .nxreleaserc.json, .nxreleaserc.json, .nxreleaserc.json, or .nxreleaserc.json file
    • a nxrelease.config.js or nxrelease.config.cjs CommonJS module exporting an object

Conclusion

  • I propose to support a global configuration for nx-semantic-release that still allows for overriding global settings at the individual project level through the executor options.
  • Allow for predefined token (${PROJECT_DIR and ${PROJECT_NAME} to start) use in the changeLogFile, tagFormat, buildTarget, commitMessage, packageJsonDir and gitAssets options.

Note: I've already started on this work and I just wanted to make this proposal to open it up for discussion before I went way far down the rabbit hole. Additionally I can't seem to get the tests to run locally.

Publish to npm is not workign

Hello 👋🏼

I would like to thank you for providing this library 👏🏼 and any other contributor.

I am using this configuration under my project.json in one of the library we built

  "semantic-release": {
      "executor": "@theunderscorer/nx-semantic-release:semantic-release",
      "options": {
        "outputPath": "dist/libs/network-bridge"
      }
    },

During the CI run I keep getting this line

[@semantic-release/npm] › ℹ Skip publishing to npm registry as npmPublish is false

After checking the code source of the plugin, I think the reason was due those lines

In fact if there is a package.json on the library root the npmPublish will set to false, is this an intended behaviour of the plugin?

Thanks in advance.

PS: for now I am overriding those values with the plugins option but I am wondering if is it the normal behaviour.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.