@react-native-windows/cli 0.66.3 → 0.67.1

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.
Files changed (51) hide show
  1. package/CHANGELOG.json +333 -34
  2. package/CHANGELOG.md +136 -20
  3. package/lib-commonjs/config/configUtils.js.map +1 -1
  4. package/lib-commonjs/config/dependencyConfig.js +2 -2
  5. package/lib-commonjs/config/dependencyConfig.js.map +1 -1
  6. package/lib-commonjs/config/projectConfig.js +2 -2
  7. package/lib-commonjs/config/projectConfig.js.map +1 -1
  8. package/lib-commonjs/e2etest/autolink.test.d.ts +5 -0
  9. package/lib-commonjs/e2etest/autolink.test.js +93 -12
  10. package/lib-commonjs/e2etest/autolink.test.js.map +1 -1
  11. package/lib-commonjs/e2etest/dependencyConfig.test.js +15 -15
  12. package/lib-commonjs/e2etest/dependencyConfig.test.js.map +1 -1
  13. package/lib-commonjs/e2etest/projectConfig.test.js +16 -16
  14. package/lib-commonjs/e2etest/projectConfig.test.js.map +1 -1
  15. package/lib-commonjs/e2etest/projectConfig.utils.js +4 -4
  16. package/lib-commonjs/e2etest/projectConfig.utils.js.map +1 -1
  17. package/lib-commonjs/e2etest/runWindows.test.js +21 -3
  18. package/lib-commonjs/e2etest/runWindows.test.js.map +1 -1
  19. package/lib-commonjs/generator-common/index.js +1 -1
  20. package/lib-commonjs/generator-common/index.js.map +1 -1
  21. package/lib-commonjs/generator-windows/index.js +24 -51
  22. package/lib-commonjs/generator-windows/index.js.map +1 -1
  23. package/lib-commonjs/healthChecks.js +22 -4
  24. package/lib-commonjs/healthChecks.js.map +1 -1
  25. package/lib-commonjs/index.js +3 -3
  26. package/lib-commonjs/index.js.map +1 -1
  27. package/lib-commonjs/runWindows/runWindows.js +29 -26
  28. package/lib-commonjs/runWindows/runWindows.js.map +1 -1
  29. package/lib-commonjs/runWindows/runWindowsOptions.d.ts +8 -8
  30. package/lib-commonjs/runWindows/runWindowsOptions.js +1 -10
  31. package/lib-commonjs/runWindows/runWindowsOptions.js.map +1 -1
  32. package/lib-commonjs/runWindows/utils/autolink.d.ts +8 -5
  33. package/lib-commonjs/runWindows/utils/autolink.js +38 -30
  34. package/lib-commonjs/runWindows/utils/autolink.js.map +1 -1
  35. package/lib-commonjs/runWindows/utils/build.js +3 -3
  36. package/lib-commonjs/runWindows/utils/build.js.map +1 -1
  37. package/lib-commonjs/runWindows/utils/checkRequirements.js +1 -1
  38. package/lib-commonjs/runWindows/utils/checkRequirements.js.map +1 -1
  39. package/lib-commonjs/runWindows/utils/commandWithProgress.d.ts +2 -1
  40. package/lib-commonjs/runWindows/utils/commandWithProgress.js +5 -4
  41. package/lib-commonjs/runWindows/utils/commandWithProgress.js.map +1 -1
  42. package/lib-commonjs/runWindows/utils/deploy.d.ts +1 -1
  43. package/lib-commonjs/runWindows/utils/deploy.js +80 -29
  44. package/lib-commonjs/runWindows/utils/deploy.js.map +1 -1
  45. package/lib-commonjs/runWindows/utils/msbuildtools.js +11 -11
  46. package/lib-commonjs/runWindows/utils/msbuildtools.js.map +1 -1
  47. package/lib-commonjs/runWindows/utils/vsInstalls.js +1 -1
  48. package/lib-commonjs/runWindows/utils/vsInstalls.js.map +1 -1
  49. package/lib-commonjs/runWindows/utils/winappdeploytool.js +4 -4
  50. package/lib-commonjs/runWindows/utils/winappdeploytool.js.map +1 -1
  51. package/package.json +13 -10
@@ -19,7 +19,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
19
19
  var __importStar = (this && this.__importStar) || function (mod) {
20
20
  if (mod && mod.__esModule) return mod;
21
21
  var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
23
  __setModuleDefault(result, mod);
24
24
  return result;
25
25
  };
@@ -42,7 +42,7 @@ const runWindowsOptions_1 = require("./runWindowsOptions");
42
42
  const autolink_1 = require("./utils/autolink");
43
43
  const os_1 = require("os");
44
44
  function setExitProcessWithError(error, loggingWasEnabled) {
45
- if (!loggingWasEnabled) {
45
+ if (loggingWasEnabled !== true) {
46
46
  console.log(`Re-run the command with ${chalk_1.default.bold('--logging')} for more information`);
47
47
  if (telemetry_1.Telemetry.client) {
48
48
  console.log(`Your session id was ${telemetry_1.Telemetry.client.commonProperties.sessionId}`);
@@ -66,7 +66,7 @@ function getPkgVersion(pkgName) {
66
66
  }
67
67
  }
68
68
  catch (_a) { }
69
- commandWithProgress_1.newWarn(`Could not determine ${pkgName} version`);
69
+ (0, commandWithProgress_1.newWarn)(`Could not determine ${pkgName} version`);
70
70
  return '';
71
71
  }
72
72
  let runWindowsPhase = 'None';
@@ -106,9 +106,10 @@ async function runWindows(args, config, options) {
106
106
  sdks.forEach(version => console.log(' ' + version));
107
107
  return;
108
108
  }
109
- catch (e) {
109
+ catch (err) {
110
+ const e = err;
110
111
  telemetry_1.Telemetry.trackException(e);
111
- commandWithProgress_1.newError('Unable to print environment info.\n' + e.toString());
112
+ (0, commandWithProgress_1.newError)('Unable to print environment info.\n' + e.toString());
112
113
  return setExitProcessWithError(e, options.logging);
113
114
  }
114
115
  }
@@ -124,7 +125,7 @@ async function runWindows(args, config, options) {
124
125
  paths: [process.cwd(), __dirname],
125
126
  });
126
127
  const rnwDependenciesPath = path_1.default.join(path_1.default.dirname(rnwPkgJsonPath), 'scripts/rnw-dependencies.ps1');
127
- commandWithProgress_1.newError(`It is possible your installation is missing required software dependencies. Dependencies can be automatically installed by running ${rnwDependenciesPath} from an elevated PowerShell prompt.\nFor more information, go to http://aka.ms/rnw-deps`);
128
+ (0, commandWithProgress_1.newError)(`It is possible your installation is missing required software dependencies. Dependencies can be automatically installed by running ${rnwDependenciesPath} from an elevated PowerShell prompt.\nFor more information, go to http://aka.ms/rnw-deps`);
128
129
  }
129
130
  return setExitProcessWithError(e, options.logging);
130
131
  }
@@ -156,13 +157,13 @@ async function runWindows(args, config, options) {
156
157
  'react-native-windows': getPkgVersion('react-native-windows'),
157
158
  'react-native': getPkgVersion('react-native'),
158
159
  'cli-version': getPkgVersion('@react-native-windows/cli'),
159
- msftInternal: telemetry_1.isMSFTInternal(),
160
+ msftInternal: (0, telemetry_1.isMSFTInternal)(),
160
161
  durationInSecs: process.uptime(),
161
162
  success: runWindowsError === undefined,
162
163
  phase: runWindowsPhase,
163
- totalMem: os_1.totalmem(),
164
- diskFree: telemetry_1.getDiskFreeSpace(__dirname),
165
- cpus: os_1.cpus().length,
164
+ totalMem: (0, os_1.totalmem)(),
165
+ diskFree: (0, telemetry_1.getDiskFreeSpace)(__dirname),
166
+ cpus: (0, os_1.cpus)().length,
166
167
  project: await getAnonymizedProjectName(config.root),
167
168
  hasRunRnwDependencies: hasRunRnwDependencies,
168
169
  },
@@ -189,9 +190,9 @@ async function getAnonymizedProjectName(projectRoot) {
189
190
  }
190
191
  exports.getAnonymizedProjectName = getAnonymizedProjectName;
191
192
  async function runWindowsInternal(args, config, options) {
192
- const verbose = options.logging;
193
+ const verbose = options.logging === true;
193
194
  if (verbose) {
194
- commandWithProgress_1.newInfo('Verbose: ON');
195
+ (0, commandWithProgress_1.newInfo)('Verbose: ON');
195
196
  }
196
197
  // Get the solution file
197
198
  let slnFile;
@@ -199,7 +200,7 @@ async function runWindowsInternal(args, config, options) {
199
200
  slnFile = build.getAppSolutionFile(options, config);
200
201
  }
201
202
  catch (e) {
202
- commandWithProgress_1.newError(`Couldn't get app solution information. ${e.message}`);
203
+ (0, commandWithProgress_1.newError)(`Couldn't get app solution information. ${e.message}`);
203
204
  throw e;
204
205
  }
205
206
  try {
@@ -215,11 +216,11 @@ async function runWindowsInternal(args, config, options) {
215
216
  await autolink_1.autoLinkCommand.func(autolinkArgs, autolinkConfig, autoLinkOptions);
216
217
  }
217
218
  else {
218
- commandWithProgress_1.newInfo('Autolink step is skipped');
219
+ (0, commandWithProgress_1.newInfo)('Autolink step is skipped');
219
220
  }
220
221
  }
221
222
  catch (e) {
222
- commandWithProgress_1.newError(`Autolinking failed. ${e.message}`);
223
+ (0, commandWithProgress_1.newError)(`Autolinking failed. ${e.message}`);
223
224
  throw e;
224
225
  }
225
226
  let buildTools;
@@ -228,21 +229,21 @@ async function runWindowsInternal(args, config, options) {
228
229
  buildTools = msbuildtools_1.default.findAvailableVersion(options.arch, verbose);
229
230
  }
230
231
  catch (error) {
231
- commandWithProgress_1.newWarn('No public VS release found');
232
+ (0, commandWithProgress_1.newWarn)('No public VS release found');
232
233
  // Try prerelease
233
234
  try {
234
- commandWithProgress_1.newInfo('Trying pre-release VS');
235
+ (0, commandWithProgress_1.newInfo)('Trying pre-release VS');
235
236
  buildTools = msbuildtools_1.default.findAvailableVersion(options.arch, verbose, true);
236
237
  }
237
238
  catch (e) {
238
- commandWithProgress_1.newError(e.message);
239
+ (0, commandWithProgress_1.newError)(e.message);
239
240
  throw error;
240
241
  }
241
242
  }
242
243
  if (options.build) {
243
244
  runWindowsPhase = 'FindSolution';
244
245
  if (!slnFile) {
245
- commandWithProgress_1.newError('Visual Studio Solution file not found. Maybe run "npx react-native-windows-init" first?');
246
+ (0, commandWithProgress_1.newError)('Visual Studio Solution file not found. Maybe run "npx react-native-windows-init" first?');
246
247
  throw new telemetry_1.CodedError('NoSolution', 'Cannot find solution file');
247
248
  }
248
249
  // Get build/deploy options
@@ -255,7 +256,7 @@ async function runWindowsInternal(args, config, options) {
255
256
  await build.buildSolution(buildTools, slnFile, buildType, options.arch, msBuildProps, verbose, 'build', options.buildLogDirectory, options.singleproc);
256
257
  }
257
258
  catch (e) {
258
- commandWithProgress_1.newError(`Build failed with message ${e.message}. Check your build configuration.`);
259
+ (0, commandWithProgress_1.newError)(`Build failed with message ${e.message}. Check your build configuration.`);
259
260
  if (e.logfile) {
260
261
  console.log('See', chalk_1.default.bold(e.logfile));
261
262
  }
@@ -263,7 +264,7 @@ async function runWindowsInternal(args, config, options) {
263
264
  }
264
265
  }
265
266
  else {
266
- commandWithProgress_1.newInfo('Build step is skipped');
267
+ (0, commandWithProgress_1.newInfo)('Build step is skipped');
267
268
  }
268
269
  if (shouldLaunchPackager(options)) {
269
270
  await deploy.startServerInNewWindow(options, verbose);
@@ -271,29 +272,31 @@ async function runWindowsInternal(args, config, options) {
271
272
  if (options.deploy) {
272
273
  runWindowsPhase = 'FindSolution';
273
274
  if (!slnFile) {
274
- commandWithProgress_1.newError('Visual Studio Solution file not found. Maybe run "npx react-native-windows-init" first?');
275
+ (0, commandWithProgress_1.newError)('Visual Studio Solution file not found. Maybe run "npx react-native-windows-init" first?');
275
276
  throw new telemetry_1.CodedError('NoSolution', 'Cannot find solution file');
276
277
  }
277
278
  try {
278
279
  runWindowsPhase = 'Deploy';
279
280
  if (options.device || options.emulator || options.target) {
280
- await deploy.deployToDevice(options, verbose);
281
+ await deploy.deployToDevice(options, verbose, config);
281
282
  }
282
283
  else {
283
284
  await deploy.deployToDesktop(options, verbose, config, buildTools);
284
285
  }
285
286
  }
286
287
  catch (e) {
287
- commandWithProgress_1.newError(`Failed to deploy${e ? `: ${e.message}` : ''}`);
288
+ (0, commandWithProgress_1.newError)(`Failed to deploy${e ? `: ${e.message}` : ''}`);
288
289
  throw e;
289
290
  }
290
291
  }
291
292
  else {
292
- commandWithProgress_1.newInfo('Deploy step is skipped');
293
+ (0, commandWithProgress_1.newInfo)('Deploy step is skipped');
293
294
  }
294
295
  }
295
296
  function shouldLaunchPackager(options) {
296
- return options.packager && options.launch && options.release !== true;
297
+ return (options.packager === true &&
298
+ options.launch === true &&
299
+ options.release !== true);
297
300
  }
298
301
  /*
299
302
  // Example of running the Windows Command
@@ -1 +1 @@
1
- {"version":3,"file":"runWindows.js","sourceRoot":"","sources":["../../src/runWindows/runWindows.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAA4B;AAC5B,4CAAoB;AACpB,gDAAwB;AACxB,+DAOyC;AAEzC,qDAAuC;AACvC,kDAA0B;AA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ACL,6BAAO,CAAC,wBAAwB,CAAC,CAAC;KACnC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,OAA0B;IACtD,OAAO,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI,CAAC;AACxE,CAAC;AAED;;;;;;;;EAQE;AAEF;;GAEG;AACU,QAAA,iBAAiB,GAAY;IACxC,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,kFAAkF;IACpF,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,qCAAiB;CAC3B,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport crypto from 'crypto';\nimport fs from 'fs';\nimport path from 'path';\nimport {\n Telemetry,\n isMSFTInternal,\n getDiskFreeSpace,\n CodedError,\n CodedErrorType,\n CodedErrors,\n} from '@react-native-windows/telemetry';\n\nimport * as build from './utils/build';\nimport chalk from 'chalk';\nimport * as deploy from './utils/deploy';\nimport {newError, newInfo, newWarn} from './utils/commandWithProgress';\nimport * as info from './utils/info';\nimport MSBuildTools from './utils/msbuildtools';\n\nimport {Command, Config} from '@react-native-community/cli-types';\nimport {runWindowsOptions, RunWindowsOptions} from './runWindowsOptions';\n\nimport {autoLinkCommand} from './utils/autolink';\nimport {totalmem, cpus} from 'os';\n\nfunction setExitProcessWithError(\n error: Error,\n loggingWasEnabled: boolean,\n): void {\n if (!loggingWasEnabled) {\n console.log(\n `Re-run the command with ${chalk.bold('--logging')} for more information`,\n );\n if (Telemetry.client) {\n console.log(\n `Your session id was ${Telemetry.client.commonProperties.sessionId}`,\n );\n }\n }\n if (error instanceof CodedError) {\n process.exitCode = CodedErrors[error.name as CodedErrorType];\n } else {\n process.exitCode = 1;\n }\n}\n\nfunction getPkgVersion(pkgName: string): string {\n try {\n const pkgJsonPath = require.resolve(`${pkgName}/package.json`, {\n paths: [process.cwd(), __dirname],\n });\n const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath).toString());\n if (pkgJson.name === pkgName && pkgJson.version !== undefined) {\n return pkgJson.version;\n }\n } catch {}\n newWarn(`Could not determine ${pkgName} version`);\n return '';\n}\n\n/**\n * Labels used by telemtry to represent current operation\n */\ntype RunWindowsPhase =\n | 'None'\n | 'AutoLink'\n | 'FindBuildTools'\n | 'FindSolution'\n | 'Deploy';\n\nlet runWindowsPhase: RunWindowsPhase = 'None';\n/**\n * Performs build deploy and launch of RNW apps.\n * @param args Unprocessed args passed from react-native CLI.\n * @param config Config passed from react-native CLI.\n * @param options Options passed from react-native CLI.\n */\nasync function runWindows(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n if (!options.telemetry) {\n if (options.logging) {\n console.log('Disabling telemetry');\n }\n Telemetry.disable();\n } else {\n Telemetry.setup();\n }\n\n // https://github.com/yarnpkg/yarn/issues/8334 - Yarn on Windows breaks apps that read from the environment variables\n // Yarn will run node via CreateProcess and pass npm_config_* variables in lowercase without unifying their value\n // with their possibly existing uppercase counterparts. This breaks programs that read from the environment block\n // and write to a case-insensitive dictionary since they expect to encounter each variable only once.\n // The values of the lowercase variables are the one npm actually wants to use, plus they are seeded from the\n // uppercase variable values one if there are no overrides.\n delete process.env.NPM_CONFIG_CACHE;\n delete process.env.NPM_CONFIG_PREFIX;\n\n const hasRunRnwDependencies =\n process.env.LocalAppData &&\n fs.existsSync(path.join(process.env.LocalAppData, 'rnw-dependencies.txt')); // CODESYNC \\vnext\\scripts\\rnw-dependencies.ps1\n\n if (options.info) {\n try {\n const output = await info.getEnvironmentInfo();\n console.log(output.trimEnd());\n console.log(' Installed UWP SDKs:');\n const sdks = MSBuildTools.getAllAvailableUAPVersions();\n sdks.forEach(version => console.log(' ' + version));\n return;\n } catch (e) {\n Telemetry.trackException(e);\n newError('Unable to print environment info.\\n' + e.toString());\n return setExitProcessWithError(e, options.logging);\n }\n }\n\n let runWindowsError;\n try {\n await runWindowsInternal(args, config, options);\n } catch (e) {\n Telemetry.trackException(e);\n runWindowsError = e;\n if (!hasRunRnwDependencies) {\n const rnwPkgJsonPath = require.resolve(\n 'react-native-windows/package.json',\n {\n paths: [process.cwd(), __dirname],\n },\n );\n const rnwDependenciesPath = path.join(\n path.dirname(rnwPkgJsonPath),\n 'scripts/rnw-dependencies.ps1',\n );\n\n newError(\n `It is possible your installation is missing required software dependencies. Dependencies can be automatically installed by running ${rnwDependenciesPath} from an elevated PowerShell prompt.\\nFor more information, go to http://aka.ms/rnw-deps`,\n );\n }\n return setExitProcessWithError(e, options.logging);\n } finally {\n Telemetry.client?.trackEvent({\n name: 'run-windows',\n properties: {\n release: options.release,\n arch: options.arch,\n singleproc: options.singleproc,\n emulator: options.emulator,\n device: options.device,\n target: options.target,\n remoteDebugging: options.remoteDebugging,\n logging: options.logging,\n packager: options.packager,\n bundle: options.bundle,\n launch: options.launch,\n autolink: options.autolink,\n build: options.bundle,\n deploy: options.deploy,\n sln: options.sln !== undefined,\n proj: options.proj !== undefined,\n msBuildProps:\n options.msbuildprops !== undefined\n ? options.msbuildprops!.split(',').length\n : 0,\n info: options.info,\n directDebugging: options.directDebugging,\n 'react-native-windows': getPkgVersion('react-native-windows'),\n 'react-native': getPkgVersion('react-native'),\n 'cli-version': getPkgVersion('@react-native-windows/cli'),\n msftInternal: isMSFTInternal(),\n durationInSecs: process.uptime(),\n success: runWindowsError === undefined,\n phase: runWindowsPhase,\n totalMem: totalmem(),\n diskFree: getDiskFreeSpace(__dirname),\n cpus: cpus().length,\n project: await getAnonymizedProjectName(config.root),\n hasRunRnwDependencies: hasRunRnwDependencies,\n },\n });\n Telemetry.client?.flush();\n }\n}\n\nexport async function getAnonymizedProjectName(\n projectRoot: string,\n): Promise<string | null> {\n const projectJsonPath = path.join(projectRoot, 'package.json');\n if (!fs.existsSync(projectJsonPath)) {\n return null;\n }\n\n const projectJson = JSON.parse(\n (await fs.promises.readFile(projectJsonPath)).toString(),\n );\n\n const projectName = projectJson.name;\n if (typeof projectName !== 'string') {\n return null;\n }\n\n // Ensure the project name cannot be reverse engineered to avoid leaking PII\n return crypto\n .createHash('sha256')\n .update(projectName)\n .digest('hex')\n .toString();\n}\n\nasync function runWindowsInternal(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n const verbose = options.logging;\n\n if (verbose) {\n newInfo('Verbose: ON');\n }\n\n // Get the solution file\n let slnFile;\n try {\n slnFile = build.getAppSolutionFile(options, config);\n } catch (e) {\n newError(`Couldn't get app solution information. ${e.message}`);\n throw e;\n }\n\n try {\n if (options.autolink) {\n const autolinkArgs: string[] = [];\n const autolinkConfig = config;\n const autoLinkOptions = {\n logging: options.logging,\n proj: options.proj,\n sln: options.sln,\n };\n runWindowsPhase = 'AutoLink';\n await autoLinkCommand.func(autolinkArgs, autolinkConfig, autoLinkOptions);\n } else {\n newInfo('Autolink step is skipped');\n }\n } catch (e) {\n newError(`Autolinking failed. ${e.message}`);\n throw e;\n }\n\n let buildTools: MSBuildTools;\n runWindowsPhase = 'FindBuildTools';\n try {\n buildTools = MSBuildTools.findAvailableVersion(options.arch, verbose);\n } catch (error) {\n newWarn('No public VS release found');\n // Try prerelease\n try {\n newInfo('Trying pre-release VS');\n buildTools = MSBuildTools.findAvailableVersion(\n options.arch,\n verbose,\n true, // preRelease\n );\n } catch (e) {\n newError(e.message);\n throw error;\n }\n }\n\n if (options.build) {\n runWindowsPhase = 'FindSolution';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n // Get build/deploy options\n const buildType = deploy.getBuildConfiguration(options);\n const msBuildProps = build.parseMsBuildProps(options);\n\n // Disable the autolink check since we just ran it\n msBuildProps.RunAutolinkCheck = 'false';\n\n try {\n runWindowsPhase = 'FindSolution';\n await build.buildSolution(\n buildTools,\n slnFile!,\n buildType,\n options.arch,\n msBuildProps,\n verbose,\n 'build',\n options.buildLogDirectory,\n options.singleproc,\n );\n } catch (e) {\n newError(\n `Build failed with message ${e.message}. Check your build configuration.`,\n );\n if (e.logfile) {\n console.log('See', chalk.bold(e.logfile));\n }\n throw e;\n }\n } else {\n newInfo('Build step is skipped');\n }\n\n if (shouldLaunchPackager(options)) {\n await deploy.startServerInNewWindow(options, verbose);\n }\n\n if (options.deploy) {\n runWindowsPhase = 'FindSolution';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n try {\n runWindowsPhase = 'Deploy';\n if (options.device || options.emulator || options.target) {\n await deploy.deployToDevice(options, verbose);\n } else {\n await deploy.deployToDesktop(options, verbose, config, buildTools);\n }\n } catch (e) {\n newError(`Failed to deploy${e ? `: ${e.message}` : ''}`);\n throw e;\n }\n } else {\n newInfo('Deploy step is skipped');\n }\n}\n\nfunction shouldLaunchPackager(options: RunWindowsOptions): boolean {\n return options.packager && options.launch && options.release !== true;\n}\n\n/*\n// Example of running the Windows Command\nrunWindows({\n root: 'C:\\\\github\\\\hack\\\\myapp',\n debug: true,\n arch: 'x86',\n nugetPath: 'C:\\\\github\\\\react\\\\react-native-windows\\\\local-cli\\\\runWindows\\\\.nuget\\\\nuget.exe'\n});\n*/\n\n/**\n * Starts the app on a connected Windows emulator or mobile device.\n */\nexport const runWindowsCommand: Command = {\n name: 'run-windows',\n description:\n 'builds your app and starts it on a connected Windows desktop, emulator or device',\n func: runWindows,\n options: runWindowsOptions,\n};\n"]}
1
+ {"version":3,"file":"runWindows.js","sourceRoot":"","sources":["../../src/runWindows/runWindows.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAA4B;AAC5B,4CAAoB;AACpB,gDAAwB;AACxB,+DAOyC;AAEzC,qDAAuC;AACvC,kDAA0B;AAC1B,uDAAyC;AACzC,qEAAuE;AACvE,mDAAqC;AACrC,wEAAgD;AAGhD,2DAAyE;AAEzE,+CAAiD;AACjD,2BAA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O,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACpE,MAAM,CAAC,CAAC;SACT;KACF;SAAM;QACL,IAAA,6BAAO,EAAC,wBAAwB,CAAC,CAAC;KACnC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,OAA0B;IACtD,OAAO,CACL,OAAO,CAAC,QAAQ,KAAK,IAAI;QACzB,OAAO,CAAC,MAAM,KAAK,IAAI;QACvB,OAAO,CAAC,OAAO,KAAK,IAAI,CACzB,CAAC;AACJ,CAAC;AAED;;;;;;;;EAQE;AAEF;;GAEG;AACU,QAAA,iBAAiB,GAAY;IACxC,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,kFAAkF;IACpF,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,qCAAiB;CAC3B,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport crypto from 'crypto';\nimport fs from 'fs';\nimport path from 'path';\nimport {\n Telemetry,\n isMSFTInternal,\n getDiskFreeSpace,\n CodedError,\n CodedErrorType,\n CodedErrors,\n} from '@react-native-windows/telemetry';\n\nimport * as build from './utils/build';\nimport chalk from 'chalk';\nimport * as deploy from './utils/deploy';\nimport {newError, newInfo, newWarn} from './utils/commandWithProgress';\nimport * as info from './utils/info';\nimport MSBuildTools from './utils/msbuildtools';\n\nimport {Command, Config} from '@react-native-community/cli-types';\nimport {runWindowsOptions, RunWindowsOptions} from './runWindowsOptions';\n\nimport {autoLinkCommand} from './utils/autolink';\nimport {totalmem, cpus} from 'os';\n\nfunction setExitProcessWithError(\n error: Error,\n loggingWasEnabled?: boolean,\n): void {\n if (loggingWasEnabled !== true) {\n console.log(\n `Re-run the command with ${chalk.bold('--logging')} for more information`,\n );\n if (Telemetry.client) {\n console.log(\n `Your session id was ${Telemetry.client.commonProperties.sessionId}`,\n );\n }\n }\n if (error instanceof CodedError) {\n process.exitCode = CodedErrors[error.name as CodedErrorType];\n } else {\n process.exitCode = 1;\n }\n}\n\nfunction getPkgVersion(pkgName: string): string {\n try {\n const pkgJsonPath = require.resolve(`${pkgName}/package.json`, {\n paths: [process.cwd(), __dirname],\n });\n const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath).toString());\n if (pkgJson.name === pkgName && pkgJson.version !== undefined) {\n return pkgJson.version;\n }\n } catch {}\n newWarn(`Could not determine ${pkgName} version`);\n return '';\n}\n\n/**\n * Labels used by telemtry to represent current operation\n */\ntype RunWindowsPhase =\n | 'None'\n | 'AutoLink'\n | 'FindBuildTools'\n | 'FindSolution'\n | 'Deploy';\n\nlet runWindowsPhase: RunWindowsPhase = 'None';\n/**\n * Performs build deploy and launch of RNW apps.\n * @param args Unprocessed args passed from react-native CLI.\n * @param config Config passed from react-native CLI.\n * @param options Options passed from react-native CLI.\n */\nasync function runWindows(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n if (!options.telemetry) {\n if (options.logging) {\n console.log('Disabling telemetry');\n }\n Telemetry.disable();\n } else {\n Telemetry.setup();\n }\n\n // https://github.com/yarnpkg/yarn/issues/8334 - Yarn on Windows breaks apps that read from the environment variables\n // Yarn will run node via CreateProcess and pass npm_config_* variables in lowercase without unifying their value\n // with their possibly existing uppercase counterparts. This breaks programs that read from the environment block\n // and write to a case-insensitive dictionary since they expect to encounter each variable only once.\n // The values of the lowercase variables are the one npm actually wants to use, plus they are seeded from the\n // uppercase variable values one if there are no overrides.\n delete process.env.NPM_CONFIG_CACHE;\n delete process.env.NPM_CONFIG_PREFIX;\n\n const hasRunRnwDependencies =\n process.env.LocalAppData &&\n fs.existsSync(path.join(process.env.LocalAppData, 'rnw-dependencies.txt')); // CODESYNC \\vnext\\scripts\\rnw-dependencies.ps1\n\n if (options.info) {\n try {\n const output = await info.getEnvironmentInfo();\n console.log(output.trimEnd());\n console.log(' Installed UWP SDKs:');\n const sdks = MSBuildTools.getAllAvailableUAPVersions();\n sdks.forEach(version => console.log(' ' + version));\n return;\n } catch (err) {\n const e = err as Error;\n Telemetry.trackException(e);\n newError('Unable to print environment info.\\n' + e.toString());\n return setExitProcessWithError(e, options.logging);\n }\n }\n\n let runWindowsError;\n try {\n await runWindowsInternal(args, config, options);\n } catch (e) {\n Telemetry.trackException(e as Error);\n runWindowsError = e;\n if (!hasRunRnwDependencies) {\n const rnwPkgJsonPath = require.resolve(\n 'react-native-windows/package.json',\n {\n paths: [process.cwd(), __dirname],\n },\n );\n const rnwDependenciesPath = path.join(\n path.dirname(rnwPkgJsonPath),\n 'scripts/rnw-dependencies.ps1',\n );\n\n newError(\n `It is possible your installation is missing required software dependencies. Dependencies can be automatically installed by running ${rnwDependenciesPath} from an elevated PowerShell prompt.\\nFor more information, go to http://aka.ms/rnw-deps`,\n );\n }\n return setExitProcessWithError(e as Error, options.logging);\n } finally {\n Telemetry.client?.trackEvent({\n name: 'run-windows',\n properties: {\n release: options.release,\n arch: options.arch,\n singleproc: options.singleproc,\n emulator: options.emulator,\n device: options.device,\n target: options.target,\n remoteDebugging: options.remoteDebugging,\n logging: options.logging,\n packager: options.packager,\n bundle: options.bundle,\n launch: options.launch,\n autolink: options.autolink,\n build: options.bundle,\n deploy: options.deploy,\n sln: options.sln !== undefined,\n proj: options.proj !== undefined,\n msBuildProps:\n options.msbuildprops !== undefined\n ? options.msbuildprops!.split(',').length\n : 0,\n info: options.info,\n directDebugging: options.directDebugging,\n 'react-native-windows': getPkgVersion('react-native-windows'),\n 'react-native': getPkgVersion('react-native'),\n 'cli-version': getPkgVersion('@react-native-windows/cli'),\n msftInternal: isMSFTInternal(),\n durationInSecs: process.uptime(),\n success: runWindowsError === undefined,\n phase: runWindowsPhase,\n totalMem: totalmem(),\n diskFree: getDiskFreeSpace(__dirname),\n cpus: cpus().length,\n project: await getAnonymizedProjectName(config.root),\n hasRunRnwDependencies: hasRunRnwDependencies,\n },\n });\n Telemetry.client?.flush();\n }\n}\n\nexport async function getAnonymizedProjectName(\n projectRoot: string,\n): Promise<string | null> {\n const projectJsonPath = path.join(projectRoot, 'package.json');\n if (!fs.existsSync(projectJsonPath)) {\n return null;\n }\n\n const projectJson = JSON.parse(\n (await fs.promises.readFile(projectJsonPath)).toString(),\n );\n\n const projectName = projectJson.name;\n if (typeof projectName !== 'string') {\n return null;\n }\n\n // Ensure the project name cannot be reverse engineered to avoid leaking PII\n return crypto\n .createHash('sha256')\n .update(projectName)\n .digest('hex')\n .toString();\n}\n\nasync function runWindowsInternal(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n const verbose = options.logging === true;\n\n if (verbose) {\n newInfo('Verbose: ON');\n }\n\n // Get the solution file\n let slnFile;\n try {\n slnFile = build.getAppSolutionFile(options, config);\n } catch (e) {\n newError(`Couldn't get app solution information. ${(e as Error).message}`);\n throw e;\n }\n\n try {\n if (options.autolink) {\n const autolinkArgs: string[] = [];\n const autolinkConfig = config;\n const autoLinkOptions = {\n logging: options.logging,\n proj: options.proj,\n sln: options.sln,\n };\n runWindowsPhase = 'AutoLink';\n await autoLinkCommand.func(autolinkArgs, autolinkConfig, autoLinkOptions);\n } else {\n newInfo('Autolink step is skipped');\n }\n } catch (e) {\n newError(`Autolinking failed. ${(e as Error).message}`);\n throw e;\n }\n\n let buildTools: MSBuildTools;\n runWindowsPhase = 'FindBuildTools';\n try {\n buildTools = MSBuildTools.findAvailableVersion(options.arch, verbose);\n } catch (error) {\n newWarn('No public VS release found');\n // Try prerelease\n try {\n newInfo('Trying pre-release VS');\n buildTools = MSBuildTools.findAvailableVersion(\n options.arch,\n verbose,\n true, // preRelease\n );\n } catch (e) {\n newError((e as Error).message);\n throw error;\n }\n }\n\n if (options.build) {\n runWindowsPhase = 'FindSolution';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n // Get build/deploy options\n const buildType = deploy.getBuildConfiguration(options);\n const msBuildProps = build.parseMsBuildProps(options);\n\n // Disable the autolink check since we just ran it\n msBuildProps.RunAutolinkCheck = 'false';\n\n try {\n runWindowsPhase = 'FindSolution';\n await build.buildSolution(\n buildTools,\n slnFile!,\n buildType,\n options.arch,\n msBuildProps,\n verbose,\n 'build',\n options.buildLogDirectory,\n options.singleproc,\n );\n } catch (e) {\n newError(\n `Build failed with message ${\n (e as Error).message\n }. Check your build configuration.`,\n );\n if ((e as any).logfile) {\n console.log('See', chalk.bold((e as any).logfile));\n }\n throw e;\n }\n } else {\n newInfo('Build step is skipped');\n }\n\n if (shouldLaunchPackager(options)) {\n await deploy.startServerInNewWindow(options, verbose);\n }\n\n if (options.deploy) {\n runWindowsPhase = 'FindSolution';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n try {\n runWindowsPhase = 'Deploy';\n if (options.device || options.emulator || options.target) {\n await deploy.deployToDevice(options, verbose, config);\n } else {\n await deploy.deployToDesktop(options, verbose, config, buildTools);\n }\n } catch (e) {\n newError(`Failed to deploy${e ? `: ${(e as Error).message}` : ''}`);\n throw e;\n }\n } else {\n newInfo('Deploy step is skipped');\n }\n}\n\nfunction shouldLaunchPackager(options: RunWindowsOptions): boolean {\n return (\n options.packager === true &&\n options.launch === true &&\n options.release !== true\n );\n}\n\n/*\n// Example of running the Windows Command\nrunWindows({\n root: 'C:\\\\github\\\\hack\\\\myapp',\n debug: true,\n arch: 'x86',\n nugetPath: 'C:\\\\github\\\\react\\\\react-native-windows\\\\local-cli\\\\runWindows\\\\.nuget\\\\nuget.exe'\n});\n*/\n\n/**\n * Starts the app on a connected Windows emulator or mobile device.\n */\nexport const runWindowsCommand: Command = {\n name: 'run-windows',\n description:\n 'builds your app and starts it on a connected Windows desktop, emulator or device',\n func: runWindows,\n options: runWindowsOptions,\n};\n"]}
@@ -37,19 +37,19 @@ export interface RunWindowsOptions {
37
37
  device?: boolean;
38
38
  target?: string;
39
39
  remoteDebugging?: string;
40
- logging: boolean;
41
- packager: boolean;
42
- bundle: boolean;
43
- launch: boolean;
44
- autolink: boolean;
45
- build: boolean;
46
- deploy: boolean;
40
+ logging?: boolean;
41
+ packager?: boolean;
42
+ bundle?: boolean;
43
+ launch?: boolean;
44
+ autolink?: boolean;
45
+ build?: boolean;
46
+ deploy?: boolean;
47
47
  deployFromLayout?: boolean;
48
48
  sln?: string;
49
49
  proj?: string;
50
50
  msbuildprops?: string;
51
51
  buildLogDirectory?: string;
52
- info: boolean;
52
+ info?: boolean;
53
53
  directDebugging?: number;
54
54
  telemetry?: boolean;
55
55
  }
@@ -45,7 +45,6 @@ exports.runWindowsOptions = [
45
45
  {
46
46
  name: '--logging',
47
47
  description: 'Enables logging',
48
- default: false,
49
48
  },
50
49
  {
51
50
  name: '--no-packager',
@@ -54,32 +53,26 @@ exports.runWindowsOptions = [
54
53
  {
55
54
  name: '--bundle',
56
55
  description: 'Enable Bundle configuration and it would be ReleaseBundle/DebugBundle other than Release/Debug',
57
- default: false,
58
56
  },
59
57
  {
60
58
  name: '--no-launch',
61
59
  description: 'Do not launch the app after deployment',
62
- default: false,
63
60
  },
64
61
  {
65
62
  name: '--no-autolink',
66
63
  description: 'Do not run autolinking',
67
- default: false,
68
64
  },
69
65
  {
70
66
  name: '--no-build',
71
67
  description: 'Do not build the solution',
72
- default: false,
73
68
  },
74
69
  {
75
70
  name: '--no-deploy',
76
71
  description: 'Do not deploy the app',
77
- default: false,
78
72
  },
79
73
  {
80
74
  name: '--deploy-from-layout',
81
- description: 'Force deploy from layout, even in release builds',
82
- default: false,
75
+ description: 'Force deploy from layout',
83
76
  },
84
77
  {
85
78
  name: '--sln [string]',
@@ -102,7 +95,6 @@ exports.runWindowsOptions = [
102
95
  {
103
96
  name: '--info',
104
97
  description: 'Dump environment information',
105
- default: false,
106
98
  },
107
99
  {
108
100
  name: '--direct-debugging [number]',
@@ -112,7 +104,6 @@ exports.runWindowsOptions = [
112
104
  {
113
105
  name: '--no-telemetry',
114
106
  description: 'Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI',
115
- default: true,
116
107
  },
117
108
  ];
118
109
  function parseBuildArch(arg) {
@@ -1 +1 @@
1
- {"version":3,"file":"runWindowsOptions.js","sourceRoot":"","sources":["../../src/runWindows/runWindowsOptions.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAuDU,QAAA,iBAAiB,GAAoB;IAChD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,2BAA2B;KACzC;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,sFAAsF;QACxF,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI;KAC/B;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,0CAA0C;QACvD,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,cAAc;KACtB;IACD;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,2BAA2B;KACzC;IACD;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,gCAAgC;KAC9C;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,uCAAuC;KACrD;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,qDAAqD;KACnE;IACD;QACE,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,2CAA2C;KACzD;IACD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,iBAAiB;QAC9B,OAAO,EAAE,KAAK;KACf;IACD;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,uCAAuC;KACrD;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,gGAAgG;QAClG,OAAO,EAAE,KAAK;KACf;IACD;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,wCAAwC;QACrD,OAAO,EAAE,KAAK;KACf;IACD;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,wBAAwB;QACrC,OAAO,EAAE,KAAK;KACf;IACD;QACE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,CAAC,CAAC;IAE9B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;QAC1B,QAAQ,CAAC,uDAAuD,CAAC,CAAC;KACnE;IACD,IAAI,GAAG,GAAG,IAAI,IAAI,GAAG,IAAI,KAAK,EAAE;QAC9B,QAAQ,CAAC,uCAAuC,CAAC,CAAC;KACnD;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,QAAQ,CAAC,GAAW;IAC3B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {CommandOption} from '@react-native-community/cli-types';\n\nexport type BuildArch = 'x86' | 'x64' | 'ARM64';\nexport type BuildConfig = 'Debug' | 'DebugBundle' | 'Release' | 'ReleaseBundle';\n\n/**\n * * Options are the following:\n * release: Boolean - Specifies release build\n * root: String - The root of the application\n * arch: String - The build architecture (ARM64, x86, x64)\n * singleproc: Boolean - opt out of multi-proc builds\n * emulator: Boolean - Deploy to the emulator\n * device: Boolean - Deploy to a device\n * target: String - Device GUID to deploy to\n * remote-debugging: Boolean - Run using remote JS proxy\n * logging: Boolean - Enables logging\n * no-packager: Boolean - Do not launch packager while building\n * bundle: Boolean - Enable Bundle configuration.\n * no-launch: Boolean - Do not launch the app after deployment\n * no-build: Boolean - Do not build the solution\n * no-deploy: Boolean - Do not deploy the app\n * deploy-from-layout: Force deploy from layout, even in release builds\n * sln: String - Solution file to build\n * msbuildprops: String - Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2\n * direct-debugging: Number - Enable direct debugging on specified port\n * no-telemetry: Boolean - Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI\n */\nexport interface RunWindowsOptions {\n release?: boolean;\n root: string;\n arch: BuildArch;\n singleproc?: boolean;\n emulator?: boolean;\n device?: boolean;\n target?: string;\n remoteDebugging?: string;\n logging: boolean;\n packager: boolean;\n bundle: boolean;\n launch: boolean;\n autolink: boolean;\n build: boolean;\n deploy: boolean;\n deployFromLayout?: boolean;\n sln?: string;\n proj?: string;\n msbuildprops?: string;\n buildLogDirectory?: string;\n info: boolean;\n directDebugging?: number;\n telemetry?: boolean;\n}\n\nexport const runWindowsOptions: CommandOption[] = [\n {\n name: '--release',\n description: 'Specifies a release build',\n },\n {\n name: '--root [string]',\n description:\n 'Override the root directory for the windows build which contains the windows folder.',\n default: config => config.root,\n },\n {\n name: '--arch [string]',\n description: 'The build architecture (ARM64, x86, x64)',\n default: 'x86',\n parse: parseBuildArch,\n },\n {\n name: '--singleproc',\n description: 'Disables multi-proc build',\n },\n {\n name: '--emulator',\n description: 'Deploys the app to an emulator',\n },\n {\n name: '--device',\n description: 'Deploys the app to a connected device',\n },\n {\n name: '--target [string]',\n description: 'Deploys the app to the specified GUID for a device.',\n },\n {\n name: '--remote-debugging',\n description: 'Deploys the app in remote debugging mode.',\n },\n {\n name: '--logging',\n description: 'Enables logging',\n default: false,\n },\n {\n name: '--no-packager',\n description: 'Do not launch packager while building',\n },\n {\n name: '--bundle',\n description:\n 'Enable Bundle configuration and it would be ReleaseBundle/DebugBundle other than Release/Debug',\n default: false,\n },\n {\n name: '--no-launch',\n description: 'Do not launch the app after deployment',\n default: false,\n },\n {\n name: '--no-autolink',\n description: 'Do not run autolinking',\n default: false,\n },\n {\n name: '--no-build',\n description: 'Do not build the solution',\n default: false,\n },\n {\n name: '--no-deploy',\n description: 'Do not deploy the app',\n default: false,\n },\n {\n name: '--deploy-from-layout',\n description: 'Force deploy from layout, even in release builds',\n default: false,\n },\n {\n name: '--sln [string]',\n description:\n \"Override the app solution file determined by 'react-native config', e.g. windows\\\\myApp.sln\",\n default: undefined,\n },\n {\n name: '--proj [string]',\n description:\n \"Override the app project file determined by 'react-native config', e.g. windows\\\\myApp\\\\myApp.vcxproj\",\n default: undefined,\n },\n {\n name: '--msbuildprops [string]',\n description:\n 'Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2',\n },\n {\n name: '--buildLogDirectory [string]',\n description: 'Optional directory where msbuild log files should be stored',\n },\n {\n name: '--info',\n description: 'Dump environment information',\n default: false,\n },\n {\n name: '--direct-debugging [number]',\n description: 'Enable direct debugging on specified port',\n parse: parseDirectDebuggingPort,\n },\n {\n name: '--no-telemetry',\n description:\n 'Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI',\n default: true,\n },\n];\n\nfunction parseBuildArch(arg: string): BuildArch {\n const supportedArches: BuildArch[] = ['x86', 'x64', 'ARM64'];\n for (const supported of supportedArches) {\n if (arg.toLowerCase() === supported.toLowerCase()) {\n return supported;\n }\n }\n\n errorOut(`Unrecognized --arch '${arg}'. Expected one of ${supportedArches}`);\n}\n\nfunction parseDirectDebuggingPort(arg: string): number {\n const num = parseInt(arg, 10);\n\n if (!Number.isInteger(num)) {\n errorOut(`Expected argument '--direct-debugging' to be a number`);\n }\n if (num < 1024 || num >= 65535) {\n errorOut('Direct debugging port it out of range');\n }\n\n return num;\n}\n\nfunction errorOut(arg: string): never {\n console.error(arg);\n process.exit(1);\n}\n"]}
1
+ {"version":3,"file":"runWindowsOptions.js","sourceRoot":"","sources":["../../src/runWindows/runWindowsOptions.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAuDU,QAAA,iBAAiB,GAAoB;IAChD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,2BAA2B;KACzC;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,sFAAsF;QACxF,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI;KAC/B;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,0CAA0C;QACvD,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,cAAc;KACtB;IACD;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,2BAA2B;KACzC;IACD;QACE,IAAI,E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,CAAC;AAEF,SAAS,cAAc,CAAC,GAAW;IACjC,MAAM,eAAe,GAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC7D,KAAK,MAAM,SAAS,IAAI,eAAe,EAAE;QACvC,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,WAAW,EAAE,EAAE;YACjD,OAAO,SAAS,CAAC;SAClB;KACF;IAED,QAAQ,CAAC,wBAAwB,GAAG,sBAAsB,eAAe,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,wBAAwB,CAAC,GAAW;IAC3C,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAE9B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;QAC1B,QAAQ,CAAC,uDAAuD,CAAC,CAAC;KACnE;IACD,IAAI,GAAG,GAAG,IAAI,IAAI,GAAG,IAAI,KAAK,EAAE;QAC9B,QAAQ,CAAC,uCAAuC,CAAC,CAAC;KACnD;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,QAAQ,CAAC,GAAW;IAC3B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {CommandOption} from '@react-native-community/cli-types';\n\nexport type BuildArch = 'x86' | 'x64' | 'ARM64';\nexport type BuildConfig = 'Debug' | 'DebugBundle' | 'Release' | 'ReleaseBundle';\n\n/**\n * * Options are the following:\n * release: Boolean - Specifies release build\n * root: String - The root of the application\n * arch: String - The build architecture (ARM64, x86, x64)\n * singleproc: Boolean - opt out of multi-proc builds\n * emulator: Boolean - Deploy to the emulator\n * device: Boolean - Deploy to a device\n * target: String - Device GUID to deploy to\n * remote-debugging: Boolean - Run using remote JS proxy\n * logging: Boolean - Enables logging\n * no-packager: Boolean - Do not launch packager while building\n * bundle: Boolean - Enable Bundle configuration.\n * no-launch: Boolean - Do not launch the app after deployment\n * no-build: Boolean - Do not build the solution\n * no-deploy: Boolean - Do not deploy the app\n * deploy-from-layout: Force deploy from layout, even in release builds\n * sln: String - Solution file to build\n * msbuildprops: String - Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2\n * direct-debugging: Number - Enable direct debugging on specified port\n * no-telemetry: Boolean - Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI\n */\nexport interface RunWindowsOptions {\n release?: boolean;\n root: string;\n arch: BuildArch;\n singleproc?: boolean;\n emulator?: boolean;\n device?: boolean;\n target?: string;\n remoteDebugging?: string;\n logging?: boolean;\n packager?: boolean;\n bundle?: boolean;\n launch?: boolean;\n autolink?: boolean;\n build?: boolean;\n deploy?: boolean;\n deployFromLayout?: boolean;\n sln?: string;\n proj?: string;\n msbuildprops?: string;\n buildLogDirectory?: string;\n info?: boolean;\n directDebugging?: number;\n telemetry?: boolean;\n}\n\nexport const runWindowsOptions: CommandOption[] = [\n {\n name: '--release',\n description: 'Specifies a release build',\n },\n {\n name: '--root [string]',\n description:\n 'Override the root directory for the windows build which contains the windows folder.',\n default: config => config.root,\n },\n {\n name: '--arch [string]',\n description: 'The build architecture (ARM64, x86, x64)',\n default: 'x86',\n parse: parseBuildArch,\n },\n {\n name: '--singleproc',\n description: 'Disables multi-proc build',\n },\n {\n name: '--emulator',\n description: 'Deploys the app to an emulator',\n },\n {\n name: '--device',\n description: 'Deploys the app to a connected device',\n },\n {\n name: '--target [string]',\n description: 'Deploys the app to the specified GUID for a device.',\n },\n {\n name: '--remote-debugging',\n description: 'Deploys the app in remote debugging mode.',\n },\n {\n name: '--logging',\n description: 'Enables logging',\n },\n {\n name: '--no-packager',\n description: 'Do not launch packager while building',\n },\n {\n name: '--bundle',\n description:\n 'Enable Bundle configuration and it would be ReleaseBundle/DebugBundle other than Release/Debug',\n },\n {\n name: '--no-launch',\n description: 'Do not launch the app after deployment',\n },\n {\n name: '--no-autolink',\n description: 'Do not run autolinking',\n },\n {\n name: '--no-build',\n description: 'Do not build the solution',\n },\n {\n name: '--no-deploy',\n description: 'Do not deploy the app',\n },\n {\n name: '--deploy-from-layout',\n description: 'Force deploy from layout',\n },\n {\n name: '--sln [string]',\n description:\n \"Override the app solution file determined by 'react-native config', e.g. windows\\\\myApp.sln\",\n default: undefined,\n },\n {\n name: '--proj [string]',\n description:\n \"Override the app project file determined by 'react-native config', e.g. windows\\\\myApp\\\\myApp.vcxproj\",\n default: undefined,\n },\n {\n name: '--msbuildprops [string]',\n description:\n 'Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2',\n },\n {\n name: '--buildLogDirectory [string]',\n description: 'Optional directory where msbuild log files should be stored',\n },\n {\n name: '--info',\n description: 'Dump environment information',\n },\n {\n name: '--direct-debugging [number]',\n description: 'Enable direct debugging on specified port',\n parse: parseDirectDebuggingPort,\n },\n {\n name: '--no-telemetry',\n description:\n 'Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI',\n },\n];\n\nfunction parseBuildArch(arg: string): BuildArch {\n const supportedArches: BuildArch[] = ['x86', 'x64', 'ARM64'];\n for (const supported of supportedArches) {\n if (arg.toLowerCase() === supported.toLowerCase()) {\n return supported;\n }\n }\n\n errorOut(`Unrecognized --arch '${arg}'. Expected one of ${supportedArches}`);\n}\n\nfunction parseDirectDebuggingPort(arg: string): number {\n const num = parseInt(arg, 10);\n\n if (!Number.isInteger(num)) {\n errorOut(`Expected argument '--direct-debugging' to be a number`);\n }\n if (num < 1024 || num >= 65535) {\n errorOut('Direct debugging port it out of range');\n }\n\n return num;\n}\n\nfunction errorOut(arg: string): never {\n console.error(arg);\n process.exit(1);\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  * @format
5
5
  */
6
- import { Command, Dependency, ProjectConfig } from '@react-native-community/cli-types';
6
+ import { Command, CommandOption, Dependency, ProjectConfig } from '@react-native-community/cli-types';
7
7
  import { WindowsProjectConfig } from '../../config/projectConfig';
8
8
  import { Ora } from 'ora';
9
9
  export declare class AutolinkWindows {
@@ -73,11 +73,14 @@ export declare class AutolinkWindows {
73
73
  /** @return The CLI command to invoke autolink-windows independently */
74
74
  getAutolinkWindowsCommand(): string;
75
75
  }
76
- interface AutoLinkOptions {
77
- logging: boolean;
78
- check: boolean;
76
+ export interface AutoLinkOptions {
77
+ logging?: boolean;
78
+ check?: boolean;
79
79
  sln?: string;
80
80
  proj?: string;
81
81
  }
82
+ export declare const autolinkOptions: CommandOption[];
83
+ /**
84
+ * Performs auto-linking for RNW native modules and apps.
85
+ */
82
86
  export declare const autoLinkCommand: Command;
83
- export {};
@@ -19,7 +19,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
19
19
  var __importStar = (this && this.__importStar) || function (mod) {
20
20
  if (mod && mod.__esModule) return mod;
21
21
  var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
23
  __setModuleDefault(result, mod);
24
24
  return result;
25
25
  };
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  return (mod && mod.__esModule) ? mod : { "default": mod };
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.autoLinkCommand = exports.AutolinkWindows = void 0;
30
+ exports.autoLinkCommand = exports.autolinkOptions = exports.AutolinkWindows = void 0;
31
31
  // Types in this file are inaccurate compared to usage in terms of falsiness.
32
32
  // We should try to rewrite some of this to do automated schema validation to
33
33
  // guarantee correct types
@@ -436,10 +436,14 @@ class AutolinkWindows {
436
436
  if (experimentalFeatures) {
437
437
  const useWinUI3FromExperimentalFeatures = ((_a = configUtils
438
438
  .tryFindPropertyValue(experimentalFeatures.content, 'UseWinUI3')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true';
439
- // use the UseWinUI3 value in react-native.config.js, or if not present, the value from ExperimentalFeatures.props
439
+ // Check if WinUI2xVersion is specified in experimental features
440
+ const targetWinUI2xVersion = configUtils.tryFindPropertyValue(experimentalFeatures.content, 'WinUI2xVersion');
441
+ // Check if WinUI3Version is specified in experimental features
442
+ const targetWinUI3xVersion = configUtils.tryFindPropertyValue(experimentalFeatures.content, 'WinUI3Version');
443
+ // Use the UseWinUI3 value in react-native.config.js, or if not present, the value from ExperimentalFeatures.props
440
444
  changesNeeded = await this.updatePackagesConfigXAMLDialect(useWinUI3FromConfig !== undefined
441
445
  ? useWinUI3FromConfig
442
- : useWinUI3FromExperimentalFeatures);
446
+ : useWinUI3FromExperimentalFeatures, targetWinUI2xVersion, targetWinUI3xVersion);
443
447
  if (useWinUI3FromConfig !== undefined) {
444
448
  // Make sure ExperimentalFeatures.props matches the value that comes from react-native.config.js
445
449
  const node = experimentalFeatures.content.getElementsByTagName('UseWinUI3');
@@ -465,7 +469,7 @@ class AutolinkWindows {
465
469
  }
466
470
  return undefined;
467
471
  }
468
- async updatePackagesConfigXAMLDialect(useWinUI3) {
472
+ async updatePackagesConfigXAMLDialect(useWinUI3, targetWinUI2xVersion, targetWinUI3xVersion) {
469
473
  let changed = false;
470
474
  const packagesConfig = this.getPackagesConfigXml();
471
475
  if (packagesConfig) {
@@ -473,8 +477,10 @@ class AutolinkWindows {
473
477
  const project = this.getWindowsConfig();
474
478
  const winUIPropsPath = path_1.default.join(resolveRnwRoot(project), 'PropertySheets/WinUI.props');
475
479
  const winuiPropsContents = configUtils.readProjectFile(winUIPropsPath);
476
- const winui2xVersion = configUtils.tryFindPropertyValue(winuiPropsContents, 'WinUI2xVersion');
477
- const winui3Version = configUtils.tryFindPropertyValue(winuiPropsContents, 'WinUI3Version');
480
+ // Use the given WinUI2xVersion, otherwise fallback to WinUI.props
481
+ const winui2xVersion = targetWinUI2xVersion !== null && targetWinUI2xVersion !== void 0 ? targetWinUI2xVersion : configUtils.tryFindPropertyValue(winuiPropsContents, 'WinUI2xVersion');
482
+ // Use the given WinUI3Version, otherwise fallback to WinUI.props
483
+ const winui3Version = targetWinUI3xVersion !== null && targetWinUI3xVersion !== void 0 ? targetWinUI3xVersion : configUtils.tryFindPropertyValue(winuiPropsContents, 'WinUI3Version');
478
484
  const dialects = [
479
485
  { id: 'Microsoft.WinUI', version: winui3Version },
480
486
  { id: 'Microsoft.UI.Xaml', version: winui2xVersion },
@@ -568,7 +574,7 @@ function verboseMessage(message, verbose) {
568
574
  */
569
575
  async function updateAutoLink(args, config, options) {
570
576
  const startTime = perf_hooks_1.performance.now();
571
- const spinner = commandWithProgress_1.newSpinner(options.check ? 'Checking auto-linked files...' : 'Auto-linking...');
577
+ const spinner = (0, commandWithProgress_1.newSpinner)(options.check ? 'Checking auto-linked files...' : 'Auto-linking...');
572
578
  try {
573
579
  const autolink = new AutolinkWindows(config.project, config.dependencies, options);
574
580
  await autolink.run(spinner);
@@ -592,31 +598,33 @@ async function updateAutoLink(args, config, options) {
592
598
  throw e;
593
599
  }
594
600
  }
601
+ exports.autolinkOptions = [
602
+ {
603
+ name: '--logging',
604
+ description: 'Verbose output logging',
605
+ },
606
+ {
607
+ name: '--check',
608
+ description: 'Only check whether any autolinked files need to change',
609
+ },
610
+ {
611
+ name: '--sln [string]',
612
+ description: "Override the app solution file determined by 'react-native config', e.g. windows\\myApp.sln",
613
+ default: undefined,
614
+ },
615
+ {
616
+ name: '--proj [string]',
617
+ description: "Override the app project file determined by 'react-native config', e.g. windows\\myApp\\myApp.vcxproj",
618
+ default: undefined,
619
+ },
620
+ ];
621
+ /**
622
+ * Performs auto-linking for RNW native modules and apps.
623
+ */
595
624
  exports.autoLinkCommand = {
596
625
  name: 'autolink-windows',
597
626
  description: 'performs autolinking',
598
627
  func: updateAutoLink,
599
- options: [
600
- {
601
- name: '--logging',
602
- description: 'Verbose output logging',
603
- default: false,
604
- },
605
- {
606
- name: '--check',
607
- description: 'Only check whether any autolinked files need to change',
608
- default: false,
609
- },
610
- {
611
- name: '--sln [string]',
612
- description: "Override the app solution file determined by 'react-native config', e.g. windows\\myApp.sln",
613
- default: undefined,
614
- },
615
- {
616
- name: '--proj [string]',
617
- description: "Override the app project file determined by 'react-native config', e.g. windows\\myApp\\myApp.vcxproj",
618
- default: undefined,
619
- },
620
- ],
628
+ options: exports.autolinkOptions,
621
629
  };
622
630
  //# sourceMappingURL=autolink.js.map