Skip to content

Commit f217aaa

Browse files
committed
AEA-5986 Use spread operator for elegance.
1 parent 641fc9b commit f217aaa

1 file changed

Lines changed: 90 additions & 95 deletions

File tree

release.config.cjs

Lines changed: 90 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -8,106 +8,101 @@ const mainBranch = process.env.MAIN_BRANCH || "main"
88
const pypiPublish = process.env.PYPI_PUBLISH?.toLowerCase() === 'true' || false
99
const pypiToken = process.env.PYPI_TOKEN
1010

11-
const pypiPlugin = [
12-
"semantic-release-pypi",
13-
{
14-
repoToken: pypiToken
15-
}
16-
]
17-
18-
const plugins = [
19-
[
20-
"@semantic-release/commit-analyzer",
11+
module.exports = {
12+
branches: [
2113
{
22-
preset: "eslint",
23-
releaseRules: [
24-
{
25-
tag: "Fix",
26-
release: "patch"
27-
},
28-
{
29-
tag: "Update",
30-
release: "patch"
31-
},
32-
{
33-
tag: "New",
34-
release: "minor"
35-
},
36-
{
37-
tag: "Breaking",
38-
release: "major"
39-
},
40-
{
41-
tag: "Docs",
42-
release: "patch"
43-
},
44-
{
45-
tag: "Build",
46-
release: false
47-
},
48-
{
49-
tag: "Upgrade",
50-
release: "patch"
51-
},
52-
{
53-
tag: "Chore",
54-
release: "patch"
55-
}
56-
]
14+
name: mainBranch
5715
}
5816
],
59-
[
60-
"@semantic-release/release-notes-generator",
61-
{
62-
preset: "eslint",
63-
writerOpts: {
64-
commitPartial: commitTemplate
17+
plugins: [
18+
[
19+
"@semantic-release/commit-analyzer",
20+
{
21+
preset: "eslint",
22+
releaseRules: [
23+
{
24+
tag: "Fix",
25+
release: "patch"
26+
},
27+
{
28+
tag: "Update",
29+
release: "patch"
30+
},
31+
{
32+
tag: "New",
33+
release: "minor"
34+
},
35+
{
36+
tag: "Breaking",
37+
release: "major"
38+
},
39+
{
40+
tag: "Docs",
41+
release: "patch"
42+
},
43+
{
44+
tag: "Build",
45+
release: false
46+
},
47+
{
48+
tag: "Upgrade",
49+
release: "patch"
50+
},
51+
{
52+
tag: "Chore",
53+
release: "patch"
54+
}
55+
]
6556
}
66-
}
67-
],
68-
[
69-
"@semantic-release/changelog",
70-
{
71-
changelogFile: "CHANGELOG.md"
72-
}
73-
],
74-
...publish_packages.map(subpackage => [
75-
"@semantic-release/npm",
76-
{
77-
pkgRoot: subpackage
78-
}
79-
]),
80-
[
81-
"@semantic-release/github",
82-
{
83-
assets: [
57+
],
58+
[
59+
"@semantic-release/release-notes-generator",
60+
{
61+
preset: "eslint",
62+
writerOpts: {
63+
commitPartial: commitTemplate
64+
}
65+
}
66+
],
67+
[
68+
"@semantic-release/changelog",
69+
{
70+
changelogFile: "CHANGELOG.md"
71+
}
72+
],
73+
...publish_packages.map(subpackage => [
74+
"@semantic-release/npm",
75+
{
76+
pkgRoot: subpackage
77+
}
78+
]),
79+
...(pypiPublish ? [
80+
[
81+
"semantic-release-pypi",
8482
{
85-
path: "CHANGELOG.md",
86-
label: "CHANGELOG.md"
87-
},
88-
...(process.env.EXTRA_ASSET ? [
83+
repoToken: pypiToken
84+
}
85+
]
86+
] : []),
87+
[
88+
"@semantic-release/github",
89+
{
90+
assets: [
8991
{
90-
path: process.env.EXTRA_ASSET,
91-
label: process.env.EXTRA_ASSET
92-
}
93-
] : [])
94-
],
95-
successComment: false,
96-
failComment: false,
97-
failTitle: false
98-
}
92+
path: "CHANGELOG.md",
93+
label: "CHANGELOG.md"
94+
},
95+
...(process.env.EXTRA_ASSET ? [
96+
{
97+
path: process.env.EXTRA_ASSET,
98+
label: process.env.EXTRA_ASSET
99+
}
100+
] : [])
101+
],
102+
successComment: false,
103+
failComment: false,
104+
failTitle: false
105+
}
106+
]
99107
]
100-
]
101-
102-
if (pypiPublish) {
103-
plugins.push(pypiPlugin)
104-
}
105-
106-
module.exports = {
107-
branches: [
108-
{
109-
name: mainBranch
110-
}
111-
],
112-
plugins: plugins
113108
}

0 commit comments

Comments
 (0)