@docupace/pipeline 1.0.77-alpha.3 → 1.0.77
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/.prettierrc.cjs +12 -12
- package/README.md +135 -135
- package/bin/azuread_update_callbacks_for_app.sh +58 -58
- package/bin/next-changeset-validate.sh +8 -8
- package/bitbucket-pipelines.yml +59 -59
- package/eslint.config.js +49 -49
- package/jest.config.js +15 -15
- package/next/changeset.sh +75 -75
- package/next/copy.sh +34 -34
- package/next/deploy.sh +40 -40
- package/next/execute.sh +123 -123
- package/next/sonar.sh +23 -23
- package/package.json +1 -1
- package/src/auth0/alias.js +79 -79
- package/src/auth0/alias.test.js +172 -172
- package/src/auth0/cli.js +82 -82
- package/src/auth0/configure.js +902 -902
- package/src/auth0/configure.test.js +167 -167
- package/src/auth0/export.js +48 -48
- package/src/auth0/export.test.js +103 -103
- package/src/auth0/metadata.js +141 -141
- package/src/auth0/metadata.test.js +186 -186
- package/src/auth0/vault.js +60 -60
- package/src/auth0/vault.test.js +134 -134
- package/src/changeset/changelog-wiki.js +328 -328
- package/src/changeset/changeset-config.js +34 -34
- package/src/changeset/cli.js +237 -237
- package/src/changeset/create.js +215 -215
- package/src/changeset/package-util.js +87 -87
- package/src/changeset/util.js +43 -43
- package/src/changeset/validate.js +91 -91
- package/src/changeset/version.js +102 -102
- package/src/jenkins/setParams.groovy +58 -58
- package/src/lib/merge-driver.js +204 -204
- package/src/merge/cli-merge-all.js +507 -507
- package/src/merge/cli-merge.js +492 -492
- package/src/merge/cli-resolve.js +399 -399
- package/src/merge/cli.js +38 -38
- package/src/merge/merge-changelog.js +87 -87
- package/src/merge/merge-package.js +106 -106
- package/src/merge/merge-types.js +82 -82
- package/src/merge/pr.js +231 -231
- package/src/micro/cli.js +71 -0
- package/src/micro/ms-deploy.js +271 -0
- package/src/micro/{publish-ms.js → ms-publish.js} +6 -8
- package/src/next/alias.js +53 -53
- package/src/next/apache.js +81 -81
- package/src/next/cli.js +1 -10
- package/src/next/config.js +137 -137
- package/src/next/connect.js +226 -226
- package/src/next/copy.js +61 -61
- package/src/next/deploy.js +633 -633
- package/src/next/git-to-semver.js +79 -79
- package/src/next/haproxy.js +76 -76
- package/src/next/jenkins.js +123 -123
- package/src/next/jira.js +84 -84
- package/src/next/logger.js +17 -17
- package/src/next/pipline.js +114 -114
- package/src/next/publish.js +71 -71
- package/src/next/pull.js +7 -7
- package/src/next/sonar.js +23 -23
- package/src/next/test.js +5 -5
- package/src/next/util.js +93 -95
- package/src/next/vault.js +45 -45
- package/terraform/apply.sh +37 -37
- package/terraform/init.sh +72 -72
- package/terraform/plan.sh +76 -76
- package/terraform/validate.sh +17 -17
- package/src/micro/deploy-microservice.js +0 -153
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
// Get absolute path to .changeset/config.json using current working directory
|
|
5
|
-
const configPath = path.join(process.cwd(), '.changeset', 'config.json');
|
|
6
|
-
|
|
7
|
-
// Function to update baseBranch to BITBUCKET_BRANCH
|
|
8
|
-
export function updateBaseBranch() {
|
|
9
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
10
|
-
if (!process.env.BITBUCKET_BRANCH) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
let originalbaseBranch = config.baseBranch;
|
|
14
|
-
config.baseBranch = process.env.BITBUCKET_BRANCH;
|
|
15
|
-
|
|
16
|
-
if (!config.baseBranch) {
|
|
17
|
-
throw new Error('BITBUCKET_BRANCH environment variable is not set.');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
21
|
-
console.log(`baseBranch updated to ${process.env.BITBUCKET_BRANCH}`);
|
|
22
|
-
|
|
23
|
-
return originalbaseBranch;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Function to revert baseBranch to original value
|
|
27
|
-
export function revertBaseBranch(originalBaseBranch) {
|
|
28
|
-
if (!originalBaseBranch) return;
|
|
29
|
-
|
|
30
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
31
|
-
config.baseBranch = originalBaseBranch;
|
|
32
|
-
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
33
|
-
console.log(`baseBranch reverted to ${originalBaseBranch}`);
|
|
34
|
-
}
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
// Get absolute path to .changeset/config.json using current working directory
|
|
5
|
+
const configPath = path.join(process.cwd(), '.changeset', 'config.json');
|
|
6
|
+
|
|
7
|
+
// Function to update baseBranch to BITBUCKET_BRANCH
|
|
8
|
+
export function updateBaseBranch() {
|
|
9
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
10
|
+
if (!process.env.BITBUCKET_BRANCH) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
let originalbaseBranch = config.baseBranch;
|
|
14
|
+
config.baseBranch = process.env.BITBUCKET_BRANCH;
|
|
15
|
+
|
|
16
|
+
if (!config.baseBranch) {
|
|
17
|
+
throw new Error('BITBUCKET_BRANCH environment variable is not set.');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
21
|
+
console.log(`baseBranch updated to ${process.env.BITBUCKET_BRANCH}`);
|
|
22
|
+
|
|
23
|
+
return originalbaseBranch;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Function to revert baseBranch to original value
|
|
27
|
+
export function revertBaseBranch(originalBaseBranch) {
|
|
28
|
+
if (!originalBaseBranch) return;
|
|
29
|
+
|
|
30
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
31
|
+
config.baseBranch = originalBaseBranch;
|
|
32
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
33
|
+
console.log(`baseBranch reverted to ${originalBaseBranch}`);
|
|
34
|
+
}
|
package/src/changeset/cli.js
CHANGED
|
@@ -1,237 +1,237 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { $ } from 'zx';
|
|
4
|
-
import { validateChangesets } from './validate.js';
|
|
5
|
-
import dotenv from 'dotenv';
|
|
6
|
-
import { isMonoRepo, setGitInfo } from '../next/util.js';
|
|
7
|
-
import {
|
|
8
|
-
toShortVersion,
|
|
9
|
-
updateJiraWithVersion,
|
|
10
|
-
versionCommand,
|
|
11
|
-
} from './version.js';
|
|
12
|
-
import { createChangeset } from './create.js';
|
|
13
|
-
import {
|
|
14
|
-
updateWikiWithVersion,
|
|
15
|
-
upsertReleaseNotesFromFile,
|
|
16
|
-
} from './changelog-wiki.js';
|
|
17
|
-
|
|
18
|
-
dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
|
|
19
|
-
|
|
20
|
-
const program = new Command();
|
|
21
|
-
|
|
22
|
-
const args = process.argv;
|
|
23
|
-
|
|
24
|
-
async function commitTagCommand(releases) {
|
|
25
|
-
console.log('📌 Checking for updates to commit...');
|
|
26
|
-
|
|
27
|
-
// Check if there are changes to commit
|
|
28
|
-
const status = (await $`git status --porcelain`).stdout.trim();
|
|
29
|
-
if (!status) {
|
|
30
|
-
console.log('✅ No changes to commit. Exiting.');
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
console.log('📌 Committing and tagging the new version...');
|
|
35
|
-
await setGitInfo();
|
|
36
|
-
await $`git add .`;
|
|
37
|
-
|
|
38
|
-
if (isMonoRepo()) {
|
|
39
|
-
await commitTagMono(releases);
|
|
40
|
-
} else {
|
|
41
|
-
await commitTag();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function getAppReleases(releases) {
|
|
46
|
-
const appReleases = releases.filter(
|
|
47
|
-
(release) =>
|
|
48
|
-
release.name.endsWith('-app') || release.name.endsWith('-template'),
|
|
49
|
-
);
|
|
50
|
-
return appReleases;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function getAppNameFromPackageName(packageName) {
|
|
54
|
-
const appName = packageName.includes('/')
|
|
55
|
-
? packageName.split('/')[1]
|
|
56
|
-
: packageName;
|
|
57
|
-
|
|
58
|
-
return appName;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async function commitTagMono(releases) {
|
|
62
|
-
let versions = [];
|
|
63
|
-
for (const release of getAppReleases(releases)) {
|
|
64
|
-
const newVersion = release.newVersion;
|
|
65
|
-
const appName = getAppNameFromPackageName(release.name);
|
|
66
|
-
versions.push(`${appName}@${newVersion}`);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const defaultBranch = process.env.BITBUCKET_BRANCH;
|
|
70
|
-
|
|
71
|
-
if (!process.env.IS_DEV) {
|
|
72
|
-
await $`git commit -m "Version bump to ${versions.join(',')} and changelog"`;
|
|
73
|
-
await $`git push origin ${defaultBranch}`;
|
|
74
|
-
} else {
|
|
75
|
-
console.log(`Simulate Version bump to ${versions.join(',')} and changelog`);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
for (const newVersion of versions) {
|
|
79
|
-
if (!process.env.IS_DEV) {
|
|
80
|
-
await $`git tag ${newVersion}`;
|
|
81
|
-
console.log(`✅ Version ${newVersion} tagged.`);
|
|
82
|
-
} else {
|
|
83
|
-
console.log(`✅ Simulate Version ${newVersion} tagged.`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (!process.env.IS_DEV) {
|
|
88
|
-
await $`git push origin --tags`;
|
|
89
|
-
console.log(`✅ Version pushed.`);
|
|
90
|
-
} else {
|
|
91
|
-
console.log(`✅ Simulate Version pushed.`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
async function commitTag() {
|
|
96
|
-
const newVersion = (
|
|
97
|
-
await $`node -p "require('./package.json').version"`
|
|
98
|
-
).stdout.trim();
|
|
99
|
-
|
|
100
|
-
if (process.env.IS_DEV) {
|
|
101
|
-
console.log(`Simulate commit of version ${newVersion}`);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const defaultBranch = process.env.BITBUCKET_BRANCH;
|
|
106
|
-
|
|
107
|
-
await $`git commit -m "Version bump to ${newVersion} and changelog"`;
|
|
108
|
-
await $`git push origin ${defaultBranch}`;
|
|
109
|
-
await $`git tag v${newVersion}`;
|
|
110
|
-
await $`git push origin --tags`;
|
|
111
|
-
console.log(`✅ Version ${newVersion} tagged and pushed.`);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Command: validate
|
|
115
|
-
program
|
|
116
|
-
.command('validate')
|
|
117
|
-
.description('Validate changesets for the provided PR')
|
|
118
|
-
.action(async () => {
|
|
119
|
-
if (!process.env.BITBUCKET_PR_ID) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
await validateChangesets();
|
|
123
|
-
});
|
|
124
|
-
// Command: version
|
|
125
|
-
program
|
|
126
|
-
.command('version')
|
|
127
|
-
.description('Run Changeset versioning')
|
|
128
|
-
.action(async () => {
|
|
129
|
-
await versionCommand();
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
// Command: commit-and-tag
|
|
133
|
-
program
|
|
134
|
-
.command('commit-tag')
|
|
135
|
-
.description('Commit and tag the new version')
|
|
136
|
-
.action(async () => {
|
|
137
|
-
await commitTagCommand();
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
// Command: all
|
|
141
|
-
program
|
|
142
|
-
.command('version-commit-tag')
|
|
143
|
-
.description('Run versioning and commit-and-tag in sequence')
|
|
144
|
-
.action(async () => {
|
|
145
|
-
console.log('📦 Running all steps...');
|
|
146
|
-
const releases = await versionCommand();
|
|
147
|
-
await updateJiraWithVersion(releases);
|
|
148
|
-
await updateWikiWithVersion(releases);
|
|
149
|
-
await commitTagCommand(releases);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
program
|
|
153
|
-
.command('close-version')
|
|
154
|
-
.description('Closes a version')
|
|
155
|
-
.action(async () => {
|
|
156
|
-
console.log('📦 Running all steps...');
|
|
157
|
-
const releases = await versionCommand(true);
|
|
158
|
-
await commitTagCommand(releases);
|
|
159
|
-
|
|
160
|
-
const { stdout: currentBranch } = await $`git rev-parse --abbrev-ref HEAD`;
|
|
161
|
-
|
|
162
|
-
if (isMonoRepo()) {
|
|
163
|
-
for (const release of getAppReleases(releases)) {
|
|
164
|
-
const appName = getAppNameFromPackageName(release.name);
|
|
165
|
-
const newVersion = toShortVersion(release.newVersion);
|
|
166
|
-
if (!newVersion) {
|
|
167
|
-
throw new Error('Error calculating branch name');
|
|
168
|
-
}
|
|
169
|
-
await $`git checkout -b release/${appName}/${newVersion}`;
|
|
170
|
-
await $`git push origin release/${appName}/${newVersion}`;
|
|
171
|
-
}
|
|
172
|
-
} else {
|
|
173
|
-
const newVersion = toShortVersion(releases[0].newVersion);
|
|
174
|
-
if (!newVersion) {
|
|
175
|
-
throw new Error('Error calculating branch name');
|
|
176
|
-
}
|
|
177
|
-
await $`git checkout -b release/${newVersion}`;
|
|
178
|
-
await $`git push origin release/${newVersion}`;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// Return to original branch
|
|
182
|
-
await $`git checkout ${currentBranch.trim()}`;
|
|
183
|
-
|
|
184
|
-
// Open next alpha version
|
|
185
|
-
await $`pnpm changeset pre enter alpha`;
|
|
186
|
-
await $`git add .`;
|
|
187
|
-
await $`git commit -m "Open next alpha version"`;
|
|
188
|
-
await $`git push origin`;
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
program
|
|
192
|
-
.name('create-changeset')
|
|
193
|
-
.description(
|
|
194
|
-
'Creates a changeset based on the current branch and Jira ticket information',
|
|
195
|
-
)
|
|
196
|
-
.action(async () => {
|
|
197
|
-
await createChangeset();
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
program
|
|
201
|
-
.command('upload-wiki')
|
|
202
|
-
.description('Upload release notes from markdown file to Confluence')
|
|
203
|
-
.requiredOption(
|
|
204
|
-
'-v, --version <version>',
|
|
205
|
-
'Version title (e.g., "Version 1.0")',
|
|
206
|
-
)
|
|
207
|
-
.requiredOption(
|
|
208
|
-
'-c, --component <component>',
|
|
209
|
-
'Component title (e.g., "Component A")',
|
|
210
|
-
)
|
|
211
|
-
.requiredOption('-f, --file <file>', 'Path to markdown file')
|
|
212
|
-
.requiredOption('-g, --group <group>', 'Group of release notes')
|
|
213
|
-
|
|
214
|
-
.action(async (options) => {
|
|
215
|
-
try {
|
|
216
|
-
console.log('📤 Uploading release notes to Confluence...');
|
|
217
|
-
const { versionPage, componentPage } = await upsertReleaseNotesFromFile({
|
|
218
|
-
version: options.version,
|
|
219
|
-
component: options.component,
|
|
220
|
-
markdownFile: options.file,
|
|
221
|
-
group: options.group,
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
console.log('✅ Successfully uploaded to Confluence');
|
|
225
|
-
console.log('Version page:', versionPage._links?.webui || versionPage.id);
|
|
226
|
-
console.log(
|
|
227
|
-
'Component page:',
|
|
228
|
-
componentPage._links?.webui || componentPage.id,
|
|
229
|
-
);
|
|
230
|
-
} catch (error) {
|
|
231
|
-
console.error('❌ Error uploading to Confluence:', error.message);
|
|
232
|
-
process.exit(1);
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
// Parse arguments
|
|
237
|
-
program.parse(args);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { $ } from 'zx';
|
|
4
|
+
import { validateChangesets } from './validate.js';
|
|
5
|
+
import dotenv from 'dotenv';
|
|
6
|
+
import { isMonoRepo, setGitInfo } from '../next/util.js';
|
|
7
|
+
import {
|
|
8
|
+
toShortVersion,
|
|
9
|
+
updateJiraWithVersion,
|
|
10
|
+
versionCommand,
|
|
11
|
+
} from './version.js';
|
|
12
|
+
import { createChangeset } from './create.js';
|
|
13
|
+
import {
|
|
14
|
+
updateWikiWithVersion,
|
|
15
|
+
upsertReleaseNotesFromFile,
|
|
16
|
+
} from './changelog-wiki.js';
|
|
17
|
+
|
|
18
|
+
dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
|
|
19
|
+
|
|
20
|
+
const program = new Command();
|
|
21
|
+
|
|
22
|
+
const args = process.argv;
|
|
23
|
+
|
|
24
|
+
async function commitTagCommand(releases) {
|
|
25
|
+
console.log('📌 Checking for updates to commit...');
|
|
26
|
+
|
|
27
|
+
// Check if there are changes to commit
|
|
28
|
+
const status = (await $`git status --porcelain`).stdout.trim();
|
|
29
|
+
if (!status) {
|
|
30
|
+
console.log('✅ No changes to commit. Exiting.');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
console.log('📌 Committing and tagging the new version...');
|
|
35
|
+
await setGitInfo();
|
|
36
|
+
await $`git add .`;
|
|
37
|
+
|
|
38
|
+
if (isMonoRepo()) {
|
|
39
|
+
await commitTagMono(releases);
|
|
40
|
+
} else {
|
|
41
|
+
await commitTag();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function getAppReleases(releases) {
|
|
46
|
+
const appReleases = releases.filter(
|
|
47
|
+
(release) =>
|
|
48
|
+
release.name.endsWith('-app') || release.name.endsWith('-template'),
|
|
49
|
+
);
|
|
50
|
+
return appReleases;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getAppNameFromPackageName(packageName) {
|
|
54
|
+
const appName = packageName.includes('/')
|
|
55
|
+
? packageName.split('/')[1]
|
|
56
|
+
: packageName;
|
|
57
|
+
|
|
58
|
+
return appName;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function commitTagMono(releases) {
|
|
62
|
+
let versions = [];
|
|
63
|
+
for (const release of getAppReleases(releases)) {
|
|
64
|
+
const newVersion = release.newVersion;
|
|
65
|
+
const appName = getAppNameFromPackageName(release.name);
|
|
66
|
+
versions.push(`${appName}@${newVersion}`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const defaultBranch = process.env.BITBUCKET_BRANCH;
|
|
70
|
+
|
|
71
|
+
if (!process.env.IS_DEV) {
|
|
72
|
+
await $`git commit -m "Version bump to ${versions.join(',')} and changelog"`;
|
|
73
|
+
await $`git push origin ${defaultBranch}`;
|
|
74
|
+
} else {
|
|
75
|
+
console.log(`Simulate Version bump to ${versions.join(',')} and changelog`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
for (const newVersion of versions) {
|
|
79
|
+
if (!process.env.IS_DEV) {
|
|
80
|
+
await $`git tag ${newVersion}`;
|
|
81
|
+
console.log(`✅ Version ${newVersion} tagged.`);
|
|
82
|
+
} else {
|
|
83
|
+
console.log(`✅ Simulate Version ${newVersion} tagged.`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!process.env.IS_DEV) {
|
|
88
|
+
await $`git push origin --tags`;
|
|
89
|
+
console.log(`✅ Version pushed.`);
|
|
90
|
+
} else {
|
|
91
|
+
console.log(`✅ Simulate Version pushed.`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async function commitTag() {
|
|
96
|
+
const newVersion = (
|
|
97
|
+
await $`node -p "require('./package.json').version"`
|
|
98
|
+
).stdout.trim();
|
|
99
|
+
|
|
100
|
+
if (process.env.IS_DEV) {
|
|
101
|
+
console.log(`Simulate commit of version ${newVersion}`);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const defaultBranch = process.env.BITBUCKET_BRANCH;
|
|
106
|
+
|
|
107
|
+
await $`git commit -m "Version bump to ${newVersion} and changelog"`;
|
|
108
|
+
await $`git push origin ${defaultBranch}`;
|
|
109
|
+
await $`git tag v${newVersion}`;
|
|
110
|
+
await $`git push origin --tags`;
|
|
111
|
+
console.log(`✅ Version ${newVersion} tagged and pushed.`);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Command: validate
|
|
115
|
+
program
|
|
116
|
+
.command('validate')
|
|
117
|
+
.description('Validate changesets for the provided PR')
|
|
118
|
+
.action(async () => {
|
|
119
|
+
if (!process.env.BITBUCKET_PR_ID) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
await validateChangesets();
|
|
123
|
+
});
|
|
124
|
+
// Command: version
|
|
125
|
+
program
|
|
126
|
+
.command('version')
|
|
127
|
+
.description('Run Changeset versioning')
|
|
128
|
+
.action(async () => {
|
|
129
|
+
await versionCommand();
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// Command: commit-and-tag
|
|
133
|
+
program
|
|
134
|
+
.command('commit-tag')
|
|
135
|
+
.description('Commit and tag the new version')
|
|
136
|
+
.action(async () => {
|
|
137
|
+
await commitTagCommand();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// Command: all
|
|
141
|
+
program
|
|
142
|
+
.command('version-commit-tag')
|
|
143
|
+
.description('Run versioning and commit-and-tag in sequence')
|
|
144
|
+
.action(async () => {
|
|
145
|
+
console.log('📦 Running all steps...');
|
|
146
|
+
const releases = await versionCommand();
|
|
147
|
+
await updateJiraWithVersion(releases);
|
|
148
|
+
await updateWikiWithVersion(releases);
|
|
149
|
+
await commitTagCommand(releases);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
program
|
|
153
|
+
.command('close-version')
|
|
154
|
+
.description('Closes a version')
|
|
155
|
+
.action(async () => {
|
|
156
|
+
console.log('📦 Running all steps...');
|
|
157
|
+
const releases = await versionCommand(true);
|
|
158
|
+
await commitTagCommand(releases);
|
|
159
|
+
|
|
160
|
+
const { stdout: currentBranch } = await $`git rev-parse --abbrev-ref HEAD`;
|
|
161
|
+
|
|
162
|
+
if (isMonoRepo()) {
|
|
163
|
+
for (const release of getAppReleases(releases)) {
|
|
164
|
+
const appName = getAppNameFromPackageName(release.name);
|
|
165
|
+
const newVersion = toShortVersion(release.newVersion);
|
|
166
|
+
if (!newVersion) {
|
|
167
|
+
throw new Error('Error calculating branch name');
|
|
168
|
+
}
|
|
169
|
+
await $`git checkout -b release/${appName}/${newVersion}`;
|
|
170
|
+
await $`git push origin release/${appName}/${newVersion}`;
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
const newVersion = toShortVersion(releases[0].newVersion);
|
|
174
|
+
if (!newVersion) {
|
|
175
|
+
throw new Error('Error calculating branch name');
|
|
176
|
+
}
|
|
177
|
+
await $`git checkout -b release/${newVersion}`;
|
|
178
|
+
await $`git push origin release/${newVersion}`;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Return to original branch
|
|
182
|
+
await $`git checkout ${currentBranch.trim()}`;
|
|
183
|
+
|
|
184
|
+
// Open next alpha version
|
|
185
|
+
await $`pnpm changeset pre enter alpha`;
|
|
186
|
+
await $`git add .`;
|
|
187
|
+
await $`git commit -m "Open next alpha version"`;
|
|
188
|
+
await $`git push origin`;
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
program
|
|
192
|
+
.name('create-changeset')
|
|
193
|
+
.description(
|
|
194
|
+
'Creates a changeset based on the current branch and Jira ticket information',
|
|
195
|
+
)
|
|
196
|
+
.action(async () => {
|
|
197
|
+
await createChangeset();
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
program
|
|
201
|
+
.command('upload-wiki')
|
|
202
|
+
.description('Upload release notes from markdown file to Confluence')
|
|
203
|
+
.requiredOption(
|
|
204
|
+
'-v, --version <version>',
|
|
205
|
+
'Version title (e.g., "Version 1.0")',
|
|
206
|
+
)
|
|
207
|
+
.requiredOption(
|
|
208
|
+
'-c, --component <component>',
|
|
209
|
+
'Component title (e.g., "Component A")',
|
|
210
|
+
)
|
|
211
|
+
.requiredOption('-f, --file <file>', 'Path to markdown file')
|
|
212
|
+
.requiredOption('-g, --group <group>', 'Group of release notes')
|
|
213
|
+
|
|
214
|
+
.action(async (options) => {
|
|
215
|
+
try {
|
|
216
|
+
console.log('📤 Uploading release notes to Confluence...');
|
|
217
|
+
const { versionPage, componentPage } = await upsertReleaseNotesFromFile({
|
|
218
|
+
version: options.version,
|
|
219
|
+
component: options.component,
|
|
220
|
+
markdownFile: options.file,
|
|
221
|
+
group: options.group,
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
console.log('✅ Successfully uploaded to Confluence');
|
|
225
|
+
console.log('Version page:', versionPage._links?.webui || versionPage.id);
|
|
226
|
+
console.log(
|
|
227
|
+
'Component page:',
|
|
228
|
+
componentPage._links?.webui || componentPage.id,
|
|
229
|
+
);
|
|
230
|
+
} catch (error) {
|
|
231
|
+
console.error('❌ Error uploading to Confluence:', error.message);
|
|
232
|
+
process.exit(1);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
// Parse arguments
|
|
237
|
+
program.parse(args);
|