@react-native-windows/cli 0.67.0 → 0.68.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib-commonjs/config/configUtils.js +1 -1
- package/lib-commonjs/config/configUtils.js.map +1 -1
- package/lib-commonjs/config/dependencyConfig.js +4 -2
- package/lib-commonjs/config/dependencyConfig.js.map +1 -1
- package/lib-commonjs/e2etest/autolink.test.js +16 -0
- package/lib-commonjs/e2etest/autolink.test.js.map +1 -1
- package/lib-commonjs/e2etest/dependencyConfig.test.js +2 -2
- package/lib-commonjs/e2etest/dependencyConfig.test.js.map +1 -1
- package/lib-commonjs/e2etest/projectConfig.test.js +2 -4
- package/lib-commonjs/e2etest/projectConfig.test.js.map +1 -1
- package/lib-commonjs/e2etest/projectConfig.utils.js +3 -10
- package/lib-commonjs/e2etest/projectConfig.utils.js.map +1 -1
- package/lib-commonjs/e2etest/runWindows.test.js +35 -14
- package/lib-commonjs/e2etest/runWindows.test.js.map +1 -1
- package/lib-commonjs/generator-common/index.js +7 -7
- package/lib-commonjs/generator-common/index.js.map +1 -1
- package/lib-commonjs/generator-windows/index.js +10 -26
- package/lib-commonjs/generator-windows/index.js.map +1 -1
- package/lib-commonjs/index.js +9 -60
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/runWindows/runWindows.d.ts +0 -1
- package/lib-commonjs/runWindows/runWindows.js +107 -131
- package/lib-commonjs/runWindows/runWindows.js.map +1 -1
- package/lib-commonjs/runWindows/runWindowsOptions.js +6 -2
- package/lib-commonjs/runWindows/runWindowsOptions.js.map +1 -1
- package/lib-commonjs/runWindows/utils/autolink.d.ts +9 -1
- package/lib-commonjs/runWindows/utils/autolink.js +81 -28
- package/lib-commonjs/runWindows/utils/autolink.js.map +1 -1
- package/lib-commonjs/runWindows/utils/build.js +1 -1
- package/lib-commonjs/runWindows/utils/build.js.map +1 -1
- package/lib-commonjs/runWindows/utils/checkRequirements.js +1 -1
- package/lib-commonjs/runWindows/utils/checkRequirements.js.map +1 -1
- package/lib-commonjs/runWindows/utils/commandWithProgress.d.ts +6 -0
- package/lib-commonjs/runWindows/utils/commandWithProgress.js +26 -5
- package/lib-commonjs/runWindows/utils/commandWithProgress.js.map +1 -1
- package/lib-commonjs/runWindows/utils/deploy.js +9 -9
- package/lib-commonjs/runWindows/utils/deploy.js.map +1 -1
- package/lib-commonjs/runWindows/utils/msbuildtools.d.ts +1 -0
- package/lib-commonjs/runWindows/utils/msbuildtools.js +19 -12
- 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.js +1 -1
- package/lib-commonjs/runWindows/utils/version.js.map +1 -1
- package/lib-commonjs/runWindows/utils/vsInstalls.js +2 -2
- package/lib-commonjs/runWindows/utils/vsInstalls.js.map +1 -1
- package/lib-commonjs/runWindows/utils/vstools.js +4 -4
- package/lib-commonjs/runWindows/utils/vstools.js.map +1 -1
- package/lib-commonjs/runWindows/utils/winappdeploytool.js +3 -3
- package/lib-commonjs/runWindows/utils/winappdeploytool.js.map +1 -1
- package/package.json +11 -10
- package/CHANGELOG.json +0 -1851
- package/CHANGELOG.md +0 -818
package/lib-commonjs/index.js
CHANGED
|
@@ -19,27 +19,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.projectConfig = exports.dependencyConfig = exports.commands = exports.generateWindows = void 0;
|
|
22
|
-
const fs_1 = __importDefault(require("fs"));
|
|
22
|
+
const fs_1 = __importDefault(require("@react-native-windows/fs"));
|
|
23
23
|
const path_1 = __importDefault(require("path"));
|
|
24
|
-
const telemetry_1 = require("@react-native-windows/telemetry");
|
|
25
24
|
const generator_windows_1 = require("./generator-windows");
|
|
26
25
|
const autolink_1 = require("./runWindows/utils/autolink");
|
|
27
26
|
const runWindows_1 = require("./runWindows/runWindows");
|
|
28
27
|
const dependencyConfig_1 = require("./config/dependencyConfig");
|
|
29
28
|
const projectConfig_1 = require("./config/projectConfig");
|
|
30
|
-
function scrubOptions(opt) {
|
|
31
|
-
return {
|
|
32
|
-
overwrite: opt.overwrite,
|
|
33
|
-
language: opt.language,
|
|
34
|
-
projectType: opt.projectType,
|
|
35
|
-
experimentalNuGetDependency: opt.experimentalNuGetDependency,
|
|
36
|
-
nuGetTestFeed: opt.nuGetTestFeed !== undefined ? true : false,
|
|
37
|
-
nuGetTestVersion: opt.nuGetTestVersion !== undefined ? true : false,
|
|
38
|
-
useWinUI3: opt.useWinUI3,
|
|
39
|
-
useHermes: opt.useHermes,
|
|
40
|
-
verbose: opt.verbose,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
29
|
/**
|
|
44
30
|
* Simple utility for running the Windows generator.
|
|
45
31
|
*
|
|
@@ -49,52 +35,15 @@ function scrubOptions(opt) {
|
|
|
49
35
|
* @param options command line options container
|
|
50
36
|
*/
|
|
51
37
|
async function generateWindows(projectDir, name, ns, options) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (!fs_1.default.existsSync(projectDir)) {
|
|
55
|
-
fs_1.default.mkdirSync(projectDir);
|
|
56
|
-
}
|
|
57
|
-
await (0, generator_windows_1.installScriptsAndDependencies)(options);
|
|
58
|
-
const rnwPackage = path_1.default.dirname(require.resolve('react-native-windows/package.json', {
|
|
59
|
-
paths: [projectDir],
|
|
60
|
-
}));
|
|
61
|
-
const templateRoot = path_1.default.join(rnwPackage, 'template');
|
|
62
|
-
await (0, generator_windows_1.copyProjectTemplateAndReplace)(templateRoot, projectDir, name, ns, options);
|
|
63
|
-
}
|
|
64
|
-
catch (e) {
|
|
65
|
-
error = e;
|
|
66
|
-
telemetry_1.Telemetry.trackException(error);
|
|
67
|
-
throw e;
|
|
68
|
-
}
|
|
69
|
-
finally {
|
|
70
|
-
if (telemetry_1.Telemetry.client) {
|
|
71
|
-
let rnVersion = '';
|
|
72
|
-
let cliVersion = '';
|
|
73
|
-
try {
|
|
74
|
-
const cwd = process.cwd();
|
|
75
|
-
const rnwPkg = JSON.parse(fs_1.default
|
|
76
|
-
.readFileSync(require.resolve('react-native-windows/package.json', {
|
|
77
|
-
paths: [cwd],
|
|
78
|
-
}))
|
|
79
|
-
.toString());
|
|
80
|
-
rnVersion = rnwPkg.peerDependencies['react-native'] || '';
|
|
81
|
-
const rnwCliPkgJson = require('../package.json');
|
|
82
|
-
cliVersion = rnwCliPkgJson.version;
|
|
83
|
-
}
|
|
84
|
-
catch (_a) { }
|
|
85
|
-
const optScrubbed = scrubOptions(options);
|
|
86
|
-
telemetry_1.Telemetry.client.trackEvent({
|
|
87
|
-
name: 'generate-windows',
|
|
88
|
-
properties: {
|
|
89
|
-
error: error,
|
|
90
|
-
...optScrubbed,
|
|
91
|
-
'react-native': rnVersion,
|
|
92
|
-
'cli-version': cliVersion,
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
telemetry_1.Telemetry.client.flush();
|
|
96
|
-
}
|
|
38
|
+
if (!fs_1.default.existsSync(projectDir)) {
|
|
39
|
+
fs_1.default.mkdirSync(projectDir);
|
|
97
40
|
}
|
|
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);
|
|
98
47
|
}
|
|
99
48
|
exports.generateWindows = generateWindows;
|
|
100
49
|
// Assert the interface here doesn't change for the reasons above
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;AAEH,
|
|
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"]}
|
|
@@ -27,66 +27,80 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.runWindowsCommand =
|
|
31
|
-
const
|
|
32
|
-
const fs_1 = __importDefault(require("fs"));
|
|
30
|
+
exports.runWindowsCommand = void 0;
|
|
31
|
+
const fs_1 = __importDefault(require("@react-native-windows/fs"));
|
|
33
32
|
const path_1 = __importDefault(require("path"));
|
|
34
33
|
const telemetry_1 = require("@react-native-windows/telemetry");
|
|
35
34
|
const build = __importStar(require("./utils/build"));
|
|
36
35
|
const chalk_1 = __importDefault(require("chalk"));
|
|
37
36
|
const deploy = __importStar(require("./utils/deploy"));
|
|
38
37
|
const commandWithProgress_1 = require("./utils/commandWithProgress");
|
|
38
|
+
const telemetryHelpers_1 = require("./utils/telemetryHelpers");
|
|
39
39
|
const info = __importStar(require("./utils/info"));
|
|
40
40
|
const msbuildtools_1 = __importDefault(require("./utils/msbuildtools"));
|
|
41
41
|
const runWindowsOptions_1 = require("./runWindowsOptions");
|
|
42
42
|
const autolink_1 = require("./utils/autolink");
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
|
56
81
|
}
|
|
57
82
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
catch (_a) { }
|
|
69
|
-
(0, commandWithProgress_1.newWarn)(`Could not determine ${pkgName} version`);
|
|
70
|
-
return '';
|
|
83
|
+
/**
|
|
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;
|
|
71
93
|
}
|
|
72
94
|
let runWindowsPhase = 'None';
|
|
95
|
+
let hasRunRnwDependencies = false;
|
|
73
96
|
/**
|
|
74
|
-
*
|
|
97
|
+
* The function run when calling `react-native run-windows`.
|
|
75
98
|
* @param args Unprocessed args passed from react-native CLI.
|
|
76
99
|
* @param config Config passed from react-native CLI.
|
|
77
100
|
* @param options Options passed from react-native CLI.
|
|
78
101
|
*/
|
|
79
102
|
async function runWindows(args, config, options) {
|
|
80
|
-
|
|
81
|
-
if (!options.telemetry) {
|
|
82
|
-
if (options.logging) {
|
|
83
|
-
console.log('Disabling telemetry');
|
|
84
|
-
}
|
|
85
|
-
telemetry_1.Telemetry.disable();
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
telemetry_1.Telemetry.setup();
|
|
89
|
-
}
|
|
103
|
+
await (0, telemetryHelpers_1.startTelemetrySession)('run-windows', config, options, (0, telemetryHelpers_1.getDefaultOptions)(config, runWindowsOptions_1.runWindowsOptions), optionSanitizer);
|
|
90
104
|
// https://github.com/yarnpkg/yarn/issues/8334 - Yarn on Windows breaks apps that read from the environment variables
|
|
91
105
|
// Yarn will run node via CreateProcess and pass npm_config_* variables in lowercase without unifying their value
|
|
92
106
|
// with their possibly existing uppercase counterparts. This breaks programs that read from the environment block
|
|
@@ -95,31 +109,35 @@ async function runWindows(args, config, options) {
|
|
|
95
109
|
// uppercase variable values one if there are no overrides.
|
|
96
110
|
delete process.env.NPM_CONFIG_CACHE;
|
|
97
111
|
delete process.env.NPM_CONFIG_PREFIX;
|
|
98
|
-
|
|
99
|
-
fs_1.default.existsSync(path_1.default.join(process.env.LocalAppData, 'rnw-dependencies.txt')); // CODESYNC \vnext\scripts\rnw-dependencies.ps1
|
|
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
|
|
114
|
+
}
|
|
115
|
+
let runWindowsError;
|
|
100
116
|
if (options.info) {
|
|
101
117
|
try {
|
|
102
118
|
const output = await info.getEnvironmentInfo();
|
|
103
119
|
console.log(output.trimEnd());
|
|
104
120
|
console.log(' Installed UWP SDKs:');
|
|
105
121
|
const sdks = msbuildtools_1.default.getAllAvailableUAPVersions();
|
|
106
|
-
sdks.forEach(version => console.log(' ' + version));
|
|
107
|
-
return;
|
|
122
|
+
sdks.forEach((version) => console.log(' ' + version));
|
|
108
123
|
}
|
|
109
|
-
catch (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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());
|
|
114
129
|
}
|
|
130
|
+
await (0, telemetryHelpers_1.endTelemetrySession)(runWindowsError, getExtraProps);
|
|
131
|
+
(0, commandWithProgress_1.setExitProcessWithError)(options.logging, runWindowsError);
|
|
132
|
+
return;
|
|
115
133
|
}
|
|
116
|
-
let runWindowsError;
|
|
117
134
|
try {
|
|
118
135
|
await runWindowsInternal(args, config, options);
|
|
119
136
|
}
|
|
120
|
-
catch (
|
|
121
|
-
|
|
122
|
-
|
|
137
|
+
catch (ex) {
|
|
138
|
+
runWindowsError =
|
|
139
|
+
ex instanceof Error ? ex : new Error(String(ex));
|
|
140
|
+
telemetry_1.Telemetry.trackException(runWindowsError);
|
|
123
141
|
if (!hasRunRnwDependencies) {
|
|
124
142
|
const rnwPkgJsonPath = require.resolve('react-native-windows/package.json', {
|
|
125
143
|
paths: [process.cwd(), __dirname],
|
|
@@ -127,68 +145,16 @@ async function runWindows(args, config, options) {
|
|
|
127
145
|
const rnwDependenciesPath = path_1.default.join(path_1.default.dirname(rnwPkgJsonPath), 'scripts/rnw-dependencies.ps1');
|
|
128
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`);
|
|
129
147
|
}
|
|
130
|
-
return setExitProcessWithError(e, options.logging);
|
|
131
|
-
}
|
|
132
|
-
finally {
|
|
133
|
-
(_a = telemetry_1.Telemetry.client) === null || _a === void 0 ? void 0 : _a.trackEvent({
|
|
134
|
-
name: 'run-windows',
|
|
135
|
-
properties: {
|
|
136
|
-
release: options.release,
|
|
137
|
-
arch: options.arch,
|
|
138
|
-
singleproc: options.singleproc,
|
|
139
|
-
emulator: options.emulator,
|
|
140
|
-
device: options.device,
|
|
141
|
-
target: options.target,
|
|
142
|
-
remoteDebugging: options.remoteDebugging,
|
|
143
|
-
logging: options.logging,
|
|
144
|
-
packager: options.packager,
|
|
145
|
-
bundle: options.bundle,
|
|
146
|
-
launch: options.launch,
|
|
147
|
-
autolink: options.autolink,
|
|
148
|
-
build: options.bundle,
|
|
149
|
-
deploy: options.deploy,
|
|
150
|
-
sln: options.sln !== undefined,
|
|
151
|
-
proj: options.proj !== undefined,
|
|
152
|
-
msBuildProps: options.msbuildprops !== undefined
|
|
153
|
-
? options.msbuildprops.split(',').length
|
|
154
|
-
: 0,
|
|
155
|
-
info: options.info,
|
|
156
|
-
directDebugging: options.directDebugging,
|
|
157
|
-
'react-native-windows': getPkgVersion('react-native-windows'),
|
|
158
|
-
'react-native': getPkgVersion('react-native'),
|
|
159
|
-
'cli-version': getPkgVersion('@react-native-windows/cli'),
|
|
160
|
-
msftInternal: (0, telemetry_1.isMSFTInternal)(),
|
|
161
|
-
durationInSecs: process.uptime(),
|
|
162
|
-
success: runWindowsError === undefined,
|
|
163
|
-
phase: runWindowsPhase,
|
|
164
|
-
totalMem: (0, os_1.totalmem)(),
|
|
165
|
-
diskFree: (0, telemetry_1.getDiskFreeSpace)(__dirname),
|
|
166
|
-
cpus: (0, os_1.cpus)().length,
|
|
167
|
-
project: await getAnonymizedProjectName(config.root),
|
|
168
|
-
hasRunRnwDependencies: hasRunRnwDependencies,
|
|
169
|
-
},
|
|
170
|
-
});
|
|
171
|
-
(_b = telemetry_1.Telemetry.client) === null || _b === void 0 ? void 0 : _b.flush();
|
|
172
148
|
}
|
|
149
|
+
await (0, telemetryHelpers_1.endTelemetrySession)(runWindowsError, getExtraProps);
|
|
150
|
+
(0, commandWithProgress_1.setExitProcessWithError)(options.logging, runWindowsError);
|
|
173
151
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const projectName = projectJson.name;
|
|
181
|
-
if (typeof projectName !== 'string') {
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
// Ensure the project name cannot be reverse engineered to avoid leaking PII
|
|
185
|
-
return crypto_1.default
|
|
186
|
-
.createHash('sha256')
|
|
187
|
-
.update(projectName)
|
|
188
|
-
.digest('hex')
|
|
189
|
-
.toString();
|
|
190
|
-
}
|
|
191
|
-
exports.getAnonymizedProjectName = getAnonymizedProjectName;
|
|
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
|
+
*/
|
|
192
158
|
async function runWindowsInternal(args, config, options) {
|
|
193
159
|
const verbose = options.logging === true;
|
|
194
160
|
if (verbose) {
|
|
@@ -203,17 +169,44 @@ async function runWindowsInternal(args, config, options) {
|
|
|
203
169
|
(0, commandWithProgress_1.newError)(`Couldn't get app solution information. ${e.message}`);
|
|
204
170
|
throw e;
|
|
205
171
|
}
|
|
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
|
|
180
|
+
try {
|
|
181
|
+
(0, commandWithProgress_1.newInfo)('Trying pre-release VS');
|
|
182
|
+
buildTools = msbuildtools_1.default.findAvailableVersion(options.arch, verbose, true);
|
|
183
|
+
}
|
|
184
|
+
catch (e) {
|
|
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
|
+
}
|
|
206
197
|
try {
|
|
207
198
|
if (options.autolink) {
|
|
208
199
|
const autolinkArgs = [];
|
|
209
200
|
const autolinkConfig = config;
|
|
210
201
|
const autoLinkOptions = {
|
|
211
202
|
logging: options.logging,
|
|
203
|
+
check: false,
|
|
212
204
|
proj: options.proj,
|
|
213
205
|
sln: options.sln,
|
|
206
|
+
telemetry: options.telemetry,
|
|
214
207
|
};
|
|
215
208
|
runWindowsPhase = 'AutoLink';
|
|
216
|
-
await autolink_1.
|
|
209
|
+
await (0, autolink_1.autolinkWindowsInternal)(autolinkArgs, autolinkConfig, autoLinkOptions);
|
|
217
210
|
}
|
|
218
211
|
else {
|
|
219
212
|
(0, commandWithProgress_1.newInfo)('Autolink step is skipped');
|
|
@@ -223,23 +216,6 @@ async function runWindowsInternal(args, config, options) {
|
|
|
223
216
|
(0, commandWithProgress_1.newError)(`Autolinking failed. ${e.message}`);
|
|
224
217
|
throw e;
|
|
225
218
|
}
|
|
226
|
-
let buildTools;
|
|
227
|
-
runWindowsPhase = 'FindBuildTools';
|
|
228
|
-
try {
|
|
229
|
-
buildTools = msbuildtools_1.default.findAvailableVersion(options.arch, verbose);
|
|
230
|
-
}
|
|
231
|
-
catch (error) {
|
|
232
|
-
(0, commandWithProgress_1.newWarn)('No public VS release found');
|
|
233
|
-
// Try prerelease
|
|
234
|
-
try {
|
|
235
|
-
(0, commandWithProgress_1.newInfo)('Trying pre-release VS');
|
|
236
|
-
buildTools = msbuildtools_1.default.findAvailableVersion(options.arch, verbose, true);
|
|
237
|
-
}
|
|
238
|
-
catch (e) {
|
|
239
|
-
(0, commandWithProgress_1.newError)(e.message);
|
|
240
|
-
throw error;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
219
|
if (options.build) {
|
|
244
220
|
runWindowsPhase = 'FindSolution';
|
|
245
221
|
if (!slnFile) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWindows.js","sourceRoot":"","sources":["../../src/runWindows/runWindows.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAA4B;AAC5B,4CAAoB;AACpB,gDAAwB;AACxB,+DAOyC;AAEzC,qDAAuC;AACvC,kDAA0B;AAC1B,uDAAyC;AACzC,qEAAuE;AACvE,mDAAqC;AACrC,wEAAgD;AAGhD,2DAAyE;AAEzE,+CAAiD;AACjD,2BAAkC;AAElC,SAAS,uBAAuB,CAC9B,KAAY,EACZ,iBAA2B;IAE3B,IAAI,iBAAiB,KAAK,IAAI,EAAE;QAC9B,OAAO,CAAC,GAAG,CACT,2BAA2B,eAAK,CAAC,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAC1E,CAAC;QACF,IAAI,qBAAS,CAAC,MAAM,EAAE;YACpB,OAAO,CAAC,GAAG,CACT,uBAAuB,qBAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,CACrE,CAAC;SACH;KACF;IACD,IAAI,KAAK,YAAY,sBAAU,EAAE;QAC/B,OAAO,CAAC,QAAQ,GAAG,uBAAW,CAAC,KAAK,CAAC,IAAsB,CAAC,CAAC;KAC9D;SAAM;QACL,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;KACtB;AACH,CAAC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right (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport crypto from 'crypto';\nimport fs from 'fs';\nimport path from 'path';\nimport {\n Telemetry,\n isMSFTInternal,\n getDiskFreeSpace,\n CodedError,\n CodedErrorType,\n CodedErrors,\n} from '@react-native-windows/telemetry';\n\nimport * as build from './utils/build';\nimport chalk from 'chalk';\nimport * as deploy from './utils/deploy';\nimport {newError, newInfo, newWarn} from './utils/commandWithProgress';\nimport * as info from './utils/info';\nimport MSBuildTools from './utils/msbuildtools';\n\nimport {Command, Config} from '@react-native-community/cli-types';\nimport {runWindowsOptions, RunWindowsOptions} from './runWindowsOptions';\n\nimport {autoLinkCommand} from './utils/autolink';\nimport {totalmem, cpus} from 'os';\n\nfunction setExitProcessWithError(\n error: Error,\n loggingWasEnabled?: boolean,\n): void {\n if (loggingWasEnabled !== true) {\n console.log(\n `Re-run the command with ${chalk.bold('--logging')} for more information`,\n );\n if (Telemetry.client) {\n console.log(\n `Your session id was ${Telemetry.client.commonProperties.sessionId}`,\n );\n }\n }\n if (error instanceof CodedError) {\n process.exitCode = CodedErrors[error.name as CodedErrorType];\n } else {\n process.exitCode = 1;\n }\n}\n\nfunction getPkgVersion(pkgName: string): string {\n try {\n const pkgJsonPath = require.resolve(`${pkgName}/package.json`, {\n paths: [process.cwd(), __dirname],\n });\n const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath).toString());\n if (pkgJson.name === pkgName && pkgJson.version !== undefined) {\n return pkgJson.version;\n }\n } catch {}\n newWarn(`Could not determine ${pkgName} version`);\n return '';\n}\n\n/**\n * Labels used by telemtry to represent current operation\n */\ntype RunWindowsPhase =\n | 'None'\n | 'AutoLink'\n | 'FindBuildTools'\n | 'FindSolution'\n | 'Deploy';\n\nlet runWindowsPhase: RunWindowsPhase = 'None';\n/**\n * Performs build deploy and launch of RNW apps.\n * @param args Unprocessed args passed from react-native CLI.\n * @param config Config passed from react-native CLI.\n * @param options Options passed from react-native CLI.\n */\nasync function runWindows(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n if (!options.telemetry) {\n if (options.logging) {\n console.log('Disabling telemetry');\n }\n Telemetry.disable();\n } else {\n Telemetry.setup();\n }\n\n // https://github.com/yarnpkg/yarn/issues/8334 - Yarn on Windows breaks apps that read from the environment variables\n // Yarn will run node via CreateProcess and pass npm_config_* variables in lowercase without unifying their value\n // with their possibly existing uppercase counterparts. This breaks programs that read from the environment block\n // and write to a case-insensitive dictionary since they expect to encounter each variable only once.\n // The values of the lowercase variables are the one npm actually wants to use, plus they are seeded from the\n // uppercase variable values one if there are no overrides.\n delete process.env.NPM_CONFIG_CACHE;\n delete process.env.NPM_CONFIG_PREFIX;\n\n const hasRunRnwDependencies =\n process.env.LocalAppData &&\n fs.existsSync(path.join(process.env.LocalAppData, 'rnw-dependencies.txt')); // CODESYNC \\vnext\\scripts\\rnw-dependencies.ps1\n\n if (options.info) {\n try {\n const output = await info.getEnvironmentInfo();\n console.log(output.trimEnd());\n console.log(' Installed UWP SDKs:');\n const sdks = MSBuildTools.getAllAvailableUAPVersions();\n sdks.forEach(version => console.log(' ' + version));\n return;\n } catch (err) {\n const e = err as Error;\n Telemetry.trackException(e);\n newError('Unable to print environment info.\\n' + e.toString());\n return setExitProcessWithError(e, options.logging);\n }\n }\n\n let runWindowsError;\n try {\n await runWindowsInternal(args, config, options);\n } catch (e) {\n Telemetry.trackException(e as Error);\n runWindowsError = e;\n if (!hasRunRnwDependencies) {\n const rnwPkgJsonPath = require.resolve(\n 'react-native-windows/package.json',\n {\n paths: [process.cwd(), __dirname],\n },\n );\n const rnwDependenciesPath = path.join(\n path.dirname(rnwPkgJsonPath),\n 'scripts/rnw-dependencies.ps1',\n );\n\n newError(\n `It is possible your installation is missing required software dependencies. Dependencies can be automatically installed by running ${rnwDependenciesPath} from an elevated PowerShell prompt.\\nFor more information, go to http://aka.ms/rnw-deps`,\n );\n }\n return setExitProcessWithError(e as Error, options.logging);\n } finally {\n Telemetry.client?.trackEvent({\n name: 'run-windows',\n properties: {\n release: options.release,\n arch: options.arch,\n singleproc: options.singleproc,\n emulator: options.emulator,\n device: options.device,\n target: options.target,\n remoteDebugging: options.remoteDebugging,\n logging: options.logging,\n packager: options.packager,\n bundle: options.bundle,\n launch: options.launch,\n autolink: options.autolink,\n build: options.bundle,\n deploy: options.deploy,\n sln: options.sln !== undefined,\n proj: options.proj !== undefined,\n msBuildProps:\n options.msbuildprops !== undefined\n ? options.msbuildprops!.split(',').length\n : 0,\n info: options.info,\n directDebugging: options.directDebugging,\n 'react-native-windows': getPkgVersion('react-native-windows'),\n 'react-native': getPkgVersion('react-native'),\n 'cli-version': getPkgVersion('@react-native-windows/cli'),\n msftInternal: isMSFTInternal(),\n durationInSecs: process.uptime(),\n success: runWindowsError === undefined,\n phase: runWindowsPhase,\n totalMem: totalmem(),\n diskFree: getDiskFreeSpace(__dirname),\n cpus: cpus().length,\n project: await getAnonymizedProjectName(config.root),\n hasRunRnwDependencies: hasRunRnwDependencies,\n },\n });\n Telemetry.client?.flush();\n }\n}\n\nexport async function getAnonymizedProjectName(\n projectRoot: string,\n): Promise<string | null> {\n const projectJsonPath = path.join(projectRoot, 'package.json');\n if (!fs.existsSync(projectJsonPath)) {\n return null;\n }\n\n const projectJson = JSON.parse(\n (await fs.promises.readFile(projectJsonPath)).toString(),\n );\n\n const projectName = projectJson.name;\n if (typeof projectName !== 'string') {\n return null;\n }\n\n // Ensure the project name cannot be reverse engineered to avoid leaking PII\n return crypto\n .createHash('sha256')\n .update(projectName)\n .digest('hex')\n .toString();\n}\n\nasync function runWindowsInternal(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n const verbose = options.logging === true;\n\n if (verbose) {\n newInfo('Verbose: ON');\n }\n\n // Get the solution file\n let slnFile;\n try {\n slnFile = build.getAppSolutionFile(options, config);\n } catch (e) {\n newError(`Couldn't get app solution information. ${(e as Error).message}`);\n throw e;\n }\n\n try {\n if (options.autolink) {\n const autolinkArgs: string[] = [];\n const autolinkConfig = config;\n const autoLinkOptions = {\n logging: options.logging,\n proj: options.proj,\n sln: options.sln,\n };\n runWindowsPhase = 'AutoLink';\n await autoLinkCommand.func(autolinkArgs, autolinkConfig, autoLinkOptions);\n } else {\n newInfo('Autolink step is skipped');\n }\n } catch (e) {\n newError(`Autolinking failed. ${(e as Error).message}`);\n throw e;\n }\n\n let buildTools: MSBuildTools;\n runWindowsPhase = 'FindBuildTools';\n try {\n buildTools = MSBuildTools.findAvailableVersion(options.arch, verbose);\n } catch (error) {\n newWarn('No public VS release found');\n // Try prerelease\n try {\n newInfo('Trying pre-release VS');\n buildTools = MSBuildTools.findAvailableVersion(\n options.arch,\n verbose,\n true, // preRelease\n );\n } catch (e) {\n newError((e as Error).message);\n throw error;\n }\n }\n\n if (options.build) {\n runWindowsPhase = 'FindSolution';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n // Get build/deploy options\n const buildType = deploy.getBuildConfiguration(options);\n const msBuildProps = build.parseMsBuildProps(options);\n\n // Disable the autolink check since we just ran it\n msBuildProps.RunAutolinkCheck = 'false';\n\n try {\n runWindowsPhase = 'FindSolution';\n await build.buildSolution(\n buildTools,\n slnFile!,\n buildType,\n options.arch,\n msBuildProps,\n verbose,\n 'build',\n options.buildLogDirectory,\n options.singleproc,\n );\n } catch (e) {\n newError(\n `Build failed with message ${\n (e as Error).message\n }. Check your build configuration.`,\n );\n if ((e as any).logfile) {\n console.log('See', chalk.bold((e as any).logfile));\n }\n throw e;\n }\n } else {\n newInfo('Build step is skipped');\n }\n\n if (shouldLaunchPackager(options)) {\n await deploy.startServerInNewWindow(options, verbose);\n }\n\n if (options.deploy) {\n runWindowsPhase = 'FindSolution';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n try {\n runWindowsPhase = 'Deploy';\n if (options.device || options.emulator || options.target) {\n await deploy.deployToDevice(options, verbose, config);\n } else {\n await deploy.deployToDesktop(options, verbose, config, buildTools);\n }\n } catch (e) {\n newError(`Failed to deploy${e ? `: ${(e as Error).message}` : ''}`);\n throw e;\n }\n } else {\n newInfo('Deploy step is skipped');\n }\n}\n\nfunction shouldLaunchPackager(options: RunWindowsOptions): boolean {\n return (\n options.packager === true &&\n options.launch === true &&\n options.release !== true\n );\n}\n\n/*\n// Example of running the Windows Command\nrunWindows({\n root: 'C:\\\\github\\\\hack\\\\myapp',\n debug: true,\n arch: 'x86',\n nugetPath: 'C:\\\\github\\\\react\\\\react-native-windows\\\\local-cli\\\\runWindows\\\\.nuget\\\\nuget.exe'\n});\n*/\n\n/**\n * Starts the app on a connected Windows emulator or mobile device.\n */\nexport const runWindowsCommand: Command = {\n name: 'run-windows',\n description:\n 'builds your app and starts it on a connected Windows desktop, emulator or device',\n func: runWindows,\n options: runWindowsOptions,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"runWindows.js","sourceRoot":"","sources":["../../src/runWindows/runWindows.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA0C;AAC1C,gDAAwB;AACxB,+DAAsE;AAEtE,qDAAuC;AACvC,kDAA0B;AAC1B,uDAAyC;AACzC,qEAKqC;AACrC,+DAIkC;AAClC,mDAAqC;AACrC,wEAAgD;AAGhD,2DAAyE;AAEzE,+CAA0E;AAE1E;;;;;GAKG;AACH,sCAAsC;AACtC,SAAS,eAAe,CAAC,GAA4B,EAAE,KAAU;IAC/D,kCAAkC;IAClC,2EAA2E;IAC3E,8DAA8D;IAC9D,QAAQ,GAAG,EAAE;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ,CAAC;QACd,KAAK,KAAK,CAAC;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,mBAAmB;YACtB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,K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AAC,MAAM,EAAE;QAClB,eAAe,GAAG,cAAc,CAAC;QACjC,IAAI,CAAC,OAAO,EAAE;YACZ,IAAA,8BAAQ,EACN,yFAAyF,CAC1F,CAAC;YACF,MAAM,IAAI,sBAAU,CAAC,YAAY,EAAE,2BAA2B,CAAC,CAAC;SACjE;QAED,IAAI;YACF,eAAe,GAAG,QAAQ,CAAC;YAC3B,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE;gBACxD,MAAM,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;aACvD;iBAAM;gBACL,MAAM,MAAM,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 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,8 +4,12 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
* @format
|
|
6
6
|
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
7
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
11
|
exports.runWindowsOptions = void 0;
|
|
12
|
+
const os_1 = __importDefault(require("os"));
|
|
9
13
|
exports.runWindowsOptions = [
|
|
10
14
|
{
|
|
11
15
|
name: '--release',
|
|
@@ -14,12 +18,12 @@ exports.runWindowsOptions = [
|
|
|
14
18
|
{
|
|
15
19
|
name: '--root [string]',
|
|
16
20
|
description: 'Override the root directory for the windows build which contains the windows folder.',
|
|
17
|
-
default: config => config.root,
|
|
21
|
+
default: (config) => config.root,
|
|
18
22
|
},
|
|
19
23
|
{
|
|
20
24
|
name: '--arch [string]',
|
|
21
25
|
description: 'The build architecture (ARM64, x86, x64)',
|
|
22
|
-
default:
|
|
26
|
+
default: os_1.default.arch(),
|
|
23
27
|
parse: parseBuildArch,
|
|
24
28
|
},
|
|
25
29
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWindowsOptions.js","sourceRoot":"","sources":["../../src/runWindows/runWindowsOptions.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"runWindowsOptions.js","sourceRoot":"","sources":["../../src/runWindows/runWindowsOptions.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,4CAAoB;AA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AC;AAClB,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport os from 'os';\nimport {CommandOption} from '@react-native-community/cli-types';\n\nexport type BuildArch = 'x86' | 'x64' | 'ARM64';\nexport type BuildConfig = 'Debug' | 'DebugBundle' | 'Release' | 'ReleaseBundle';\n\n/**\n * * Options are the following:\n * release: Boolean - Specifies release build\n * root: String - The root of the application\n * arch: String - The build architecture (ARM64, x86, x64)\n * singleproc: Boolean - opt out of multi-proc builds\n * emulator: Boolean - Deploy to the emulator\n * device: Boolean - Deploy to a device\n * target: String - Device GUID to deploy to\n * remote-debugging: Boolean - Run using remote JS proxy\n * logging: Boolean - Enables logging\n * no-packager: Boolean - Do not launch packager while building\n * bundle: Boolean - Enable Bundle configuration.\n * no-launch: Boolean - Do not launch the app after deployment\n * no-build: Boolean - Do not build the solution\n * no-deploy: Boolean - Do not deploy the app\n * deploy-from-layout: Force deploy from layout, even in release builds\n * sln: String - Solution file to build\n * msbuildprops: String - Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2\n * direct-debugging: Number - Enable direct debugging on specified port\n * no-telemetry: Boolean - Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI\n */\nexport interface RunWindowsOptions {\n release?: boolean;\n root: string;\n arch: BuildArch;\n singleproc?: boolean;\n emulator?: boolean;\n device?: boolean;\n target?: string;\n remoteDebugging?: string;\n logging?: boolean;\n packager?: boolean;\n bundle?: boolean;\n launch?: boolean;\n autolink?: boolean;\n build?: boolean;\n deploy?: boolean;\n deployFromLayout?: boolean;\n sln?: string;\n proj?: string;\n msbuildprops?: string;\n buildLogDirectory?: string;\n info?: boolean;\n directDebugging?: number;\n telemetry?: boolean;\n}\n\nexport const runWindowsOptions: CommandOption[] = [\n {\n name: '--release',\n description: 'Specifies a release build',\n },\n {\n name: '--root [string]',\n description:\n 'Override the root directory for the windows build which contains the windows folder.',\n default: (config) => config.root,\n },\n {\n name: '--arch [string]',\n description: 'The build architecture (ARM64, x86, x64)',\n default: os.arch(),\n parse: parseBuildArch,\n },\n {\n name: '--singleproc',\n description: 'Disables multi-proc build',\n },\n {\n name: '--emulator',\n description: 'Deploys the app to an emulator',\n },\n {\n name: '--device',\n description: 'Deploys the app to a connected device',\n },\n {\n name: '--target [string]',\n description: 'Deploys the app to the specified GUID for a device.',\n },\n {\n name: '--remote-debugging',\n description: 'Deploys the app in remote debugging mode.',\n },\n {\n name: '--logging',\n description: 'Enables logging',\n },\n {\n name: '--no-packager',\n description: 'Do not launch packager while building',\n },\n {\n name: '--bundle',\n description:\n 'Enable Bundle configuration and it would be ReleaseBundle/DebugBundle other than Release/Debug',\n },\n {\n name: '--no-launch',\n description: 'Do not launch the app after deployment',\n },\n {\n name: '--no-autolink',\n description: 'Do not run autolinking',\n },\n {\n name: '--no-build',\n description: 'Do not build the solution',\n },\n {\n name: '--no-deploy',\n description: 'Do not deploy the app',\n },\n {\n name: '--deploy-from-layout',\n description: 'Force deploy from layout',\n },\n {\n name: '--sln [string]',\n description:\n \"Override the app solution file determined by 'react-native config', e.g. windows\\\\myApp.sln\",\n default: undefined,\n },\n {\n name: '--proj [string]',\n description:\n \"Override the app project file determined by 'react-native config', e.g. windows\\\\myApp\\\\myApp.vcxproj\",\n default: undefined,\n },\n {\n name: '--msbuildprops [string]',\n description:\n 'Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2',\n },\n {\n name: '--buildLogDirectory [string]',\n description: 'Optional directory where msbuild log files should be stored',\n },\n {\n name: '--info',\n description: 'Dump environment information',\n },\n {\n name: '--direct-debugging [number]',\n description: 'Enable direct debugging on specified port',\n parse: parseDirectDebuggingPort,\n },\n {\n name: '--no-telemetry',\n description:\n 'Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI',\n },\n];\n\nfunction parseBuildArch(arg: string): BuildArch {\n const supportedArches: BuildArch[] = ['x86', 'x64', 'ARM64'];\n for (const supported of supportedArches) {\n if (arg.toLowerCase() === supported.toLowerCase()) {\n return supported;\n }\n }\n\n errorOut(`Unrecognized --arch '${arg}'. Expected one of ${supportedArches}`);\n}\n\nfunction parseDirectDebuggingPort(arg: string): number {\n const num = parseInt(arg, 10);\n\n if (!Number.isInteger(num)) {\n errorOut(`Expected argument '--direct-debugging' to be a number`);\n }\n if (num < 1024 || num >= 65535) {\n errorOut('Direct debugging port it out of range');\n }\n\n return num;\n}\n\nfunction errorOut(arg: string): never {\n console.error(arg);\n process.exit(1);\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
* @format
|
|
5
5
|
*/
|
|
6
|
-
import { Command, CommandOption, Dependency, ProjectConfig } from '@react-native-community/cli-types';
|
|
6
|
+
import { Command, CommandOption, Config, Dependency, ProjectConfig } from '@react-native-community/cli-types';
|
|
7
7
|
import { WindowsProjectConfig } from '../../config/projectConfig';
|
|
8
8
|
import { Ora } from 'ora';
|
|
9
9
|
export declare class AutolinkWindows {
|
|
@@ -73,11 +73,19 @@ export declare class AutolinkWindows {
|
|
|
73
73
|
/** @return The CLI command to invoke autolink-windows independently */
|
|
74
74
|
getAutolinkWindowsCommand(): string;
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Performs auto-linking for RNW native modules and apps.
|
|
78
|
+
* @param args Unprocessed args passed from react-native CLI.
|
|
79
|
+
* @param config Config passed from react-native CLI.
|
|
80
|
+
* @param options Options passed from react-native CLI.
|
|
81
|
+
*/
|
|
82
|
+
export declare function autolinkWindowsInternal(args: string[], config: Config, options: AutoLinkOptions): Promise<void>;
|
|
76
83
|
export interface AutoLinkOptions {
|
|
77
84
|
logging?: boolean;
|
|
78
85
|
check?: boolean;
|
|
79
86
|
sln?: string;
|
|
80
87
|
proj?: string;
|
|
88
|
+
telemetry?: boolean;
|
|
81
89
|
}
|
|
82
90
|
export declare const autolinkOptions: CommandOption[];
|
|
83
91
|
/**
|