@payfit/nx-core 4.29.1 → 4.30.0-ephemeral-release-scripts-e842aa9.0

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@payfit/nx-core",
3
- "version": "4.29.1",
3
+ "version": "4.30.0-ephemeral-release-scripts-e842aa9.0",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -19,6 +19,7 @@
19
19
  "tinyexec": "1.0.1",
20
20
  "tslib": "^2.8.1",
21
21
  "yaml": "2.8.0",
22
+ "yargs": "17.7.2",
22
23
  "zod": "^3.24.3"
23
24
  },
24
25
  "devDependencies": {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const release_1 = require("nx/release");
4
+ const yargs = require("yargs");
5
+ /**
6
+ * Helper function to log messages with timestamps
7
+ */
8
+ function log(message, isError = false) {
9
+ const timestamp = new Date().toISOString();
10
+ const logFn = isError ? console.error : console.log;
11
+ logFn(`[${timestamp}] ${message}`);
12
+ }
13
+ ;
14
+ (async () => {
15
+ try {
16
+ const options = await yargs
17
+ .version(false) // don't use the default meaning of version in yargs
18
+ .option('version', {
19
+ description: 'Explicit version specifier to use, if overriding conventional commits',
20
+ type: 'string',
21
+ })
22
+ .option('dryRun', {
23
+ alias: 'd',
24
+ description: 'Whether or not to perform a dry-run of the release process, defaults to true',
25
+ type: 'boolean',
26
+ default: true,
27
+ })
28
+ .option('verbose', {
29
+ description: 'Whether or not to enable verbose logging, defaults to false',
30
+ type: 'boolean',
31
+ default: false,
32
+ })
33
+ .option('specifier', {
34
+ description: 'The specifier to use when creating the release, can be set to "prerelease" for releasing an alpha version',
35
+ type: 'string',
36
+ default: undefined,
37
+ })
38
+ .option('skipPublish', {
39
+ description: 'Skip publishing the package to the registry',
40
+ type: 'boolean',
41
+ default: false,
42
+ })
43
+ .option('preid', {
44
+ description: 'The version prefix to use, can be set in combination with specifier="prerelease"',
45
+ type: 'string',
46
+ default: undefined,
47
+ })
48
+ .parseAsync();
49
+ log('Starting release process...');
50
+ log(`Release options: ${JSON.stringify(options, null, 2)}`);
51
+ // Step 1: Version Release
52
+ log('Step 1/3: Starting version release...');
53
+ const { projectsVersionData } = await (0, release_1.releaseVersion)({
54
+ specifier: options.version,
55
+ dryRun: options.dryRun,
56
+ verbose: options.verbose,
57
+ preid: options.preid,
58
+ });
59
+ log('Version release completed successfully');
60
+ // iterate over `projectsVersionData` to extract changed projects
61
+ const projectsToPublish = Object.entries(projectsVersionData)
62
+ .map(([projectName, versionData]) => {
63
+ if (versionData?.newVersion) {
64
+ log(`Project '${projectName}' will be updated to version ${versionData.newVersion}`);
65
+ return projectName;
66
+ }
67
+ return null; // filter out projects that didn't change
68
+ })
69
+ .filter(Boolean);
70
+ if (projectsToPublish.length === 0) {
71
+ log('No projects to publish. Exiting...');
72
+ process.exit(0);
73
+ }
74
+ log(`Found ${projectsToPublish.length} project(s) to publish: ${projectsToPublish.join(', ')}`);
75
+ // Step 2: Changelog Release
76
+ log('Step 2/3: Generating changelog...');
77
+ await (0, release_1.releaseChangelog)({
78
+ versionData: projectsVersionData,
79
+ dryRun: options.dryRun,
80
+ verbose: options.verbose,
81
+ });
82
+ log('Changelog generation completed successfully');
83
+ // Step 3: Publish Release
84
+ if (!options.skipPublish) {
85
+ log('Step 3/3: Publishing packages...');
86
+ const publishResults = await (0, release_1.releasePublish)({
87
+ projects: projectsToPublish,
88
+ dryRun: options.dryRun,
89
+ verbose: options.verbose,
90
+ });
91
+ // Log publish results
92
+ Object.entries(publishResults).forEach(([projectName, result]) => {
93
+ if (result.code === 0) {
94
+ log(`Successfully published ${projectName}`);
95
+ }
96
+ else {
97
+ log(`Failed to publish ${projectName} with exit code ${result.code}`, true);
98
+ }
99
+ });
100
+ const allSuccessful = Object.values(publishResults).every(result => result.code === 0);
101
+ if (allSuccessful) {
102
+ log('All packages published successfully');
103
+ }
104
+ else {
105
+ log('Some packages failed to publish. Check the logs for details.', true);
106
+ }
107
+ process.exit(allSuccessful ? 0 : 1);
108
+ }
109
+ else {
110
+ log('Skipping publish step as requested.');
111
+ process.exit(0);
112
+ }
113
+ }
114
+ catch (error) {
115
+ log(`Error during release process: ${error instanceof Error ? error.message : String(error)}`, true);
116
+ if (error instanceof Error && error.stack) {
117
+ log(`Stack trace: ${error.stack}`, true);
118
+ }
119
+ process.exit(1);
120
+ }
121
+ })();
122
+ //# sourceMappingURL=release.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release.js","sourceRoot":"","sources":["../../../../../packages/nx-core/src/scripts/release.ts"],"names":[],"mappings":";;AAAA,wCAA6E;AAC7E,+BAA8B;AAE9B;;GAEG;AACH,SAAS,GAAG,CAAC,OAAe,EAAE,OAAO,GAAG,KAAK;IAC3C,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAA;IACnD,KAAK,CAAC,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC,CAAA;AACpC,CAAC;AAED,CAAC;AAAA,CAAC,KAAK,IAAI,EAAE;IACX,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,KAAK;aACxB,OAAO,CAAC,KAAK,CAAC,CAAC,oDAAoD;aACnE,MAAM,CAAC,SAAS,EAAE;YACjB,WAAW,EACT,uEAAuE;YACzE,IAAI,EAAE,QAAQ;SACf,CAAC;aACD,MAAM,CAAC,QAAQ,EAAE;YAChB,KAAK,EAAE,GAAG;YACV,WAAW,EACT,8EAA8E;YAChF,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,IAAI;SACd,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,WAAW,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