infra-kit 0.1.2 → 0.1.3
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "infra-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.3",
|
|
5
5
|
"description": "infra-kit",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/main.js",
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
"fix": "pnpm run prettier-fix && pnpm run eslint-fix && pnpm run qa"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"@inquirer/checkbox": "^4.0.6",
|
|
33
|
+
"@inquirer/confirm": "^5.1.3",
|
|
32
34
|
"@inquirer/select": "^4.0.6",
|
|
33
35
|
"commander": "^13.1.0",
|
|
34
36
|
"zx": "^8.3.0"
|
|
@@ -3,12 +3,15 @@ import { $ } from 'zx'
|
|
|
3
3
|
|
|
4
4
|
import { validateGitHubCliAndAuth } from '../../shared/gh-cli-auth'
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Deploy a release branch to an environment
|
|
8
|
+
*/
|
|
6
9
|
export const ghDeploy = async () => {
|
|
7
10
|
await validateGitHubCliAndAuth()
|
|
8
11
|
|
|
9
12
|
const ENVs = ['dev', 'arthur', 'renana', 'roman', 'eliran', 'alex', 'vova', 'oriana']
|
|
10
13
|
|
|
11
|
-
let releasePRsList: string[] = []
|
|
14
|
+
let releasePRsList: string[] = [] // ["release/v1.8.0", "release/v1.9.0"]
|
|
12
15
|
|
|
13
16
|
try {
|
|
14
17
|
// Example of releasePRs.output: {"headRefName":"release/v1.8.0","number":665,"state":"OPEN","title":"WIP Release/v1.8.0"}
|
|
@@ -1,37 +1,65 @@
|
|
|
1
|
-
import
|
|
1
|
+
import checkbox from '@inquirer/checkbox'
|
|
2
|
+
import confirm from '@inquirer/confirm'
|
|
3
|
+
import { $ } from 'zx'
|
|
4
|
+
|
|
5
|
+
import { validateGitHubCliAndAuth } from '../../shared/gh-cli-auth'
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
8
|
* Merge dev into every release branch
|
|
5
9
|
*/
|
|
6
10
|
export const ghMergeDev = async () => {
|
|
7
|
-
|
|
11
|
+
await validateGitHubCliAndAuth()
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
let releasePRsList: string[] = [] // ["release/v1.8.0", "release/v1.9.0"]
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
try {
|
|
16
|
+
// Example of releasePRs.output: {"headRefName":"release/v1.8.0","number":665,"state":"OPEN","title":"WIP Release/v1.8.0"}
|
|
17
|
+
const releasePRs =
|
|
18
|
+
await $`gh pr list --search "Release in:title" --base dev --json number,title,headRefName,state,baseRefName`
|
|
19
|
+
|
|
20
|
+
const releasePRsArray = JSON.parse(releasePRs.stdout)
|
|
21
|
+
|
|
22
|
+
if (releasePRsArray.length === 0) {
|
|
23
|
+
console.error('❌ No release PRs found. Check the project folder for the script. Exiting...')
|
|
24
|
+
process.exit(1)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
releasePRsList = releasePRsArray.map((pr) => pr.headRefName)
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error('❌ Error fetching release PRs:', error.message)
|
|
14
30
|
process.exit(1)
|
|
15
31
|
}
|
|
16
32
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
33
|
+
const selectedReleaseBranches = await checkbox({
|
|
34
|
+
required: true,
|
|
35
|
+
message: '🔍 Select release branches',
|
|
36
|
+
choices: releasePRsList.map((pr) => ({
|
|
37
|
+
name: pr,
|
|
38
|
+
value: pr,
|
|
39
|
+
})),
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
// Validate input
|
|
43
|
+
// if (selectedReleaseBranches.length === 0) {
|
|
44
|
+
// console.error('No branches provided. Exiting...')
|
|
45
|
+
// process.exit(1)
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
const answer = await confirm({
|
|
49
|
+
message: `Are you sure you want to merge dev into these branches: ${selectedReleaseBranches.join(', ')}?`,
|
|
50
|
+
})
|
|
21
51
|
|
|
22
|
-
if (
|
|
52
|
+
if (!answer) {
|
|
23
53
|
console.log('Operation cancelled. Exiting...')
|
|
24
54
|
process.exit(0)
|
|
25
55
|
}
|
|
26
56
|
|
|
27
57
|
await $`git fetch origin`
|
|
28
|
-
|
|
29
58
|
await $`git switch dev`
|
|
30
|
-
|
|
31
59
|
await $`git pull origin dev`
|
|
32
60
|
|
|
33
61
|
// Merge dev into each branch
|
|
34
|
-
for (const branch of
|
|
62
|
+
for (const branch of selectedReleaseBranches) {
|
|
35
63
|
await mergeDev(branch)
|
|
36
64
|
}
|
|
37
65
|
|