@nx/js 21.0.0-beta.0 → 21.0.0-beta.2
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/migrations.json +18 -0
- package/package.json +7 -8
- package/src/executors/node/node.impl.js +2 -2
- package/src/executors/release-publish/release-publish.impl.js +58 -17
- package/src/generators/init/files/ts-solution/tsconfig.base.json__tmpl__ +2 -1
- package/src/generators/init/init.js +1 -2
- package/src/generators/library/library.js +29 -135
- package/src/generators/library/utils/add-release-config.d.ts +11 -0
- package/src/generators/library/utils/add-release-config.js +150 -0
- package/src/generators/release-version/release-version.d.ts +1 -1
- package/src/generators/release-version/release-version.js +16 -14
- package/src/generators/release-version/schema.d.ts +1 -1
- package/src/generators/release-version/schema.json +23 -4
- package/src/generators/setup-build/generator.js +4 -0
- package/src/plugins/jest/start-local-registry.js +7 -3
- package/src/plugins/typescript/plugin.js +433 -211
- package/src/plugins/typescript/util.d.ts +9 -0
- package/src/plugins/typescript/util.js +74 -0
- package/src/release/utils/update-lock-file.d.ts +10 -0
- package/src/{generators/release-version → release}/utils/update-lock-file.js +12 -9
- package/src/release/version-actions.d.ts +22 -0
- package/src/release/version-actions.js +189 -0
- package/src/utils/assets/copy-assets-handler.js +11 -5
- package/src/utils/buildable-libs-utils.d.ts +0 -2
- package/src/utils/buildable-libs-utils.js +12 -42
- package/src/utils/find-npm-dependencies.d.ts +1 -0
- package/src/utils/find-npm-dependencies.js +12 -2
- package/src/utils/npm-config.js +1 -4
- package/src/utils/package-json/update-package-json.d.ts +1 -0
- package/src/utils/package-json/update-package-json.js +42 -1
- package/src/utils/package-manager-workspaces.d.ts +1 -0
- package/src/utils/package-manager-workspaces.js +12 -7
- package/src/utils/swc/add-swc-config.d.ts +1 -1
- package/src/utils/swc/add-swc-config.js +3 -3
- package/src/utils/typescript/plugin.d.ts +1 -1
- package/src/utils/typescript/plugin.js +27 -16
- package/src/utils/typescript/ts-solution-setup.d.ts +3 -2
- package/src/utils/typescript/ts-solution-setup.js +32 -9
- package/src/utils/versions.d.ts +2 -2
- package/src/utils/versions.js +2 -2
- package/src/generators/release-version/utils/update-lock-file.d.ts +0 -5
- package/src/utils/typescript/tsnode-register.d.ts +0 -1
- package/src/utils/typescript/tsnode-register.js +0 -23
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addReleaseConfigForTsSolution = addReleaseConfigForTsSolution;
|
|
4
|
+
exports.addReleaseConfigForNonTsSolution = addReleaseConfigForNonTsSolution;
|
|
5
|
+
exports.releaseTasks = releaseTasks;
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const find_matching_projects_1 = require("nx/src/utils/find-matching-projects");
|
|
8
|
+
const generator_1 = require("../../setup-verdaccio/generator");
|
|
9
|
+
/**
|
|
10
|
+
* Adds release option in nx.json to build the project before versioning
|
|
11
|
+
*/
|
|
12
|
+
async function addReleaseConfigForTsSolution(tree, projectName, projectConfiguration) {
|
|
13
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
14
|
+
const addPreVersionCommand = () => {
|
|
15
|
+
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
16
|
+
nxJson.release = {
|
|
17
|
+
...nxJson.release,
|
|
18
|
+
version: {
|
|
19
|
+
preVersionCommand: `${pmc.dlx} nx run-many -t build`,
|
|
20
|
+
...nxJson.release?.version,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
// if the release configuration does not exist, it will be created
|
|
25
|
+
if (!nxJson.release || (!nxJson.release.projects && !nxJson.release.groups)) {
|
|
26
|
+
// skip adding any projects configuration since the new project should be
|
|
27
|
+
// automatically included by nx release's default project detection logic
|
|
28
|
+
addPreVersionCommand();
|
|
29
|
+
(0, devkit_1.writeJson)(tree, 'nx.json', nxJson);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const project = {
|
|
33
|
+
name: projectName,
|
|
34
|
+
type: 'lib',
|
|
35
|
+
data: {
|
|
36
|
+
root: projectConfiguration.root,
|
|
37
|
+
tags: projectConfiguration.tags,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
// if the project is already included in the release configuration, it will not be added again
|
|
41
|
+
if (projectsConfigMatchesProject(nxJson.release.projects, project)) {
|
|
42
|
+
devkit_1.output.log({
|
|
43
|
+
title: `Project already included in existing release configuration`,
|
|
44
|
+
});
|
|
45
|
+
addPreVersionCommand();
|
|
46
|
+
(0, devkit_1.writeJson)(tree, 'nx.json', nxJson);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// if the release configuration is a string, it will be converted to an array and added to it
|
|
50
|
+
if (Array.isArray(nxJson.release.projects)) {
|
|
51
|
+
nxJson.release.projects.push(projectName);
|
|
52
|
+
addPreVersionCommand();
|
|
53
|
+
(0, devkit_1.writeJson)(tree, 'nx.json', nxJson);
|
|
54
|
+
devkit_1.output.log({
|
|
55
|
+
title: `Added project to existing release configuration`,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (nxJson.release.groups) {
|
|
59
|
+
const allGroups = Object.entries(nxJson.release.groups);
|
|
60
|
+
for (const [name, group] of allGroups) {
|
|
61
|
+
if (projectsConfigMatchesProject(group.projects, project)) {
|
|
62
|
+
addPreVersionCommand();
|
|
63
|
+
(0, devkit_1.writeJson)(tree, 'nx.json', nxJson);
|
|
64
|
+
devkit_1.output.log({
|
|
65
|
+
title: `Project already included in existing release configuration for group ${name}`,
|
|
66
|
+
});
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
devkit_1.output.warn({
|
|
71
|
+
title: `Could not find a release group that includes ${projectName}`,
|
|
72
|
+
bodyLines: [
|
|
73
|
+
`Ensure that ${projectName} is included in a release group's "projects" list in nx.json so it can be published with "nx release"`,
|
|
74
|
+
],
|
|
75
|
+
});
|
|
76
|
+
addPreVersionCommand();
|
|
77
|
+
(0, devkit_1.writeJson)(tree, 'nx.json', nxJson);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (typeof nxJson.release.projects === 'string') {
|
|
81
|
+
nxJson.release.projects = [nxJson.release.projects, projectName];
|
|
82
|
+
addPreVersionCommand();
|
|
83
|
+
(0, devkit_1.writeJson)(tree, 'nx.json', nxJson);
|
|
84
|
+
devkit_1.output.log({
|
|
85
|
+
title: `Added project to existing release configuration`,
|
|
86
|
+
});
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Add release configuration for non-ts solution projects
|
|
92
|
+
* Add release option in project.json and add packageRoot to nx-release-publish target
|
|
93
|
+
*/
|
|
94
|
+
async function addReleaseConfigForNonTsSolution(useLegacyVersioning, tree, projectName, projectConfiguration, defaultOutputDirectory = 'dist') {
|
|
95
|
+
const packageRoot = (0, devkit_1.joinPathFragments)(defaultOutputDirectory, '{projectRoot}');
|
|
96
|
+
projectConfiguration.targets ??= {};
|
|
97
|
+
projectConfiguration.targets['nx-release-publish'] = {
|
|
98
|
+
options: {
|
|
99
|
+
packageRoot,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
if (useLegacyVersioning) {
|
|
103
|
+
projectConfiguration.release = {
|
|
104
|
+
version: {
|
|
105
|
+
generatorOptions: {
|
|
106
|
+
packageRoot,
|
|
107
|
+
// using git tags to determine the current version is required here because
|
|
108
|
+
// the version in the package root is overridden with every build
|
|
109
|
+
currentVersionResolver: 'git-tag',
|
|
110
|
+
fallbackCurrentVersionResolver: 'disk',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
// TODO: re-evaluate this config in new versions
|
|
117
|
+
projectConfiguration.release = {
|
|
118
|
+
version: {
|
|
119
|
+
manifestRootsToUpdate: [packageRoot],
|
|
120
|
+
// using git tags to determine the current version is required here because
|
|
121
|
+
// the version in the package root is overridden with every build
|
|
122
|
+
currentVersionResolver: 'git-tag',
|
|
123
|
+
fallbackCurrentVersionResolver: 'disk',
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
await addReleaseConfigForTsSolution(tree, projectName, projectConfiguration);
|
|
128
|
+
return projectConfiguration;
|
|
129
|
+
}
|
|
130
|
+
function projectsConfigMatchesProject(projectsConfig, project) {
|
|
131
|
+
if (!projectsConfig) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
if (typeof projectsConfig === 'string') {
|
|
135
|
+
projectsConfig = [projectsConfig];
|
|
136
|
+
}
|
|
137
|
+
const graph = {
|
|
138
|
+
[project.name]: project,
|
|
139
|
+
};
|
|
140
|
+
const matchingProjects = (0, find_matching_projects_1.findMatchingProjects)(projectsConfig, graph);
|
|
141
|
+
return matchingProjects.includes(project.name);
|
|
142
|
+
}
|
|
143
|
+
async function releaseTasks(tree) {
|
|
144
|
+
return (0, devkit_1.runTasksInSerial)(await (0, generator_1.default)(tree, { skipFormat: true }), () => logNxReleaseDocsInfo());
|
|
145
|
+
}
|
|
146
|
+
function logNxReleaseDocsInfo() {
|
|
147
|
+
devkit_1.output.log({
|
|
148
|
+
title: `📦 To learn how to publish this library, see https://nx.dev/core-features/manage-releases.`,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
|
-
import { ReleaseVersionGeneratorResult } from 'nx/src/command-line/release/version';
|
|
2
|
+
import { ReleaseVersionGeneratorResult } from 'nx/src/command-line/release/version-legacy';
|
|
3
3
|
import { ReleaseVersionGeneratorSchema } from './schema';
|
|
4
4
|
export declare function releaseVersionGenerator(tree: Tree, options: ReleaseVersionGeneratorSchema): Promise<ReleaseVersionGeneratorResult>;
|
|
5
5
|
export default releaseVersionGenerator;
|
|
@@ -11,15 +11,15 @@ const config_1 = require("nx/src/command-line/release/config/config");
|
|
|
11
11
|
const git_1 = require("nx/src/command-line/release/utils/git");
|
|
12
12
|
const resolve_semver_specifier_1 = require("nx/src/command-line/release/utils/resolve-semver-specifier");
|
|
13
13
|
const semver_1 = require("nx/src/command-line/release/utils/semver");
|
|
14
|
-
const
|
|
14
|
+
const version_legacy_1 = require("nx/src/command-line/release/version-legacy");
|
|
15
15
|
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
16
16
|
const ora = require("ora");
|
|
17
17
|
const semver_2 = require("semver");
|
|
18
|
+
const update_lock_file_1 = require("../../release/utils/update-lock-file");
|
|
18
19
|
const is_locally_linked_package_version_1 = require("../../utils/is-locally-linked-package-version");
|
|
19
20
|
const npm_config_1 = require("../../utils/npm-config");
|
|
20
21
|
const resolve_local_package_dependencies_1 = require("./utils/resolve-local-package-dependencies");
|
|
21
22
|
const sort_projects_topologically_1 = require("./utils/sort-projects-topologically");
|
|
22
|
-
const update_lock_file_1 = require("./utils/update-lock-file");
|
|
23
23
|
function resolvePreIdSpecifier(currentSpecifier, preid) {
|
|
24
24
|
if (!currentSpecifier.startsWith('pre') && preid) {
|
|
25
25
|
return `pre${currentSpecifier}`;
|
|
@@ -39,10 +39,10 @@ async function releaseVersionGenerator(tree, options) {
|
|
|
39
39
|
options.specifier = options.specifier.replace(/^v/, '');
|
|
40
40
|
}
|
|
41
41
|
if (options.versionPrefix &&
|
|
42
|
-
|
|
42
|
+
version_legacy_1.validReleaseVersionPrefixes.indexOf(options.versionPrefix) === -1) {
|
|
43
43
|
throw new Error(`Invalid value for version.generatorOptions.versionPrefix: "${options.versionPrefix}"
|
|
44
44
|
|
|
45
|
-
Valid values are: ${
|
|
45
|
+
Valid values are: ${version_legacy_1.validReleaseVersionPrefixes
|
|
46
46
|
.map((s) => `"${s}"`)
|
|
47
47
|
.join(', ')}`);
|
|
48
48
|
}
|
|
@@ -54,7 +54,6 @@ Valid values are: ${version_1.validReleaseVersionPrefixes
|
|
|
54
54
|
const updateDependents = options.updateDependents ?? 'auto';
|
|
55
55
|
const updateDependentsBump = resolvePreIdSpecifier('patch', options.preid);
|
|
56
56
|
// Sort the projects topologically if update dependents is enabled
|
|
57
|
-
// TODO: maybe move this sorting to the command level?
|
|
58
57
|
const projects = updateDependents === 'never' ||
|
|
59
58
|
options.releaseGroup.projectsRelationship !== 'independent'
|
|
60
59
|
? options.projects
|
|
@@ -191,7 +190,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
191
190
|
const releaseTagPattern = options.releaseGroup.releaseTagPattern;
|
|
192
191
|
latestMatchingGitTag = await (0, git_1.getLatestGitTagForPattern)(releaseTagPattern, {
|
|
193
192
|
projectName: project.name,
|
|
194
|
-
});
|
|
193
|
+
}, options.releaseGroup.releaseTagPatternCheckAllBranchesWhen);
|
|
195
194
|
if (!latestMatchingGitTag) {
|
|
196
195
|
if (options.fallbackCurrentVersionResolver === 'disk') {
|
|
197
196
|
if (!currentVersionFromDisk &&
|
|
@@ -287,8 +286,6 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
287
286
|
logger.buffer(`🚫 No changes were detected using git history and the conventional commits standard.`);
|
|
288
287
|
break;
|
|
289
288
|
}
|
|
290
|
-
// TODO: reevaluate this prerelease logic/workflow for independent projects
|
|
291
|
-
//
|
|
292
289
|
// Always assume that if the current version is a prerelease, then the next version should be a prerelease.
|
|
293
290
|
// Users must manually graduate from a prerelease to a release by providing an explicit specifier.
|
|
294
291
|
if ((0, semver_2.prerelease)(currentVersion ?? '')) {
|
|
@@ -404,7 +401,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
404
401
|
const allDependentProjects = Object.values(localPackageDependencies)
|
|
405
402
|
.flat()
|
|
406
403
|
.filter((localPackageDependency) => {
|
|
407
|
-
return localPackageDependency.target ===
|
|
404
|
+
return localPackageDependency.target === projectName;
|
|
408
405
|
});
|
|
409
406
|
const includeTransitiveDependents = updateDependents !== 'never' &&
|
|
410
407
|
options.releaseGroup.projectsRelationship === 'independent';
|
|
@@ -423,9 +420,10 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
423
420
|
const dependentProjectsOutsideCurrentBatch = [];
|
|
424
421
|
// Track circular dependencies using value of project1:project2
|
|
425
422
|
const circularDependencies = new Set();
|
|
423
|
+
const projectsDependOnCurrentProject = localPackageDependencies[projectName]?.map((localPackageDependencies) => localPackageDependencies.target) ?? [];
|
|
426
424
|
for (const dependentProject of allDependentProjects) {
|
|
427
425
|
// Track circular dependencies (add both directions for easy look up)
|
|
428
|
-
if (dependentProject.
|
|
426
|
+
if (projectsDependOnCurrentProject.includes(dependentProject.source)) {
|
|
429
427
|
circularDependencies.add(`${dependentProject.source}:${dependentProject.target}`);
|
|
430
428
|
circularDependencies.add(`${dependentProject.target}:${dependentProject.source}`);
|
|
431
429
|
}
|
|
@@ -489,7 +487,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
489
487
|
}
|
|
490
488
|
continue;
|
|
491
489
|
}
|
|
492
|
-
const newVersion = (0,
|
|
490
|
+
const newVersion = (0, version_legacy_1.deriveNewSemverVersion)(currentVersion, specifier, options.preid);
|
|
493
491
|
versionData[projectName].newVersion = newVersion;
|
|
494
492
|
(0, devkit_1.writeJson)(tree, packageJsonPath, {
|
|
495
493
|
...packageJson,
|
|
@@ -555,7 +553,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
555
553
|
}
|
|
556
554
|
// Bump the dependent's version if applicable and record it in the version data
|
|
557
555
|
if (forceVersionBump) {
|
|
558
|
-
const newPackageVersion = (0,
|
|
556
|
+
const newPackageVersion = (0, version_legacy_1.deriveNewSemverVersion)(currentPackageVersion, forceVersionBump, options.preid);
|
|
559
557
|
json.version = newPackageVersion;
|
|
560
558
|
// Look up any dependent projects from the transitiveLocalPackageDependents list
|
|
561
559
|
const transitiveDependentProjects = transitiveLocalPackageDependents.filter((localPackageDependency) => localPackageDependency.target === dependentProject.source);
|
|
@@ -665,7 +663,10 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
665
663
|
deletedFiles.push(...(await cb(opts.dryRun)));
|
|
666
664
|
}
|
|
667
665
|
const cwd = tree.root;
|
|
668
|
-
changedFiles.push(...(await (0, update_lock_file_1.updateLockFile)(cwd,
|
|
666
|
+
changedFiles.push(...(await (0, update_lock_file_1.updateLockFile)(cwd, {
|
|
667
|
+
...opts,
|
|
668
|
+
useLegacyVersioning: true,
|
|
669
|
+
})));
|
|
669
670
|
return { changedFiles, deletedFiles };
|
|
670
671
|
},
|
|
671
672
|
};
|
|
@@ -696,7 +697,8 @@ function createResolvePackageRoot(customPackageRoot) {
|
|
|
696
697
|
return projectNode.data.root;
|
|
697
698
|
}
|
|
698
699
|
if (projectNode.data.root === '.') {
|
|
699
|
-
//
|
|
700
|
+
// This is a temporary workaround to fix NXC-574 until NXC-573 is resolved.
|
|
701
|
+
// This has been fixed in "versioning v2"
|
|
700
702
|
return projectNode.data.root;
|
|
701
703
|
}
|
|
702
704
|
return (0, utils_1.interpolate)(customPackageRoot, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ReleaseVersionGeneratorSchema } from 'nx/src/command-line/release/version';
|
|
1
|
+
export { ReleaseVersionGeneratorSchema } from 'nx/src/command-line/release/version-legacy';
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
"properties": {
|
|
9
9
|
"projects": {
|
|
10
10
|
"type": "array",
|
|
11
|
+
"hidden": true,
|
|
12
|
+
"$comment": "This is not configured/passed by the user. It is provided by the version command.",
|
|
11
13
|
"description": "The ProjectGraphProjectNodes being versioned in the current execution.",
|
|
12
14
|
"items": {
|
|
13
15
|
"type": "object"
|
|
@@ -15,16 +17,33 @@
|
|
|
15
17
|
},
|
|
16
18
|
"projectGraph": {
|
|
17
19
|
"type": "object",
|
|
20
|
+
"hidden": true,
|
|
21
|
+
"$comment": "This is not configured/passed by the user. It is provided by the version command.",
|
|
18
22
|
"description": "ProjectGraph instance"
|
|
19
23
|
},
|
|
20
|
-
"specifier": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"description": "Exact version or semver keyword to apply to the selected release group. Overrides specifierSource."
|
|
23
|
-
},
|
|
24
24
|
"releaseGroup": {
|
|
25
25
|
"type": "object",
|
|
26
|
+
"hidden": true,
|
|
27
|
+
"$comment": "This is not configured/passed by the user. It is provided by the version command.",
|
|
26
28
|
"description": "The resolved release group configuration, including name, relevant to all projects in the current execution."
|
|
27
29
|
},
|
|
30
|
+
"conventionalCommitsConfig": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"hidden": true,
|
|
33
|
+
"$comment": "This is not configured/passed by the user. It is provided by the version command.",
|
|
34
|
+
"description": "The conventional commits configuration to use when determining the next version of the project.",
|
|
35
|
+
"default": {}
|
|
36
|
+
},
|
|
37
|
+
"firstRelease": {
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"hidden": true,
|
|
40
|
+
"$comment": "This is not configured/passed by the user. It is provided by the version command.",
|
|
41
|
+
"description": "Whether this is the first release of the project (which skips some validation within the generator)."
|
|
42
|
+
},
|
|
43
|
+
"specifier": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "Exact version or semver keyword to apply to the selected release group. Overrides specifierSource."
|
|
46
|
+
},
|
|
28
47
|
"specifierSource": {
|
|
29
48
|
"type": "string",
|
|
30
49
|
"default": "prompt",
|
|
@@ -232,6 +232,9 @@ function updatePackageJson(tree, projectName, projectRoot, main, outputPath, roo
|
|
|
232
232
|
version: '0.0.1',
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
|
+
// the file must exist in the TS solution setup, which is the only case this
|
|
236
|
+
// function is called
|
|
237
|
+
const tsconfigBase = (0, devkit_1.readJson)(tree, 'tsconfig.base.json');
|
|
235
238
|
packageJson = (0, update_package_json_1.getUpdatedPackageJsonContent)(packageJson, {
|
|
236
239
|
main,
|
|
237
240
|
outputPath,
|
|
@@ -240,6 +243,7 @@ function updatePackageJson(tree, projectName, projectRoot, main, outputPath, roo
|
|
|
240
243
|
packageJsonPath,
|
|
241
244
|
rootDir,
|
|
242
245
|
format,
|
|
246
|
+
skipDevelopmentExports: !tsconfigBase.compilerOptions?.customConditions?.includes('development'),
|
|
243
247
|
});
|
|
244
248
|
(0, devkit_1.writeJson)(tree, packageJsonPath, packageJson);
|
|
245
249
|
}
|
|
@@ -29,20 +29,24 @@ function startLocalRegistry({ localRegistryTarget, storage, verbose, clearStorag
|
|
|
29
29
|
const port = parseInt(data.toString().match(new RegExp(`${listenAddress}:(?<port>\\d+)`))
|
|
30
30
|
?.groups?.port);
|
|
31
31
|
const registry = `http://${listenAddress}:${port}`;
|
|
32
|
+
const authToken = 'secretVerdaccioToken';
|
|
32
33
|
console.log(`Local registry started on ${registry}`);
|
|
33
34
|
process.env.npm_config_registry = registry;
|
|
34
|
-
(0, child_process_1.execSync)(`npm config set //${listenAddress}:${port}/:_authToken "
|
|
35
|
+
(0, child_process_1.execSync)(`npm config set //${listenAddress}:${port}/:_authToken "${authToken}" --ws=false`, {
|
|
35
36
|
windowsHide: false,
|
|
36
37
|
});
|
|
38
|
+
// bun
|
|
39
|
+
process.env.BUN_CONFIG_REGISTRY = registry;
|
|
40
|
+
process.env.BUN_CONFIG_TOKEN = authToken;
|
|
37
41
|
// yarnv1
|
|
38
42
|
process.env.YARN_REGISTRY = registry;
|
|
39
43
|
// yarnv2
|
|
40
44
|
process.env.YARN_NPM_REGISTRY_SERVER = registry;
|
|
41
45
|
process.env.YARN_UNSAFE_HTTP_WHITELIST = listenAddress;
|
|
42
|
-
console.log('Set npm and yarn config registry to ' + registry);
|
|
46
|
+
console.log('Set npm, bun, and yarn config registry to ' + registry);
|
|
43
47
|
resolve(() => {
|
|
44
48
|
childProcess.kill();
|
|
45
|
-
(0, child_process_1.execSync)(`npm config delete //${listenAddress}:${port}/:_authToken`, {
|
|
49
|
+
(0, child_process_1.execSync)(`npm config delete //${listenAddress}:${port}/:_authToken --ws=false`, {
|
|
46
50
|
windowsHide: false,
|
|
47
51
|
});
|
|
48
52
|
});
|