bulk-release 2.4.1 → 2.5.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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [2.5.0](https://github.com/semrel-extra/zx-bulk-release/compare/v2.4.2...v2.5.0) (2023-04-09)
2
+
3
+ ### Features
4
+ * feat: respect `publishCmd` also with `--snapshot` flag ([50521d2](https://github.com/semrel-extra/zx-bulk-release/commit/50521d28220df2e98978dfaa76efb8a5346470d0))
5
+
6
+ ## [2.4.2](https://github.com/semrel-extra/zx-bulk-release/compare/v2.4.1...v2.4.2) (2023-04-09)
7
+
8
+ ### Fixes & improvements
9
+ * fix: make safe `git config unset` ([562083d](https://github.com/semrel-extra/zx-bulk-release/commit/562083d14ede6db93e0e19853aa8baf3a1e0f578))
10
+
1
11
  ## [2.4.1](https://github.com/semrel-extra/zx-bulk-release/compare/v2.4.0...v2.4.1) (2023-04-09)
2
12
 
3
13
  ### Fixes & improvements
package/README.md CHANGED
@@ -35,18 +35,18 @@ yarn add zx-bulk-release
35
35
  ```shell
36
36
  GH_TOKEN=ghtoken GH_USER=username NPM_TOKEN=npmtoken npx zx-bulk-release [opts]
37
37
  ```
38
- | Flag | Description | Default |
39
- |------------------------------|----------------------------------------------------------------------------------------|------------------|
40
- | `--ignore` | Packages to ignore: `a, b` | |
41
- | `--include-private` | Include `private` packages | `false` |
42
- | `--concurrency` | `build/publish` threads limit | `os.cpus.length` |
43
- | `--no-build` | Skip `buildCmd` invoke | |
44
- | `--no-npm-fetch` | Disable npm artifacts fetching | |
45
- | `--only-workspace-deps` | Recognize only `workspace:` deps as graph edges | |
46
- | `--dry-run` / `--no-publish` | Disable any publish logic | |
47
- | `--report` | Persist release state to file | |
48
- | `--snapshot` | Disable any publishing steps except of npm and push packages to the `snapshot` channel | |
49
- | `--debug` | Enable [zx](https://github.com/google/zx#verbose) verbose mode | |
38
+ | Flag | Description | Default |
39
+ |------------------------------|---------------------------------------------------------------------------------------------------------------------------|------------------|
40
+ | `--ignore` | Packages to ignore: `a, b` | |
41
+ | `--include-private` | Include `private` packages | `false` |
42
+ | `--concurrency` | `build/publish` threads limit | `os.cpus.length` |
43
+ | `--no-build` | Skip `buildCmd` invoke | |
44
+ | `--no-npm-fetch` | Disable npm artifacts fetching | |
45
+ | `--only-workspace-deps` | Recognize only `workspace:` deps as graph edges | |
46
+ | `--dry-run` / `--no-publish` | Disable any publish logic | |
47
+ | `--report` | Persist release state to file | |
48
+ | `--snapshot` | Disable any publishing steps except of `npm` and `publishCmd` (if defined), then push packages to the `snapshot` channel | |
49
+ | `--debug` | Enable [zx](https://github.com/google/zx#verbose) verbose mode | |
50
50
 
51
51
  ### JS API
52
52
  ```js
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bulk-release",
3
3
  "alias": "bulk-release",
4
- "version": "2.4.1",
4
+ "version": "2.5.0",
5
5
  "description": "zx-based alternative for multi-semantic-release",
6
6
  "type": "module",
7
7
  "exports": {
@@ -113,6 +113,6 @@ export const setUserConfig = memoizeBy(async(cwd, gitCommitterName, gitCommitter
113
113
  git config user.email ${gitCommitterEmail}
114
114
  `)
115
115
 
116
- export const unsetUserConfig = async(cwd) => $.o({cwd})`
116
+ export const unsetUserConfig = async(cwd) => $.o({cwd, nothrow: true})`
117
117
  git config --unset user.name &&
118
118
  git config --unset user.email`
@@ -35,19 +35,16 @@ export const fetchManifest = async (pkg, {nothrow} = {}) => {
35
35
  }
36
36
 
37
37
  export const npmPublish = async (pkg) => {
38
- const {absPath: cwd, name, version, manifest, manifestPath, manifestRaw, config: {npmPublish, npmRegistry, npmToken, npmConfig} } = pkg
38
+ const {absPath: cwd, name, version, manifest, config: {npmPublish, npmRegistry, npmToken, npmConfig} } = pkg
39
39
 
40
40
  if (manifest.private || npmPublish === false) return
41
41
 
42
42
  log({pkg})(`publishing npm package ${name} ${version} to ${npmRegistry}`)
43
43
 
44
- await fs.writeJson(manifestPath, manifest, {spaces: 2})
45
-
46
44
  const npmTag = pkg.preversion ? 'snapshot' : 'latest'
47
45
  const npmrc = await getNpmrc({npmConfig, npmToken, npmRegistry})
48
46
 
49
47
  await $.o({cwd})`npm publish --no-git-tag-version --registry=${npmRegistry} --userconfig ${npmrc} --tag ${npmTag} --no-workspaces`
50
- fs.writeFileSync(manifestPath, manifestRaw, {encoding: 'utf8'})
51
48
  }
52
49
 
53
50
  export const getNpmrc = async ({npmConfig, npmToken, npmRegistry}) => {
@@ -63,7 +63,7 @@ export const run = async ({cwd = process.cwd(), env, flags = {}} = {}) => within
63
63
  .setStatus('failure')
64
64
  throw e
65
65
  } finally {
66
- await unsetUserConfig(cwd)
66
+ await clean(cwd, packages)
67
67
  }
68
68
  report
69
69
  .setStatus('success')
@@ -142,8 +142,13 @@ const publish = memoizeBy(async (pkg, run = runCmd) => within(async () => {
142
142
  throw new Error('package.json version not synced')
143
143
  }
144
144
 
145
+ await fs.writeJson(pkg.manifestPath, pkg.manifest, {spaces: 2})
146
+
145
147
  if (pkg.context.flags.snapshot) {
146
- await npmPublish(pkg)
148
+ await Promise.all([
149
+ npmPublish(pkg),
150
+ run(pkg, 'publishCmd')
151
+ ])
147
152
  } else {
148
153
  await pushReleaseTag(pkg)
149
154
  await Promise.all([
@@ -155,6 +160,12 @@ const publish = memoizeBy(async (pkg, run = runCmd) => within(async () => {
155
160
  run(pkg, 'publishCmd')
156
161
  ])
157
162
  }
158
-
159
163
  pkg.published = true
160
164
  }))
165
+
166
+ const clean = async (cwd, packages) => {
167
+ await unsetUserConfig(cwd)
168
+ await Promise.all(Object.values(packages).map(({manifestPath, manifestRaw}) =>
169
+ fs.writeFile(manifestPath, manifestRaw, {encoding: 'utf8'})
170
+ ))
171
+ }