semantic-release-lerna 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -61,7 +61,6 @@ The plugin can be configured in the [**semantic-release** configuration file](ht
61
61
  "lerna.json",
62
62
  "package.json",
63
63
  "package-lock.json",
64
- "lerna.json",
65
64
  "packages/*/package.json",
66
65
  "packages/*/package-lock.json"
67
66
  ]
@@ -75,20 +74,11 @@ To use legacy auth set `NPM_USERNAME`, `NPM_PASSWORD` and `NPM_EMAIL`.
75
74
 
76
75
  ## Options
77
76
 
78
- ### `npmVerifyAuth`
79
-
80
- - Type: `boolean`
81
- - Default: `true`
82
-
83
- Set to `false` to disable verifying NPM registry credentials.
84
-
85
- ### `latch`
86
-
87
- - Type: `"major" | "minor" | "patch" | "none"`
88
- - Default: `"minor"`
89
-
90
- Latches package versions together.
91
- If the version bump is at least the given version all packages will be bumped regardless if the package has been touched or not.
77
+ | Option | Description | Default |
78
+ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
79
+ | `npmVerifyAuth` | Set to `false` to disable verifying NPM registry credentials. | `true` |
80
+ | `latch` | Latches package versions together. If the version bump is at least the given version all packages will be bumped regardless if the package has been touched or not. `"major", "minor", "patch", "none"` | `"minor"` |
81
+ | `rootVersion` | Allow to update version on root `package.json`. | `true` |
92
82
 
93
83
  ## Troubleshooting
94
84
 
@@ -33,7 +33,7 @@ async function generateNotes(pluginConfig, context) {
33
33
  const { generateNotes = false } = pluginConfig;
34
34
 
35
35
  if (!generateNotes) {
36
- logger.log(`release notes scope disabled, skipping`);
36
+ logger.log(`Release notes scope disabled, skipping`);
37
37
  return "";
38
38
  }
39
39
 
package/lib/prepare.js CHANGED
@@ -188,6 +188,7 @@ module.exports = async (npmrc, pluginConfig, context) => {
188
188
  } = context;
189
189
  const basePath = pluginConfig.pkgRoot ? path.resolve(cwd, pluginConfig.pkgRoot) : cwd;
190
190
  const rootPkg = new Package(readJson(path.join(basePath, "package.json")), basePath);
191
+ const { rootVersion = true } = pluginConfig;
191
192
 
192
193
  const changed = await getChangedPackages(pluginConfig.latch, { cwd, logger, version });
193
194
  if (changed.length === 0) {
@@ -215,8 +216,11 @@ module.exports = async (npmrc, pluginConfig, context) => {
215
216
 
216
217
  /* Bump version in "lerna.json" */
217
218
  await updateLernaJson(basePath, context);
218
- await updatePackage(npmrc, rootPkg, context);
219
219
 
220
- /* Bump version in "package-lock.json" */
221
- await updateLockfile(npmrc, rootPkg, context);
220
+ if (rootVersion) {
221
+ await updatePackage(npmrc, rootPkg, context);
222
+ await updateLockfile(npmrc, rootPkg, context);
223
+ } else {
224
+ logger.log("Don't write version to root package.json");
225
+ }
222
226
  };
@@ -146,6 +146,44 @@ it("Update lerna.json and root package.json when one or more package has changed
146
146
  expect(context.log).toHaveBeenCalledWith("Write version %s to lerna.json in %s", "1.0.0", cwd);
147
147
  });
148
148
 
149
+ it("Update only lerna.json when one or more package has changed when option `rootVersion` is `false`", async () => {
150
+ expect.assertions(4);
151
+ const cwd = tempy.directory();
152
+ const npmrc = tempy.file({ name: ".npmrc" });
153
+ const project = await createProject(cwd, "0.0.0");
154
+
155
+ await createPackage(cwd, "foo", "0.0.0", {
156
+ changed: true,
157
+ });
158
+
159
+ await prepare(
160
+ npmrc,
161
+ {
162
+ rootVersion: false,
163
+ },
164
+ {
165
+ cwd,
166
+ env: {},
167
+ stdout: context.stdout,
168
+ stderr: context.stderr,
169
+ nextRelease: { version: "1.0.0" },
170
+ logger: context.logger,
171
+ }
172
+ );
173
+
174
+ // Verify lerna.json has been updated
175
+ expect(await readJson(project.lernaPath)).toEqual(
176
+ expect.objectContaining({
177
+ version: "1.0.0",
178
+ })
179
+ );
180
+
181
+ // Verify the logger has been called with the version updated
182
+ expect(context.log).toHaveBeenCalledWith("1 package need version bump: [ 'foo' ]");
183
+ expect(context.log).toHaveBeenCalledWith("Write version %s to lerna.json in %s", "1.0.0", cwd);
184
+ expect(context.log).toHaveBeenCalledWith("Don't write version to root package.json");
185
+ });
186
+
149
187
  it("Update package.json in changed packages", async () => {
150
188
  expect.assertions(2);
151
189
  const cwd = tempy.directory();
package/lib/publish.js CHANGED
@@ -42,6 +42,7 @@ module.exports = async (npmrc, config, pkg, context) => {
42
42
  lerna, 'publish', 'from-package',
43
43
  '--loglevel', 'verbose',
44
44
  '--yes',
45
+ '--concurrency', "1",
45
46
  '--no-verify-access', // prepare step has already verify access and lerna doesn't properly pass authentication
46
47
  '--dist-tag', distTag,
47
48
  '--registry', registry,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semantic-release-lerna",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "semantic-release plugin to publish lerna monorepo packages to npm",
5
5
  "keywords": [
6
6
  "npm",
@@ -68,20 +68,20 @@
68
68
  "write-json-file": "^4.0.0"
69
69
  },
70
70
  "devDependencies": {
71
- "@html-validate/eslint-config": "5.4.9",
72
- "@html-validate/eslint-config-jest": "5.4.8",
73
- "@html-validate/prettier-config": "2.2.0",
71
+ "@html-validate/eslint-config": "5.5.0",
72
+ "@html-validate/eslint-config-jest": "5.5.0",
73
+ "@html-validate/prettier-config": "2.3.0",
74
74
  "@semantic-release/npm": "9.0.1",
75
- "@types/jest": "27.5.1",
75
+ "@types/jest": "29.0.1",
76
76
  "codecov": "3.8.3",
77
77
  "fs-extra": "10.1.0",
78
- "got": "11.8.3",
79
- "jest": "28.1.0",
80
- "lerna": "5.0.0",
81
- "prettier": "2.6.2",
82
- "semantic-release": "19.0.2",
78
+ "got": "11.8.5",
79
+ "jest": "29.0.3",
80
+ "lerna": "5.5.1",
81
+ "prettier": "2.7.1",
82
+ "semantic-release": "19.0.5",
83
83
  "stream-buffers": "3.0.2",
84
- "verdaccio": "5.10.2"
84
+ "verdaccio": "5.15.3"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "@semantic-release/npm": ">= 7",
@@ -89,7 +89,7 @@
89
89
  "semantic-release": ">=15.0.0 <20.0.0"
90
90
  },
91
91
  "engines": {
92
- "node": ">= 12.10"
92
+ "node": ">= 14"
93
93
  },
94
94
  "publishConfig": {
95
95
  "access": "public"