zx-bulk-release 1.4.2 → 1.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/package.json +1 -1
- package/src/main/js/publish.js +13 -8
- package/src/test/js/integration.test.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## [1.5.0](https://github.com/semrel-extra/zx-bulk-release/compare/v1.4.2...v1.5.0) (2022-06-21)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
* feat: add commit-ish to meta ([9092a4d](https://github.com/semrel-extra/zx-bulk-release/commit/9092a4d41f51fb58a9d7cb1696bb9ee3f07c9133))
|
|
5
|
+
|
|
1
6
|
## [1.4.2](https://github.com/semrel-extra/zx-bulk-release/compare/v1.4.1...v1.4.2) (2022-06-21)
|
|
2
7
|
|
|
3
8
|
### Fixes & improvements
|
package/package.json
CHANGED
package/src/main/js/publish.js
CHANGED
|
@@ -2,8 +2,6 @@ import {formatTag, getLatestTag} from './tag.js'
|
|
|
2
2
|
import {tempy, ctx, fs, path} from 'zx-extra'
|
|
3
3
|
import {copydir} from 'git-glob-cp'
|
|
4
4
|
|
|
5
|
-
const META_VERSION = '1'
|
|
6
|
-
|
|
7
5
|
export const publish = async (pkg) => {
|
|
8
6
|
await pushTag(pkg)
|
|
9
7
|
await pushMeta(pkg)
|
|
@@ -25,28 +23,32 @@ export const pushTag = (pkg) => ctx(async ($) => {
|
|
|
25
23
|
await $`git push origin ${tag}`
|
|
26
24
|
})
|
|
27
25
|
|
|
28
|
-
export const pushMeta = async (
|
|
26
|
+
export const pushMeta = (pkg) => ctx(async ($) => {
|
|
29
27
|
console.log('push artifact to branch `meta`')
|
|
30
28
|
|
|
31
29
|
const cwd = pkg.absPath
|
|
32
30
|
const {name, version} = pkg
|
|
33
31
|
const tag = formatTag({name, version})
|
|
34
|
-
const to =
|
|
32
|
+
const to = '.'
|
|
35
33
|
const branch = 'meta'
|
|
36
34
|
const msg = `chore: release meta ${name} ${version}`
|
|
35
|
+
|
|
36
|
+
$.cwd = cwd
|
|
37
|
+
const hash = (await $`git rev-parse HEAD`).toString().trim()
|
|
37
38
|
const meta = {
|
|
38
|
-
META_VERSION,
|
|
39
|
+
META_VERSION: '1',
|
|
39
40
|
name: pkg.name,
|
|
41
|
+
hash,
|
|
40
42
|
version: pkg.version,
|
|
41
43
|
dependencies: pkg.dependencies,
|
|
42
44
|
devDependencies: pkg.devDependencies,
|
|
43
45
|
peerDependencies: pkg.peerDependencies,
|
|
44
46
|
optionalDependencies: pkg.optionalDependencies,
|
|
45
47
|
}
|
|
46
|
-
const files = [{relpath:
|
|
48
|
+
const files = [{relpath: `${getArtifactPath(tag)}.json`, contents: meta}]
|
|
47
49
|
|
|
48
50
|
await push({cwd, to, branch, msg, files})
|
|
49
|
-
}
|
|
51
|
+
})
|
|
50
52
|
|
|
51
53
|
export const npmPublish = ({absPath: cwd}) => ctx(async ($) => {
|
|
52
54
|
const {npmRegistry, npmToken, npmConfig} = parseEnv($.env)
|
|
@@ -154,7 +156,10 @@ export const getLatestMeta = async (cwd, tag) => {
|
|
|
154
156
|
|
|
155
157
|
try {
|
|
156
158
|
const _cwd = await fetch({cwd, branch: 'meta'})
|
|
157
|
-
return await
|
|
159
|
+
return await Promise.any([
|
|
160
|
+
fs.readJson(path.resolve(_cwd, `${getArtifactPath(tag)}.json`)),
|
|
161
|
+
fs.readJson(path.resolve(_cwd, getArtifactPath(tag), 'meta.json'))
|
|
162
|
+
])
|
|
158
163
|
} catch {}
|
|
159
164
|
|
|
160
165
|
return null
|
|
@@ -121,7 +121,7 @@ test('run()', async () => {
|
|
|
121
121
|
const meta = tempy.temporaryDirectory()
|
|
122
122
|
|
|
123
123
|
await $`git clone --single-branch --branch meta --depth 1 ${origin} ${meta}`
|
|
124
|
-
assert.is((await fs.readJson(`${meta}/${tag.toLowerCase().replace(/[^a-z0-9-]/g, '-')}
|
|
124
|
+
assert.is((await fs.readJson(`${meta}/${tag.toLowerCase().replace(/[^a-z0-9-]/g, '-')}.json`)).version, '1.0.1')
|
|
125
125
|
})
|
|
126
126
|
|
|
127
127
|
await registry.stop()
|