@react-native-windows/cli 0.0.0-canary.11 → 0.0.0-canary.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/lib-commonjs/config/configUtils.d.ts +25 -2
- package/lib-commonjs/config/configUtils.js +119 -30
- package/lib-commonjs/config/configUtils.js.map +1 -1
- package/lib-commonjs/config/dependencyConfig.js +101 -44
- package/lib-commonjs/config/dependencyConfig.js.map +1 -1
- package/lib-commonjs/config/projectConfig.d.ts +4 -1
- package/lib-commonjs/config/projectConfig.js +68 -12
- package/lib-commonjs/config/projectConfig.js.map +1 -1
- package/lib-commonjs/e2etest/autolink.test.d.ts +6 -0
- package/lib-commonjs/e2etest/autolink.test.js +435 -0
- package/lib-commonjs/e2etest/autolink.test.js.map +1 -0
- package/lib-commonjs/e2etest/dependencyConfig.test.d.ts +6 -0
- package/lib-commonjs/e2etest/dependencyConfig.test.js +162 -0
- package/lib-commonjs/e2etest/dependencyConfig.test.js.map +1 -0
- package/lib-commonjs/e2etest/projectConfig.test.d.ts +6 -0
- package/lib-commonjs/e2etest/projectConfig.test.js +123 -0
- package/lib-commonjs/e2etest/projectConfig.test.js.map +1 -0
- package/lib-commonjs/e2etest/projectConfig.utils.d.ts +4 -0
- package/lib-commonjs/e2etest/projectConfig.utils.js +56 -0
- package/lib-commonjs/e2etest/projectConfig.utils.js.map +1 -0
- package/lib-commonjs/e2etest/runWindows.test.d.ts +6 -0
- package/lib-commonjs/e2etest/runWindows.test.js +61 -0
- package/lib-commonjs/e2etest/runWindows.test.js.map +1 -0
- package/lib-commonjs/generator-common/index.d.ts +16 -0
- package/lib-commonjs/generator-common/index.js +65 -44
- package/lib-commonjs/generator-common/index.js.map +1 -1
- package/lib-commonjs/generator-windows/index.d.ts +2 -2
- package/lib-commonjs/generator-windows/index.js +248 -155
- package/lib-commonjs/generator-windows/index.js.map +1 -1
- package/lib-commonjs/healthChecks.d.ts +2 -0
- package/lib-commonjs/healthChecks.js +88 -0
- package/lib-commonjs/healthChecks.js.map +1 -0
- package/lib-commonjs/index.d.ts +5 -0
- package/lib-commonjs/index.js +24 -8
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/runWindows/runWindows.js +211 -53
- package/lib-commonjs/runWindows/runWindows.js.map +1 -1
- package/lib-commonjs/runWindows/runWindowsOptions.d.ts +14 -10
- package/lib-commonjs/runWindows/runWindowsOptions.js +16 -12
- package/lib-commonjs/runWindows/runWindowsOptions.js.map +1 -1
- package/lib-commonjs/runWindows/utils/autolink.d.ts +88 -1
- package/lib-commonjs/runWindows/utils/autolink.js +596 -265
- package/lib-commonjs/runWindows/utils/autolink.js.map +1 -1
- package/lib-commonjs/runWindows/utils/build.d.ts +1 -2
- package/lib-commonjs/runWindows/utils/build.js +25 -32
- package/lib-commonjs/runWindows/utils/build.js.map +1 -1
- package/lib-commonjs/runWindows/utils/checkRequirements.js +12 -8
- package/lib-commonjs/runWindows/utils/checkRequirements.js.map +1 -1
- package/lib-commonjs/runWindows/utils/commandWithProgress.d.ts +11 -3
- package/lib-commonjs/runWindows/utils/commandWithProgress.js +60 -25
- package/lib-commonjs/runWindows/utils/commandWithProgress.js.map +1 -1
- package/lib-commonjs/runWindows/utils/deploy.d.ts +1 -1
- package/lib-commonjs/runWindows/utils/deploy.js +167 -85
- package/lib-commonjs/runWindows/utils/deploy.js.map +1 -1
- package/lib-commonjs/runWindows/utils/info.js +5 -2
- package/lib-commonjs/runWindows/utils/info.js.map +1 -1
- package/lib-commonjs/runWindows/utils/msbuildtools.d.ts +10 -5
- package/lib-commonjs/runWindows/utils/msbuildtools.js +98 -61
- package/lib-commonjs/runWindows/utils/msbuildtools.js.map +1 -1
- package/lib-commonjs/runWindows/utils/telemetryHelpers.d.ts +29 -0
- package/lib-commonjs/runWindows/utils/telemetryHelpers.js +109 -0
- package/lib-commonjs/runWindows/utils/telemetryHelpers.js.map +1 -0
- package/lib-commonjs/runWindows/utils/version.d.ts +4 -4
- package/lib-commonjs/runWindows/utils/version.js +1 -1
- package/lib-commonjs/runWindows/utils/version.js.map +1 -1
- package/lib-commonjs/runWindows/utils/vsInstalls.d.ts +4 -1
- package/lib-commonjs/runWindows/utils/vsInstalls.js +22 -7
- package/lib-commonjs/runWindows/utils/vsInstalls.js.map +1 -1
- package/lib-commonjs/runWindows/utils/vstools.d.ts +1 -0
- package/lib-commonjs/runWindows/utils/vstools.js +42 -29
- package/lib-commonjs/runWindows/utils/vstools.js.map +1 -1
- package/lib-commonjs/runWindows/utils/winappdeploytool.d.ts +3 -3
- package/lib-commonjs/runWindows/utils/winappdeploytool.js +19 -16
- package/lib-commonjs/runWindows/utils/winappdeploytool.js.map +1 -1
- package/package.json +42 -25
- package/powershell/Add-AppDevPackage.ps1 +2 -2
- package/powershell/WindowsStoreAppUtils.ps1 +10 -0
- package/CHANGELOG.json +0 -170
- package/CHANGELOG.md +0 -85
|
@@ -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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ACf;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 }"]}
|
package/lib-commonjs/index.d.ts
CHANGED
|
@@ -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';
|
package/lib-commonjs/index.js
CHANGED
|
@@ -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
|
|
10
|
-
const
|
|
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,13 +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 (!
|
|
26
|
-
|
|
38
|
+
if (!fs_1.default.existsSync(projectDir)) {
|
|
39
|
+
fs_1.default.mkdirSync(projectDir);
|
|
27
40
|
}
|
|
28
|
-
generator_windows_1.
|
|
29
|
-
const rnwPackage =
|
|
30
|
-
|
|
31
|
-
|
|
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);
|
|
32
47
|
}
|
|
33
48
|
exports.generateWindows = generateWindows;
|
|
34
49
|
// Assert the interface here doesn't change for the reasons above
|
|
@@ -37,4 +52,5 @@ assertStableInterface;
|
|
|
37
52
|
exports.commands = [autolink_1.autoLinkCommand, runWindows_1.runWindowsCommand];
|
|
38
53
|
exports.dependencyConfig = dependencyConfig_1.dependencyConfigWindows;
|
|
39
54
|
exports.projectConfig = projectConfig_1.projectConfigWindows;
|
|
55
|
+
__exportStar(require("./healthChecks"), exports);
|
|
40
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
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,276 @@
|
|
|
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
|
|
10
|
-
const
|
|
11
|
-
const
|
|
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
|
|
14
|
-
const
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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();
|
|
37
119
|
console.log(output.trimEnd());
|
|
38
120
|
console.log(' Installed UWP SDKs:');
|
|
39
121
|
const sdks = msbuildtools_1.default.getAllAvailableUAPVersions();
|
|
40
|
-
sdks.forEach(version => console.log(' ' + version));
|
|
41
|
-
return;
|
|
122
|
+
sdks.forEach((version) => console.log(' ' + version));
|
|
42
123
|
}
|
|
43
|
-
catch (
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
61
|
-
commandWithProgress_1.
|
|
168
|
+
catch (e) {
|
|
169
|
+
(0, commandWithProgress_1.newError)(`Couldn't get app solution information. ${e.message}`);
|
|
170
|
+
throw e;
|
|
62
171
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
172
|
+
let buildTools;
|
|
173
|
+
runWindowsPhase = 'FindBuildTools';
|
|
174
|
+
try {
|
|
175
|
+
buildTools = msbuildtools_1.default.findAvailableVersion(options.arch, verbose);
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
(0, commandWithProgress_1.newWarn)('No public VS release found');
|
|
179
|
+
// Try prerelease
|
|
69
180
|
try {
|
|
70
|
-
|
|
181
|
+
(0, commandWithProgress_1.newInfo)('Trying pre-release VS');
|
|
182
|
+
buildTools = msbuildtools_1.default.findAvailableVersion(options.arch, verbose, true);
|
|
71
183
|
}
|
|
72
184
|
catch (e) {
|
|
73
|
-
commandWithProgress_1.newError(
|
|
74
|
-
|
|
185
|
+
(0, commandWithProgress_1.newError)(e.message);
|
|
186
|
+
throw error;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Restore packages.config files for dependencies that don't support PackageReference.
|
|
190
|
+
try {
|
|
191
|
+
await buildTools.restorePackageConfigs(slnFile);
|
|
192
|
+
}
|
|
193
|
+
catch (e) {
|
|
194
|
+
(0, commandWithProgress_1.newError)(`Couldn't restore found packages.config instances. ${e.message}`);
|
|
195
|
+
throw e;
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
if (options.autolink) {
|
|
199
|
+
const autolinkArgs = [];
|
|
200
|
+
const autolinkConfig = config;
|
|
201
|
+
const autoLinkOptions = {
|
|
202
|
+
logging: options.logging,
|
|
203
|
+
check: false,
|
|
204
|
+
proj: options.proj,
|
|
205
|
+
sln: options.sln,
|
|
206
|
+
telemetry: options.telemetry,
|
|
207
|
+
};
|
|
208
|
+
runWindowsPhase = 'AutoLink';
|
|
209
|
+
await (0, autolink_1.autolinkWindowsInternal)(autolinkArgs, autolinkConfig, autoLinkOptions);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
(0, commandWithProgress_1.newInfo)('Autolink step is skipped');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
catch (e) {
|
|
216
|
+
(0, commandWithProgress_1.newError)(`Autolinking failed. ${e.message}`);
|
|
217
|
+
throw e;
|
|
218
|
+
}
|
|
219
|
+
if (options.build) {
|
|
220
|
+
runWindowsPhase = 'FindSolution';
|
|
221
|
+
if (!slnFile) {
|
|
222
|
+
(0, commandWithProgress_1.newError)('Visual Studio Solution file not found. Maybe run "npx react-native-windows-init" first?');
|
|
223
|
+
throw new telemetry_1.CodedError('NoSolution', 'Cannot find solution file');
|
|
75
224
|
}
|
|
76
225
|
// Get build/deploy options
|
|
77
226
|
const buildType = deploy.getBuildConfiguration(options);
|
|
78
|
-
|
|
227
|
+
const msBuildProps = build.parseMsBuildProps(options);
|
|
79
228
|
// Disable the autolink check since we just ran it
|
|
80
229
|
msBuildProps.RunAutolinkCheck = 'false';
|
|
81
230
|
try {
|
|
82
|
-
|
|
83
|
-
options.buildLogDirectory, options.singleproc);
|
|
231
|
+
runWindowsPhase = 'FindSolution';
|
|
232
|
+
await build.buildSolution(buildTools, slnFile, buildType, options.arch, msBuildProps, verbose, 'build', options.buildLogDirectory, options.singleproc);
|
|
84
233
|
}
|
|
85
234
|
catch (e) {
|
|
86
|
-
commandWithProgress_1.newError(`Build failed with message ${e.message}. Check your build configuration.`);
|
|
235
|
+
(0, commandWithProgress_1.newError)(`Build failed with message ${e.message}. Check your build configuration.`);
|
|
87
236
|
if (e.logfile) {
|
|
88
|
-
console.log('See',
|
|
237
|
+
console.log('See', chalk_1.default.bold(e.logfile));
|
|
89
238
|
}
|
|
90
|
-
|
|
239
|
+
throw e;
|
|
91
240
|
}
|
|
92
241
|
}
|
|
93
242
|
else {
|
|
94
|
-
commandWithProgress_1.newInfo('Build step is skipped');
|
|
243
|
+
(0, commandWithProgress_1.newInfo)('Build step is skipped');
|
|
244
|
+
}
|
|
245
|
+
if (shouldLaunchPackager(options)) {
|
|
246
|
+
await deploy.startServerInNewWindow(options, verbose);
|
|
95
247
|
}
|
|
96
|
-
await deploy.startServerInNewWindow(options, verbose);
|
|
97
248
|
if (options.deploy) {
|
|
249
|
+
runWindowsPhase = 'FindSolution';
|
|
98
250
|
if (!slnFile) {
|
|
99
|
-
commandWithProgress_1.newError('Visual Studio Solution file not found. Maybe run "react-native
|
|
100
|
-
|
|
251
|
+
(0, commandWithProgress_1.newError)('Visual Studio Solution file not found. Maybe run "npx react-native-windows-init" first?');
|
|
252
|
+
throw new telemetry_1.CodedError('NoSolution', 'Cannot find solution file');
|
|
101
253
|
}
|
|
102
254
|
try {
|
|
255
|
+
runWindowsPhase = 'Deploy';
|
|
103
256
|
if (options.device || options.emulator || options.target) {
|
|
104
|
-
await deploy.deployToDevice(options, verbose);
|
|
257
|
+
await deploy.deployToDevice(options, verbose, config);
|
|
105
258
|
}
|
|
106
259
|
else {
|
|
107
260
|
await deploy.deployToDesktop(options, verbose, config, buildTools);
|
|
108
261
|
}
|
|
109
262
|
}
|
|
110
263
|
catch (e) {
|
|
111
|
-
commandWithProgress_1.newError(`Failed to deploy${e ? `: ${e.message}` : ''}`);
|
|
112
|
-
|
|
264
|
+
(0, commandWithProgress_1.newError)(`Failed to deploy${e ? `: ${e.message}` : ''}`);
|
|
265
|
+
throw e;
|
|
113
266
|
}
|
|
114
267
|
}
|
|
115
268
|
else {
|
|
116
|
-
commandWithProgress_1.newInfo('Deploy step is skipped');
|
|
269
|
+
(0, commandWithProgress_1.newInfo)('Deploy step is skipped');
|
|
117
270
|
}
|
|
118
271
|
}
|
|
272
|
+
function shouldLaunchPackager(options) {
|
|
273
|
+
return (options.packager === true &&
|
|
274
|
+
options.launch === true &&
|
|
275
|
+
options.release !== true);
|
|
276
|
+
}
|
|
119
277
|
/*
|
|
120
278
|
// Example of running the Windows Command
|
|
121
279
|
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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AO,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 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 // Restore packages.config files for dependencies that don't support PackageReference.\n try {\n await buildTools.restorePackageConfigs(slnFile);\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 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 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,13 @@
|
|
|
4
4
|
* @format
|
|
5
5
|
*/
|
|
6
6
|
import { CommandOption } from '@react-native-community/cli-types';
|
|
7
|
-
export declare type BuildArch = 'x86' | 'x64' | '
|
|
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
|
|
13
|
+
* arch: String - The build architecture (ARM64, x86, x64)
|
|
14
14
|
* singleproc: Boolean - opt out of multi-proc builds
|
|
15
15
|
* emulator: Boolean - Deploy to the emulator
|
|
16
16
|
* device: Boolean - Deploy to a device
|
|
@@ -22,9 +22,11 @@ export declare type BuildConfig = 'Debug' | 'DebugBundle' | 'Release' | 'Release
|
|
|
22
22
|
* no-launch: Boolean - Do not launch the app after deployment
|
|
23
23
|
* no-build: Boolean - Do not build the solution
|
|
24
24
|
* no-deploy: Boolean - Do not deploy the app
|
|
25
|
+
* deploy-from-layout: Force deploy from layout, even in release builds
|
|
25
26
|
* sln: String - Solution file to build
|
|
26
27
|
* msbuildprops: String - Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2
|
|
27
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
|
|
28
30
|
*/
|
|
29
31
|
export interface RunWindowsOptions {
|
|
30
32
|
release?: boolean;
|
|
@@ -35,18 +37,20 @@ export interface RunWindowsOptions {
|
|
|
35
37
|
device?: boolean;
|
|
36
38
|
target?: string;
|
|
37
39
|
remoteDebugging?: string;
|
|
38
|
-
logging
|
|
39
|
-
packager
|
|
40
|
-
bundle
|
|
41
|
-
launch
|
|
42
|
-
autolink
|
|
43
|
-
build
|
|
44
|
-
deploy
|
|
40
|
+
logging?: boolean;
|
|
41
|
+
packager?: boolean;
|
|
42
|
+
bundle?: boolean;
|
|
43
|
+
launch?: boolean;
|
|
44
|
+
autolink?: boolean;
|
|
45
|
+
build?: boolean;
|
|
46
|
+
deploy?: boolean;
|
|
47
|
+
deployFromLayout?: boolean;
|
|
45
48
|
sln?: string;
|
|
46
49
|
proj?: string;
|
|
47
50
|
msbuildprops?: string;
|
|
48
51
|
buildLogDirectory?: string;
|
|
49
|
-
info
|
|
52
|
+
info?: boolean;
|
|
50
53
|
directDebugging?: number;
|
|
54
|
+
telemetry?: boolean;
|
|
51
55
|
}
|
|
52
56
|
export declare const runWindowsOptions: CommandOption[];
|