@docupace/pipeline 1.0.61-alpha.1 → 1.0.62

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.
@@ -0,0 +1,28 @@
1
+ clone:
2
+ depth: 2
3
+
4
+ pipelines:
5
+ pull-requests:
6
+ '**':
7
+ - step:
8
+ runs-on:
9
+ - linux.shell
10
+ - onprem
11
+ name: On Pull Request
12
+ script:
13
+ - pnpm config set //registry.npmjs.org/:_authToken $DOCUPACE_NPM_TOKEN
14
+ - pnpm install --frozen-lockfile
15
+ - >
16
+ npx eslint . --rule "no-unused-vars: warn" --rule "no-useless-escape: warn" --color
17
+ custom:
18
+ scheduled-tests:
19
+ - step:
20
+ runs-on:
21
+ - linux.shell
22
+ - onprem
23
+ name: Manual
24
+ script:
25
+ - pnpm config set //registry.npmjs.org/:_authToken $DOCUPACE_NPM_TOKEN
26
+ - pnpm install --frozen-lockfile
27
+ - >
28
+ npx eslint . --rule "no-unused-vars: warn" --rule "no-useless-escape: warn" --color
package/eslint.config.js CHANGED
@@ -2,6 +2,7 @@ import globals from 'globals';
2
2
  import pluginJs from '@eslint/js';
3
3
  import prettierConfig from 'eslint-config-prettier';
4
4
  import prettierPlugin from 'eslint-plugin-prettier';
5
+ import importPlugin from 'eslint-plugin-import';
5
6
 
6
7
  /** @type {import('eslint').Linter.Config[]} */
7
8
  export default [
@@ -17,10 +18,21 @@ export default [
17
18
  {
18
19
  plugins: {
19
20
  prettier: prettierPlugin,
21
+ import: importPlugin,
22
+ },
23
+ settings: {
24
+ 'import/resolver': {
25
+ node: { extensions: ['.js', '.mjs', '.cjs'] },
26
+ typescript: {},
27
+ },
20
28
  },
21
29
  rules: {
22
30
  ...prettierConfig.rules,
23
31
  'prettier/prettier': 'error',
32
+ // Import-related rules
33
+ 'import/no-unresolved': 'error',
34
+ 'import/named': 'error',
35
+ 'import/no-extraneous-dependencies': 'error',
24
36
  },
25
37
  },
26
38
  ];
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.61-alpha.1",
3
+ "version": "1.0.62",
4
+ "description": "",
4
5
  "main": "index.js",
5
6
  "type": "module",
6
7
  "bin": {
7
8
  "dp-changeset-cli": "src/changeset/cli.js",
8
9
  "dp-next-cli": "src/next/cli.js",
9
- "dp-auth0-cli": "src/auth0/cli.js",
10
- "dp-merge-cli": "src/merge/cli.js"
10
+ "dp-auth0-cli": "src/auth0/cli.js"
11
11
  },
12
12
  "keywords": [
13
13
  "bash"
@@ -16,29 +16,32 @@
16
16
  "license": "ISC",
17
17
  "dependencies": {
18
18
  "@changesets/cli": "^2.27.10",
19
- "@docupace/core-client": "^0.1.59",
19
+ "@docupace/core-client": "^0.1.94",
20
20
  "@docupace/pipeline": "^1.0.33-alpha-2",
21
21
  "auth0-deploy-cli": "^8.8.0",
22
22
  "axios": "^1.7.9",
23
23
  "commander": "^12.1.0",
24
24
  "dotenv": "^16.4.7",
25
+ "eslint-plugin-import": "^2.32.0",
25
26
  "fs-extra": "^11.3.0",
26
27
  "inquirer": "^12.6.1",
27
28
  "js-yaml": "^4.1.0",
28
29
  "lodash": "^4.17.21",
29
30
  "openai": "^4.76.3",
30
31
  "semver": "^7.7.2",
31
- "zod": "^3.24.1",
32
- "zx": "^8.3.0"
32
+ "zod": "^3.24.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@eslint/js": "^9.17.0",
36
36
  "esbuild": "^0.24.0",
37
- "eslint": "^9.17.0",
37
+ "eslint": "^9.34.0",
38
38
  "eslint-config-prettier": "^9.1.0",
39
+ "eslint-import-resolver-node": "^0.3.9",
40
+ "eslint-import-resolver-typescript": "^4.4.4",
39
41
  "eslint-plugin-prettier": "^5.2.1",
40
42
  "globals": "^15.14.0",
41
- "prettier": "^3.4.2"
43
+ "prettier": "^3.4.2",
44
+ "zx": "^8.8.1"
42
45
  },
43
46
  "scripts": {
44
47
  "test-deploy-core": "dp-next-cli deploy-core-pipeline dev template",
@@ -10,10 +10,7 @@ import {
10
10
  readDeployConfig,
11
11
  } from '../next/deploy.js';
12
12
 
13
- import {
14
- getVaultSecrets,
15
- updateVaultSecrets
16
- } from './vault.js';
13
+ import { getVaultSecrets, updateVaultSecrets } from './vault.js';
17
14
  import {
18
15
  coreSiteEnvMap,
19
16
  environmentConfig,
@@ -22,7 +19,7 @@ import {
22
19
 
23
20
  async function ensureDirectoryExists(dirPath) {
24
21
  try {
25
- await fs.promises.mkdir(dirPath, {recursive: true});
22
+ await fs.promises.mkdir(dirPath, { recursive: true });
26
23
  console.log(`Directory created or already exists: ${dirPath}`);
27
24
  } catch (err) {
28
25
  console.error(`Failed to create directory: ${err.message}`);
@@ -85,7 +82,7 @@ async function configureUI(
85
82
  const auth0Response = await axios.get(
86
83
  `https://${auth0Domain}/api/v2/clients`,
87
84
  {
88
- headers: {authorization: `Bearer ${auth0Token}`},
85
+ headers: { authorization: `Bearer ${auth0Token}` },
89
86
  },
90
87
  );
91
88
 
@@ -121,13 +118,14 @@ async function configureUI(
121
118
  console.log(`siteAWSSecretsPath => ${siteAWSSecretsPath}`);
122
119
  }
123
120
 
124
- const awsS3Vars = (useS3 === true || useS3 === 'true')
125
- ? `
121
+ const awsS3Vars =
122
+ useS3 === true || useS3 === 'true'
123
+ ? `
126
124
  AWS_ACCESS_KEY_ID: vault:secret/data/${site}/aws/config#AWS_ACCESS_KEY_ID
127
125
  AWS_BUCKET_NAME: vault:secret/data/${site}/aws/config#AWS_BUCKET_NAME
128
126
  AWS_SECRET_ACCESS_KEY: vault:secret/data/${site}/aws/config#AWS_SECRET_ACCESS_KEY
129
127
  AWS_REGION: vault:secret/data/${site}/aws/config#AWS_REGION`
130
- : '';
128
+ : '';
131
129
 
132
130
  // Prepare ui.app.yaml
133
131
  const uiAppYaml = `
@@ -151,13 +149,17 @@ uiMain:
151
149
  image:
152
150
  repository: registry.paperout.com/docupace-ui-main-${env}-docker-local/enterprise-ui-app
153
151
  tag: ${imageTag}
154
- ${useS3 === true || useS3 === 'true' ? `
152
+ ${
153
+ useS3 === true || useS3 === 'true'
154
+ ? `
155
155
  serviceAccount:
156
156
  create: true
157
157
  annotations:
158
158
  "helm.sh/hook": pre-install
159
159
  "helm.sh/hook-weight": "-10"
160
- eks.amazonaws.com/role-arn: arn:aws:iam::${siteAWSSecrets.AWS_ACCOUNT_ID}:role/eks-pod-identity-connect-next-${env}-${site}-bucket` : ''}
160
+ eks.amazonaws.com/role-arn: arn:aws:iam::${siteAWSSecrets.AWS_ACCOUNT_ID}:role/eks-pod-identity-connect-next-${env}-${site}-bucket`
161
+ : ''
162
+ }
161
163
  imagePullSecrets:
162
164
  - name: jf-artifactory
163
165
  ingress:
@@ -222,7 +224,9 @@ externalConnectService:
222
224
  if (err) {
223
225
  console.error('Failed to write the file:', err);
224
226
  } else {
225
- console.log(`File ${repoPath}/dp/${site}/ui.app.yaml written successfully.`);
227
+ console.log(
228
+ `File ${repoPath}/dp/${site}/ui.app.yaml written successfully.`,
229
+ );
226
230
  }
227
231
  },
228
232
  );
@@ -234,7 +238,9 @@ externalConnectService:
234
238
  if (err) {
235
239
  console.error('Failed to write the file:', err);
236
240
  } else {
237
- console.log(`File ${repoPath}/dp/${site}/ui.values.yaml written successfully.`);
241
+ console.log(
242
+ `File ${repoPath}/dp/${site}/ui.values.yaml written successfully.`,
243
+ );
238
244
  }
239
245
  },
240
246
  );
@@ -274,7 +280,7 @@ async function configureCCUI(
274
280
  const auth0Response = await axios.get(
275
281
  `https://${auth0Domain}/api/v2/clients`,
276
282
  {
277
- headers: {authorization: `Bearer ${auth0Token}`},
283
+ headers: { authorization: `Bearer ${auth0Token}` },
278
284
  },
279
285
  );
280
286
 
@@ -310,15 +316,20 @@ async function configureCCUI(
310
316
  console.log(`siteAWSSecretsPath => ${siteAWSSecretsPath}`);
311
317
  }
312
318
 
313
- const awsS3Vars = (useS3 === true || useS3 === 'true')
314
- ? `
319
+ const awsS3Vars =
320
+ useS3 === true || useS3 === 'true'
321
+ ? `
315
322
  AWS_ACCESS_KEY_ID: vault:secret/data/${site}/aws/config#AWS_ACCESS_KEY_ID
316
323
  AWS_BUCKET_NAME: vault:secret/data/${site}/aws/config#AWS_BUCKET_NAME
317
324
  AWS_SECRET_ACCESS_KEY: vault:secret/data/${site}/aws/config#AWS_SECRET_ACCESS_KEY
318
325
  AWS_REGION: vault:secret/data/${site}/aws/config#AWS_REGION`
319
- : '';
326
+ : '';
327
+
328
+ const uiCCAppYaml = `
329
+ repo: docupace-ui-main
330
+ revision: ${revision}
331
+ `.trim();
320
332
 
321
- // Prepare cc.app.yaml
322
333
  const uiCCValuesYaml = `
323
334
  uiMain:
324
335
  auth0BaseUrl: https://${ccUrl}
@@ -354,13 +365,17 @@ ingress:
354
365
  - hosts:
355
366
  - ${ccUrl}
356
367
  secretName: dp-cc-ui-cert
357
- ${useS3 === true || useS3 === 'true' ? `
368
+ ${
369
+ useS3 === true || useS3 === 'true'
370
+ ? `
358
371
  serviceAccount:
359
372
  create: true
360
373
  annotations:
361
374
  "helm.sh/hook": pre-install
362
375
  "helm.sh/hook-weight": "-10"
363
- eks.amazonaws.com/role-arn: arn:aws:iam::${siteAWSSecrets.AWS_ACCOUNT_ID}:role/eks-pod-identity-connect-next-${env}-${site}-bucket` : ''}
376
+ eks.amazonaws.com/role-arn: arn:aws:iam::${siteAWSSecrets.AWS_ACCOUNT_ID}:role/eks-pod-identity-connect-next-${env}-${site}-bucket`
377
+ : ''
378
+ }
364
379
  `.trim();
365
380
 
366
381
  console.log('Writing configuration files...');
@@ -371,9 +386,14 @@ serviceAccount:
371
386
  uiCCAppYaml,
372
387
  (err) => {
373
388
  if (err) {
374
- console.error(`Failed to write ${repoPath}/dp/${site}/cc.app.yaml file:`, err);
389
+ console.error(
390
+ `Failed to write ${repoPath}/dp/${site}/cc.app.yaml file:`,
391
+ err,
392
+ );
375
393
  } else {
376
- console.log(`File ${repoPath}/dp/${site}/cc.app.yaml written successfully.`);
394
+ console.log(
395
+ `File ${repoPath}/dp/${site}/cc.app.yaml written successfully.`,
396
+ );
377
397
  }
378
398
  },
379
399
  );
@@ -383,9 +403,14 @@ serviceAccount:
383
403
  uiCCValuesYaml,
384
404
  (err) => {
385
405
  if (err) {
386
- console.error(`Failed to write ${repoPath}/dp/${site}/cc.values.yaml file:`, err);
406
+ console.error(
407
+ `Failed to write ${repoPath}/dp/${site}/cc.values.yaml file:`,
408
+ err,
409
+ );
387
410
  } else {
388
- console.log(`File ${repoPath}/dp/${site}/cc.values.yaml written successfully.`);
411
+ console.log(
412
+ `File ${repoPath}/dp/${site}/cc.values.yaml written successfully.`,
413
+ );
389
414
  }
390
415
  },
391
416
  );
@@ -406,7 +431,10 @@ export async function cleanAndWritePropertiesFile(configPath, content) {
406
431
  await fs.writeFile(configPath, cleanedContent, 'utf8');
407
432
  console.log(`Cleaned and written file to: ${configPath}`);
408
433
  } catch (error) {
409
- console.error(`Error writing properties file to ${configPath}:`, error.message);
434
+ console.error(
435
+ `Error writing properties file to ${configPath}:`,
436
+ error.message,
437
+ );
410
438
  process.exit(1);
411
439
  }
412
440
  }
@@ -427,7 +455,12 @@ export async function updateCoreSiteConfig(site, env, useS3Ui, useS3Gq) {
427
455
 
428
456
  let siteAWSSecrets = null;
429
457
 
430
- if (useS3Ui === true || useS3Ui === 'true' || useS3Gq === true || useS3Gq === 'true') {
458
+ if (
459
+ useS3Ui === true ||
460
+ useS3Ui === 'true' ||
461
+ useS3Gq === true ||
462
+ useS3Gq === 'true'
463
+ ) {
431
464
  const siteAWSSecretsPath = getVaultSecretsConfigs(site).awsSecretsPath;
432
465
  siteAWSSecrets = await getVaultSecrets(siteAWSSecretsPath);
433
466
  console.log(`siteAWSSecretsPath => ${siteAWSSecretsPath}`);
@@ -435,11 +468,13 @@ export async function updateCoreSiteConfig(site, env, useS3Ui, useS3Gq) {
435
468
 
436
469
  const coreSiteConfig = `
437
470
  ${
438
- siteAWSSecrets
439
- ? `
471
+ siteAWSSecrets
472
+ ? `
440
473
  com.docupace.imports.files.FilesImportConfig.aws.accessKeyId=${siteAWSSecrets.AWS_ACCESS_KEY_ID}
441
474
  com.docupace.imports.files.FilesImportConfig.aws.accessKeySecret=${siteAWSSecrets.AWS_SECRET_ACCESS_KEY}
442
- com.docupace.imports.files.FilesImportConfig.aws.region=${siteAWSSecrets.AWS_REGION}`.trim() : ''}
475
+ com.docupace.imports.files.FilesImportConfig.aws.region=${siteAWSSecrets.AWS_REGION}`.trim()
476
+ : ''
477
+ }
443
478
  `;
444
479
 
445
480
  await fs.ensureDir(path.join(coreSiteConfigRepoPath, site.toUpperCase()));
@@ -482,7 +517,7 @@ async function configureGraphQLServer(
482
517
  const auth0Response = await axios.get(
483
518
  `https://${auth0Domain}/api/v2/clients`,
484
519
  {
485
- headers: {authorization: `Bearer ${auth0Token}`},
520
+ headers: { authorization: `Bearer ${auth0Token}` },
486
521
  },
487
522
  );
488
523
 
@@ -525,13 +560,14 @@ async function configureGraphQLServer(
525
560
  console.log(`siteAWSSecretsPath => ${siteAWSSecretsPath}`);
526
561
  }
527
562
 
528
- const awsS3Vars = (useS3 === true || useS3 === 'true')
529
- ? `
563
+ const awsS3Vars =
564
+ useS3 === true || useS3 === 'true'
565
+ ? `
530
566
  AWS_ACCESS_KEY_ID: vault:secret/data/${site}/aws/config#AWS_ACCESS_KEY_ID
531
567
  AWS_S3_BUCKET_NAME: vault:secret/data/${site}/aws/config#AWS_BUCKET_NAME
532
568
  AWS_SECRET_ACCESS_KEY: vault:secret/data/${site}/aws/config#AWS_SECRET_ACCESS_KEY
533
569
  AWS_REGION: vault:secret/data/${site}/aws/config#AWS_REGION`.trim()
534
- : '';
570
+ : '';
535
571
  // Prepare graphql-server.app.yaml
536
572
  const graphQLServerAppYaml = `
537
573
  repo: docupace-graphql-server
@@ -556,15 +592,16 @@ graphqlServer:
556
592
  AUTH0_CC_CLIENT_ID: vault:secret/data/${site}/graphql-server/config#AUTH0_CC_CLIENT_ID
557
593
  AUTH0_CC_CLIENT_SECRET: vault:secret/data/${site}/graphql-server/config#AUTH0_CC_CLIENT_SECRET${awsS3Vars ? '\n ' + awsS3Vars.trim() : ''}
558
594
  ${
559
- useS3 === true || useS3 === 'true'
560
- ? `
595
+ useS3 === true || useS3 === 'true'
596
+ ? `
561
597
  serviceAccount:
562
598
  create: true
563
599
  annotations:
564
600
  "helm.sh/hook": pre-install
565
601
  "helm.sh/hook-weight": "-10"
566
602
  eks.amazonaws.com/role-arn: arn:aws:iam::${siteAWSSecrets.AWS_ACCOUNT_ID}:role/eks-pod-identity-connect-next-${env}-${site}-bucket`.trim()
567
- : ''}
603
+ : ''
604
+ }
568
605
  image:
569
606
  repository: registry.paperout.com/docupace-graphql-server-${env}-docker-local/docupace-graphql-server
570
607
  tag: ${imageTag}
@@ -609,9 +646,14 @@ ingress:
609
646
  graphQLServerValuesYaml,
610
647
  (err) => {
611
648
  if (err) {
612
- console.error(`Failed to write ${repoPath}/dp/${site}/graphql-server.values.yaml file:`, err);
649
+ console.error(
650
+ `Failed to write ${repoPath}/dp/${site}/graphql-server.values.yaml file:`,
651
+ err,
652
+ );
613
653
  } else {
614
- console.log(`File ${repoPath}/dp/${site}/graphql-server.values.yaml written successfully.`);
654
+ console.log(
655
+ `File ${repoPath}/dp/${site}/graphql-server.values.yaml written successfully.`,
656
+ );
615
657
  }
616
658
  },
617
659
  );
@@ -686,13 +728,13 @@ export async function configureFromSite(
686
728
  let uiImageTag, uiRevision;
687
729
  if (deployUI === true || deployUI === 'true') {
688
730
  // Read deploy configs
689
- const {deployConfig: deployUIConfig} = await readDeployConfig(
731
+ const { deployConfig: deployUIConfig } = await readDeployConfig(
690
732
  'ui',
691
733
  fromEnv,
692
734
  fromSite,
693
735
  'values',
694
736
  );
695
- const {deployConfig: deployUiRevisionConfig} = await readDeployConfig(
737
+ const { deployConfig: deployUiRevisionConfig } = await readDeployConfig(
696
738
  'ui',
697
739
  fromEnv,
698
740
  fromSite,
@@ -707,14 +749,14 @@ export async function configureFromSite(
707
749
 
708
750
  let ccImageTag, ccRevision;
709
751
  if (deployCCUI === true || deployCCUI === 'true') {
710
- const {deployConfig: deployCCConfig} = await readDeployConfig(
752
+ const { deployConfig: deployCCConfig } = await readDeployConfig(
711
753
  'cc',
712
754
  fromEnv,
713
755
  fromSite,
714
756
  'values',
715
757
  );
716
758
 
717
- const {deployConfig: deployCCRevisionConfig} = await readDeployConfig(
759
+ const { deployConfig: deployCCRevisionConfig } = await readDeployConfig(
718
760
  'cc',
719
761
  fromEnv,
720
762
  fromSite,
@@ -727,19 +769,15 @@ export async function configureFromSite(
727
769
  console.log(`Copying Latest CC Revision: ${ccRevision}`);
728
770
  }
729
771
 
730
- const {deployConfig: deployGraphQLServerConfig} = await readDeployConfig(
772
+ const { deployConfig: deployGraphQLServerConfig } = await readDeployConfig(
731
773
  'graphql-server',
732
774
  fromEnv,
733
775
  fromSite,
734
776
  'values',
735
777
  );
736
778
 
737
- const {deployConfig: deployGraphQLServerRevisionConfig} = await readDeployConfig(
738
- 'graphql-server',
739
- fromEnv,
740
- fromSite,
741
- 'app',
742
- );
779
+ const { deployConfig: deployGraphQLServerRevisionConfig } =
780
+ await readDeployConfig('graphql-server', fromEnv, fromSite, 'app');
743
781
 
744
782
  const gqRevision = deployGraphQLServerRevisionConfig.revision;
745
783
 
@@ -767,11 +805,7 @@ export async function configureFromSite(
767
805
 
768
806
  const envConfig = environmentConfig[toEnv];
769
807
 
770
- let CORE_URL,
771
- SITE_HOST,
772
- CORE_API_CONTEXT,
773
- CONNECT_URL,
774
- DOCUPACE_HOST;
808
+ let CORE_URL, SITE_HOST, CORE_API_CONTEXT, CONNECT_URL, DOCUPACE_HOST;
775
809
  const newUrl = envConfig.newUrl(toSite);
776
810
  const ccUrl = envConfig.ccUrl(toSite);
777
811
 
@@ -10,10 +10,6 @@ import {
10
10
  versionCommand,
11
11
  } from './version.js';
12
12
  import { createChangeset } from './create.js';
13
- import {
14
- updateWikiWithVersion,
15
- upsertReleaseNotesFromFile,
16
- } from './changelog-wiki.js';
17
13
 
18
14
  dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
19
15
 
@@ -97,11 +93,6 @@ async function commitTag() {
97
93
  await $`node -p "require('./package.json').version"`
98
94
  ).stdout.trim();
99
95
 
100
- if (process.env.IS_DEV) {
101
- console.log(`Simulate commit of version ${newVersion}`);
102
- return;
103
- }
104
-
105
96
  const defaultBranch = process.env.BITBUCKET_BRANCH;
106
97
 
107
98
  await $`git commit -m "Version bump to ${newVersion} and changelog"`;
@@ -145,7 +136,6 @@ program
145
136
  console.log('📦 Running all steps...');
146
137
  const releases = await versionCommand();
147
138
  await updateJiraWithVersion(releases);
148
- await updateWikiWithVersion(releases);
149
139
  await commitTagCommand(releases);
150
140
  });
151
141
 
@@ -197,41 +187,5 @@ program
197
187
  await createChangeset();
198
188
  });
199
189
 
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
190
  // Parse arguments
237
191
  program.parse(args);
@@ -110,17 +110,8 @@ async function generateReleaseNotes(jiraTicketData) {
110
110
  /**
111
111
  * Writes the changeset file
112
112
  */
113
- async function writeJiraChangesetFile(
114
- packages,
115
- jiraTicketId,
116
- changeType,
117
- summary,
118
- ) {
119
- const text = `${summary} [${jiraTicketId}]`;
120
- await writeChangesetFile(packages, jiraTicketId, changeType, text);
121
- }
122
-
123
- export async function writeChangesetFile(packages, filename, changeType, text) {
113
+ async function writeChangesetFile(packages, jiraTicketId, changeType, summary) {
114
+ // Generate the YAML frontmatter for multiple packages
124
115
  const packageEntries = packages
125
116
  .map((pkg) => `'${pkg.name}': ${changeType}`)
126
117
  .join('\n');
@@ -129,10 +120,9 @@ export async function writeChangesetFile(packages, filename, changeType, text) {
129
120
  ${packageEntries}
130
121
  ---
131
122
 
132
- ${text}
123
+ ${summary} [${jiraTicketId}]
133
124
  `;
134
-
135
- const changesetFile = `./.changeset/${filename}.md`;
125
+ const changesetFile = `./.changeset/${jiraTicketId}.md`;
136
126
 
137
127
  await createChangesetDirectory();
138
128
  await fs.promises.writeFile(changesetFile, changesetContent);
@@ -205,7 +195,7 @@ export async function createChangesetForPackage(packages) {
205
195
  console.log(`Release note: ${summary}`);
206
196
 
207
197
  // Step 5: Create a changeset .md file for all packages
208
- await writeJiraChangesetFile(packages, jiraTicketId, change_type, summary);
198
+ await writeChangesetFile(packages, jiraTicketId, change_type, summary);
209
199
 
210
200
  console.log('Changeset created successfully!');
211
201
  } catch (err) {
@@ -37,7 +37,7 @@ export function getPackageNames(rootPath = '.') {
37
37
  fs.readFileSync(rootPackageJson, 'utf8'),
38
38
  );
39
39
  return packageJson.name
40
- ? [{ name: packageJson.name, path: rootPath, content: packageJson }]
40
+ ? [{ name: packageJson.name, path: rootPath }]
41
41
  : [];
42
42
  } catch (error) {
43
43
  console.error('Error reading root package.json:', error);
@@ -71,7 +71,6 @@ function getPackagesFromDirectory(dirPath) {
71
71
  packages.push({
72
72
  name: packageJson.name,
73
73
  path: itemPath,
74
- content: packageJson,
75
74
  });
76
75
  }
77
76
  } catch (error) {
@@ -34,10 +34,10 @@ export async function getPackage(mainModulePath) {
34
34
  * @returns {JIRA-TicketID|null}
35
35
  */
36
36
  export function findJiraTicketId(str) {
37
- if (!str) {
38
- return null;
39
- }
40
- const regex = /([A-Z]{2,}-\d+)/;
41
- const matches = str.match(regex);
42
- return matches ? matches[0] : null;
37
+ if (!str) {
38
+ return null;
39
+ }
40
+ const regex = /([A-Z]{2,}-\d+)/;
41
+ const matches = str.match(regex);
42
+ return matches ? matches[0] : null;
43
43
  }
@@ -17,31 +17,32 @@ function areArraysEqualIgnoringOrder(arr1, arr2) {
17
17
  }
18
18
 
19
19
  export async function validateChangesets() {
20
- await setGitInfo();
21
- const destBranch = process.env.BITBUCKET_PR_DESTINATION_BRANCH;
22
- await $`git fetch origin ${destBranch}:${destBranch}`;
23
- let releases;
24
-
25
- try {
26
- console.log('🔍 Validating changesets...');
27
- releases = await versionStatus(destBranch);
28
- }
29
- catch(e) {
30
- console.error(
31
- '❌ No changeset found. Please add a changeset to this PR. Please see more information at https://docupacellc.atlassian.net/wiki/spaces/PM/pages/1350893571/Creating+changesets+for+Docupace+Next',
32
- );
33
- process.exit(-1);
34
- }
35
-
36
- if(!['master', 'main'].includes(destBranch)) {
37
- if(releases.some(item => item.type !== 'patch')) {
38
- console.error('❌ A changeset must be a patch for change to a release branch');
39
- process.exit(-1);
40
- }
41
- }
20
+ await setGitInfo();
21
+ const destBranch = process.env.BITBUCKET_PR_DESTINATION_BRANCH;
22
+ await $`git fetch origin ${destBranch}:${destBranch}`;
23
+ let releases;
42
24
 
43
- console.log('✅ Changeset validation passed.');
25
+ try {
26
+ console.log('🔍 Validating changesets...');
27
+ releases = await versionStatus(destBranch);
28
+ } catch (e) {
29
+ console.error(
30
+ '❌ No changeset found. Please add a changeset to this PR. Please see more information at https://docupacellc.atlassian.net/wiki/spaces/PM/pages/1350893571/Creating+changesets+for+Docupace+Next',
31
+ e,
32
+ );
33
+ process.exit(-1);
34
+ }
35
+
36
+ if (!['master', 'main'].includes(destBranch)) {
37
+ if (releases.some((item) => item.type !== 'patch')) {
38
+ console.error(
39
+ '❌ A changeset must be a patch for change to a release branch',
40
+ );
41
+ process.exit(-1);
42
+ }
43
+ }
44
44
 
45
+ console.log('✅ Changeset validation passed.');
45
46
  }
46
47
 
47
48
  export async function validateChangesetPath(directoryPath) {