@nx/js 17.0.2 → 17.1.0-beta.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/babel.js +1 -0
- package/migrations.json +6 -0
- package/package.json +5 -4
- package/src/executors/release-publish/release-publish.impl.js +5 -5
- package/src/generators/library/library.js +5 -1
- package/src/generators/library/schema.json +6 -0
- package/src/generators/release-version/release-version.js +188 -86
- package/src/generators/release-version/schema.json +13 -3
- package/src/utils/schema.d.ts +1 -0
package/babel.js
CHANGED
|
@@ -70,6 +70,7 @@ module.exports = function (api, options = {}) {
|
|
|
70
70
|
require.resolve('@babel/plugin-proposal-decorators'),
|
|
71
71
|
options.decorators ?? { legacy: true },
|
|
72
72
|
],
|
|
73
|
+
[require.resolve('@babel/plugin-transform-class-properties'), { loose }],
|
|
73
74
|
].filter(Boolean),
|
|
74
75
|
overrides: [
|
|
75
76
|
// Convert `const enum` to `enum`. The former cannot be supported by babel
|
package/migrations.json
CHANGED
|
@@ -23,6 +23,12 @@
|
|
|
23
23
|
"version": "16.8.2-beta.0",
|
|
24
24
|
"description": "Remove invalid options (strict, noInterop) for ES6 type modules.",
|
|
25
25
|
"factory": "./src/migrations/update-16-8-2/update-swcrc"
|
|
26
|
+
},
|
|
27
|
+
"update-17-0-0-remove-deprecated-build-options": {
|
|
28
|
+
"cli": "nx",
|
|
29
|
+
"version": "17.0.2",
|
|
30
|
+
"description": "Remove deprecated build options",
|
|
31
|
+
"implementation": "./src/migrations/update-17-0-0/remove-deprecated-build-options"
|
|
26
32
|
}
|
|
27
33
|
},
|
|
28
34
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.1.0-beta.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
|
|
6
6
|
"repository": {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@babel/core": "^7.22.9",
|
|
34
34
|
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
35
35
|
"@babel/plugin-transform-runtime": "^7.22.9",
|
|
36
|
+
"@babel/plugin-transform-class-properties": "^7.22.5",
|
|
36
37
|
"@babel/preset-env": "^7.22.9",
|
|
37
38
|
"@babel/preset-typescript": "^7.22.5",
|
|
38
39
|
"@babel/runtime": "^7.22.6",
|
|
@@ -56,9 +57,9 @@
|
|
|
56
57
|
"semver": "7.5.3",
|
|
57
58
|
"source-map-support": "0.5.19",
|
|
58
59
|
"tslib": "^2.3.0",
|
|
59
|
-
"@nx/devkit": "17.0.
|
|
60
|
-
"@nx/workspace": "17.0.
|
|
61
|
-
"@nrwl/js": "17.0.
|
|
60
|
+
"@nx/devkit": "17.1.0-beta.0",
|
|
61
|
+
"@nx/workspace": "17.1.0-beta.0",
|
|
62
|
+
"@nrwl/js": "17.1.0-beta.0"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|
|
64
65
|
"verdaccio": "^5.0.4"
|
|
@@ -21,11 +21,11 @@ async function runExecutor(options, context) {
|
|
|
21
21
|
const packageRoot = (0, devkit_1.joinPathFragments)(context.root, options.packageRoot ?? projectConfig.root);
|
|
22
22
|
const packageJsonPath = (0, devkit_1.joinPathFragments)(packageRoot, 'package.json');
|
|
23
23
|
const projectPackageJson = (0, devkit_1.readJsonFile)(packageJsonPath);
|
|
24
|
-
const
|
|
24
|
+
const packageName = projectPackageJson.name;
|
|
25
25
|
// If package and project name match, we can make log messages terser
|
|
26
|
-
let packageTxt =
|
|
27
|
-
? `package "${
|
|
28
|
-
: `package "${
|
|
26
|
+
let packageTxt = packageName === context.projectName
|
|
27
|
+
? `package "${packageName}"`
|
|
28
|
+
: `package "${packageName}" from project "${context.projectName}"`;
|
|
29
29
|
if (projectPackageJson.private === true) {
|
|
30
30
|
console.warn(`Skipping ${packageTxt}, because it has \`"private": true\` in ${packageJsonPath}`);
|
|
31
31
|
return {
|
|
@@ -54,7 +54,7 @@ async function runExecutor(options, context) {
|
|
|
54
54
|
});
|
|
55
55
|
const stdoutData = JSON.parse(output.toString());
|
|
56
56
|
// If npm workspaces are in use, the publish output will nest the data under the package name, so we normalize it first
|
|
57
|
-
const normalizedStdoutData = stdoutData[
|
|
57
|
+
const normalizedStdoutData = stdoutData[packageName] ?? stdoutData;
|
|
58
58
|
(0, log_tar_1.logTar)(normalizedStdoutData);
|
|
59
59
|
if (options.dryRun) {
|
|
60
60
|
console.log(`Would publish to ${registry} with tag "${tag}", but ${chalk.keyword('orange')('[dry-run]')} was set`);
|
|
@@ -32,7 +32,9 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
32
32
|
const options = await normalizeOptions(tree, schema);
|
|
33
33
|
createFiles(tree, options, `${filesDir}/lib`);
|
|
34
34
|
addProject(tree, options);
|
|
35
|
-
|
|
35
|
+
if (!options.skipPackageJson) {
|
|
36
|
+
tasks.push(addProjectDependencies(tree, options));
|
|
37
|
+
}
|
|
36
38
|
if (options.publishable) {
|
|
37
39
|
tasks.push(await (0, generator_1.default)(tree, { ...options, skipFormat: true }));
|
|
38
40
|
}
|
|
@@ -52,6 +54,7 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
52
54
|
project: options.name,
|
|
53
55
|
includeLib: true,
|
|
54
56
|
includeVitest: options.unitTestRunner === 'vitest',
|
|
57
|
+
testEnvironment: options.testEnvironment,
|
|
55
58
|
}, false);
|
|
56
59
|
}
|
|
57
60
|
if (options.linter !== 'none') {
|
|
@@ -81,6 +84,7 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
81
84
|
project: options.name,
|
|
82
85
|
includeLib: false,
|
|
83
86
|
includeVitest: true,
|
|
87
|
+
testEnvironment: options.testEnvironment,
|
|
84
88
|
}, true);
|
|
85
89
|
}
|
|
86
90
|
if (!schema.skipTsConfig) {
|
|
@@ -48,6 +48,12 @@
|
|
|
48
48
|
"default": false,
|
|
49
49
|
"x-priority": "internal"
|
|
50
50
|
},
|
|
51
|
+
"skipPackageJson": {
|
|
52
|
+
"description": "Do not add dependencies to `package.json`.",
|
|
53
|
+
"type": "boolean",
|
|
54
|
+
"default": false,
|
|
55
|
+
"x-priority": "internal"
|
|
56
|
+
},
|
|
51
57
|
"skipTsConfig": {
|
|
52
58
|
"type": "boolean",
|
|
53
59
|
"description": "Do not update tsconfig.json for development experience.",
|
|
@@ -4,107 +4,195 @@ exports.releaseVersionGenerator = void 0;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const chalk = require("chalk");
|
|
6
6
|
const child_process_1 = require("child_process");
|
|
7
|
+
const git_1 = require("nx/src/command-line/release/utils/git");
|
|
8
|
+
const resolve_semver_specifier_1 = require("nx/src/command-line/release/utils/resolve-semver-specifier");
|
|
9
|
+
const semver_1 = require("nx/src/command-line/release/utils/semver");
|
|
7
10
|
const version_1 = require("nx/src/command-line/release/version");
|
|
8
11
|
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
9
12
|
const ora = require("ora");
|
|
10
13
|
const path_1 = require("path");
|
|
14
|
+
const semver_2 = require("semver");
|
|
11
15
|
const resolve_local_package_dependencies_1 = require("./utils/resolve-local-package-dependencies");
|
|
12
16
|
async function releaseVersionGenerator(tree, options) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const packageJsonPath = (0, devkit_1.joinPathFragments)(packageRoot, 'package.json');
|
|
32
|
-
const workspaceRelativePackageJsonPath = (0, path_1.relative)(devkit_1.workspaceRoot, packageJsonPath);
|
|
33
|
-
const color = getColor(projectName);
|
|
34
|
-
const log = (msg) => {
|
|
35
|
-
console.log(color.instance.bold(projectName) + ' ' + msg);
|
|
36
|
-
};
|
|
37
|
-
if (!tree.exists(packageJsonPath)) {
|
|
38
|
-
throw new Error(`The project "${projectName}" does not have a package.json available at ${workspaceRelativePackageJsonPath}.
|
|
39
|
-
|
|
40
|
-
To fix this you will either need to add a package.json file at that location, or configure "release" within your nx.json to exclude "${projectName}" from the current release group, or amend the packageRoot configuration to point to where the package.json should be.`);
|
|
17
|
+
try {
|
|
18
|
+
// If the user provided a specifier, validate that it is valid semver or a relative semver keyword
|
|
19
|
+
if (options.specifier && !(0, semver_1.isValidSemverSpecifier)(options.specifier)) {
|
|
20
|
+
throw new Error(`The given version specifier "${options.specifier}" is not valid. You provide an exact version or a valid semver keyword such as "major", "minor", "patch", etc.`);
|
|
21
|
+
}
|
|
22
|
+
const projects = options.projects;
|
|
23
|
+
// Resolve any custom package roots for each project upfront as they will need to be reused during dependency resolution
|
|
24
|
+
const projectNameToPackageRootMap = new Map();
|
|
25
|
+
for (const project of projects) {
|
|
26
|
+
projectNameToPackageRootMap.set(project.name,
|
|
27
|
+
// Default to the project root if no custom packageRoot
|
|
28
|
+
!options.packageRoot
|
|
29
|
+
? project.data.root
|
|
30
|
+
: (0, utils_1.interpolate)(options.packageRoot, {
|
|
31
|
+
workspaceRoot: '',
|
|
32
|
+
projectRoot: project.data.root,
|
|
33
|
+
projectName: project.name,
|
|
34
|
+
}));
|
|
41
35
|
}
|
|
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
|
-
|
|
36
|
+
let currentVersion;
|
|
37
|
+
// only used for options.currentVersionResolver === 'git-tag', but
|
|
38
|
+
// must be declared here in order to reuse it for additional projects
|
|
39
|
+
let latestMatchingGitTag;
|
|
40
|
+
// if specifier is undefined, then we haven't resolved it yet
|
|
41
|
+
// if specifier is null, then it has been resolved and no changes are necessary
|
|
42
|
+
let specifier = options.specifier ? options.specifier : undefined;
|
|
43
|
+
for (const project of projects) {
|
|
44
|
+
const projectName = project.name;
|
|
45
|
+
const packageRoot = projectNameToPackageRootMap.get(projectName);
|
|
46
|
+
const packageJsonPath = (0, devkit_1.joinPathFragments)(packageRoot, 'package.json');
|
|
47
|
+
const workspaceRelativePackageJsonPath = (0, path_1.relative)(devkit_1.workspaceRoot, packageJsonPath);
|
|
48
|
+
const color = getColor(projectName);
|
|
49
|
+
const log = (msg) => {
|
|
50
|
+
console.log(color.instance.bold(projectName) + ' ' + msg);
|
|
51
|
+
};
|
|
52
|
+
if (!tree.exists(packageJsonPath)) {
|
|
53
|
+
throw new Error(`The project "${projectName}" does not have a package.json available at ${workspaceRelativePackageJsonPath}.
|
|
54
|
+
|
|
55
|
+
To fix this you will either need to add a package.json file at that location, or configure "release" within your nx.json to exclude "${projectName}" from the current release group, or amend the packageRoot configuration to point to where the package.json should be.`);
|
|
56
|
+
}
|
|
57
|
+
devkit_1.output.logSingleLine(`Running release version for project: ${color.instance.bold(project.name)}`);
|
|
58
|
+
const projectPackageJson = (0, devkit_1.readJson)(tree, packageJsonPath);
|
|
59
|
+
log(`🔍 Reading data for package "${projectPackageJson.name}" from ${workspaceRelativePackageJsonPath}`);
|
|
60
|
+
const { name: packageName, version: currentVersionFromDisk } = projectPackageJson;
|
|
61
|
+
switch (options.currentVersionResolver) {
|
|
62
|
+
case 'registry': {
|
|
63
|
+
const metadata = options.currentVersionResolverMetadata;
|
|
64
|
+
const registry = metadata?.registry ??
|
|
65
|
+
(await getNpmRegistry()) ??
|
|
66
|
+
'https://registry.npmjs.org';
|
|
67
|
+
const tag = metadata?.tag ?? 'latest';
|
|
68
|
+
// If the currentVersionResolver is set to registry, we only want to make the request once for the whole batch of projects
|
|
69
|
+
if (!currentVersion) {
|
|
70
|
+
const spinner = ora(`${Array.from(new Array(projectName.length + 3)).join(' ')}Resolving the current version for tag "${tag}" on ${registry}`);
|
|
71
|
+
spinner.color =
|
|
72
|
+
color.spinnerColor;
|
|
73
|
+
spinner.start();
|
|
74
|
+
// Must be non-blocking async to allow spinner to render
|
|
75
|
+
currentVersion = await new Promise((resolve, reject) => {
|
|
76
|
+
(0, child_process_1.exec)(`npm view ${packageName} version --registry=${registry} --tag=${tag}`, (error, stdout, stderr) => {
|
|
77
|
+
if (error) {
|
|
78
|
+
return reject(error);
|
|
79
|
+
}
|
|
80
|
+
if (stderr) {
|
|
81
|
+
return reject(stderr);
|
|
82
|
+
}
|
|
83
|
+
return resolve(stdout.trim());
|
|
84
|
+
});
|
|
67
85
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
86
|
+
spinner.stop();
|
|
87
|
+
log(`📄 Resolved the current version as ${currentVersion} for tag "${tag}" from registry ${registry}`);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
log(`📄 Using the current version ${currentVersion} already resolved from the registry ${registry}`);
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
71
93
|
}
|
|
72
|
-
|
|
73
|
-
|
|
94
|
+
case 'disk':
|
|
95
|
+
currentVersion = currentVersionFromDisk;
|
|
96
|
+
log(`📄 Resolved the current version as ${currentVersion} from ${packageJsonPath}`);
|
|
97
|
+
break;
|
|
98
|
+
case 'git-tag': {
|
|
99
|
+
if (!currentVersion) {
|
|
100
|
+
const releaseTagPattern = options.releaseGroup.releaseTagPattern;
|
|
101
|
+
latestMatchingGitTag = await (0, git_1.getLatestGitTagForPattern)(releaseTagPattern, {
|
|
102
|
+
projectName: project.name,
|
|
103
|
+
});
|
|
104
|
+
if (!latestMatchingGitTag) {
|
|
105
|
+
throw new Error(`No git tags matching pattern "${releaseTagPattern}" for project "${project.name}" were found.`);
|
|
106
|
+
}
|
|
107
|
+
currentVersion = latestMatchingGitTag.extractedVersion;
|
|
108
|
+
log(`📄 Resolved the current version as ${currentVersion} from git tag "${latestMatchingGitTag.tag}".`);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
log(`📄 Using the current version ${currentVersion} already resolved from git tag "${latestMatchingGitTag.tag}".`);
|
|
112
|
+
}
|
|
113
|
+
break;
|
|
74
114
|
}
|
|
75
|
-
|
|
115
|
+
default:
|
|
116
|
+
throw new Error(`Invalid value for options.currentVersionResolver: ${options.currentVersionResolver}`);
|
|
117
|
+
}
|
|
118
|
+
if (options.specifier) {
|
|
119
|
+
log(`📄 Using the provided version specifier "${options.specifier}".`);
|
|
120
|
+
}
|
|
121
|
+
// if specifier is null, then we determined previously via conventional commits that no changes are necessary
|
|
122
|
+
if (specifier === undefined) {
|
|
123
|
+
const specifierSource = options.specifierSource;
|
|
124
|
+
switch (specifierSource) {
|
|
125
|
+
case 'conventional-commits':
|
|
126
|
+
if (options.currentVersionResolver !== 'git-tag') {
|
|
127
|
+
throw new Error(`Invalid currentVersionResolver "${options.currentVersionResolver}" provided for release group "${options.releaseGroup.name}". Must be "git-tag" when "specifierSource" is "conventional-commits"`);
|
|
128
|
+
}
|
|
129
|
+
specifier = await (0, resolve_semver_specifier_1.resolveSemverSpecifierFromConventionalCommits)(latestMatchingGitTag.tag, options.projectGraph, projects.map((p) => p.name));
|
|
130
|
+
if (!specifier) {
|
|
131
|
+
log(`🚫 No changes were detected using git history and the conventional commits standard.`);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
// Always assume that if the current version is a prerelease, then the next version should be a prerelease.
|
|
135
|
+
// Users must manually graduate from a prerelease to a release by providing an explicit specifier.
|
|
136
|
+
if ((0, semver_2.prerelease)(currentVersion)) {
|
|
137
|
+
specifier = 'prerelease';
|
|
138
|
+
log(`📄 Resolved the specifier as "${specifier}" since the current version is a prerelease.`);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
log(`📄 Resolved the specifier as "${specifier}" using git history and the conventional commits standard.`);
|
|
142
|
+
}
|
|
143
|
+
break;
|
|
144
|
+
case 'prompt':
|
|
145
|
+
specifier = await (0, resolve_semver_specifier_1.resolveSemverSpecifierFromPrompt)(`What kind of change is this for the ${projects.length} matched projects(s) within release group "${options.releaseGroup.name}"?`, `What is the exact version for the ${projects.length} matched project(s) within release group "${options.releaseGroup.name}"?`);
|
|
146
|
+
break;
|
|
147
|
+
default:
|
|
148
|
+
throw new Error(`Invalid specifierSource "${specifierSource}" provided. Must be one of "prompt" or "conventional-commits"`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (!specifier) {
|
|
152
|
+
log(`🚫 Skipping versioning "${projectPackageJson.name}" as no changes were detected.`);
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
// Resolve any local package dependencies for this project (before applying the new version)
|
|
156
|
+
const localPackageDependencies = (0, resolve_local_package_dependencies_1.resolveLocalPackageDependencies)(tree, options.projectGraph, projects, projectNameToPackageRootMap);
|
|
157
|
+
const newVersion = (0, version_1.deriveNewSemverVersion)(currentVersion, specifier, options.preid);
|
|
158
|
+
(0, devkit_1.writeJson)(tree, packageJsonPath, {
|
|
159
|
+
...projectPackageJson,
|
|
160
|
+
version: newVersion,
|
|
161
|
+
});
|
|
162
|
+
log(`✍️ New version ${newVersion} written to ${workspaceRelativePackageJsonPath}`);
|
|
163
|
+
const dependentProjects = Object.values(localPackageDependencies)
|
|
164
|
+
.filter((localPackageDependencies) => {
|
|
165
|
+
return localPackageDependencies.some((localPackageDependency) => localPackageDependency.target === project.name);
|
|
166
|
+
})
|
|
167
|
+
.flat();
|
|
168
|
+
if (dependentProjects.length > 0) {
|
|
169
|
+
log(`✍️ Applying new version ${newVersion} to ${dependentProjects.length} ${dependentProjects.length > 1
|
|
170
|
+
? 'packages which depend'
|
|
171
|
+
: 'package which depends'} on ${project.name}`);
|
|
172
|
+
}
|
|
173
|
+
for (const dependentProject of dependentProjects) {
|
|
174
|
+
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(projectNameToPackageRootMap.get(dependentProject.source), 'package.json'), (json) => {
|
|
175
|
+
json[dependentProject.dependencyCollection][packageName] =
|
|
176
|
+
newVersion;
|
|
177
|
+
return json;
|
|
178
|
+
});
|
|
76
179
|
}
|
|
77
|
-
case 'disk':
|
|
78
|
-
currentVersion = currentVersionFromDisk;
|
|
79
|
-
log(`📄 Resolved the current version as ${currentVersion} from ${packageJsonPath}`);
|
|
80
|
-
break;
|
|
81
|
-
default:
|
|
82
|
-
throw new Error(`Invalid value for options.currentVersionResolver: ${options.currentVersionResolver}`);
|
|
83
180
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const dependentProjects = Object.values(localPackageDependencies)
|
|
93
|
-
.filter((localPackageDependencies) => {
|
|
94
|
-
return localPackageDependencies.some((localPackageDependency) => localPackageDependency.target === project.name);
|
|
95
|
-
})
|
|
96
|
-
.flat();
|
|
97
|
-
if (dependentProjects.length > 0) {
|
|
98
|
-
log(`✍️ Applying new version ${newVersion} to ${dependentProjects.length} ${dependentProjects.length > 1
|
|
99
|
-
? 'packages which depend'
|
|
100
|
-
: 'package which depends'} on ${project.name}`);
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
|
184
|
+
devkit_1.output.error({
|
|
185
|
+
title: e.message,
|
|
186
|
+
});
|
|
187
|
+
// Dump the full stack trace in verbose mode
|
|
188
|
+
console.error(e);
|
|
101
189
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return json;
|
|
190
|
+
else {
|
|
191
|
+
devkit_1.output.error({
|
|
192
|
+
title: e.message,
|
|
106
193
|
});
|
|
107
194
|
}
|
|
195
|
+
process.exit(1);
|
|
108
196
|
}
|
|
109
197
|
}
|
|
110
198
|
exports.releaseVersionGenerator = releaseVersionGenerator;
|
|
@@ -129,3 +217,17 @@ function getColor(projectName) {
|
|
|
129
217
|
const colorIndex = code % colors.length;
|
|
130
218
|
return colors[colorIndex];
|
|
131
219
|
}
|
|
220
|
+
async function getNpmRegistry() {
|
|
221
|
+
// Must be non-blocking async to allow spinner to render
|
|
222
|
+
return await new Promise((resolve, reject) => {
|
|
223
|
+
(0, child_process_1.exec)('npm config get registry', (error, stdout, stderr) => {
|
|
224
|
+
if (error) {
|
|
225
|
+
return reject(error);
|
|
226
|
+
}
|
|
227
|
+
if (stderr) {
|
|
228
|
+
return reject(stderr);
|
|
229
|
+
}
|
|
230
|
+
return resolve(stdout.trim());
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
}
|
|
@@ -19,7 +19,17 @@
|
|
|
19
19
|
},
|
|
20
20
|
"specifier": {
|
|
21
21
|
"type": "string",
|
|
22
|
-
"description": "Exact version or semver keyword to apply to the selected release group.
|
|
22
|
+
"description": "Exact version or semver keyword to apply to the selected release group. Overrides specifierSource."
|
|
23
|
+
},
|
|
24
|
+
"releaseGroup": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"description": "The resolved release group configuration, including name, relevant to all projects in the current execution."
|
|
27
|
+
},
|
|
28
|
+
"specifierSource": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"default": "prompt",
|
|
31
|
+
"description": "Which approach to use to determine the semver specifier used to bump the version of the project.",
|
|
32
|
+
"enum": ["prompt", "conventional-commits"]
|
|
23
33
|
},
|
|
24
34
|
"preid": {
|
|
25
35
|
"type": "string",
|
|
@@ -33,7 +43,7 @@
|
|
|
33
43
|
"type": "string",
|
|
34
44
|
"default": "disk",
|
|
35
45
|
"description": "Which approach to use to determine the current version of the project.",
|
|
36
|
-
"enum": ["registry", "disk"]
|
|
46
|
+
"enum": ["registry", "disk", "git-tag"]
|
|
37
47
|
},
|
|
38
48
|
"currentVersionResolverMetadata": {
|
|
39
49
|
"type": "object",
|
|
@@ -41,5 +51,5 @@
|
|
|
41
51
|
"default": {}
|
|
42
52
|
}
|
|
43
53
|
},
|
|
44
|
-
"required": ["projects", "projectGraph", "
|
|
54
|
+
"required": ["projects", "projectGraph", "releaseGroup"]
|
|
45
55
|
}
|
package/src/utils/schema.d.ts
CHANGED