-
Notifications
You must be signed in to change notification settings - Fork 0
/
.versionrc.js
72 lines (61 loc) · 1.8 KB
/
.versionrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* eslint-disable node/no-unpublished-require */
const fs = require("fs-extra")
// package.json
const getDirectoriesSync = (source) =>
fs
.readdirSync(source, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory() || dirent.isSymbolicLink())
.map((dirent) => dirent.name)
const bumpFiles = []
bumpFiles.push({ filename: "package.json", type: "json" })
const packageDirs = getDirectoriesSync("packages")
for (const dir of packageDirs) {
const filename = `packages/${dir}/package.json`
if (fs.pathExistsSync(filename)) {
bumpFiles.push({ filename, type: "json" })
}
}
// charts
const getChartsRecursive = (dir, list = []) => {
const chartList = getDirectoriesSync(dir)
list.push(
...chartList.map((c) =>
fs.realpathSync(`${dir}/${c}`).slice(__dirname.length + 1)
)
)
for (const chartName of chartList) {
const childDir = `${dir}/${chartName}/charts`
if (fs.pathExistsSync(childDir)) {
list.push(...getChartsRecursive(childDir))
}
}
return list
}
const chartsUpdater = "packages/dev-tools/lib/standard-version-chart-updater.js"
const charts = getChartsRecursive("plugins")
bumpFiles.push(
...charts.map((chartDir) => ({
filename: `${chartDir}/Chart.yaml`,
updater: chartsUpdater,
}))
)
bumpFiles.push({
filename: `packages/webhook/Chart.yaml`,
updater: chartsUpdater,
})
// e2e version (docker images, github actions, workflows etc...)
// it works but it's too slow, I prefer external bumper in this case
/*
const versionE2eGetFiles = require("./packages/dev-tools/lib/version-e2e-get-files")
const e2eFiles = versionE2eGetFiles()
const e2eUpdater = "packages/dev-tools/lib/standard-version-e2e-updater.js"
bumpFiles.push(
...e2eFiles.map((file) => ({
filename: file,
updater: e2eUpdater,
}))
)
*/
module.exports = {
bumpFiles,
}