bulk-release 2.4.2 → 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 +5 -0
- package/README.md +12 -12
- package/package.json +1 -1
- package/src/main/js/npm.js +1 -4
- package/src/main/js/processor.js +14 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
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
|
+
|
|
1
6
|
## [2.4.2](https://github.com/semrel-extra/zx-bulk-release/compare/v2.4.1...v2.4.2) (2023-04-09)
|
|
2
7
|
|
|
3
8
|
### 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
|
|
39
|
-
|
|
40
|
-
| `--ignore` | Packages to ignore: `a, b`
|
|
41
|
-
| `--include-private` | Include `private` packages
|
|
42
|
-
| `--concurrency` | `build/publish` threads limit
|
|
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
package/src/main/js/npm.js
CHANGED
|
@@ -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,
|
|
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
|
-
await fs.writeFile(manifestPath, manifestRaw, {encoding: 'utf8'})
|
|
51
48
|
}
|
|
52
49
|
|
|
53
50
|
export const getNpmrc = async ({npmConfig, npmToken, npmRegistry}) => {
|
package/src/main/js/processor.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
+
}
|