@react-native-windows/cli 0.0.0-canary.13 → 0.0.0-canary.130

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 (80) hide show
  1. package/README.md +47 -0
  2. package/lib-commonjs/config/configUtils.d.ts +25 -2
  3. package/lib-commonjs/config/configUtils.js +138 -30
  4. package/lib-commonjs/config/configUtils.js.map +1 -1
  5. package/lib-commonjs/config/dependencyConfig.js +104 -43
  6. package/lib-commonjs/config/dependencyConfig.js.map +1 -1
  7. package/lib-commonjs/config/projectConfig.d.ts +4 -1
  8. package/lib-commonjs/config/projectConfig.js +72 -12
  9. package/lib-commonjs/config/projectConfig.js.map +1 -1
  10. package/lib-commonjs/e2etest/autolink.test.d.ts +6 -0
  11. package/lib-commonjs/e2etest/autolink.test.js +386 -0
  12. package/lib-commonjs/e2etest/autolink.test.js.map +1 -0
  13. package/lib-commonjs/e2etest/dependencyConfig.test.d.ts +6 -0
  14. package/lib-commonjs/e2etest/dependencyConfig.test.js +130 -0
  15. package/lib-commonjs/e2etest/dependencyConfig.test.js.map +1 -0
  16. package/lib-commonjs/e2etest/projectConfig.test.d.ts +6 -0
  17. package/lib-commonjs/e2etest/projectConfig.test.js +111 -0
  18. package/lib-commonjs/e2etest/projectConfig.test.js.map +1 -0
  19. package/lib-commonjs/e2etest/projectConfig.utils.d.ts +8 -0
  20. package/lib-commonjs/e2etest/projectConfig.utils.js +77 -0
  21. package/lib-commonjs/e2etest/projectConfig.utils.js.map +1 -0
  22. package/lib-commonjs/e2etest/runWindows.test.d.ts +6 -0
  23. package/lib-commonjs/e2etest/runWindows.test.js +61 -0
  24. package/lib-commonjs/e2etest/runWindows.test.js.map +1 -0
  25. package/lib-commonjs/generator-common/index.d.ts +16 -0
  26. package/lib-commonjs/generator-common/index.js +60 -39
  27. package/lib-commonjs/generator-common/index.js.map +1 -1
  28. package/lib-commonjs/generator-windows/index.d.ts +2 -2
  29. package/lib-commonjs/generator-windows/index.js +265 -182
  30. package/lib-commonjs/generator-windows/index.js.map +1 -1
  31. package/lib-commonjs/healthChecks.d.ts +2 -0
  32. package/lib-commonjs/healthChecks.js +88 -0
  33. package/lib-commonjs/healthChecks.js.map +1 -0
  34. package/lib-commonjs/index.d.ts +5 -0
  35. package/lib-commonjs/index.js +28 -8
  36. package/lib-commonjs/index.js.map +1 -1
  37. package/lib-commonjs/runWindows/runWindows.js +239 -52
  38. package/lib-commonjs/runWindows/runWindows.js.map +1 -1
  39. package/lib-commonjs/runWindows/runWindowsOptions.d.ts +14 -10
  40. package/lib-commonjs/runWindows/runWindowsOptions.js +15 -11
  41. package/lib-commonjs/runWindows/runWindowsOptions.js.map +1 -1
  42. package/lib-commonjs/runWindows/utils/autolink.d.ts +88 -1
  43. package/lib-commonjs/runWindows/utils/autolink.js +594 -260
  44. package/lib-commonjs/runWindows/utils/autolink.js.map +1 -1
  45. package/lib-commonjs/runWindows/utils/build.d.ts +1 -2
  46. package/lib-commonjs/runWindows/utils/build.js +24 -31
  47. package/lib-commonjs/runWindows/utils/build.js.map +1 -1
  48. package/lib-commonjs/runWindows/utils/checkRequirements.js +11 -7
  49. package/lib-commonjs/runWindows/utils/checkRequirements.js.map +1 -1
  50. package/lib-commonjs/runWindows/utils/commandWithProgress.d.ts +11 -3
  51. package/lib-commonjs/runWindows/utils/commandWithProgress.js +58 -22
  52. package/lib-commonjs/runWindows/utils/commandWithProgress.js.map +1 -1
  53. package/lib-commonjs/runWindows/utils/deploy.d.ts +1 -1
  54. package/lib-commonjs/runWindows/utils/deploy.js +168 -82
  55. package/lib-commonjs/runWindows/utils/deploy.js.map +1 -1
  56. package/lib-commonjs/runWindows/utils/info.js +5 -2
  57. package/lib-commonjs/runWindows/utils/info.js.map +1 -1
  58. package/lib-commonjs/runWindows/utils/msbuildtools.d.ts +11 -5
  59. package/lib-commonjs/runWindows/utils/msbuildtools.js +148 -64
  60. package/lib-commonjs/runWindows/utils/msbuildtools.js.map +1 -1
  61. package/lib-commonjs/runWindows/utils/telemetryHelpers.d.ts +29 -0
  62. package/lib-commonjs/runWindows/utils/telemetryHelpers.js +113 -0
  63. package/lib-commonjs/runWindows/utils/telemetryHelpers.js.map +1 -0
  64. package/lib-commonjs/runWindows/utils/version.d.ts +4 -4
  65. package/lib-commonjs/runWindows/utils/version.js.map +1 -1
  66. package/lib-commonjs/runWindows/utils/vsInstalls.d.ts +4 -1
  67. package/lib-commonjs/runWindows/utils/vsInstalls.js +22 -7
  68. package/lib-commonjs/runWindows/utils/vsInstalls.js.map +1 -1
  69. package/lib-commonjs/runWindows/utils/vstools.d.ts +1 -0
  70. package/lib-commonjs/runWindows/utils/vstools.js +40 -27
  71. package/lib-commonjs/runWindows/utils/vstools.js.map +1 -1
  72. package/lib-commonjs/runWindows/utils/winappdeploytool.d.ts +3 -3
  73. package/lib-commonjs/runWindows/utils/winappdeploytool.js +17 -14
  74. package/lib-commonjs/runWindows/utils/winappdeploytool.js.map +1 -1
  75. package/package.json +40 -22
  76. package/powershell/Add-AppDevPackage.ps1 +2 -2
  77. package/powershell/Eval-MsBuildProperties.ps1 +156 -0
  78. package/powershell/WindowsStoreAppUtils.ps1 +10 -0
  79. package/CHANGELOG.json +0 -185
  80. package/CHANGELOG.md +0 -93
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getHealthChecks = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const child_process_1 = require("child_process");
9
+ const rnDir = path_1.default.dirname(require.resolve('react-native/package.json', { paths: [process.cwd()] }));
10
+ const cliDir = path_1.default.dirname(require.resolve('@react-native-community/cli/package.json', { paths: [rnDir] }));
11
+ const execaPath = require.resolve('execa', { paths: [cliDir] });
12
+ const execa = require(execaPath);
13
+ const commandWithProgress_1 = require("./runWindows/utils/commandWithProgress");
14
+ function getHealthChecks() {
15
+ // #8471: There are known cases where the dependencies script will error out.
16
+ // Fail gracefully if that happens in the meantime.
17
+ try {
18
+ return getHealthChecksUnsafe();
19
+ }
20
+ catch (_a) {
21
+ return [{
22
+ label: 'Windows',
23
+ healthchecks: [{
24
+ label: 'Failed to enumerate health checks',
25
+ getDiagnostics: async () => ({ needsToBeFixed: true }),
26
+ runAutomaticFix: async ({ loader }) => { loader.fail(); },
27
+ }]
28
+ }];
29
+ }
30
+ }
31
+ exports.getHealthChecks = getHealthChecks;
32
+ function getHealthChecksUnsafe() {
33
+ // All our health checks are windows only...
34
+ if (process.platform !== 'win32') {
35
+ return undefined;
36
+ }
37
+ const rnwDepScriptPath = path_1.default.join(path_1.default.dirname(require.resolve('react-native-windows/package.json', { paths: [process.cwd()] })), 'Scripts/rnw-dependencies.ps1');
38
+ const rnwDeps = (0, child_process_1.execSync)(`${commandWithProgress_1.powershell} -ExecutionPolicy Unrestricted -NoProfile "${rnwDepScriptPath}" -NoPrompt -ListChecks`, { stdio: 'pipe' });
39
+ const deps = rnwDeps.toString().trim().split('\n');
40
+ return [
41
+ {
42
+ label: 'Windows',
43
+ healthchecks: deps.map(dep => {
44
+ const match = /([^:]+): ([^:]+): (.*)/.exec(dep);
45
+ if (!match) {
46
+ throw new Error(`Unexpected output from ${rnwDepScriptPath}`);
47
+ }
48
+ const [, /*optional*/ , id, name] = match;
49
+ return {
50
+ label: name,
51
+ // The schema check of react-native doctor requires this to be a string, although it should be a boolean
52
+ // Enable this once we pick up a new version of the CLI that includes https://github.com/react-native-community/cli/pull/1367
53
+ // isRequired: (optional.trim() === 'Required') ? true : false,
54
+ getDiagnostics: async () => {
55
+ let needsToBeFixed = true;
56
+ try {
57
+ await execa(`${commandWithProgress_1.powershell} -ExecutionPolicy Unrestricted -NoProfile "${rnwDepScriptPath}" -NoPrompt -Check ${id}`);
58
+ needsToBeFixed = false;
59
+ }
60
+ catch (_a) {
61
+ }
62
+ return {
63
+ needsToBeFixed,
64
+ };
65
+ },
66
+ runAutomaticFix: async ({ loader, logManualInstallation }) => {
67
+ const command = `${commandWithProgress_1.powershell} -ExecutionPolicy Unrestricted -NoProfile "${rnwDepScriptPath}" -Check ${id}`;
68
+ try {
69
+ const { exitCode } = await execa(command, { stdio: 'inherit' });
70
+ if (exitCode) {
71
+ logManualInstallation({ command, healthcheck: `react-native-windows dependency "${id}"` });
72
+ loader.fail();
73
+ }
74
+ else {
75
+ loader.succeed();
76
+ }
77
+ }
78
+ catch (_a) {
79
+ logManualInstallation({ command, healthcheck: `react-native-windows dependency "${id}"` });
80
+ loader.fail();
81
+ }
82
+ }
83
+ };
84
+ })
85
+ }
86
+ ];
87
+ }
88
+ //# sourceMappingURL=healthChecks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"healthChecks.js","sourceRoot":"","sources":["../src/healthChecks.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,iDAAwC;AAExC,MAAM,KAAK,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,2BAA2B,EAAE,EAAC,KAAK,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAC,CAAC,CAAC,CAAC;AACnG,MAAM,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,0CAA0C,EAAE,EAAC,KAAK,EAAE,CAAC,KAAK,CAAC,EAAC,CAAC,CAAC,CAAC;AAC3G,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAChE,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAGjC,gFAAoE;AAEpE,SAAgB,eAAe;IAC7B,6EAA6E;IAC7E,mDAAmD;IACnD,IAAI;QACF,OAAO,qBAAqB,EAAE,CAAC;KAChC;IAAC,WAAM;QACN,OAAO,CAAC;gBACN,KAAK,EAAE,SAAS;gBAChB,YAAY,EAAE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ACL,KAAK,EAAE,IAAI;oBACX,wGAAwG;oBACxG,6HAA6H;oBAC7H,gEAAgE;oBAChE,cAAc,EAAE,KAAK,IAAI,EAAE;wBACzB,IAAI,cAAc,GAAG,IAAI,CAAC;wBAC1B,IAAI;4BACF,MAAM,KAAK,CAAC,GAAG,gCAAU,8CAA8C,gBAAgB,sBAAsB,EAAE,EAAE,CAAC,CAAC;4BACnH,cAAc,GAAG,KAAK,CAAC;yBACxB;wBAAC,WAAM;yBACP;wBACD,OAAO;4BACL,cAAc;yBACf,CAAA;oBACH,CAAC;oBACD,eAAe,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE,EAAE,EAAE;wBAC3D,MAAM,OAAO,GAAG,GAAG,gCAAU,8CAA8C,gBAAgB,YAAY,EAAE,EAAE,CAAC;wBAC5G,IAAI;4BACF,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;4BAChE,IAAI,QAAQ,EAAE;gCACZ,qBAAqB,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,oCAAoC,EAAE,GAAG,EAAE,CAAC,CAAC;gCAC3F,MAAM,CAAC,IAAI,EAAE,CAAC;6BACf;iCAAM;gCACL,MAAM,CAAC,OAAO,EAAE,CAAC;6BAClB;yBACF;wBAAC,WAAM;4BACN,qBAAqB,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,oCAAoC,EAAE,GAAG,EAAE,CAAC,CAAC;4BAC3F,MAAM,CAAC,IAAI,EAAE,CAAC;yBACf;oBACH,CAAC;iBACF,CAAA;YACH,CAAC,CAAC;SACL;KAAC,CAAC;AACP,CAAC","sourcesContent":["import path from 'path';\n\nimport { execSync} from 'child_process';\n\nconst rnDir = path.dirname(require.resolve('react-native/package.json', {paths: [process.cwd()]}));\nconst cliDir = path.dirname(require.resolve('@react-native-community/cli/package.json', {paths: [rnDir]}));\nconst execaPath = require.resolve('execa', { paths: [cliDir] });\nconst execa = require(execaPath);\n\nimport type {HealthCheckCategory} from '@react-native-community/cli-types';\nimport { powershell } from './runWindows/utils/commandWithProgress';\n\nexport function getHealthChecks(): HealthCheckCategory[] | undefined {\n // #8471: There are known cases where the dependencies script will error out.\n // Fail gracefully if that happens in the meantime.\n try {\n return getHealthChecksUnsafe();\n } catch {\n return [{\n label: 'Windows',\n healthchecks: [{\n label: 'Failed to enumerate health checks',\n getDiagnostics: async () => ({needsToBeFixed: true}),\n runAutomaticFix: async ({loader}) => {loader.fail()},\n }]\n }];\n }\n}\n\nfunction getHealthChecksUnsafe(): HealthCheckCategory[] | undefined {\n// All our health checks are windows only...\n if (process.platform !== 'win32') {\n return undefined;\n }\n\n const rnwDepScriptPath = path.join(path.dirname(require.resolve(\n 'react-native-windows/package.json',\n {paths: [process.cwd()]})), 'Scripts/rnw-dependencies.ps1');\n \n const rnwDeps = execSync(`${powershell} -ExecutionPolicy Unrestricted -NoProfile \"${rnwDepScriptPath}\" -NoPrompt -ListChecks`, {stdio: 'pipe'});\n const deps = rnwDeps.toString().trim().split('\\n');\n return [\n {\n label: 'Windows',\n healthchecks:\n deps.map(dep => {\n const match = /([^:]+): ([^:]+): (.*)/.exec(dep);\n if (!match) {\n throw new Error(`Unexpected output from ${rnwDepScriptPath}`);\n }\n const [, /*optional*/, id, name] = match;\n return {\n label: name,\n // The schema check of react-native doctor requires this to be a string, although it should be a boolean\n // Enable this once we pick up a new version of the CLI that includes https://github.com/react-native-community/cli/pull/1367\n // isRequired: (optional.trim() === 'Required') ? true : false, \n getDiagnostics: async () => {\n let needsToBeFixed = true;\n try {\n await execa(`${powershell} -ExecutionPolicy Unrestricted -NoProfile \"${rnwDepScriptPath}\" -NoPrompt -Check ${id}`);\n needsToBeFixed = false;\n } catch {\n }\n return {\n needsToBeFixed,\n }\n },\n runAutomaticFix: async ({ loader, logManualInstallation }) => {\n const command = `${powershell} -ExecutionPolicy Unrestricted -NoProfile \"${rnwDepScriptPath}\" -Check ${id}`;\n try {\n const { exitCode } = await execa(command, { stdio: 'inherit' });\n if (exitCode) {\n logManualInstallation({ command, healthcheck: `react-native-windows dependency \"${id}\"` });\n loader.fail();\n } else {\n loader.succeed();\n }\n } catch {\n logManualInstallation({ command, healthcheck: `react-native-windows dependency \"${id}\"` });\n loader.fail();\n }\n }\n }\n })\n }];\n }"]}
@@ -25,11 +25,15 @@ import { projectConfigWindows } from './config/projectConfig';
25
25
  export interface GenerateOptions {
26
26
  overwrite: boolean;
27
27
  language: 'cpp' | 'cs';
28
+ projectType: 'app' | 'lib';
28
29
  experimentalNuGetDependency: boolean;
29
30
  nuGetTestVersion?: string;
30
31
  nuGetTestFeed?: string;
31
32
  useWinUI3: boolean;
33
+ useHermes: boolean;
34
+ useDevMode: boolean;
32
35
  verbose: boolean;
36
+ telemetry: boolean;
33
37
  }
34
38
  /**
35
39
  * Simple utility for running the Windows generator.
@@ -43,3 +47,4 @@ export declare function generateWindows(projectDir: string, name: string, ns: st
43
47
  export declare const commands: import("@react-native-community/cli-types").Command<false>[];
44
48
  export declare const dependencyConfig: typeof dependencyConfigWindows;
45
49
  export declare const projectConfig: typeof projectConfigWindows;
50
+ export * from './healthChecks';
@@ -4,10 +4,27 @@
4
4
  * Licensed under the MIT License.
5
5
  * @format
6
6
  */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
7
24
  Object.defineProperty(exports, "__esModule", { value: true });
8
25
  exports.projectConfig = exports.dependencyConfig = exports.commands = exports.generateWindows = void 0;
9
- const fs = require("fs");
10
- const path = require("path");
26
+ const fs_1 = __importDefault(require("@react-native-windows/fs"));
27
+ const path_1 = __importDefault(require("path"));
11
28
  const generator_windows_1 = require("./generator-windows");
12
29
  const autolink_1 = require("./runWindows/utils/autolink");
13
30
  const runWindows_1 = require("./runWindows/runWindows");
@@ -22,13 +39,15 @@ const projectConfig_1 = require("./config/projectConfig");
22
39
  * @param options command line options container
23
40
  */
24
41
  async function generateWindows(projectDir, name, ns, options) {
25
- if (!fs.existsSync(projectDir)) {
26
- fs.mkdirSync(projectDir);
42
+ if (!fs_1.default.existsSync(projectDir)) {
43
+ fs_1.default.mkdirSync(projectDir);
27
44
  }
28
- generator_windows_1.installDependencies(options);
29
- const rnwPackage = path.dirname(require.resolve('react-native-windows/package.json', { paths: [projectDir] }));
30
- const templateRoot = path.join(rnwPackage, 'template');
31
- await generator_windows_1.copyProjectTemplateAndReplace(templateRoot, projectDir, name, ns, options);
45
+ await (0, generator_windows_1.installScriptsAndDependencies)(options);
46
+ const rnwPackage = path_1.default.dirname(require.resolve('react-native-windows/package.json', {
47
+ paths: [projectDir],
48
+ }));
49
+ const templateRoot = path_1.default.join(rnwPackage, 'template');
50
+ await (0, generator_windows_1.copyProjectTemplateAndReplace)(templateRoot, projectDir, name, ns, options);
32
51
  }
33
52
  exports.generateWindows = generateWindows;
34
53
  // Assert the interface here doesn't change for the reasons above
@@ -37,4 +56,5 @@ assertStableInterface;
37
56
  exports.commands = [autolink_1.autoLinkCommand, runWindows_1.runWindowsCommand];
38
57
  exports.dependencyConfig = dependencyConfig_1.dependencyConfigWindows;
39
58
  exports.projectConfig = projectConfig_1.projectConfigWindows;
59
+ __exportStar(require("./healthChecks"), exports);
40
60
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,yBAAyB;AACzB,6BAA6B;AAC7B,2DAG6B;AAE7B,0DAA4D;AAC5D,wDAA0D;AAC1D,gEAAkE;AAClE,0DAA4D;AA6B5D;;;;;;;GAOG;AACI,KAAK,UAAU,eAAe,CACnC,UAAkB,EAClB,IAAY,EACZ,EAAU,EACV,OAAwB;IAExB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QAC9B,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;KAC1B;IAED,uCAAmB,CAAC,OAAO,CAAC,CAAC;IAE7B,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,OAAO,CAAC,OAAO,CAAC,mCAAmC,EAAE,EAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAC,CAAC,CAC5E,CAAC;IACF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACvD,MAAM,iDAA6B,CACjC,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,EAAE,EACF,OAAO,CACR,CAAC;AACJ,CAAC;AAvBD,0CAuBC;AAED,iEAAiE;AACjE,MAAM,qBAAqB,GAOf,IAAI,CAAC;AACjB,qBAAqB,CAAC;AAET,QAAA,QAAQ,GAAG,CAAC,0BAAe,EAAE,8BAAiB,CAAC,CAAC;AAChD,QAAA,gBAAgB,GAAG,0CAAuB,CAAC;AAC3C,QAAA,aAAa,GAAG,oCAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;AAEH,kEAA0C;AAC1C,gDAAwB;AAExB,2DAG6B;AAE7B,0DAA4D;AAC5D,wDAA0D;AAC1D,gEAAkE;AAClE,0DAA4D;AAiC5D;;;;;;;GAOG;AACI,KAAK,UAAU,eAAe,CACnC,UAAkB,EAClB,IAAY,EACZ,EAAU,EACV,OAAwB;IAExB,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QAC9B,YAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;KAC1B;IAED,MAAM,IAAA,iDAA6B,EAAC,OAAO,CAAC,CAAC;IAE7C,MAAM,UAAU,GAAG,cAAI,CAAC,OAAO,CAC7B,OAAO,CAAC,OAAO,CAAC,mCAAmC,EAAE;QACnD,KAAK,EAAE,CAAC,UAAU,CAAC;KACpB,CAAC,CACH,CAAC;IACF,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACvD,MAAM,IAAA,iDAA6B,EACjC,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,EAAE,EACF,OAAO,CACR,CAAC;AACJ,CAAC;AAzBD,0CAyBC;AAED,iEAAiE;AACjE,MAAM,qBAAqB,GAOf,IAAI,CAAC;AACjB,qBAAqB,CAAC;AAET,QAAA,QAAQ,GAAG,CAAC,0BAAe,EAAE,8BAAiB,CAAC,CAAC;AAChD,QAAA,gBAAgB,GAAG,0CAAuB,CAAC;AAC3C,QAAA,aAAa,GAAG,oCAAoB,CAAC;AAClD,iDAA+B","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\n\nimport {\n copyProjectTemplateAndReplace,\n installScriptsAndDependencies,\n} from './generator-windows';\n\nimport {autoLinkCommand} from './runWindows/utils/autolink';\nimport {runWindowsCommand} from './runWindows/runWindows';\nimport {dependencyConfigWindows} from './config/dependencyConfig';\nimport {projectConfigWindows} from './config/projectConfig';\n\n/**\n * Project generation options\n *\n * _\n * | |\n * __| | __ _ _ __ __ _ ___ _ __\n * / _` |/ _` | '_ \\ / _` |/ _ \\ '__|\n * | (_| | (_| | | | | (_| | __/ |\n * \\__,_|\\__,_|_| |_|\\__, |\\___|_|\n * __/ |\n * |___/\n *\n *\n * Properties on this interface must remain stable, as new versions of\n * react-native-windows-init may be used with local-cli dating back to 0.61.\n * All existing arguments must work correctly when changing this interface.\n */\nexport interface GenerateOptions {\n overwrite: boolean;\n language: 'cpp' | 'cs';\n projectType: 'app' | 'lib';\n experimentalNuGetDependency: boolean;\n nuGetTestVersion?: string;\n nuGetTestFeed?: string;\n useWinUI3: boolean;\n useHermes: boolean;\n useDevMode: boolean;\n verbose: boolean;\n telemetry: boolean;\n}\n\n/**\n * Simple utility for running the Windows generator.\n *\n * @param projectDir root project directory (i.e. contains index.js)\n * @param name name of the root JS module for this app\n * @param ns namespace for the project\n * @param options command line options container\n */\nexport async function generateWindows(\n projectDir: string,\n name: string,\n ns: string,\n options: GenerateOptions,\n) {\n if (!fs.existsSync(projectDir)) {\n fs.mkdirSync(projectDir);\n }\n\n await installScriptsAndDependencies(options);\n\n const rnwPackage = path.dirname(\n require.resolve('react-native-windows/package.json', {\n paths: [projectDir],\n }),\n );\n const templateRoot = path.join(rnwPackage, 'template');\n await copyProjectTemplateAndReplace(\n templateRoot,\n projectDir,\n name,\n ns,\n options,\n );\n}\n\n// Assert the interface here doesn't change for the reasons above\nconst assertStableInterface: typeof generateWindows extends (\n projectDir: string,\n name: string,\n ns: string,\n options: GenerateOptions,\n) => Promise<void>\n ? true\n : never = true;\nassertStableInterface;\n\nexport const commands = [autoLinkCommand, runWindowsCommand];\nexport const dependencyConfig = dependencyConfigWindows;\nexport const projectConfig = projectConfigWindows;\nexport * from './healthChecks';\n"]}
@@ -4,118 +4,305 @@
4
4
  * Licensed under the MIT License.
5
5
  * @format
6
6
  */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || function (mod) {
24
+ if (mod && mod.__esModule) return mod;
25
+ var result = {};
26
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
27
+ __setModuleDefault(result, mod);
28
+ return result;
29
+ };
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
7
33
  Object.defineProperty(exports, "__esModule", { value: true });
8
34
  exports.runWindowsCommand = void 0;
9
- const build = require("./utils/build");
10
- const chalk = require("chalk");
11
- const deploy = require("./utils/deploy");
35
+ const fs_1 = __importDefault(require("@react-native-windows/fs"));
36
+ const path_1 = __importDefault(require("path"));
37
+ const telemetry_1 = require("@react-native-windows/telemetry");
38
+ const build = __importStar(require("./utils/build"));
39
+ const chalk_1 = __importDefault(require("chalk"));
40
+ const deploy = __importStar(require("./utils/deploy"));
12
41
  const commandWithProgress_1 = require("./utils/commandWithProgress");
13
- const info = require("./utils/info");
14
- const msbuildtools_1 = require("./utils/msbuildtools");
42
+ const telemetryHelpers_1 = require("./utils/telemetryHelpers");
43
+ const info = __importStar(require("./utils/info"));
44
+ const msbuildtools_1 = __importDefault(require("./utils/msbuildtools"));
15
45
  const runWindowsOptions_1 = require("./runWindowsOptions");
16
46
  const autolink_1 = require("./utils/autolink");
17
- function ExitProcessWithError(loggingWasEnabled) {
18
- if (!loggingWasEnabled) {
19
- console.log(`Re-run the command with ${chalk.bold('--logging')} for more information`);
47
+ /**
48
+ * Sanitizes the given option for telemetery.
49
+ * @param key The key of the option.
50
+ * @param value The unsanitized value of the option.
51
+ * @returns The sanitized value of the option.
52
+ */
53
+ // eslint-disable-next-line complexity
54
+ function optionSanitizer(key, value) {
55
+ // Do not add a default case here.
56
+ // Strings risking PII should just return true if present, false otherwise.
57
+ // All others should return the value (or false if undefined).
58
+ switch (key) {
59
+ case 'root':
60
+ case 'target':
61
+ case 'sln':
62
+ case 'proj':
63
+ case 'buildLogDirectory':
64
+ return value === undefined ? false : true; // Strip PII
65
+ case 'msbuildprops':
66
+ return value === undefined ? 0 : value.split(',').length; // Convert to count
67
+ case 'release':
68
+ case 'arch':
69
+ case 'singleproc':
70
+ case 'emulator':
71
+ case 'device':
72
+ case 'remoteDebugging':
73
+ case 'logging':
74
+ case 'packager':
75
+ case 'bundle':
76
+ case 'launch':
77
+ case 'autolink':
78
+ case 'build':
79
+ case 'deploy':
80
+ case 'deployFromLayout':
81
+ case 'info':
82
+ case 'directDebugging':
83
+ case 'telemetry':
84
+ return value === undefined ? false : value; // Return value
20
85
  }
21
- process.exit(1);
22
86
  }
23
87
  /**
24
- * Performs build deploy and launch of RNW apps.
88
+ * Get the extra props to add to the `run-windows` telemetry event.
89
+ * @returns The extra props.
90
+ */
91
+ async function getExtraProps() {
92
+ const extraProps = {
93
+ phase: runWindowsPhase,
94
+ hasRunRnwDependencies,
95
+ msBuildProps: evaluateMSBuildPropsCallback
96
+ ? evaluateMSBuildPropsCallback()
97
+ : {},
98
+ };
99
+ return extraProps;
100
+ }
101
+ let runWindowsPhase = 'None';
102
+ let hasRunRnwDependencies = false;
103
+ let evaluateMSBuildPropsCallback;
104
+ /**
105
+ * The function run when calling `react-native run-windows`.
25
106
  * @param args Unprocessed args passed from react-native CLI.
26
107
  * @param config Config passed from react-native CLI.
27
108
  * @param options Options passed from react-native CLI.
28
109
  */
29
110
  async function runWindows(args, config, options) {
30
- const verbose = options.logging;
31
- if (verbose) {
32
- commandWithProgress_1.newInfo('Verbose: ON');
111
+ await (0, telemetryHelpers_1.startTelemetrySession)('run-windows', config, options, (0, telemetryHelpers_1.getDefaultOptions)(config, runWindowsOptions_1.runWindowsOptions), optionSanitizer);
112
+ // https://github.com/yarnpkg/yarn/issues/8334 - Yarn on Windows breaks apps that read from the environment variables
113
+ // Yarn will run node via CreateProcess and pass npm_config_* variables in lowercase without unifying their value
114
+ // with their possibly existing uppercase counterparts. This breaks programs that read from the environment block
115
+ // and write to a case-insensitive dictionary since they expect to encounter each variable only once.
116
+ // The values of the lowercase variables are the one npm actually wants to use, plus they are seeded from the
117
+ // uppercase variable values one if there are no overrides.
118
+ delete process.env.NPM_CONFIG_CACHE;
119
+ delete process.env.NPM_CONFIG_PREFIX;
120
+ if (process.env.LocalAppData) {
121
+ hasRunRnwDependencies = fs_1.default.existsSync(path_1.default.join(process.env.LocalAppData, 'rnw-dependencies.txt')); // CODESYNC \vnext\scripts\rnw-dependencies.ps1
33
122
  }
123
+ let runWindowsError;
34
124
  if (options.info) {
125
+ runWindowsPhase = 'Info';
35
126
  try {
36
127
  const output = await info.getEnvironmentInfo();
37
128
  console.log(output.trimEnd());
38
129
  console.log(' Installed UWP SDKs:');
39
130
  const sdks = msbuildtools_1.default.getAllAvailableUAPVersions();
40
131
  sdks.forEach(version => console.log(' ' + version));
41
- return;
42
132
  }
43
- catch (e) {
44
- commandWithProgress_1.newError('Unable to print environment info.\n' + e.toString());
45
- ExitProcessWithError(options.logging);
133
+ catch (ex) {
134
+ runWindowsError =
135
+ ex instanceof Error ? ex : new Error(String(ex));
136
+ telemetry_1.Telemetry.trackException(runWindowsError);
137
+ (0, commandWithProgress_1.newError)('Unable to print environment info.\n' + runWindowsError.toString());
46
138
  }
139
+ await (0, telemetryHelpers_1.endTelemetrySession)(runWindowsError, getExtraProps);
140
+ (0, commandWithProgress_1.setExitProcessWithError)(options.logging, runWindowsError);
141
+ return;
142
+ }
143
+ try {
144
+ await runWindowsInternal(args, config, options);
145
+ }
146
+ catch (ex) {
147
+ runWindowsError =
148
+ ex instanceof Error ? ex : new Error(String(ex));
149
+ telemetry_1.Telemetry.trackException(runWindowsError);
150
+ if (!hasRunRnwDependencies) {
151
+ const rnwPkgJsonPath = require.resolve('react-native-windows/package.json', {
152
+ paths: [process.cwd(), __dirname],
153
+ });
154
+ const rnwDependenciesPath = path_1.default.join(path_1.default.dirname(rnwPkgJsonPath), 'scripts/rnw-dependencies.ps1');
155
+ (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`);
156
+ }
157
+ }
158
+ await (0, telemetryHelpers_1.endTelemetrySession)(runWindowsError, getExtraProps);
159
+ (0, commandWithProgress_1.setExitProcessWithError)(options.logging, runWindowsError);
160
+ }
161
+ /**
162
+ * Performs build deploy and launch of RNW apps.
163
+ * @param args Unprocessed args passed from react-native CLI.
164
+ * @param config Config passed from react-native CLI.
165
+ * @param options Options passed from react-native CLI.
166
+ */
167
+ async function runWindowsInternal(args, config, options) {
168
+ const verbose = options.logging === true;
169
+ if (verbose) {
170
+ (0, commandWithProgress_1.newInfo)('Verbose: ON');
47
171
  }
48
172
  // Get the solution file
49
- const slnFile = build.getAppSolutionFile(options, config);
50
- if (options.autolink) {
51
- const autolinkArgs = [];
52
- const autolinkConfig = config;
53
- const autoLinkOptions = {
54
- logging: options.logging,
55
- proj: options.proj,
56
- sln: options.sln,
57
- };
58
- await autolink_1.autoLinkCommand.func(autolinkArgs, autolinkConfig, autoLinkOptions);
173
+ let slnFile;
174
+ runWindowsPhase = 'FindSolution';
175
+ try {
176
+ slnFile = build.getAppSolutionFile(options, config);
59
177
  }
60
- else {
61
- commandWithProgress_1.newInfo('Autolink step is skipped');
178
+ catch (e) {
179
+ (0, commandWithProgress_1.newError)(`Couldn't get app solution information. ${e.message}`);
180
+ throw e;
62
181
  }
63
- const buildTools = msbuildtools_1.default.findAvailableVersion(options.arch, verbose);
64
- if (options.build) {
65
- if (!slnFile) {
66
- commandWithProgress_1.newError('Visual Studio Solution file not found. Maybe run "react-native windows" first?');
67
- ExitProcessWithError(options.logging);
182
+ let buildTools;
183
+ runWindowsPhase = 'FindBuildTools';
184
+ try {
185
+ buildTools = msbuildtools_1.default.findAvailableVersion(options.arch, verbose);
186
+ }
187
+ catch (error) {
188
+ (0, commandWithProgress_1.newWarn)('No public VS release found');
189
+ // Try prerelease
190
+ try {
191
+ (0, commandWithProgress_1.newInfo)('Trying pre-release VS');
192
+ buildTools = msbuildtools_1.default.findAvailableVersion(options.arch, verbose, true);
193
+ }
194
+ catch (e) {
195
+ (0, commandWithProgress_1.newError)(e.message);
196
+ throw error;
197
+ }
198
+ }
199
+ // Set up the callback to capture MSBuild properties after the command completes
200
+ evaluateMSBuildPropsCallback = () => {
201
+ const projectFile = build.getAppProjectFile(options, config);
202
+ if (projectFile) {
203
+ if (verbose) {
204
+ (0, commandWithProgress_1.newInfo)('Gathering MSBuild data for telemetry.');
205
+ }
206
+ const msBuildPropertiesJsonPath = path_1.default.resolve(path_1.default.dirname(projectFile), 'Generated Files', 'msbuildproperties.g.json');
207
+ if (fs_1.default.existsSync(msBuildPropertiesJsonPath)) {
208
+ if (verbose) {
209
+ (0, commandWithProgress_1.newInfo)('Loading properties from msbuildproperties.g.json');
210
+ }
211
+ return fs_1.default.readJsonFileSync(msBuildPropertiesJsonPath);
212
+ }
213
+ if (verbose) {
214
+ (0, commandWithProgress_1.newInfo)('Unable to find msbuildproperties.g.json');
215
+ }
68
216
  }
217
+ return {};
218
+ };
219
+ // Restore packages.config files for dependencies that don't support PackageReference.
220
+ runWindowsPhase = 'RestorePackagesConfig';
221
+ const buildType = deploy.getBuildConfiguration(options);
222
+ try {
223
+ await buildTools.restorePackageConfigs(slnFile, options.arch, buildType);
224
+ }
225
+ catch (e) {
226
+ (0, commandWithProgress_1.newError)(`Couldn't restore found packages.config instances. ${e.message}`);
227
+ throw e;
228
+ }
229
+ if (options.autolink) {
230
+ runWindowsPhase = 'Autolink';
69
231
  try {
70
- await build.restoreNuGetPackages(slnFile, buildTools, verbose);
232
+ const autolinkArgs = [];
233
+ const autolinkConfig = config;
234
+ const autoLinkOptions = {
235
+ logging: options.logging,
236
+ check: false,
237
+ proj: options.proj,
238
+ sln: options.sln,
239
+ telemetry: options.telemetry,
240
+ };
241
+ await (0, autolink_1.autolinkWindowsInternal)(autolinkArgs, autolinkConfig, autoLinkOptions);
71
242
  }
72
243
  catch (e) {
73
- commandWithProgress_1.newError('Failed to restore the NuGet packages: ' + e.toString());
74
- ExitProcessWithError(options.logging);
244
+ (0, commandWithProgress_1.newError)(`Autolinking failed. ${e.message}`);
245
+ throw e;
246
+ }
247
+ }
248
+ else {
249
+ (0, commandWithProgress_1.newInfo)('Autolink step is skipped');
250
+ }
251
+ if (options.build) {
252
+ runWindowsPhase = 'Build';
253
+ if (!slnFile) {
254
+ (0, commandWithProgress_1.newError)('Visual Studio Solution file not found. Maybe run "npx react-native-windows-init" first?');
255
+ throw new telemetry_1.CodedError('NoSolution', 'Cannot find solution file');
75
256
  }
76
257
  // Get build/deploy options
77
- const buildType = deploy.getBuildConfiguration(options);
78
- var msBuildProps = build.parseMsBuildProps(options);
258
+ const msBuildProps = build.parseMsBuildProps(options);
79
259
  // Disable the autolink check since we just ran it
80
260
  msBuildProps.RunAutolinkCheck = 'false';
81
261
  try {
82
- await build.buildSolution(buildTools, slnFile, buildType, options.arch, msBuildProps, verbose, undefined, // build the default target
83
- options.buildLogDirectory, options.singleproc);
262
+ await build.buildSolution(buildTools, slnFile, buildType, options.arch, msBuildProps, verbose, 'build', options.buildLogDirectory, options.singleproc);
84
263
  }
85
264
  catch (e) {
86
- commandWithProgress_1.newError(`Build failed with message ${e.message}. Check your build configuration.`);
265
+ (0, commandWithProgress_1.newError)(`Build failed with message ${e.message}. Check your build configuration.`);
87
266
  if (e.logfile) {
88
- console.log('See', chalk.bold(e.logfile));
267
+ console.log('See', chalk_1.default.bold(e.logfile));
89
268
  }
90
- ExitProcessWithError(options.logging);
269
+ throw e;
91
270
  }
92
271
  }
93
272
  else {
94
- commandWithProgress_1.newInfo('Build step is skipped');
273
+ (0, commandWithProgress_1.newInfo)('Build step is skipped');
274
+ }
275
+ if (shouldLaunchPackager(options)) {
276
+ await deploy.startServerInNewWindow(options, verbose);
95
277
  }
96
- await deploy.startServerInNewWindow(options, verbose);
97
278
  if (options.deploy) {
279
+ runWindowsPhase = 'Deploy';
98
280
  if (!slnFile) {
99
- commandWithProgress_1.newError('Visual Studio Solution file not found. Maybe run "react-native windows" first?');
100
- ExitProcessWithError(options.logging);
281
+ (0, commandWithProgress_1.newError)('Visual Studio Solution file not found. Maybe run "npx react-native-windows-init" first?');
282
+ throw new telemetry_1.CodedError('NoSolution', 'Cannot find solution file');
101
283
  }
102
284
  try {
103
285
  if (options.device || options.emulator || options.target) {
104
- await deploy.deployToDevice(options, verbose);
286
+ await deploy.deployToDevice(options, verbose, config);
105
287
  }
106
288
  else {
107
289
  await deploy.deployToDesktop(options, verbose, config, buildTools);
108
290
  }
109
291
  }
110
292
  catch (e) {
111
- commandWithProgress_1.newError(`Failed to deploy${e ? `: ${e.message}` : ''}`);
112
- ExitProcessWithError(options.logging);
293
+ (0, commandWithProgress_1.newError)(`Failed to deploy${e ? `: ${e.message}` : ''}`);
294
+ throw e;
113
295
  }
114
296
  }
115
297
  else {
116
- commandWithProgress_1.newInfo('Deploy step is skipped');
298
+ (0, commandWithProgress_1.newInfo)('Deploy step is skipped');
117
299
  }
118
300
  }
301
+ function shouldLaunchPackager(options) {
302
+ return (options.packager === true &&
303
+ options.launch === true &&
304
+ options.release !== true);
305
+ }
119
306
  /*
120
307
  // Example of running the Windows Command
121
308
  runWindows({
@@ -1 +1 @@
1
- {"version":3,"file":"runWindows.js","sourceRoot":"","sources":["../../src/runWindows/runWindows.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,uCAAuC;AACvC,+BAA+B;AAC/B,yCAAyC;AACzC,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zB,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 fs from '@react-native-windows/fs';\nimport path from 'path';\nimport {Telemetry, CodedError} from '@react-native-windows/telemetry';\n\nimport * as build from './utils/build';\nimport chalk from 'chalk';\nimport * as deploy from './utils/deploy';\nimport {\n newError,\n newInfo,\n newWarn,\n setExitProcessWithError,\n} from './utils/commandWithProgress';\nimport {\n getDefaultOptions,\n startTelemetrySession,\n endTelemetrySession,\n} from './utils/telemetryHelpers';\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 {autolinkWindowsInternal, AutoLinkOptions} from './utils/autolink';\n\n/**\n * Sanitizes the given option for telemetery.\n * @param key The key of the option.\n * @param value The unsanitized value of the option.\n * @returns The sanitized value of the option.\n */\n// eslint-disable-next-line complexity\nfunction optionSanitizer(key: keyof RunWindowsOptions, value: any): any {\n // Do not add a default case here.\n // Strings risking PII should just return true if present, false otherwise.\n // All others should return the value (or false if undefined).\n switch (key) {\n case 'root':\n case 'target':\n case 'sln':\n case 'proj':\n case 'buildLogDirectory':\n return value === undefined ? false : true; // Strip PII\n case 'msbuildprops':\n return value === undefined ? 0 : value.split(',').length; // Convert to count\n case 'release':\n case 'arch':\n case 'singleproc':\n case 'emulator':\n case 'device':\n case 'remoteDebugging':\n case 'logging':\n case 'packager':\n case 'bundle':\n case 'launch':\n case 'autolink':\n case 'build':\n case 'deploy':\n case 'deployFromLayout':\n case 'info':\n case 'directDebugging':\n case 'telemetry':\n return value === undefined ? false : value; // Return value\n }\n}\n\n/**\n * Get the extra props to add to the `run-windows` telemetry event.\n * @returns The extra props.\n */\nasync function getExtraProps(): Promise<Record<string, any>> {\n const extraProps: Record<string, any> = {\n phase: runWindowsPhase,\n hasRunRnwDependencies,\n msBuildProps: evaluateMSBuildPropsCallback\n ? evaluateMSBuildPropsCallback()\n : {},\n };\n return extraProps;\n}\n\n/**\n * Labels used by telemetry to represent current operation\n */\ntype RunWindowsPhase =\n | 'None'\n | 'Info'\n | 'FindSolution'\n | 'FindBuildTools'\n | 'Autolink'\n | 'RestorePackagesConfig'\n | 'Build'\n | 'Deploy';\n\nlet runWindowsPhase: RunWindowsPhase = 'None';\n\nlet hasRunRnwDependencies: boolean = false;\n\nlet evaluateMSBuildPropsCallback:\n | (() => Record<string, string> | null)\n | undefined;\n\n/**\n * The function run when calling `react-native run-windows`.\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 await startTelemetrySession(\n 'run-windows',\n config,\n options,\n getDefaultOptions(config, runWindowsOptions),\n optionSanitizer,\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 if (process.env.LocalAppData) {\n hasRunRnwDependencies = fs.existsSync(\n path.join(process.env.LocalAppData, 'rnw-dependencies.txt'),\n ); // CODESYNC \\vnext\\scripts\\rnw-dependencies.ps1\n }\n\n let runWindowsError: Error | undefined;\n if (options.info) {\n runWindowsPhase = '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 } catch (ex) {\n runWindowsError =\n ex instanceof Error ? (ex as Error) : new Error(String(ex));\n Telemetry.trackException(runWindowsError);\n\n newError(\n 'Unable to print environment info.\\n' + runWindowsError.toString(),\n );\n }\n await endTelemetrySession(runWindowsError, getExtraProps);\n setExitProcessWithError(options.logging, runWindowsError);\n return;\n }\n\n try {\n await runWindowsInternal(args, config, options);\n } catch (ex) {\n runWindowsError =\n ex instanceof Error ? (ex as Error) : new Error(String(ex));\n Telemetry.trackException(runWindowsError);\n\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 }\n await endTelemetrySession(runWindowsError, getExtraProps);\n setExitProcessWithError(options.logging, runWindowsError);\n}\n\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 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: string | null;\n runWindowsPhase = 'FindSolution';\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 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 // Set up the callback to capture MSBuild properties after the command completes\n evaluateMSBuildPropsCallback = () => {\n const projectFile = build.getAppProjectFile(options, config);\n if (projectFile) {\n if (verbose) {\n newInfo('Gathering MSBuild data for telemetry.');\n }\n\n const msBuildPropertiesJsonPath = path.resolve(\n path.dirname(projectFile),\n 'Generated Files',\n 'msbuildproperties.g.json',\n );\n\n if (fs.existsSync(msBuildPropertiesJsonPath)) {\n if (verbose) {\n newInfo('Loading properties from msbuildproperties.g.json');\n }\n return fs.readJsonFileSync(msBuildPropertiesJsonPath);\n }\n\n if (verbose) {\n newInfo('Unable to find msbuildproperties.g.json');\n }\n }\n\n return {};\n };\n\n // Restore packages.config files for dependencies that don't support PackageReference.\n runWindowsPhase = 'RestorePackagesConfig';\n const buildType = deploy.getBuildConfiguration(options);\n try {\n await buildTools.restorePackageConfigs(slnFile, options.arch, buildType);\n } catch (e) {\n newError(\n `Couldn't restore found packages.config instances. ${\n (e as Error).message\n }`,\n );\n throw e;\n }\n\n if (options.autolink) {\n runWindowsPhase = 'Autolink';\n try {\n const autolinkArgs: string[] = [];\n const autolinkConfig = config;\n const autoLinkOptions: AutoLinkOptions = {\n logging: options.logging,\n check: false,\n proj: options.proj,\n sln: options.sln,\n telemetry: options.telemetry,\n };\n await autolinkWindowsInternal(\n autolinkArgs,\n autolinkConfig,\n autoLinkOptions,\n );\n } catch (e) {\n newError(`Autolinking failed. ${(e as Error).message}`);\n throw e;\n }\n } else {\n newInfo('Autolink step is skipped');\n }\n\n if (options.build) {\n runWindowsPhase = 'Build';\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 msBuildProps = build.parseMsBuildProps(options);\n\n // Disable the autolink check since we just ran it\n msBuildProps.RunAutolinkCheck = 'false';\n\n try {\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 = 'Deploy';\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 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"]}