@jcoreio/toolchain-semantic-release 4.0.1 → 4.2.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/package.json +4 -3
- package/plugins/scripts.cjs +28 -15
- package/release.config.cjs +93 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jcoreio/toolchain-semantic-release",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "toolchain for running semantic-release",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/jcoreio/toolchains/issues"
|
|
14
14
|
},
|
|
15
|
-
"homepage": "https://github.com/jcoreio/toolchains/tree/
|
|
15
|
+
"homepage": "https://github.com/jcoreio/toolchains/tree/main/packages/semantic-release",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"dedent-js": "^1.0.1",
|
|
18
18
|
"resolve-bin": "^1.0.0",
|
|
19
|
-
"@jcoreio/toolchain": "4.0
|
|
19
|
+
"@jcoreio/toolchain": "4.2.0"
|
|
20
20
|
},
|
|
21
21
|
"bin": {
|
|
22
22
|
"semantic-release": "./bin/semantic-release"
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@semantic-release/github": "^10.0.3",
|
|
28
28
|
"@semantic-release/npm": "^12.0.0",
|
|
29
29
|
"@semantic-release/release-notes-generator": "^13.0.0",
|
|
30
|
+
"conventional-changelog-conventionalcommits": "^7.0.2",
|
|
30
31
|
"semantic-release": "^23.0.8"
|
|
31
32
|
}
|
|
32
33
|
}
|
package/plugins/scripts.cjs
CHANGED
|
@@ -1,29 +1,42 @@
|
|
|
1
1
|
const execa = require('@jcoreio/toolchain/util/execa.cjs')
|
|
2
|
-
const {
|
|
2
|
+
const {
|
|
3
|
+
packageJson,
|
|
4
|
+
isMonorepoRoot,
|
|
5
|
+
} = require('@jcoreio/toolchain/util/findUps.cjs')
|
|
3
6
|
const resolveBin = require('resolve-bin')
|
|
4
|
-
const
|
|
7
|
+
const ownPackageJson = require('../package.json')
|
|
5
8
|
|
|
6
9
|
module.exports = [
|
|
7
10
|
{
|
|
8
11
|
release: {
|
|
9
12
|
description: 'run automated release',
|
|
10
13
|
run: async (args = []) => {
|
|
11
|
-
|
|
12
|
-
resolveBin.sync('semantic-release')
|
|
13
|
-
for (const key in packageJson.toolchainManaged
|
|
14
|
-
.optionalDevDependencies)
|
|
15
|
-
require(key)
|
|
16
|
-
} catch (error) {
|
|
14
|
+
if (isMonorepoRoot && packageJson.name !== '@jcoreio/toolchains') {
|
|
17
15
|
await execa('pnpm', [
|
|
18
|
-
'
|
|
19
|
-
'-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
).map(([key, value]) => `${key}@${value}`),
|
|
16
|
+
'run',
|
|
17
|
+
'-r',
|
|
18
|
+
'--workspace-concurrency=1',
|
|
19
|
+
'tc',
|
|
20
|
+
'release',
|
|
24
21
|
])
|
|
22
|
+
} else {
|
|
23
|
+
try {
|
|
24
|
+
resolveBin.sync('semantic-release')
|
|
25
|
+
for (const key in ownPackageJson.toolchainManaged
|
|
26
|
+
.optionalDevDependencies)
|
|
27
|
+
require(key)
|
|
28
|
+
} catch (error) {
|
|
29
|
+
await execa('pnpm', [
|
|
30
|
+
'install',
|
|
31
|
+
'-D',
|
|
32
|
+
...(isMonorepoRoot ? ['-w'] : []),
|
|
33
|
+
...Object.entries(
|
|
34
|
+
ownPackageJson.toolchainManaged.optionalDevDependencies
|
|
35
|
+
).map(([key, value]) => `${key}@${value}`),
|
|
36
|
+
])
|
|
37
|
+
}
|
|
38
|
+
await execa('semantic-release', args)
|
|
25
39
|
}
|
|
26
|
-
await execa('semantic-release', args)
|
|
27
40
|
},
|
|
28
41
|
},
|
|
29
42
|
},
|
package/release.config.cjs
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {
|
|
2
|
+
projectDir,
|
|
3
|
+
packageJson: { name: pkg },
|
|
4
|
+
monorepoSubpackageJsonFiles,
|
|
5
|
+
monorepoPackageJson,
|
|
6
|
+
} = require('@jcoreio/toolchain/util/findUps.cjs')
|
|
2
7
|
const execa = require('@jcoreio/toolchain/util/execa.cjs')
|
|
3
8
|
const path = require('path')
|
|
4
9
|
|
|
@@ -11,7 +16,11 @@ try {
|
|
|
11
16
|
hasMain = false
|
|
12
17
|
}
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
const otherPackages = monorepoSubpackageJsonFiles
|
|
20
|
+
? monorepoSubpackageJsonFiles.map((f) => require(f).name)
|
|
21
|
+
: []
|
|
22
|
+
|
|
23
|
+
const base = {
|
|
15
24
|
branches: [
|
|
16
25
|
'+([0-9])?(.{+([0-9]),x}).x',
|
|
17
26
|
hasMain ? 'main' : 'master',
|
|
@@ -20,15 +29,86 @@ module.exports = {
|
|
|
20
29
|
{ name: 'beta', prerelease: true },
|
|
21
30
|
{ name: 'alpha', prerelease: true },
|
|
22
31
|
],
|
|
23
|
-
plugins: [
|
|
24
|
-
require.resolve('@semantic-release/commit-analyzer'),
|
|
25
|
-
require.resolve('@semantic-release/release-notes-generator'),
|
|
26
|
-
[
|
|
27
|
-
require.resolve('@semantic-release/npm'),
|
|
28
|
-
{
|
|
29
|
-
pkgRoot: path.join(projectDir, 'dist'),
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
require.resolve('@semantic-release/github'),
|
|
33
|
-
],
|
|
34
32
|
}
|
|
33
|
+
|
|
34
|
+
module.exports =
|
|
35
|
+
monorepoSubpackageJsonFiles &&
|
|
36
|
+
monorepoPackageJson &&
|
|
37
|
+
monorepoPackageJson.name !== '@jcoreio/toolchains'
|
|
38
|
+
? {
|
|
39
|
+
...base,
|
|
40
|
+
tagFormat: `${pkg}-v\${version}`,
|
|
41
|
+
plugins: [
|
|
42
|
+
[
|
|
43
|
+
require.resolve('@semantic-release/commit-analyzer'),
|
|
44
|
+
{
|
|
45
|
+
preset: 'conventionalcommits',
|
|
46
|
+
releaseRules: [
|
|
47
|
+
...[pkg, undefined].flatMap((scope) => [
|
|
48
|
+
{ breaking: true, scope, release: 'major' },
|
|
49
|
+
{ revert: true, scope, release: 'patch' },
|
|
50
|
+
{ type: 'feat', scope, release: 'minor' },
|
|
51
|
+
{ type: 'fix', scope, release: 'patch' },
|
|
52
|
+
{ type: 'perf', scope, release: 'patch' },
|
|
53
|
+
]),
|
|
54
|
+
{ scope: undefined, release: false },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
require.resolve('@semantic-release/release-notes-generator'),
|
|
60
|
+
{
|
|
61
|
+
preset: 'conventionalcommits',
|
|
62
|
+
presetConfig: {
|
|
63
|
+
types: [
|
|
64
|
+
{ type: 'build', section: 'Build System', hidden: true },
|
|
65
|
+
{ type: 'chore', section: 'Build System', hidden: true },
|
|
66
|
+
{
|
|
67
|
+
type: 'ci',
|
|
68
|
+
section: 'Continuous Integration',
|
|
69
|
+
hidden: true,
|
|
70
|
+
},
|
|
71
|
+
{ type: 'style', section: 'Styles', hidden: true },
|
|
72
|
+
{ type: 'test', section: 'Tests', hidden: true },
|
|
73
|
+
...[
|
|
74
|
+
{ type: 'docs', section: 'Documentation' },
|
|
75
|
+
{ type: 'feat', section: 'Features' },
|
|
76
|
+
{ type: 'fix', section: 'Bug Fixes' },
|
|
77
|
+
{ type: 'perf', section: 'Performance Improvements' },
|
|
78
|
+
{ type: 'refactor', section: 'Code Refactoring' },
|
|
79
|
+
].flatMap((cfg) => [
|
|
80
|
+
{ ...cfg, scope: pkg, hidden: false },
|
|
81
|
+
...otherPackages.map((otherPkg) => ({
|
|
82
|
+
...cfg,
|
|
83
|
+
scope: otherPkg,
|
|
84
|
+
hidden: true,
|
|
85
|
+
})),
|
|
86
|
+
{ ...cfg, hidden: false },
|
|
87
|
+
]),
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
[
|
|
93
|
+
require.resolve('@semantic-release/npm'),
|
|
94
|
+
{
|
|
95
|
+
pkgRoot: path.join(__dirname, 'dist'),
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
require.resolve('@semantic-release/github'),
|
|
99
|
+
],
|
|
100
|
+
}
|
|
101
|
+
: {
|
|
102
|
+
...base,
|
|
103
|
+
plugins: [
|
|
104
|
+
require.resolve('@semantic-release/commit-analyzer'),
|
|
105
|
+
require.resolve('@semantic-release/release-notes-generator'),
|
|
106
|
+
[
|
|
107
|
+
require.resolve('@semantic-release/npm'),
|
|
108
|
+
{
|
|
109
|
+
pkgRoot: path.join(projectDir, 'dist'),
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
require.resolve('@semantic-release/github'),
|
|
113
|
+
],
|
|
114
|
+
}
|