@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
|
@@ -50,7 +50,10 @@ function updatePackageJson(options, context, target, dependencies, fileMap = nul
|
|
|
50
50
|
options.format = ['cjs'];
|
|
51
51
|
}
|
|
52
52
|
// update package specific settings
|
|
53
|
-
packageJson = getUpdatedPackageJsonContent(packageJson,
|
|
53
|
+
packageJson = getUpdatedPackageJsonContent(packageJson, {
|
|
54
|
+
skipDevelopmentExports: true,
|
|
55
|
+
...options,
|
|
56
|
+
});
|
|
54
57
|
// save files
|
|
55
58
|
(0, devkit_1.writeJsonFile)(`${options.outputPath}/package.json`, packageJson);
|
|
56
59
|
if (options.generateLockfile) {
|
|
@@ -146,6 +149,19 @@ function getUpdatedPackageJsonContent(packageJson, options) {
|
|
|
146
149
|
packageJson.exports ??=
|
|
147
150
|
typeof packageJson.exports === 'string' ? {} : { ...packageJson.exports };
|
|
148
151
|
packageJson.exports['./package.json'] ??= './package.json';
|
|
152
|
+
if (!options.skipDevelopmentExports && (hasCjsFormat || hasEsmFormat)) {
|
|
153
|
+
packageJson.exports['.'] ??= {};
|
|
154
|
+
const developmentExports = getDevelopmentExports(options);
|
|
155
|
+
for (const [exportEntry, filePath] of Object.entries(developmentExports)) {
|
|
156
|
+
if (!packageJson.exports[exportEntry]) {
|
|
157
|
+
packageJson.exports[exportEntry] ??= {};
|
|
158
|
+
packageJson.exports[exportEntry]['development'] ??= filePath;
|
|
159
|
+
}
|
|
160
|
+
else if (typeof packageJson.exports[exportEntry] === 'object') {
|
|
161
|
+
packageJson.exports[exportEntry].development ??= filePath;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
149
165
|
}
|
|
150
166
|
if (!options.skipTypings) {
|
|
151
167
|
const mainFile = (0, path_1.basename)(options.main).replace(/\.[tj]s$/, '');
|
|
@@ -215,6 +231,31 @@ function getUpdatedPackageJsonContent(packageJson, options) {
|
|
|
215
231
|
}
|
|
216
232
|
return packageJson;
|
|
217
233
|
}
|
|
234
|
+
function getDevelopmentExports(options) {
|
|
235
|
+
const mainRelativeDir = (0, get_main_file_dir_1.getRelativeDirectoryToProjectRoot)(options.main, options.projectRoot);
|
|
236
|
+
const exports = {
|
|
237
|
+
'.': mainRelativeDir + (0, path_1.basename)(options.main),
|
|
238
|
+
};
|
|
239
|
+
if (options.additionalEntryPoints?.length) {
|
|
240
|
+
const jsRegex = /\.[jt]sx?$/;
|
|
241
|
+
for (const file of options.additionalEntryPoints) {
|
|
242
|
+
const { ext: fileExt, name: fileName, base: baseName } = (0, path_1.parse)(file);
|
|
243
|
+
if (!jsRegex.test(fileExt)) {
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
const relativeDir = (0, get_main_file_dir_1.getRelativeDirectoryToProjectRoot)(file, options.projectRoot);
|
|
247
|
+
const sourceFilePath = relativeDir + baseName;
|
|
248
|
+
const entryRelativeDir = relativeDir.replace(/^\.\/src\//, './');
|
|
249
|
+
const entryFilePath = entryRelativeDir + fileName;
|
|
250
|
+
if (fileName === 'index') {
|
|
251
|
+
const barrelEntry = entryRelativeDir.replace(/\/$/, '');
|
|
252
|
+
exports[barrelEntry] = sourceFilePath;
|
|
253
|
+
}
|
|
254
|
+
exports[entryFilePath] = sourceFilePath;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return exports;
|
|
258
|
+
}
|
|
218
259
|
function getOutputDir(options) {
|
|
219
260
|
const packageJsonDir = options.packageJsonPath
|
|
220
261
|
? (0, path_1.dirname)(options.packageJsonPath)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
2
2
|
export type ProjectPackageManagerWorkspaceState = 'included' | 'excluded' | 'no-workspaces';
|
|
3
3
|
export declare function getProjectPackageManagerWorkspaceState(tree: Tree, projectRoot: string): ProjectPackageManagerWorkspaceState;
|
|
4
|
+
export declare function getPackageManagerWorkspacesPatterns(tree: Tree): string[];
|
|
4
5
|
export declare function isUsingPackageManagerWorkspaces(tree: Tree): boolean;
|
|
5
6
|
export declare function isWorkspacesEnabled(tree: Tree): boolean;
|
|
6
7
|
export declare function getProjectPackageManagerWorkspaceStateWarningTask(projectPackageManagerWorkspaceState: ProjectPackageManagerWorkspaceState, workspaceRoot: string): GeneratorCallback;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getProjectPackageManagerWorkspaceState = getProjectPackageManagerWorkspaceState;
|
|
4
|
+
exports.getPackageManagerWorkspacesPatterns = getPackageManagerWorkspacesPatterns;
|
|
4
5
|
exports.isUsingPackageManagerWorkspaces = isUsingPackageManagerWorkspaces;
|
|
5
6
|
exports.isWorkspacesEnabled = isWorkspacesEnabled;
|
|
6
7
|
exports.getProjectPackageManagerWorkspaceStateWarningTask = getProjectPackageManagerWorkspaceStateWarningTask;
|
|
7
8
|
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const
|
|
9
|
+
const picomatch = require("picomatch");
|
|
9
10
|
const posix_1 = require("node:path/posix");
|
|
10
11
|
const package_json_1 = require("nx/src/plugins/package-json");
|
|
11
12
|
const semver_1 = require("semver");
|
|
@@ -13,17 +14,21 @@ function getProjectPackageManagerWorkspaceState(tree, projectRoot) {
|
|
|
13
14
|
if (!isUsingPackageManagerWorkspaces(tree)) {
|
|
14
15
|
return 'no-workspaces';
|
|
15
16
|
}
|
|
16
|
-
const patterns = (
|
|
17
|
-
const isIncluded = patterns.some((p) => (
|
|
17
|
+
const patterns = getPackageManagerWorkspacesPatterns(tree);
|
|
18
|
+
const isIncluded = patterns.some((p) => picomatch(p)((0, posix_1.join)(projectRoot, 'package.json')));
|
|
18
19
|
return isIncluded ? 'included' : 'excluded';
|
|
19
20
|
}
|
|
21
|
+
function getPackageManagerWorkspacesPatterns(tree) {
|
|
22
|
+
return (0, package_json_1.getGlobPatternsFromPackageManagerWorkspaces)(tree.root, (path) => (0, devkit_1.readJson)(tree, path, { expectComments: true }), (path) => {
|
|
23
|
+
const content = tree.read(path, 'utf-8');
|
|
24
|
+
const { load } = require('@zkochan/js-yaml');
|
|
25
|
+
return load(content, { filename: path });
|
|
26
|
+
}, (path) => tree.exists(path));
|
|
27
|
+
}
|
|
20
28
|
function isUsingPackageManagerWorkspaces(tree) {
|
|
21
29
|
return isWorkspacesEnabled(tree);
|
|
22
30
|
}
|
|
23
|
-
function isWorkspacesEnabled(tree
|
|
24
|
-
// packageManager: PackageManager = detectPackageManager(),
|
|
25
|
-
// root: string = workspaceRoot
|
|
26
|
-
) {
|
|
31
|
+
function isWorkspacesEnabled(tree) {
|
|
27
32
|
const packageManager = (0, devkit_1.detectPackageManager)(tree.root);
|
|
28
33
|
if (packageManager === 'pnpm') {
|
|
29
34
|
return tree.exists('pnpm-workspace.yaml');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
|
2
2
|
export declare const defaultExclude: string[];
|
|
3
|
-
export declare function addSwcConfig(tree: Tree, projectDir: string, type?: 'commonjs' | 'es6', supportTsx?: boolean): void;
|
|
3
|
+
export declare function addSwcConfig(tree: Tree, projectDir: string, type?: 'commonjs' | 'es6', supportTsx?: boolean, swcName?: string, additionalExcludes?: string[]): void;
|
|
4
4
|
export declare function addSwcTestConfig(tree: Tree, projectDir: string, type?: 'commonjs' | 'es6', supportTsx?: boolean): void;
|
|
@@ -43,11 +43,11 @@ const swcOptionsString = (type = 'commonjs', exclude, supportTsx) => `{
|
|
|
43
43
|
"exclude": ${JSON.stringify(exclude)}
|
|
44
44
|
}
|
|
45
45
|
`;
|
|
46
|
-
function addSwcConfig(tree, projectDir, type = 'commonjs', supportTsx = false) {
|
|
47
|
-
const swcrcPath = (0, path_1.join)(projectDir,
|
|
46
|
+
function addSwcConfig(tree, projectDir, type = 'commonjs', supportTsx = false, swcName = '.swcrc', additionalExcludes = []) {
|
|
47
|
+
const swcrcPath = (0, path_1.join)(projectDir, swcName);
|
|
48
48
|
if (tree.exists(swcrcPath))
|
|
49
49
|
return;
|
|
50
|
-
tree.write(swcrcPath, swcOptionsString(type, exports.defaultExclude, supportTsx));
|
|
50
|
+
tree.write(swcrcPath, swcOptionsString(type, [...exports.defaultExclude, ...additionalExcludes], supportTsx));
|
|
51
51
|
}
|
|
52
52
|
function addSwcTestConfig(tree, projectDir, type = 'commonjs', supportTsx = false) {
|
|
53
53
|
const swcrcPath = (0, path_1.join)(projectDir, '.spec.swcrc');
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NxJsonConfiguration } from '@nx/devkit';
|
|
2
|
-
export declare function ensureProjectIsIncludedInPluginRegistrations(nxJson: NxJsonConfiguration, projectRoot: string, buildTargetName
|
|
2
|
+
export declare function ensureProjectIsIncludedInPluginRegistrations(nxJson: NxJsonConfiguration, projectRoot: string, buildTargetName: string | null): void;
|
|
3
3
|
export declare function ensureProjectIsExcludedFromPluginRegistrations(nxJson: NxJsonConfiguration, projectRoot: string): void;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ensureProjectIsIncludedInPluginRegistrations = ensureProjectIsIncludedInPluginRegistrations;
|
|
4
4
|
exports.ensureProjectIsExcludedFromPluginRegistrations = ensureProjectIsExcludedFromPluginRegistrations;
|
|
5
5
|
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
6
|
-
function ensureProjectIsIncludedInPluginRegistrations(nxJson, projectRoot, buildTargetName
|
|
6
|
+
function ensureProjectIsIncludedInPluginRegistrations(nxJson, projectRoot, buildTargetName) {
|
|
7
7
|
nxJson.plugins ??= [];
|
|
8
8
|
let isIncluded = false;
|
|
9
9
|
let index = 0;
|
|
@@ -13,12 +13,17 @@ function ensureProjectIsIncludedInPluginRegistrations(nxJson, projectRoot, build
|
|
|
13
13
|
continue;
|
|
14
14
|
}
|
|
15
15
|
if (typeof registration === 'string') {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
if (buildTargetName) {
|
|
17
|
+
// if it's a string all projects are included but the are no user-specified options
|
|
18
|
+
// and the build task is not inferred by default, so we need to exclude it
|
|
19
|
+
nxJson.plugins[index] = {
|
|
20
|
+
plugin: '@nx/js/typescript',
|
|
21
|
+
exclude: [`${projectRoot}/*`],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
isIncluded = true;
|
|
26
|
+
}
|
|
22
27
|
}
|
|
23
28
|
else {
|
|
24
29
|
// check if the project would be included by the plugin registration
|
|
@@ -27,7 +32,7 @@ function ensureProjectIsIncludedInPluginRegistrations(nxJson, projectRoot, build
|
|
|
27
32
|
// it's included by the plugin registration, check if the user-specified options would result
|
|
28
33
|
// in the appropriate build task being inferred, if not, we need to exclude it
|
|
29
34
|
if (registration.options?.typecheck !== false &&
|
|
30
|
-
|
|
35
|
+
matchesBuildTargetDefinition(registration.options?.build, buildTargetName)) {
|
|
31
36
|
// it has the desired options, do nothing, but continue processing
|
|
32
37
|
// other registrations to exclude as needed
|
|
33
38
|
isIncluded = true;
|
|
@@ -40,7 +45,7 @@ function ensureProjectIsIncludedInPluginRegistrations(nxJson, projectRoot, build
|
|
|
40
45
|
}
|
|
41
46
|
else if (!isIncluded &&
|
|
42
47
|
registration.options?.typecheck !== false &&
|
|
43
|
-
|
|
48
|
+
matchesBuildTargetDefinition(registration.options?.build, buildTargetName)) {
|
|
44
49
|
if (!registration.exclude?.length) {
|
|
45
50
|
// negative pattern are not supported by the `exclude` option so we
|
|
46
51
|
// can't update it to not exclude the project, so we only update the
|
|
@@ -66,17 +71,20 @@ function ensureProjectIsIncludedInPluginRegistrations(nxJson, projectRoot, build
|
|
|
66
71
|
if (!isIncluded) {
|
|
67
72
|
// the project is not included by any plugin registration with an inferred build task
|
|
68
73
|
// with the given name, so we create a new plugin registration for it
|
|
69
|
-
|
|
74
|
+
const registration = {
|
|
70
75
|
plugin: '@nx/js/typescript',
|
|
71
76
|
include: [`${projectRoot}/*`],
|
|
72
77
|
options: {
|
|
73
78
|
typecheck: { targetName: 'typecheck' },
|
|
74
|
-
build: {
|
|
75
|
-
targetName: buildTargetName,
|
|
76
|
-
configName: 'tsconfig.lib.json',
|
|
77
|
-
},
|
|
78
79
|
},
|
|
79
|
-
}
|
|
80
|
+
};
|
|
81
|
+
if (buildTargetName) {
|
|
82
|
+
registration.options.build = {
|
|
83
|
+
targetName: buildTargetName,
|
|
84
|
+
configName: 'tsconfig.lib.json',
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
nxJson.plugins.push(registration);
|
|
80
88
|
}
|
|
81
89
|
}
|
|
82
90
|
function ensureProjectIsExcludedFromPluginRegistrations(nxJson, projectRoot) {
|
|
@@ -115,8 +123,11 @@ function isTypeScriptPluginRegistration(plugin) {
|
|
|
115
123
|
return ((typeof plugin === 'string' && plugin === '@nx/js/typescript') ||
|
|
116
124
|
(typeof plugin !== 'string' && plugin.plugin === '@nx/js/typescript'));
|
|
117
125
|
}
|
|
118
|
-
function
|
|
126
|
+
function matchesBuildTargetDefinition(buildOptions, buildTargetName) {
|
|
119
127
|
if (buildOptions === undefined || buildOptions === false) {
|
|
128
|
+
return !buildTargetName;
|
|
129
|
+
}
|
|
130
|
+
if (!buildTargetName) {
|
|
120
131
|
return false;
|
|
121
132
|
}
|
|
122
133
|
if (buildOptions === true && buildTargetName === 'build') {
|
|
@@ -2,7 +2,8 @@ import { type Tree } from '@nx/devkit';
|
|
|
2
2
|
export declare function isUsingTypeScriptPlugin(tree: Tree): boolean;
|
|
3
3
|
export declare function isUsingTsSolutionSetup(tree?: Tree): boolean;
|
|
4
4
|
export declare function assertNotUsingTsSolutionSetup(tree: Tree, pluginName: string, generatorName: string): void;
|
|
5
|
-
export declare function findRuntimeTsConfigName(
|
|
5
|
+
export declare function findRuntimeTsConfigName(projectRoot: string, tree?: Tree): string | null;
|
|
6
6
|
export declare function updateTsconfigFiles(tree: Tree, projectRoot: string, runtimeTsconfigFileName: string, compilerOptions: Record<string, string | boolean | string[]>, exclude?: string[], rootDir?: string): void;
|
|
7
|
-
export declare function addProjectToTsSolutionWorkspace(tree: Tree, projectDir: string): void
|
|
7
|
+
export declare function addProjectToTsSolutionWorkspace(tree: Tree, projectDir: string): Promise<void>;
|
|
8
8
|
export declare function getProjectType(tree: Tree, projectRoot: string, projectType?: 'library' | 'application'): 'library' | 'application';
|
|
9
|
+
export declare function getProjectSourceRoot(tree: Tree, projectSourceRoot: string | undefined, projectRoot: string): string | undefined;
|
|
@@ -7,6 +7,7 @@ exports.findRuntimeTsConfigName = findRuntimeTsConfigName;
|
|
|
7
7
|
exports.updateTsconfigFiles = updateTsconfigFiles;
|
|
8
8
|
exports.addProjectToTsSolutionWorkspace = addProjectToTsSolutionWorkspace;
|
|
9
9
|
exports.getProjectType = getProjectType;
|
|
10
|
+
exports.getProjectSourceRoot = getProjectSourceRoot;
|
|
10
11
|
const devkit_1 = require("@nx/devkit");
|
|
11
12
|
const posix_1 = require("node:path/posix");
|
|
12
13
|
const tree_1 = require("nx/src/generators/tree");
|
|
@@ -71,7 +72,8 @@ function assertNotUsingTsSolutionSetup(tree, pluginName, generatorName) {
|
|
|
71
72
|
});
|
|
72
73
|
throw new Error(`The ${artifactString} doesn't yet support the existing TypeScript setup. See the error above.`);
|
|
73
74
|
}
|
|
74
|
-
function findRuntimeTsConfigName(
|
|
75
|
+
function findRuntimeTsConfigName(projectRoot, tree) {
|
|
76
|
+
tree ??= new tree_1.FsTree(devkit_1.workspaceRoot, false);
|
|
75
77
|
if (tree.exists((0, devkit_1.joinPathFragments)(projectRoot, 'tsconfig.app.json')))
|
|
76
78
|
return 'tsconfig.app.json';
|
|
77
79
|
if (tree.exists((0, devkit_1.joinPathFragments)(projectRoot, 'tsconfig.lib.json')))
|
|
@@ -90,9 +92,7 @@ function updateTsconfigFiles(tree, projectRoot, runtimeTsconfigFileName, compile
|
|
|
90
92
|
json.extends = (0, devkit_1.joinPathFragments)(offset, 'tsconfig.base.json');
|
|
91
93
|
json.compilerOptions = {
|
|
92
94
|
...json.compilerOptions,
|
|
93
|
-
|
|
94
|
-
// Other tooling like jest write to "out-tsc/jest" to we just default to "out-tsc/<project-name>".
|
|
95
|
-
outDir: (0, devkit_1.joinPathFragments)('out-tsc', projectRoot.split('/').at(-1)),
|
|
95
|
+
outDir: 'dist',
|
|
96
96
|
rootDir,
|
|
97
97
|
...compilerOptions,
|
|
98
98
|
};
|
|
@@ -145,12 +145,29 @@ function updateTsconfigFiles(tree, projectRoot, runtimeTsconfigFileName, compile
|
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
function addProjectToTsSolutionWorkspace(tree, projectDir) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
async function addProjectToTsSolutionWorkspace(tree, projectDir) {
|
|
149
|
+
const state = (0, package_manager_workspaces_1.getProjectPackageManagerWorkspaceState)(tree, projectDir);
|
|
150
|
+
if (state === 'included') {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
// If dir is "libs/foo", we try to use "libs/*" but we only do it if it's
|
|
154
|
+
// safe to do so. So, we first check if adding that pattern doesn't result
|
|
155
|
+
// in extra projects being matched. If extra projects are matched, or the
|
|
156
|
+
// dir is just "foo" then we add it as is.
|
|
152
157
|
const baseDir = (0, posix_1.dirname)(projectDir);
|
|
153
|
-
|
|
158
|
+
let pattern = projectDir;
|
|
159
|
+
if (baseDir !== '.') {
|
|
160
|
+
const patterns = (0, package_manager_workspaces_1.getPackageManagerWorkspacesPatterns)(tree);
|
|
161
|
+
const projectsBefore = patterns.length > 0 ? await (0, devkit_1.globAsync)(tree, patterns) : [];
|
|
162
|
+
patterns.push(`${baseDir}/*/package.json`);
|
|
163
|
+
const projectsAfter = await (0, devkit_1.globAsync)(tree, patterns);
|
|
164
|
+
if (projectsBefore.length + 1 === projectsAfter.length) {
|
|
165
|
+
// Adding the pattern to the parent directory only results in one extra
|
|
166
|
+
// project being matched, which is the project we're adding. It's safe
|
|
167
|
+
// to add the pattern to the parent directory.
|
|
168
|
+
pattern = `${baseDir}/*`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
154
171
|
if (tree.exists('pnpm-workspace.yaml')) {
|
|
155
172
|
const { load, dump } = require('@zkochan/js-yaml');
|
|
156
173
|
const workspaceFile = tree.read('pnpm-workspace.yaml', 'utf-8');
|
|
@@ -189,3 +206,9 @@ function getProjectType(tree, projectRoot, projectType) {
|
|
|
189
206
|
return 'application';
|
|
190
207
|
return 'library';
|
|
191
208
|
}
|
|
209
|
+
function getProjectSourceRoot(tree, projectSourceRoot, projectRoot) {
|
|
210
|
+
return (projectSourceRoot ??
|
|
211
|
+
(tree.exists((0, devkit_1.joinPathFragments)(projectRoot, 'src'))
|
|
212
|
+
? (0, devkit_1.joinPathFragments)(projectRoot, 'src')
|
|
213
|
+
: projectRoot));
|
|
214
|
+
}
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export declare const nxVersion: any;
|
|
2
2
|
export declare const esbuildVersion = "^0.19.2";
|
|
3
3
|
export declare const prettierVersion = "^2.6.2";
|
|
4
|
-
export declare const swcCliVersion = "~0.
|
|
4
|
+
export declare const swcCliVersion = "~0.6.0";
|
|
5
5
|
export declare const swcCoreVersion = "~1.5.7";
|
|
6
6
|
export declare const swcHelpersVersion = "~0.5.11";
|
|
7
7
|
export declare const swcNodeVersion = "~1.9.1";
|
|
8
8
|
export declare const tsLibVersion = "^2.3.0";
|
|
9
9
|
export declare const typesNodeVersion = "18.16.9";
|
|
10
|
-
export declare const verdaccioVersion = "^
|
|
10
|
+
export declare const verdaccioVersion = "^6.0.5";
|
|
11
11
|
export declare const typescriptVersion = "~5.7.2";
|
|
12
12
|
/**
|
|
13
13
|
* The minimum version is currently determined from the lowest version
|
package/src/utils/versions.js
CHANGED
|
@@ -4,13 +4,13 @@ exports.supportedTypescriptVersions = exports.typescriptVersion = exports.verdac
|
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
5
|
exports.esbuildVersion = '^0.19.2';
|
|
6
6
|
exports.prettierVersion = '^2.6.2';
|
|
7
|
-
exports.swcCliVersion = '~0.
|
|
7
|
+
exports.swcCliVersion = '~0.6.0';
|
|
8
8
|
exports.swcCoreVersion = '~1.5.7';
|
|
9
9
|
exports.swcHelpersVersion = '~0.5.11';
|
|
10
10
|
exports.swcNodeVersion = '~1.9.1';
|
|
11
11
|
exports.tsLibVersion = '^2.3.0';
|
|
12
12
|
exports.typesNodeVersion = '18.16.9';
|
|
13
|
-
exports.verdaccioVersion = '^
|
|
13
|
+
exports.verdaccioVersion = '^6.0.5';
|
|
14
14
|
// Typescript
|
|
15
15
|
exports.typescriptVersion = '~5.7.2';
|
|
16
16
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function tsNodeRegister(file: string, tsConfig?: string): void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tsNodeRegister = tsNodeRegister;
|
|
4
|
-
function tsNodeRegister(file, tsConfig) {
|
|
5
|
-
if (!file?.endsWith('.ts'))
|
|
6
|
-
return;
|
|
7
|
-
// Register TS compiler lazily
|
|
8
|
-
require('ts-node').register({
|
|
9
|
-
project: tsConfig,
|
|
10
|
-
compilerOptions: {
|
|
11
|
-
module: 'CommonJS',
|
|
12
|
-
types: ['node'],
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
if (!tsConfig)
|
|
16
|
-
return;
|
|
17
|
-
// Register paths in tsConfig
|
|
18
|
-
const tsconfigPaths = require('tsconfig-paths');
|
|
19
|
-
const { absoluteBaseUrl: baseUrl, paths } = tsconfigPaths.loadConfig(tsConfig);
|
|
20
|
-
if (baseUrl && paths) {
|
|
21
|
-
tsconfigPaths.register({ baseUrl, paths });
|
|
22
|
-
}
|
|
23
|
-
}
|