@nx/js 19.0.0-beta.5 → 19.0.0-beta.7

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.5",
3
+ "version": "19.0.0-beta.7",
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.5",
61
- "@nx/workspace": "19.0.0-beta.5",
62
- "@nrwl/js": "19.0.0-beta.5"
60
+ "@nx/devkit": "19.0.0-beta.7",
61
+ "@nx/workspace": "19.0.0-beta.7",
62
+ "@nrwl/js": "19.0.0-beta.7"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "verdaccio": "^5.0.4"
@@ -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`).toString()))
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 = (0, semver_1.major)((0, child_process_1.execSync)('yarn --version').toString().trim()) === 1;
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) {