@react-native-windows/cli 0.0.0-canary.1 → 0.0.0-canary.102

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 (123) hide show
  1. package/README.md +49 -0
  2. package/lib-commonjs/config/configUtils.d.ts +27 -6
  3. package/lib-commonjs/config/configUtils.js +122 -45
  4. package/lib-commonjs/config/configUtils.js.map +1 -1
  5. package/lib-commonjs/config/dependencyConfig.d.ts +3 -3
  6. package/lib-commonjs/config/dependencyConfig.js +128 -54
  7. package/lib-commonjs/config/dependencyConfig.js.map +1 -1
  8. package/lib-commonjs/config/projectConfig.d.ts +6 -3
  9. package/lib-commonjs/config/projectConfig.js +68 -12
  10. package/lib-commonjs/config/projectConfig.js.map +1 -1
  11. package/lib-commonjs/e2etest/autolink.test.d.ts +6 -0
  12. package/lib-commonjs/e2etest/autolink.test.js +435 -0
  13. package/lib-commonjs/e2etest/autolink.test.js.map +1 -0
  14. package/lib-commonjs/e2etest/dependencyConfig.test.d.ts +6 -0
  15. package/lib-commonjs/e2etest/dependencyConfig.test.js +162 -0
  16. package/lib-commonjs/e2etest/dependencyConfig.test.js.map +1 -0
  17. package/lib-commonjs/e2etest/projectConfig.test.d.ts +6 -0
  18. package/lib-commonjs/e2etest/projectConfig.test.js +125 -0
  19. package/lib-commonjs/e2etest/projectConfig.test.js.map +1 -0
  20. package/lib-commonjs/e2etest/projectConfig.utils.d.ts +4 -0
  21. package/lib-commonjs/e2etest/projectConfig.utils.js +63 -0
  22. package/lib-commonjs/e2etest/projectConfig.utils.js.map +1 -0
  23. package/lib-commonjs/e2etest/runWindows.test.d.ts +6 -0
  24. package/lib-commonjs/e2etest/runWindows.test.js +61 -0
  25. package/lib-commonjs/e2etest/runWindows.test.js.map +1 -0
  26. package/lib-commonjs/generator-common/index.d.ts +16 -0
  27. package/lib-commonjs/generator-common/index.js +60 -39
  28. package/lib-commonjs/generator-common/index.js.map +1 -1
  29. package/lib-commonjs/generator-windows/index.d.ts +2 -2
  30. package/lib-commonjs/generator-windows/index.js +250 -145
  31. package/lib-commonjs/generator-windows/index.js.map +1 -1
  32. package/lib-commonjs/healthChecks.d.ts +2 -0
  33. package/lib-commonjs/healthChecks.js +88 -0
  34. package/lib-commonjs/healthChecks.js.map +1 -0
  35. package/lib-commonjs/index.d.ts +5 -0
  36. package/lib-commonjs/index.js +24 -6
  37. package/lib-commonjs/index.js.map +1 -1
  38. package/lib-commonjs/runWindows/runWindows.js +203 -55
  39. package/lib-commonjs/runWindows/runWindows.js.map +1 -1
  40. package/lib-commonjs/runWindows/runWindowsOptions.d.ts +16 -10
  41. package/lib-commonjs/runWindows/runWindowsOptions.js +19 -11
  42. package/lib-commonjs/runWindows/runWindowsOptions.js.map +1 -1
  43. package/lib-commonjs/runWindows/utils/autolink.d.ts +88 -1
  44. package/lib-commonjs/runWindows/utils/autolink.js +592 -250
  45. package/lib-commonjs/runWindows/utils/autolink.js.map +1 -1
  46. package/lib-commonjs/runWindows/utils/build.d.ts +1 -2
  47. package/lib-commonjs/runWindows/utils/build.js +26 -33
  48. package/lib-commonjs/runWindows/utils/build.js.map +1 -1
  49. package/lib-commonjs/runWindows/utils/checkRequirements.js +11 -7
  50. package/lib-commonjs/runWindows/utils/checkRequirements.js.map +1 -1
  51. package/lib-commonjs/runWindows/utils/commandWithProgress.d.ts +11 -3
  52. package/lib-commonjs/runWindows/utils/commandWithProgress.js +57 -22
  53. package/lib-commonjs/runWindows/utils/commandWithProgress.js.map +1 -1
  54. package/lib-commonjs/runWindows/utils/deploy.d.ts +1 -1
  55. package/lib-commonjs/runWindows/utils/deploy.js +164 -82
  56. package/lib-commonjs/runWindows/utils/deploy.js.map +1 -1
  57. package/lib-commonjs/runWindows/utils/info.js +5 -2
  58. package/lib-commonjs/runWindows/utils/info.js.map +1 -1
  59. package/lib-commonjs/runWindows/utils/msbuildtools.d.ts +9 -5
  60. package/lib-commonjs/runWindows/utils/msbuildtools.js +95 -58
  61. package/lib-commonjs/runWindows/utils/msbuildtools.js.map +1 -1
  62. package/lib-commonjs/runWindows/utils/telemetryHelpers.d.ts +29 -0
  63. package/lib-commonjs/runWindows/utils/telemetryHelpers.js +109 -0
  64. package/lib-commonjs/runWindows/utils/telemetryHelpers.js.map +1 -0
  65. package/lib-commonjs/runWindows/utils/version.d.ts +4 -4
  66. package/lib-commonjs/runWindows/utils/version.js.map +1 -1
  67. package/lib-commonjs/runWindows/utils/vsInstalls.d.ts +4 -1
  68. package/lib-commonjs/runWindows/utils/vsInstalls.js +22 -7
  69. package/lib-commonjs/runWindows/utils/vsInstalls.js.map +1 -1
  70. package/lib-commonjs/runWindows/utils/vstools.d.ts +1 -0
  71. package/lib-commonjs/runWindows/utils/vstools.js +44 -25
  72. package/lib-commonjs/runWindows/utils/vstools.js.map +1 -1
  73. package/lib-commonjs/runWindows/utils/winappdeploytool.d.ts +3 -3
  74. package/lib-commonjs/runWindows/utils/winappdeploytool.js +17 -14
  75. package/lib-commonjs/runWindows/utils/winappdeploytool.js.map +1 -1
  76. package/package.json +43 -27
  77. package/powershell/Add-AppDevPackage.ps1 +2 -2
  78. package/powershell/WindowsStoreAppUtils.ps1 +11 -1
  79. package/CHANGELOG.json +0 -20
  80. package/CHANGELOG.md +0 -13
  81. package/templates/_gitignore +0 -92
  82. package/templates/b_gitignore +0 -1
  83. package/templates/cpp/keys/MyApp_TemporaryKey.pfx +0 -0
  84. package/templates/cpp/proj/MyApp.sln +0 -194
  85. package/templates/cpp/proj/MyApp.vcxproj +0 -220
  86. package/templates/cpp/proj/MyApp.vcxproj.filters +0 -63
  87. package/templates/cpp/proj/packages.config +0 -6
  88. package/templates/cpp/src/App.cpp +0 -80
  89. package/templates/cpp/src/App.h +0 -25
  90. package/templates/cpp/src/App.idl +0 -3
  91. package/templates/cpp/src/AutolinkedNativeModules.g.cpp +0 -13
  92. package/templates/cpp/src/AutolinkedNativeModules.g.h +0 -10
  93. package/templates/cpp/src/AutolinkedNativeModules.g.targets +0 -6
  94. package/templates/cpp/src/MainPage.cpp +0 -24
  95. package/templates/cpp/src/MainPage.h +0 -21
  96. package/templates/cpp/src/MainPage.idl +0 -8
  97. package/templates/cpp/src/PropertySheet.props +0 -16
  98. package/templates/cpp/src/ReactPackageProvider.cpp +0 -18
  99. package/templates/cpp/src/ReactPackageProvider.h +0 -15
  100. package/templates/cpp/src/pch.cpp +0 -1
  101. package/templates/cpp/src/pch.h +0 -26
  102. package/templates/cs/keys/MyApp_TemporaryKey.pfx +0 -0
  103. package/templates/cs/proj/MyApp.csproj +0 -189
  104. package/templates/cs/proj/MyApp.sln +0 -208
  105. package/templates/cs/src/App.xaml.cs +0 -56
  106. package/templates/cs/src/AutolinkedNativeModules.g.cs +0 -13
  107. package/templates/cs/src/AutolinkedNativeModules.g.targets +0 -6
  108. package/templates/cs/src/MainPage.xaml.cs +0 -33
  109. package/templates/cs/src/Properties/AssemblyInfo.cs +0 -29
  110. package/templates/cs/src/Properties/Default.rd.xml +0 -32
  111. package/templates/index.windows.bundle +0 -9
  112. package/templates/metro.config.js +0 -29
  113. package/templates/shared/assets/LockScreenLogo.scale-200.png +0 -0
  114. package/templates/shared/assets/SplashScreen.scale-200.png +0 -0
  115. package/templates/shared/assets/Square150x150Logo.scale-200.png +0 -0
  116. package/templates/shared/assets/Square44x44Logo.scale-200.png +0 -0
  117. package/templates/shared/assets/Square44x44Logo.targetsize-24_altform-unplated.png +0 -0
  118. package/templates/shared/assets/StoreLogo.png +0 -0
  119. package/templates/shared/assets/Wide310x150Logo.scale-200.png +0 -0
  120. package/templates/shared/proj/NuGet.Config +0 -13
  121. package/templates/shared/src/App.xaml +0 -10
  122. package/templates/shared/src/MainPage.xaml +0 -21
  123. package/templates/shared/src/Package.appxmanifest +0 -50
@@ -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,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,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,23 @@
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
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
7
20
  Object.defineProperty(exports, "__esModule", { value: true });
8
21
  exports.projectConfig = exports.dependencyConfig = exports.commands = exports.generateWindows = void 0;
9
- const fs = require("fs");
10
- const path = require("path");
22
+ const fs_1 = __importDefault(require("@react-native-windows/fs"));
23
+ const path_1 = __importDefault(require("path"));
11
24
  const generator_windows_1 = require("./generator-windows");
12
25
  const autolink_1 = require("./runWindows/utils/autolink");
13
26
  const runWindows_1 = require("./runWindows/runWindows");
@@ -22,11 +35,15 @@ const projectConfig_1 = require("./config/projectConfig");
22
35
  * @param options command line options container
23
36
  */
24
37
  async function generateWindows(projectDir, name, ns, options) {
25
- if (!fs.existsSync(projectDir)) {
26
- fs.mkdirSync(projectDir);
38
+ if (!fs_1.default.existsSync(projectDir)) {
39
+ fs_1.default.mkdirSync(projectDir);
27
40
  }
28
- generator_windows_1.installDependencies(options);
29
- await generator_windows_1.copyProjectTemplateAndReplace(path.join(__dirname, '..', 'templates'), projectDir, name, ns, options);
41
+ await (0, generator_windows_1.installScriptsAndDependencies)(options);
42
+ const rnwPackage = path_1.default.dirname(require.resolve('react-native-windows/package.json', {
43
+ paths: [projectDir],
44
+ }));
45
+ const templateRoot = path_1.default.join(rnwPackage, 'template');
46
+ await (0, generator_windows_1.copyProjectTemplateAndReplace)(templateRoot, projectDir, name, ns, options);
30
47
  }
31
48
  exports.generateWindows = generateWindows;
32
49
  // Assert the interface here doesn't change for the reasons above
@@ -35,4 +52,5 @@ assertStableInterface;
35
52
  exports.commands = [autolink_1.autoLinkCommand, runWindows_1.runWindowsCommand];
36
53
  exports.dependencyConfig = dependencyConfig_1.dependencyConfigWindows;
37
54
  exports.projectConfig = projectConfig_1.projectConfigWindows;
55
+ __exportStar(require("./healthChecks"), exports);
38
56
  //# 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,iDAA6B,CACjC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,EACvC,UAAU,EACV,IAAI,EACJ,EAAE,EACF,OAAO,CACR,CAAC;AACJ,CAAC;AAnBD,0CAmBC;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,33 +4,115 @@
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
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ var __importDefault = (this && this.__importDefault) || function (mod) {
27
+ return (mod && mod.__esModule) ? mod : { "default": mod };
28
+ };
7
29
  Object.defineProperty(exports, "__esModule", { value: true });
8
30
  exports.runWindowsCommand = void 0;
9
- const build = require("./utils/build");
10
- const chalk = require("chalk");
11
- const deploy = require("./utils/deploy");
31
+ const fs_1 = __importDefault(require("@react-native-windows/fs"));
32
+ const path_1 = __importDefault(require("path"));
33
+ const telemetry_1 = require("@react-native-windows/telemetry");
34
+ const build = __importStar(require("./utils/build"));
35
+ const chalk_1 = __importDefault(require("chalk"));
36
+ const deploy = __importStar(require("./utils/deploy"));
12
37
  const commandWithProgress_1 = require("./utils/commandWithProgress");
13
- const info = require("./utils/info");
14
- const msbuildtools_1 = require("./utils/msbuildtools");
38
+ const telemetryHelpers_1 = require("./utils/telemetryHelpers");
39
+ const info = __importStar(require("./utils/info"));
40
+ const msbuildtools_1 = __importDefault(require("./utils/msbuildtools"));
15
41
  const runWindowsOptions_1 = require("./runWindowsOptions");
16
42
  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`);
43
+ /**
44
+ * Sanitizes the given option for telemetery.
45
+ * @param key The key of the option.
46
+ * @param value The unsanitized value of the option.
47
+ * @returns The sanitized value of the option.
48
+ */
49
+ // eslint-disable-next-line complexity
50
+ function optionSanitizer(key, value) {
51
+ // Do not add a default case here.
52
+ // Strings risking PII should just return true if present, false otherwise.
53
+ // All others should return the value (or false if undefined).
54
+ switch (key) {
55
+ case 'root':
56
+ case 'target':
57
+ case 'sln':
58
+ case 'proj':
59
+ case 'buildLogDirectory':
60
+ return value === undefined ? false : true; // Strip PII
61
+ case 'msbuildprops':
62
+ return value === undefined ? 0 : value.split(',').length; // Convert to count
63
+ case 'release':
64
+ case 'arch':
65
+ case 'singleproc':
66
+ case 'emulator':
67
+ case 'device':
68
+ case 'remoteDebugging':
69
+ case 'logging':
70
+ case 'packager':
71
+ case 'bundle':
72
+ case 'launch':
73
+ case 'autolink':
74
+ case 'build':
75
+ case 'deploy':
76
+ case 'deployFromLayout':
77
+ case 'info':
78
+ case 'directDebugging':
79
+ case 'telemetry':
80
+ return value === undefined ? false : value; // Return value
20
81
  }
21
- process.exit(1);
22
82
  }
23
83
  /**
24
- * Performs build deploy and launch of RNW apps.
84
+ * Get the extra props to add to the `run-windows` telemetry event.
85
+ * @returns The extra props.
86
+ */
87
+ async function getExtraProps() {
88
+ const extraProps = {
89
+ phase: runWindowsPhase,
90
+ hasRunRnwDependencies,
91
+ };
92
+ return extraProps;
93
+ }
94
+ let runWindowsPhase = 'None';
95
+ let hasRunRnwDependencies = false;
96
+ /**
97
+ * The function run when calling `react-native run-windows`.
25
98
  * @param args Unprocessed args passed from react-native CLI.
26
99
  * @param config Config passed from react-native CLI.
27
100
  * @param options Options passed from react-native CLI.
28
101
  */
29
102
  async function runWindows(args, config, options) {
30
- const verbose = options.logging;
31
- if (verbose) {
32
- commandWithProgress_1.newInfo('Verbose: ON');
103
+ await (0, telemetryHelpers_1.startTelemetrySession)('run-windows', config, options, (0, telemetryHelpers_1.getDefaultOptions)(config, runWindowsOptions_1.runWindowsOptions), optionSanitizer);
104
+ // https://github.com/yarnpkg/yarn/issues/8334 - Yarn on Windows breaks apps that read from the environment variables
105
+ // Yarn will run node via CreateProcess and pass npm_config_* variables in lowercase without unifying their value
106
+ // with their possibly existing uppercase counterparts. This breaks programs that read from the environment block
107
+ // and write to a case-insensitive dictionary since they expect to encounter each variable only once.
108
+ // The values of the lowercase variables are the one npm actually wants to use, plus they are seeded from the
109
+ // uppercase variable values one if there are no overrides.
110
+ delete process.env.NPM_CONFIG_CACHE;
111
+ delete process.env.NPM_CONFIG_PREFIX;
112
+ if (process.env.LocalAppData) {
113
+ hasRunRnwDependencies = fs_1.default.existsSync(path_1.default.join(process.env.LocalAppData, 'rnw-dependencies.txt')); // CODESYNC \vnext\scripts\rnw-dependencies.ps1
33
114
  }
115
+ let runWindowsError;
34
116
  if (options.info) {
35
117
  try {
36
118
  const output = await info.getEnvironmentInfo();
@@ -38,86 +120,152 @@ async function runWindows(args, config, options) {
38
120
  console.log(' Installed UWP SDKs:');
39
121
  const sdks = msbuildtools_1.default.getAllAvailableUAPVersions();
40
122
  sdks.forEach(version => console.log(' ' + version));
41
- return;
42
123
  }
43
- catch (e) {
44
- commandWithProgress_1.newError('Unable to print environment info.\n' + e.toString());
45
- ExitProcessWithError(options.logging);
124
+ catch (ex) {
125
+ runWindowsError =
126
+ ex instanceof Error ? ex : new Error(String(ex));
127
+ telemetry_1.Telemetry.trackException(runWindowsError);
128
+ (0, commandWithProgress_1.newError)('Unable to print environment info.\n' + runWindowsError.toString());
46
129
  }
130
+ await (0, telemetryHelpers_1.endTelemetrySession)(runWindowsError, getExtraProps);
131
+ (0, commandWithProgress_1.setExitProcessWithError)(options.logging, runWindowsError);
132
+ return;
133
+ }
134
+ try {
135
+ await runWindowsInternal(args, config, options);
136
+ }
137
+ catch (ex) {
138
+ runWindowsError =
139
+ ex instanceof Error ? ex : new Error(String(ex));
140
+ telemetry_1.Telemetry.trackException(runWindowsError);
141
+ if (!hasRunRnwDependencies) {
142
+ const rnwPkgJsonPath = require.resolve('react-native-windows/package.json', {
143
+ paths: [process.cwd(), __dirname],
144
+ });
145
+ const rnwDependenciesPath = path_1.default.join(path_1.default.dirname(rnwPkgJsonPath), 'scripts/rnw-dependencies.ps1');
146
+ (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`);
147
+ }
148
+ }
149
+ await (0, telemetryHelpers_1.endTelemetrySession)(runWindowsError, getExtraProps);
150
+ (0, commandWithProgress_1.setExitProcessWithError)(options.logging, runWindowsError);
151
+ }
152
+ /**
153
+ * Performs build deploy and launch of RNW apps.
154
+ * @param args Unprocessed args passed from react-native CLI.
155
+ * @param config Config passed from react-native CLI.
156
+ * @param options Options passed from react-native CLI.
157
+ */
158
+ async function runWindowsInternal(args, config, options) {
159
+ const verbose = options.logging === true;
160
+ if (verbose) {
161
+ (0, commandWithProgress_1.newInfo)('Verbose: ON');
47
162
  }
48
163
  // 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);
164
+ let slnFile;
165
+ try {
166
+ slnFile = build.getAppSolutionFile(options, config);
59
167
  }
60
- else {
61
- commandWithProgress_1.newInfo('Autolink step is skipped');
168
+ catch (e) {
169
+ (0, commandWithProgress_1.newError)(`Couldn't get app solution information. ${e.message}`);
170
+ throw e;
62
171
  }
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);
172
+ try {
173
+ if (options.autolink) {
174
+ const autolinkArgs = [];
175
+ const autolinkConfig = config;
176
+ const autoLinkOptions = {
177
+ logging: options.logging,
178
+ check: false,
179
+ proj: options.proj,
180
+ sln: options.sln,
181
+ telemetry: options.telemetry,
182
+ };
183
+ runWindowsPhase = 'AutoLink';
184
+ await (0, autolink_1.autolinkWindowsInternal)(autolinkArgs, autolinkConfig, autoLinkOptions);
68
185
  }
186
+ else {
187
+ (0, commandWithProgress_1.newInfo)('Autolink step is skipped');
188
+ }
189
+ }
190
+ catch (e) {
191
+ (0, commandWithProgress_1.newError)(`Autolinking failed. ${e.message}`);
192
+ throw e;
193
+ }
194
+ let buildTools;
195
+ runWindowsPhase = 'FindBuildTools';
196
+ try {
197
+ buildTools = msbuildtools_1.default.findAvailableVersion(options.arch, verbose);
198
+ }
199
+ catch (error) {
200
+ (0, commandWithProgress_1.newWarn)('No public VS release found');
201
+ // Try prerelease
69
202
  try {
70
- await build.restoreNuGetPackages(slnFile, buildTools, verbose);
203
+ (0, commandWithProgress_1.newInfo)('Trying pre-release VS');
204
+ buildTools = msbuildtools_1.default.findAvailableVersion(options.arch, verbose, true);
71
205
  }
72
206
  catch (e) {
73
- commandWithProgress_1.newError('Failed to restore the NuGet packages: ' + e.toString());
74
- ExitProcessWithError(options.logging);
207
+ (0, commandWithProgress_1.newError)(e.message);
208
+ throw error;
209
+ }
210
+ }
211
+ if (options.build) {
212
+ runWindowsPhase = 'FindSolution';
213
+ if (!slnFile) {
214
+ (0, commandWithProgress_1.newError)('Visual Studio Solution file not found. Maybe run "npx react-native-windows-init" first?');
215
+ throw new telemetry_1.CodedError('NoSolution', 'Cannot find solution file');
75
216
  }
76
217
  // Get build/deploy options
77
218
  const buildType = deploy.getBuildConfiguration(options);
78
- var msBuildProps = build.parseMsBuildProps(options);
79
- if (!options.autolink) {
80
- // Disable the autolink check if --no-autolink was passed
81
- msBuildProps.RunAutolinkCheck = 'false';
82
- }
219
+ const msBuildProps = build.parseMsBuildProps(options);
220
+ // Disable the autolink check since we just ran it
221
+ msBuildProps.RunAutolinkCheck = 'false';
83
222
  try {
84
- await build.buildSolution(buildTools, slnFile, buildType, options.arch, msBuildProps, verbose, undefined, // build the default target
85
- options.buildLogDirectory);
223
+ runWindowsPhase = 'FindSolution';
224
+ await build.buildSolution(buildTools, slnFile, buildType, options.arch, msBuildProps, verbose, 'build', options.buildLogDirectory, options.singleproc);
86
225
  }
87
226
  catch (e) {
88
- commandWithProgress_1.newError(`Build failed with message ${e.message}. Check your build configuration.`);
227
+ (0, commandWithProgress_1.newError)(`Build failed with message ${e.message}. Check your build configuration.`);
89
228
  if (e.logfile) {
90
- console.log('See', chalk.bold(e.logfile));
229
+ console.log('See', chalk_1.default.bold(e.logfile));
91
230
  }
92
- ExitProcessWithError(options.logging);
231
+ throw e;
93
232
  }
94
233
  }
95
234
  else {
96
- commandWithProgress_1.newInfo('Build step is skipped');
235
+ (0, commandWithProgress_1.newInfo)('Build step is skipped');
236
+ }
237
+ if (shouldLaunchPackager(options)) {
238
+ await deploy.startServerInNewWindow(options, verbose);
97
239
  }
98
- await deploy.startServerInNewWindow(options, verbose);
99
240
  if (options.deploy) {
241
+ runWindowsPhase = 'FindSolution';
100
242
  if (!slnFile) {
101
- commandWithProgress_1.newError('Visual Studio Solution file not found. Maybe run "react-native windows" first?');
102
- ExitProcessWithError(options.logging);
243
+ (0, commandWithProgress_1.newError)('Visual Studio Solution file not found. Maybe run "npx react-native-windows-init" first?');
244
+ throw new telemetry_1.CodedError('NoSolution', 'Cannot find solution file');
103
245
  }
104
246
  try {
247
+ runWindowsPhase = 'Deploy';
105
248
  if (options.device || options.emulator || options.target) {
106
- await deploy.deployToDevice(options, verbose);
249
+ await deploy.deployToDevice(options, verbose, config);
107
250
  }
108
251
  else {
109
252
  await deploy.deployToDesktop(options, verbose, config, buildTools);
110
253
  }
111
254
  }
112
255
  catch (e) {
113
- commandWithProgress_1.newError(`Failed to deploy${e ? `: ${e.message}` : ''}`);
114
- ExitProcessWithError(options.logging);
256
+ (0, commandWithProgress_1.newError)(`Failed to deploy${e ? `: ${e.message}` : ''}`);
257
+ throw e;
115
258
  }
116
259
  }
117
260
  else {
118
- commandWithProgress_1.newInfo('Deploy step is skipped');
261
+ (0, commandWithProgress_1.newInfo)('Deploy step is skipped');
119
262
  }
120
263
  }
264
+ function shouldLaunchPackager(options) {
265
+ return (options.packager === true &&
266
+ options.launch === true &&
267
+ options.release !== true);
268
+ }
121
269
  /*
122
270
  // Example of running the Windows Command
123
271
  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,qEAA8D;AAC9D,qCAAqC;AACrC,uDAAgD;AAGhD,2DAAyE;AAEzE,+CAAiD;AAEjD,SAAS,oBAAoB,CAAC,iBAA0B;IACtD,IAAI,CAAC,iBAAiB,EAAE;QACtB,OAAO,CAAC,GAAG,CACT,2BAA2B,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAC1E,CAAC;KACH;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,KAAK,UAAU,UAAU,CACvB,IAAc,EACd,MAAc,EACd,OAA0B;IAE1B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAEhC,IAAI,OAAO,EAAE;QACX,6BAAO,CAAC,aAAa,CAAC,CAAC;KACxB;IAED,IAAI,OAAO,CAAC,IAAI,EAAE;QAChB,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC/C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;YACrC,MAAM,IAAI,GAAG,sBAAY,CAAC,0BAA0B,EAAE,CAAC;YACvD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;YACvD,OAAO;SACR;QAAC,OAAO,CAAC,EAAE;YAC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CAAC,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;aACpE;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAA,8BAAQ,EAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,KAAM,CAAW,CAAC,OAAO,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 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 };\n return extraProps;\n}\n\n/**\n * Labels used by telemetry to represent current operation\n */\ntype RunWindowsPhase =\n | 'None'\n | 'AutoLink'\n | 'FindBuildTools'\n | 'FindSolution'\n | 'Deploy';\n\nlet runWindowsPhase: RunWindowsPhase = 'None';\n\nlet hasRunRnwDependencies: boolean = false;\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 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;\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: AutoLinkOptions = {\n logging: options.logging,\n check: false,\n proj: options.proj,\n sln: options.sln,\n telemetry: options.telemetry,\n };\n runWindowsPhase = 'AutoLink';\n await autolinkWindowsInternal(\n autolinkArgs,\n autolinkConfig,\n autoLinkOptions,\n );\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"]}
@@ -4,13 +4,14 @@
4
4
  * @format
5
5
  */
6
6
  import { CommandOption } from '@react-native-community/cli-types';
7
- export declare type BuildArch = 'x86' | 'x64' | 'ARM' | 'ARM64';
7
+ export declare type BuildArch = 'x86' | 'x64' | 'ARM64';
8
8
  export declare type BuildConfig = 'Debug' | 'DebugBundle' | 'Release' | 'ReleaseBundle';
9
9
  /**
10
10
  * * Options are the following:
11
11
  * release: Boolean - Specifies release build
12
12
  * root: String - The root of the application
13
- * arch: String - The build architecture (x86, x64, ARM, Any CPU)
13
+ * arch: String - The build architecture (ARM64, x86, x64)
14
+ * singleproc: Boolean - opt out of multi-proc builds
14
15
  * emulator: Boolean - Deploy to the emulator
15
16
  * device: Boolean - Deploy to a device
16
17
  * target: String - Device GUID to deploy to
@@ -21,30 +22,35 @@ export declare type BuildConfig = 'Debug' | 'DebugBundle' | 'Release' | 'Release
21
22
  * no-launch: Boolean - Do not launch the app after deployment
22
23
  * no-build: Boolean - Do not build the solution
23
24
  * no-deploy: Boolean - Do not deploy the app
25
+ * deploy-from-layout: Force deploy from layout, even in release builds
24
26
  * sln: String - Solution file to build
25
27
  * msbuildprops: String - Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2
26
28
  * direct-debugging: Number - Enable direct debugging on specified port
29
+ * no-telemetry: Boolean - Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI
27
30
  */
28
31
  export interface RunWindowsOptions {
29
32
  release?: boolean;
30
33
  root: string;
31
34
  arch: BuildArch;
35
+ singleproc?: boolean;
32
36
  emulator?: boolean;
33
37
  device?: boolean;
34
38
  target?: string;
35
39
  remoteDebugging?: string;
36
- logging: boolean;
37
- packager: boolean;
38
- bundle: boolean;
39
- launch: boolean;
40
- autolink: boolean;
41
- build: boolean;
42
- deploy: boolean;
40
+ logging?: boolean;
41
+ packager?: boolean;
42
+ bundle?: boolean;
43
+ launch?: boolean;
44
+ autolink?: boolean;
45
+ build?: boolean;
46
+ deploy?: boolean;
47
+ deployFromLayout?: boolean;
43
48
  sln?: string;
44
49
  proj?: string;
45
50
  msbuildprops?: string;
46
51
  buildLogDirectory?: string;
47
- info: boolean;
52
+ info?: boolean;
48
53
  directDebugging?: number;
54
+ telemetry?: boolean;
49
55
  }
50
56
  export declare const runWindowsOptions: CommandOption[];