@nx/js 19.0.0-beta.6 → 19.0.0-beta.8
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": "@nx/js",
|
|
3
|
-
"version": "19.0.0-beta.
|
|
3
|
+
"version": "19.0.0-beta.8",
|
|
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": {
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"semver": "^7.5.3",
|
|
58
58
|
"source-map-support": "0.5.19",
|
|
59
59
|
"tslib": "^2.3.0",
|
|
60
|
-
"@nx/devkit": "19.0.0-beta.
|
|
61
|
-
"@nx/workspace": "19.0.0-beta.
|
|
62
|
-
"@nrwl/js": "19.0.0-beta.
|
|
60
|
+
"@nx/devkit": "19.0.0-beta.8",
|
|
61
|
+
"@nx/workspace": "19.0.0-beta.8",
|
|
62
|
+
"@nrwl/js": "19.0.0-beta.8"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"verdaccio": "^5.0.4"
|
|
@@ -297,7 +297,7 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
|
|
|
297
297
|
function fileToRunCorrectPath(fileToRun) {
|
|
298
298
|
if ((0, fileutils_1.fileExists)(fileToRun))
|
|
299
299
|
return fileToRun;
|
|
300
|
-
const extensionsToTry = ['.cjs', '.mjs', 'cjs.js', '.esm.js'];
|
|
300
|
+
const extensionsToTry = ['.cjs', '.mjs', '.cjs.js', '.esm.js'];
|
|
301
301
|
for (const ext of extensionsToTry) {
|
|
302
302
|
const file = fileToRun.replace(/\.js$/, ext);
|
|
303
303
|
if ((0, fileutils_1.fileExists)(file))
|
|
@@ -8,6 +8,10 @@ const detectPort = require("detect-port");
|
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const semver_1 = require("semver");
|
|
10
10
|
let childProcess;
|
|
11
|
+
let env = {
|
|
12
|
+
SKIP_YARN_COREPACK_CHECK: 'true',
|
|
13
|
+
...process.env,
|
|
14
|
+
};
|
|
11
15
|
/**
|
|
12
16
|
* - set npm and yarn to use local registry
|
|
13
17
|
* - start verdaccio
|
|
@@ -104,19 +108,19 @@ function createVerdaccioOptions(options, workspaceRoot) {
|
|
|
104
108
|
}
|
|
105
109
|
function setupNpm(options) {
|
|
106
110
|
try {
|
|
107
|
-
(0, child_process_1.execSync)('npm --version');
|
|
111
|
+
(0, child_process_1.execSync)('npm --version', { env });
|
|
108
112
|
}
|
|
109
113
|
catch (e) {
|
|
110
114
|
return () => { };
|
|
111
115
|
}
|
|
112
116
|
let npmRegistryPath;
|
|
113
117
|
try {
|
|
114
|
-
npmRegistryPath = (0, child_process_1.execSync)(`npm config get registry --location ${options.location}
|
|
118
|
+
npmRegistryPath = (0, child_process_1.execSync)(`npm config get registry --location ${options.location}`, { env })
|
|
115
119
|
?.toString()
|
|
116
120
|
?.trim()
|
|
117
121
|
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
|
|
118
|
-
(0, child_process_1.execSync)(`npm config set registry http://localhost:${options.port}/ --location ${options.location}
|
|
119
|
-
(0, child_process_1.execSync)(`npm config set //localhost:${options.port}/:_authToken="secretVerdaccioToken" --location ${options.location}
|
|
122
|
+
(0, child_process_1.execSync)(`npm config set registry http://localhost:${options.port}/ --location ${options.location}`, { env });
|
|
123
|
+
(0, child_process_1.execSync)(`npm config set //localhost:${options.port}/:_authToken="secretVerdaccioToken" --location ${options.location}`, { env });
|
|
120
124
|
devkit_1.logger.info(`Set npm registry to http://localhost:${options.port}/`);
|
|
121
125
|
}
|
|
122
126
|
catch (e) {
|
|
@@ -124,19 +128,21 @@ function setupNpm(options) {
|
|
|
124
128
|
}
|
|
125
129
|
return () => {
|
|
126
130
|
try {
|
|
127
|
-
const currentNpmRegistryPath = (0, child_process_1.execSync)(`npm config get registry --location ${options.location}
|
|
131
|
+
const currentNpmRegistryPath = (0, child_process_1.execSync)(`npm config get registry --location ${options.location}`, { env })
|
|
128
132
|
?.toString()
|
|
129
133
|
?.trim()
|
|
130
134
|
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
|
|
131
135
|
if (npmRegistryPath && currentNpmRegistryPath.includes('localhost')) {
|
|
132
|
-
(0, child_process_1.execSync)(`npm config set registry ${npmRegistryPath} --location ${options.location}
|
|
136
|
+
(0, child_process_1.execSync)(`npm config set registry ${npmRegistryPath} --location ${options.location}`, { env });
|
|
133
137
|
devkit_1.logger.info(`Reset npm registry to ${npmRegistryPath}`);
|
|
134
138
|
}
|
|
135
139
|
else {
|
|
136
|
-
(0, child_process_1.execSync)(`npm config delete registry --location ${options.location}
|
|
140
|
+
(0, child_process_1.execSync)(`npm config delete registry --location ${options.location}`, {
|
|
141
|
+
env,
|
|
142
|
+
});
|
|
137
143
|
devkit_1.logger.info('Cleared custom npm registry');
|
|
138
144
|
}
|
|
139
|
-
(0, child_process_1.execSync)(`npm config delete //localhost:${options.port}/:_authToken --location ${options.location}
|
|
145
|
+
(0, child_process_1.execSync)(`npm config delete //localhost:${options.port}/:_authToken --location ${options.location}`, { env });
|
|
140
146
|
}
|
|
141
147
|
catch (e) {
|
|
142
148
|
throw new Error(`Failed to reset npm registry: ${e.message}`);
|
|
@@ -145,22 +151,25 @@ function setupNpm(options) {
|
|
|
145
151
|
}
|
|
146
152
|
function getYarnUnsafeHttpWhitelist(isYarnV1) {
|
|
147
153
|
return !isYarnV1
|
|
148
|
-
? new Set(JSON.parse((0, child_process_1.execSync)(`yarn config get unsafeHttpWhitelist --json
|
|
154
|
+
? new Set(JSON.parse((0, child_process_1.execSync)(`yarn config get unsafeHttpWhitelist --json`, {
|
|
155
|
+
env,
|
|
156
|
+
}).toString()))
|
|
149
157
|
: null;
|
|
150
158
|
}
|
|
151
159
|
function setYarnUnsafeHttpWhitelist(currentWhitelist, options) {
|
|
152
160
|
if (currentWhitelist.size > 0) {
|
|
153
|
-
(0, child_process_1.execSync)(`yarn config set unsafeHttpWhitelist --json '${JSON.stringify(Array.from(currentWhitelist))}'` + (options.location === 'user' ? ' --home' : ''));
|
|
161
|
+
(0, child_process_1.execSync)(`yarn config set unsafeHttpWhitelist --json '${JSON.stringify(Array.from(currentWhitelist))}'` + (options.location === 'user' ? ' --home' : ''), { env });
|
|
154
162
|
}
|
|
155
163
|
else {
|
|
156
164
|
(0, child_process_1.execSync)(`yarn config unset unsafeHttpWhitelist` +
|
|
157
|
-
(options.location === 'user' ? ' --home' : ''));
|
|
165
|
+
(options.location === 'user' ? ' --home' : ''), { env });
|
|
158
166
|
}
|
|
159
167
|
}
|
|
160
168
|
function setupYarn(options) {
|
|
161
169
|
let isYarnV1;
|
|
162
170
|
try {
|
|
163
|
-
isYarnV1 =
|
|
171
|
+
isYarnV1 =
|
|
172
|
+
(0, semver_1.major)((0, child_process_1.execSync)('yarn --version', { env }).toString().trim()) === 1;
|
|
164
173
|
}
|
|
165
174
|
catch {
|
|
166
175
|
// This would fail if yarn is not installed which is okay
|
|
@@ -168,12 +177,14 @@ function setupYarn(options) {
|
|
|
168
177
|
}
|
|
169
178
|
try {
|
|
170
179
|
const registryConfigName = isYarnV1 ? 'registry' : 'npmRegistryServer';
|
|
171
|
-
const yarnRegistryPath = (0, child_process_1.execSync)(`yarn config get ${registryConfigName}
|
|
180
|
+
const yarnRegistryPath = (0, child_process_1.execSync)(`yarn config get ${registryConfigName}`, {
|
|
181
|
+
env,
|
|
182
|
+
})
|
|
172
183
|
?.toString()
|
|
173
184
|
?.trim()
|
|
174
185
|
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
|
|
175
186
|
(0, child_process_1.execSync)(`yarn config set ${registryConfigName} http://localhost:${options.port}/` +
|
|
176
|
-
(options.location === 'user' ? ' --home' : ''));
|
|
187
|
+
(options.location === 'user' ? ' --home' : ''), { env });
|
|
177
188
|
devkit_1.logger.info(`Set yarn registry to http://localhost:${options.port}/`);
|
|
178
189
|
const currentWhitelist = getYarnUnsafeHttpWhitelist(isYarnV1);
|
|
179
190
|
let whitelistedLocalhost = false;
|
|
@@ -185,18 +196,18 @@ function setupYarn(options) {
|
|
|
185
196
|
}
|
|
186
197
|
return () => {
|
|
187
198
|
try {
|
|
188
|
-
const currentYarnRegistryPath = (0, child_process_1.execSync)(`yarn config get ${registryConfigName}
|
|
199
|
+
const currentYarnRegistryPath = (0, child_process_1.execSync)(`yarn config get ${registryConfigName}`, { env })
|
|
189
200
|
?.toString()
|
|
190
201
|
?.trim()
|
|
191
202
|
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
|
|
192
203
|
if (yarnRegistryPath && currentYarnRegistryPath.includes('localhost')) {
|
|
193
204
|
(0, child_process_1.execSync)(`yarn config set ${registryConfigName} ${yarnRegistryPath}` +
|
|
194
|
-
(options.location === 'user' ? ' --home' : ''));
|
|
205
|
+
(options.location === 'user' ? ' --home' : ''), { env });
|
|
195
206
|
devkit_1.logger.info(`Reset yarn ${registryConfigName} to ${yarnRegistryPath}`);
|
|
196
207
|
}
|
|
197
208
|
else {
|
|
198
209
|
(0, child_process_1.execSync)(`yarn config ${isYarnV1 ? 'delete' : 'unset'} ${registryConfigName}` +
|
|
199
|
-
(options.location === 'user' ? ' --home' : ''));
|
|
210
|
+
(options.location === 'user' ? ' --home' : ''), { env });
|
|
200
211
|
devkit_1.logger.info(`Cleared custom yarn ${registryConfigName}`);
|
|
201
212
|
}
|
|
202
213
|
if (whitelistedLocalhost) {
|
|
@@ -43,11 +43,13 @@ exports.createNodes = [
|
|
|
43
43
|
!siblingFiles.includes('tsconfig.json')) {
|
|
44
44
|
return {};
|
|
45
45
|
}
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
const nodeHash = (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, pluginOptions, context, [(0, lock_file_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
|
|
47
|
+
// The hash is calculated at the node/project level, so we add the config file path to avoid conflicts when caching
|
|
48
|
+
const cacheKey = `${nodeHash}_${configFilePath}`;
|
|
49
|
+
const targets = targetsCache[cacheKey]
|
|
50
|
+
? targetsCache[cacheKey]
|
|
49
51
|
: buildTscTargets(fullConfigPath, projectRoot, pluginOptions, context);
|
|
50
|
-
calculatedTargets[
|
|
52
|
+
calculatedTargets[cacheKey] = targets;
|
|
51
53
|
return {
|
|
52
54
|
projects: {
|
|
53
55
|
[projectRoot]: {
|