@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkRequirements.js","sourceRoot":"","sources":["../../../src/runWindows/utils/checkRequirements.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,+DAA2D;AAC3D,iDAAuC;AACvC,gDAAwB;AACxB,sDAA4B;AAC5B,wDAAgC;AAShC,MAAM,iBAAiB,GAAiD;IACtE,MAAM,EAAE;QACN,EAAE,EAAE,IAAI,iBAAO,CAAC,CAAC,EAAE,CAAC,CAAC;QACrB,OAAO,EAAE,IAAI,iBAAO,CAAC,E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Aa,CAAC;AACvB,CAAC;AAED,SAAS,WAAW,CAAC,oBAA4B;IAC/C,MAAM,aAAa,GAAG,uBAAuB,EAAE,CAAC;IAChD,MAAM,eAAe,GAAG,4BAA4B,CAClD,YAAY,EACZ,oBAAoB,CACrB,CAAC;IACF,MAAM,eAAe,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE,CAC1D,YAAY,CAAC,EAAE,CAAC,eAAe,CAAC,CACjC,CAAC;IAEF,IAAI,eAAe,EAAE;QACnB,OAAO,cAAc,CAAC,eAAe,CAAC,CAAC;KACxC;IAED,MAAM,gBAAgB,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;IACzD,MAAM,IAAI,sBAAU,CAClB,OAAO,EACP,iEAAiE,gBAAgB,oDAAoD,gBAAgB,8DAA8D,CACpN,CAAC;AACJ,CAAC;AAED,SAAgB,eAAe,CAAC,MAAc;IAC5C,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC;AAFD,0CAEC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {CodedError} from '@react-native-windows/telemetry';\nimport {execSync} from 'child_process';\nimport path from 'path';\nimport shell from 'shelljs';\nimport Version from './version';\n\ntype Requirement =\n | 'os'\n | 'msbuild'\n | 'visualstudio'\n | 'windowssdk'\n | 'phonesdk';\n\nconst REQUIRED_VERSIONS: Record<string, Record<Requirement, Version>> = {\n '10.0': {\n os: new Version(6, 3),\n msbuild: new Version(14, 0),\n visualstudio: new Version(14, 0),\n windowssdk: new Version(10, 0),\n phonesdk: new Version(10, 0),\n },\n};\n\nfunction shortenVersion(version: Version): string {\n return /^(\\d+(?:\\.\\d+)?)/.exec(version.toString())![1];\n}\n\nfunction getMinimalRequiredVersionFor(\n requirement: Requirement,\n windowsTargetVersion: keyof typeof REQUIRED_VERSIONS,\n): Version {\n return REQUIRED_VERSIONS[windowsTargetVersion][requirement];\n}\n\nfunction getInstalledWindowsSdks(): Version[] {\n const installedSdks: Version[] = [];\n\n const execString =\n 'reg query \"HKLM\\\\SOFTWARE\\\\Microsoft\\\\Microsoft SDKs\\\\Windows\" /s /v InstallationFolder /reg:32';\n let output: string;\n try {\n output = execSync(execString).toString();\n } catch (e) {\n return installedSdks;\n }\n\n const re =\n /\\\\Microsoft SDKs\\\\Windows\\\\v(\\d+\\.\\d+)\\s*InstallationFolder\\s+REG_SZ\\s+(.*)/gim;\n let match: RegExpExecArray | null;\n while ((match = re.exec(output))) {\n const sdkPath = match[2];\n if (shell.test('-e', path.join(sdkPath, 'SDKManifest.xml'))) {\n const sdkVersion = Version.tryParse(match[1]);\n if (!sdkVersion) {\n throw new CodedError(\n 'BadSDKVersionFormat',\n `Unexpected SDK version format for '${match[1]}'`,\n );\n }\n installedSdks.push(sdkVersion);\n }\n }\n\n return installedSdks;\n}\n\nfunction checkWinSdk(windowsTargetVersion: string): string {\n const installedSdks = getInstalledWindowsSdks();\n const requiredVersion = getMinimalRequiredVersionFor(\n 'windowssdk',\n windowsTargetVersion,\n );\n const hasSdkInstalled = installedSdks.some((installedSdk) =>\n installedSdk.eq(requiredVersion),\n );\n\n if (hasSdkInstalled) {\n return shortenVersion(requiredVersion);\n }\n\n const shortenedVersion = shortenVersion(requiredVersion);\n throw new CodedError(\n 'NoSDK',\n `Windows SDK not found. Ensure that you have installed Windows ${shortenedVersion} SDK along with Visual Studio or install Windows ${shortenedVersion} SDK separately from https://dev.windows.com/en-us/downloads`,\n );\n}\n\nexport function isWinSdkPresent(target: string): string {\n return checkWinSdk(target);\n}\n"]}
|
|
@@ -13,3 +13,9 @@ export declare function newError(text: string): void;
|
|
|
13
13
|
export declare function newWarn(text: string): void;
|
|
14
14
|
export declare function newSuccess(text: string): void;
|
|
15
15
|
export declare function newInfo(text: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Sets the process exit code and offers some information at the end of a CLI command.
|
|
18
|
+
* @param loggingIsEnabled Is verbose logging enabled.
|
|
19
|
+
* @param error The error caught during the process, if any.
|
|
20
|
+
*/
|
|
21
|
+
export declare function setExitProcessWithError(loggingIsEnabled?: boolean, error?: Error): void;
|
|
@@ -8,7 +8,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
9
|
};
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.newInfo = exports.newSuccess = exports.newWarn = exports.newError = exports.commandWithProgress = exports.runPowerShellScriptFunction = exports.powershell = exports.newSpinner = void 0;
|
|
11
|
+
exports.setExitProcessWithError = exports.newInfo = exports.newSuccess = exports.newWarn = exports.newError = exports.commandWithProgress = exports.runPowerShellScriptFunction = exports.powershell = exports.newSpinner = void 0;
|
|
12
12
|
const child_process_1 = require("child_process");
|
|
13
13
|
const ora_1 = __importDefault(require("ora"));
|
|
14
14
|
const cli_spinners_1 = __importDefault(require("cli-spinners"));
|
|
@@ -69,11 +69,11 @@ function commandWithProgress(spinner, taskDoingName, command, args, verbose, err
|
|
|
69
69
|
const cp = (0, child_process_1.spawn)(command, args, spawnOptions);
|
|
70
70
|
let firstErrorLine = null;
|
|
71
71
|
if (!verbose) {
|
|
72
|
-
cp.stdout.on('data', chunk => {
|
|
72
|
+
cp.stdout.on('data', (chunk) => {
|
|
73
73
|
const text = chunk.toString();
|
|
74
74
|
setSpinnerText(spinner, taskDoingName + ': ', text);
|
|
75
75
|
});
|
|
76
|
-
cp.stderr.on('data', chunk => {
|
|
76
|
+
cp.stderr.on('data', (chunk) => {
|
|
77
77
|
const text = chunk.toString();
|
|
78
78
|
if (!firstErrorLine) {
|
|
79
79
|
firstErrorLine = text;
|
|
@@ -86,7 +86,7 @@ function commandWithProgress(spinner, taskDoingName, command, args, verbose, err
|
|
|
86
86
|
}));
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
cp.on('error', e => {
|
|
89
|
+
cp.on('error', (e) => {
|
|
90
90
|
if (verbose) {
|
|
91
91
|
console.error(chalk_1.default.red(e.toString()));
|
|
92
92
|
}
|
|
@@ -94,7 +94,7 @@ function commandWithProgress(spinner, taskDoingName, command, args, verbose, err
|
|
|
94
94
|
const ce = new telemetry_1.CodedError(errorCategory, e.message);
|
|
95
95
|
ce.stack = e.stack;
|
|
96
96
|
reject(ce);
|
|
97
|
-
}).on('close', code => {
|
|
97
|
+
}).on('close', (code) => {
|
|
98
98
|
if (code === 0) {
|
|
99
99
|
spinner.succeed(taskDoingName);
|
|
100
100
|
resolve();
|
|
@@ -125,4 +125,25 @@ function newInfo(text) {
|
|
|
125
125
|
newSpinner(text).info(text);
|
|
126
126
|
}
|
|
127
127
|
exports.newInfo = newInfo;
|
|
128
|
+
/**
|
|
129
|
+
* Sets the process exit code and offers some information at the end of a CLI command.
|
|
130
|
+
* @param loggingIsEnabled Is verbose logging enabled.
|
|
131
|
+
* @param error The error caught during the process, if any.
|
|
132
|
+
*/
|
|
133
|
+
function setExitProcessWithError(loggingIsEnabled, error) {
|
|
134
|
+
if (error) {
|
|
135
|
+
const errorType = error instanceof telemetry_1.CodedError ? error.type : 'Unknown';
|
|
136
|
+
process.exitCode = telemetry_1.CodedErrors[errorType];
|
|
137
|
+
if (loggingIsEnabled) {
|
|
138
|
+
console.log(`Command failed with error ${chalk_1.default.bold(errorType)}: ${error.message}`);
|
|
139
|
+
if (telemetry_1.Telemetry.isEnabled()) {
|
|
140
|
+
console.log(`Your telemetry sessionId was ${chalk_1.default.bold(telemetry_1.Telemetry.getSessionId())}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
console.log(`Command failed. Re-run the command with ${chalk_1.default.bold('--logging')} for more information.`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.setExitProcessWithError = setExitProcessWithError;
|
|
128
149
|
//# sourceMappingURL=commandWithProgress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandWithProgress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BACL,OAAO,CAAC,IAAI,EAAE,CAAC;gBACf,MAAM,CACJ,IAAI,sBAAU,CACZ,aAAa,EACb,GAAG,aAAa,iBAAiB,IAAI,EAAE,EACvC;oBACE,SAAS,EAAE,IAAI;iBAChB,CACF,CACF,CAAC;aACH;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AA/DD,kDA+DC;AAED,SAAgB,QAAQ,CAAC,IAAY;IACnC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAFD,4BAEC;AAED,SAAgB,OAAO,CAAC,IAAY;IAClC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAFD,0BAEC;AAED,SAAgB,UAAU,CAAC,IAAY;IACrC,UAAU,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAFD,gCAEC;AAED,SAAgB,OAAO,CAAC,IAAY;IAClC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAFD,0BAEC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {spawn, SpawnOptions} from 'child_process';\nimport ora from 'ora';\nimport spinners from 'cli-spinners';\nimport chalk from 'chalk';\nimport {CodedError, CodedErrorType} from '@react-native-windows/telemetry';\n\nfunction setSpinnerText(spinner: ora.Ora, prefix: string, text: string) {\n text = prefix + spinnerString(text);\n spinner.text = text.length > 45 ? text.slice(0, 110) + '...' : text;\n}\n\nfunction spinnerString(msg: string) {\n msg = msg.trim();\n const lastLineIndex = msg.lastIndexOf('\\n');\n if (lastLineIndex > 0) {\n msg = msg.slice(lastLineIndex + 1);\n }\n msg = msg.trim();\n return msg;\n}\n\nexport function newSpinner(text: string) {\n const options: ora.Options = {\n text: text,\n indent: 1,\n\n // ora turns off emoji rendering by default on windows, since the default terminal\n // doesn't render them. Turn them back on when running in the new windows terminal\n ...(process.env.WT_SESSION && {spinner: spinners.dots}),\n\n // By default, ora process.stderr as the output stream, however,the VS Code debugger\n // Uses stdout to match success patterns\n stream: process.stdout,\n };\n\n return ora(options).start();\n}\n\nexport const powershell = `${process.env.SystemRoot}\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe`;\n\nexport async function runPowerShellScriptFunction(\n taskDescription: string,\n script: string | null,\n funcName: string,\n verbose: boolean,\n errorCategory: CodedErrorType,\n) {\n try {\n const printException = verbose ? '$_;' : '';\n const importScript = script ? `Import-Module \"${script}\"; ` : '';\n await commandWithProgress(\n newSpinner(taskDescription),\n taskDescription,\n powershell,\n [\n '-NoProfile',\n '-ExecutionPolicy',\n 'RemoteSigned',\n `${importScript}try { ${funcName} -ErrorAction Stop; $lec = $LASTEXITCODE; } catch { $lec = 1; ${printException} }; exit $lec`,\n ],\n verbose,\n errorCategory,\n );\n } catch {\n // The error output from the process will be shown if verbose is set.\n // We don't capture the process output if verbose is set, but at least we have the task name in text, so throw that.\n throw new CodedError(errorCategory, taskDescription);\n }\n}\n\nexport function commandWithProgress(\n spinner: ora.Ora,\n taskDoingName: string,\n command: string,\n args: string[],\n verbose: boolean,\n errorCategory: CodedErrorType,\n) {\n return new Promise<void>((resolve, reject) => {\n const spawnOptions: SpawnOptions = verbose ? {stdio: 'inherit'} : {};\n\n if (verbose) {\n spinner.stop();\n }\n\n const cp = spawn(command, args, spawnOptions);\n let firstErrorLine: string | null = null;\n if (!verbose) {\n cp.stdout!.on('data', chunk => {\n const text = chunk.toString();\n setSpinnerText(spinner, taskDoingName + ': ', text);\n });\n cp.stderr!.on('data', chunk => {\n const text: string = chunk.toString();\n if (!firstErrorLine) {\n firstErrorLine = text;\n }\n if (text) {\n setSpinnerText(spinner, taskDoingName + ': ERROR: ', firstErrorLine);\n }\n reject(\n new CodedError(errorCategory, firstErrorLine, {\n taskName: taskDoingName,\n }),\n );\n });\n }\n cp.on('error', e => {\n if (verbose) {\n console.error(chalk.red(e.toString()));\n }\n spinner.fail(e.toString());\n const ce = new CodedError(errorCategory, e.message);\n ce.stack = e.stack;\n reject(ce);\n }).on('close', code => {\n if (code === 0) {\n spinner.succeed(taskDoingName);\n resolve();\n } else {\n spinner.fail();\n reject(\n new CodedError(\n errorCategory,\n `${taskDoingName} - error code ${code}`,\n {\n errorCode: code,\n },\n ),\n );\n }\n });\n });\n}\n\nexport function newError(text: string) {\n newSpinner(text).fail(text);\n}\n\nexport function newWarn(text: string) {\n newSpinner(text).warn(text);\n}\n\nexport function newSuccess(text: string) {\n newSpinner(text).succeed(text);\n}\n\nexport function newInfo(text: string) {\n newSpinner(text).info(text);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"commandWithProgress.js","sourceRoot":"","sources":["../../../src/runWindows/utils/commandWithProgress.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,iDAAkD;AAClD,8CAAsB;AACtB,gEAAoC;AACpC,kDAA0B;AAC1B,+DAKyC;AAEzC,SAAS,cAAc,CAAC,OAAgB,EAAE,MAAc,EAAE,IAAY;IACpE,IAAI,GAAG,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACtE,CAAC;AAED,SAAS,aAAa,CAAC,GAAW;IAChC,GAAG,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,aAAa,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC5C,IAAI,aAAa,GAAG,CAAC,EAAE;QACrB,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;KACpC;IACD,GAAG,GAAG,G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C;AAC9B,CAAC;AAFD,0BAEC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB,CACrC,gBAA0B,EAC1B,KAAa;IAEb,IAAI,KAAK,EAAE;QACT,MAAM,SAAS,GACb,KAAK,YAAY,sBAAU,CAAC,CAAC,CAAE,KAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QAEvE,OAAO,CAAC,QAAQ,GAAG,uBAAW,CAAC,SAAS,CAAC,CAAC;QAE1C,IAAI,gBAAgB,EAAE;YACpB,OAAO,CAAC,GAAG,CACT,6BAA6B,eAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CACvE,CAAC;YACF,IAAI,qBAAS,CAAC,SAAS,EAAE,EAAE;gBACzB,OAAO,CAAC,GAAG,CACT,gCAAgC,eAAK,CAAC,IAAI,CACxC,qBAAS,CAAC,YAAY,EAAE,CACzB,EAAE,CACJ,CAAC;aACH;SACF;aAAM;YACL,OAAO,CAAC,GAAG,CACT,2CAA2C,eAAK,CAAC,IAAI,CACnD,WAAW,CACZ,wBAAwB,CAC1B,CAAC;SACH;KACF;AACH,CAAC;AA7BD,0DA6BC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {spawn, SpawnOptions} from 'child_process';\nimport ora from 'ora';\nimport spinners from 'cli-spinners';\nimport chalk from 'chalk';\nimport {\n Telemetry,\n CodedError,\n CodedErrors,\n CodedErrorType,\n} from '@react-native-windows/telemetry';\n\nfunction setSpinnerText(spinner: ora.Ora, prefix: string, text: string) {\n text = prefix + spinnerString(text);\n spinner.text = text.length > 45 ? text.slice(0, 110) + '...' : text;\n}\n\nfunction spinnerString(msg: string) {\n msg = msg.trim();\n const lastLineIndex = msg.lastIndexOf('\\n');\n if (lastLineIndex > 0) {\n msg = msg.slice(lastLineIndex + 1);\n }\n msg = msg.trim();\n return msg;\n}\n\nexport function newSpinner(text: string) {\n const options: ora.Options = {\n text: text,\n indent: 1,\n\n // ora turns off emoji rendering by default on windows, since the default terminal\n // doesn't render them. Turn them back on when running in the new windows terminal\n ...(process.env.WT_SESSION && {spinner: spinners.dots}),\n\n // By default, ora process.stderr as the output stream, however,the VS Code debugger\n // Uses stdout to match success patterns\n stream: process.stdout,\n };\n\n return ora(options).start();\n}\n\nexport const powershell = `${process.env.SystemRoot}\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe`;\n\nexport async function runPowerShellScriptFunction(\n taskDescription: string,\n script: string | null,\n funcName: string,\n verbose: boolean,\n errorCategory: CodedErrorType,\n) {\n try {\n const printException = verbose ? '$_;' : '';\n const importScript = script ? `Import-Module \"${script}\"; ` : '';\n await commandWithProgress(\n newSpinner(taskDescription),\n taskDescription,\n powershell,\n [\n '-NoProfile',\n '-ExecutionPolicy',\n 'RemoteSigned',\n `${importScript}try { ${funcName} -ErrorAction Stop; $lec = $LASTEXITCODE; } catch { $lec = 1; ${printException} }; exit $lec`,\n ],\n verbose,\n errorCategory,\n );\n } catch {\n // The error output from the process will be shown if verbose is set.\n // We don't capture the process output if verbose is set, but at least we have the task name in text, so throw that.\n throw new CodedError(errorCategory, taskDescription);\n }\n}\n\nexport function commandWithProgress(\n spinner: ora.Ora,\n taskDoingName: string,\n command: string,\n args: string[],\n verbose: boolean,\n errorCategory: CodedErrorType,\n) {\n return new Promise<void>((resolve, reject) => {\n const spawnOptions: SpawnOptions = verbose ? {stdio: 'inherit'} : {};\n\n if (verbose) {\n spinner.stop();\n }\n\n const cp = spawn(command, args, spawnOptions);\n let firstErrorLine: string | null = null;\n if (!verbose) {\n cp.stdout!.on('data', (chunk) => {\n const text = chunk.toString();\n setSpinnerText(spinner, taskDoingName + ': ', text);\n });\n cp.stderr!.on('data', (chunk) => {\n const text: string = chunk.toString();\n if (!firstErrorLine) {\n firstErrorLine = text;\n }\n if (text) {\n setSpinnerText(spinner, taskDoingName + ': ERROR: ', firstErrorLine);\n }\n reject(\n new CodedError(errorCategory, firstErrorLine, {\n taskName: taskDoingName,\n }),\n );\n });\n }\n cp.on('error', (e) => {\n if (verbose) {\n console.error(chalk.red(e.toString()));\n }\n spinner.fail(e.toString());\n const ce = new CodedError(errorCategory, e.message);\n ce.stack = e.stack;\n reject(ce);\n }).on('close', (code) => {\n if (code === 0) {\n spinner.succeed(taskDoingName);\n resolve();\n } else {\n spinner.fail();\n reject(\n new CodedError(\n errorCategory,\n `${taskDoingName} - error code ${code}`,\n {\n errorCode: code,\n },\n ),\n );\n }\n });\n });\n}\n\nexport function newError(text: string) {\n newSpinner(text).fail(text);\n}\n\nexport function newWarn(text: string) {\n newSpinner(text).warn(text);\n}\n\nexport function newSuccess(text: string) {\n newSpinner(text).succeed(text);\n}\n\nexport function newInfo(text: string) {\n newSpinner(text).info(text);\n}\n\n/**\n * Sets the process exit code and offers some information at the end of a CLI command.\n * @param loggingIsEnabled Is verbose logging enabled.\n * @param error The error caught during the process, if any.\n */\nexport function setExitProcessWithError(\n loggingIsEnabled?: boolean,\n error?: Error,\n): void {\n if (error) {\n const errorType =\n error instanceof CodedError ? (error as CodedError).type : 'Unknown';\n\n process.exitCode = CodedErrors[errorType];\n\n if (loggingIsEnabled) {\n console.log(\n `Command failed with error ${chalk.bold(errorType)}: ${error.message}`,\n );\n if (Telemetry.isEnabled()) {\n console.log(\n `Your telemetry sessionId was ${chalk.bold(\n Telemetry.getSessionId(),\n )}`,\n );\n }\n } else {\n console.log(\n `Command failed. Re-run the command with ${chalk.bold(\n '--logging',\n )} for more information.`,\n );\n }\n }\n}\n"]}
|
|
@@ -29,7 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.startServerInNewWindow = exports.deployToDesktop = exports.deployToDevice = exports.getBuildConfiguration = void 0;
|
|
31
31
|
const child_process_1 = require("child_process");
|
|
32
|
-
const fs_1 = __importDefault(require("fs"));
|
|
32
|
+
const fs_1 = __importDefault(require("@react-native-windows/fs"));
|
|
33
33
|
const http_1 = __importDefault(require("http"));
|
|
34
34
|
const path_1 = __importDefault(require("path"));
|
|
35
35
|
const glob_1 = __importDefault(require("glob"));
|
|
@@ -114,7 +114,7 @@ function getAppPackage(options, projectName) {
|
|
|
114
114
|
appPackage = appPackageCandidates[0];
|
|
115
115
|
}
|
|
116
116
|
else if (appPackageCandidates.length > 1) {
|
|
117
|
-
const filteredAppPackageCandidates = appPackageCandidates.filter(x => x.includes(projectName));
|
|
117
|
+
const filteredAppPackageCandidates = appPackageCandidates.filter((x) => x.includes(projectName));
|
|
118
118
|
if (filteredAppPackageCandidates.length >= 1) {
|
|
119
119
|
appPackage = filteredAppPackageCandidates[0];
|
|
120
120
|
}
|
|
@@ -126,7 +126,7 @@ function getAppPackage(options, projectName) {
|
|
|
126
126
|
const newGlob = `${rootGlob}/*_${options.arch === 'x86' ? '{Win32,x86}' : options.arch}_Test`;
|
|
127
127
|
const result = glob_1.default.sync(newGlob);
|
|
128
128
|
if (result.length > 1 && projectName) {
|
|
129
|
-
const newFilteredGlobs = result.filter(x => x.includes(projectName));
|
|
129
|
+
const newFilteredGlobs = result.filter((x) => x.includes(projectName));
|
|
130
130
|
if (newFilteredGlobs.length >= 1) {
|
|
131
131
|
(0, commandWithProgress_1.newWarn)(`More than one app package found: ${result}`);
|
|
132
132
|
}
|
|
@@ -167,7 +167,7 @@ function getAppxManifestPath(options, projectName) {
|
|
|
167
167
|
appxPath = globs[0];
|
|
168
168
|
}
|
|
169
169
|
else {
|
|
170
|
-
const filteredGlobs = globs.filter(x => x.includes(projectName));
|
|
170
|
+
const filteredGlobs = globs.filter((x) => x.includes(projectName));
|
|
171
171
|
appxPath = filteredGlobs[0];
|
|
172
172
|
if (filteredGlobs.length > 1) {
|
|
173
173
|
(0, commandWithProgress_1.newWarn)(`More than one appxmanifest for ${projectName}: ${filteredGlobs.join(',')}`);
|
|
@@ -208,7 +208,7 @@ async function deployToDevice(options, verbose, config) {
|
|
|
208
208
|
const deployTool = new winappdeploytool_1.default();
|
|
209
209
|
const appxManifest = getAppxManifest(options, projectName);
|
|
210
210
|
const shouldLaunch = shouldLaunchApp(options);
|
|
211
|
-
const identity = appxManifest.root.children.filter(x => {
|
|
211
|
+
const identity = appxManifest.root.children.filter((x) => {
|
|
212
212
|
return x.name === 'mp:PhoneIdentity';
|
|
213
213
|
})[0];
|
|
214
214
|
const appName = identity.attributes.PhoneProductId;
|
|
@@ -244,7 +244,7 @@ async function deployToDesktop(options, verbose, config, buildTools) {
|
|
|
244
244
|
const windowsStoreAppUtils = getWindowsStoreAppUtils(options);
|
|
245
245
|
const appxManifestPath = getAppxManifestPath(options, projectName);
|
|
246
246
|
const appxManifest = parseAppxManifest(appxManifestPath);
|
|
247
|
-
const identity = appxManifest.root.children.filter(x => {
|
|
247
|
+
const identity = appxManifest.root.children.filter((x) => {
|
|
248
248
|
return x.name === 'Identity';
|
|
249
249
|
})[0];
|
|
250
250
|
const appName = identity.attributes.Name;
|
|
@@ -299,9 +299,9 @@ async function deployToDesktop(options, verbose, config, buildTools) {
|
|
|
299
299
|
}
|
|
300
300
|
exports.deployToDesktop = deployToDesktop;
|
|
301
301
|
function startServerInNewWindow(options, verbose) {
|
|
302
|
-
return new Promise(resolve => {
|
|
302
|
+
return new Promise((resolve) => {
|
|
303
303
|
http_1.default
|
|
304
|
-
.get('http://localhost:8081/status', res => {
|
|
304
|
+
.get('http://localhost:8081/status', (res) => {
|
|
305
305
|
if (res.statusCode === 200) {
|
|
306
306
|
(0, commandWithProgress_1.newSuccess)('React-Native Server already started');
|
|
307
307
|
}
|
|
@@ -324,6 +324,6 @@ function launchServer(options, verbose) {
|
|
|
324
324
|
detached: true,
|
|
325
325
|
stdio: verbose ? 'inherit' : 'ignore',
|
|
326
326
|
};
|
|
327
|
-
(0, child_process_1.spawn)('cmd.exe', ['/C', 'start npx
|
|
327
|
+
(0, child_process_1.spawn)('cmd.exe', ['/C', 'start npx react-native start'], opts);
|
|
328
328
|
}
|
|
329
329
|
//# sourceMappingURL=deploy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/runWindows/utils/deploy.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAA4D;AAC5D,4CAAoB;AACpB,gDAAwB;AACxB,gDAAwB;AACxB,gDAAwB;AACxB,4DAA+B;AAC/B,0EAAkD;AAClD,+DAS+B;AAC/B,+CAAiC;AAIjC,sEAAwD;AAExD,+DAA2D;AAC3D,wDAAgC;AAEhC,SAAS,KAAK,CAAC,OAAe;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvB,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,SAAgB,qBAAqB,CAAC,OAA0B;IAC9D,OAAO,OAAO,CAAC,OAAO;QACpB,CAAC,CAAC,OAAO,CAAC,MAAM;YACd,CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,SAAS;QACb,CAAC,CAAC,OAAO,CAAC,MAAM;YAChB,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,OAAO,CAAC;AACd,CAAC;AARD,sDAQC;AAED,SAAS,qBAAqB,CAC5B,OAA0B,EAC1B,MAAc;IAEd,IAAI,OAAO,CAAC,gBAAgB,EAAE;QAC5B,yBAAyB;QACzB,OAAO,KAAK,CAAC;KACd;IAED,IAAI,qBAAqB,GAAmB,IAAI,CAAC;IACjD,IAAI,4BAA4B,GAAmB,IAAI,CAAC;IAExD,4DAA4D;IAC5D,2DAA2D;IAC3D,6CAA6C;IAE7C,6CAA6C;IAC7C,IAAI,OAAO,CAAC,YAAY,EAAE;QACxB,MAAM,YAAY,GAAG,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACtD,IAAI,o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AAE,GAAG,EAAE;YAChB,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC/B,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC;AAnBD,wDAmBC;AAED,SAAS,YAAY,CAAC,OAA0B,EAAE,OAAgB;IAChE,IAAA,gCAAU,EAAC,kCAAkC,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAiB;QACzB,GAAG,EAAE,OAAO,CAAC,IAAI;QACjB,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;KACtC,CAAC;IAEF,IAAA,qBAAK,EAAC,SAAS,EAAE,CAAC,IAAI,EAAE,2CAA2C,CAAC,EAAE,IAAI,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {spawn, execSync, SpawnOptions} from 'child_process';\nimport fs from 'fs';\nimport http from 'http';\nimport path from 'path';\nimport glob from 'glob';\nimport parse from 'xml-parser';\nimport WinAppDeployTool from './winappdeploytool';\nimport {\n newInfo,\n newSuccess,\n newError,\n newWarn,\n newSpinner,\n commandWithProgress,\n runPowerShellScriptFunction,\n powershell,\n} from './commandWithProgress';\nimport * as build from './build';\nimport {BuildConfig, RunWindowsOptions} from '../runWindowsOptions';\nimport MSBuildTools from './msbuildtools';\nimport {Config} from '@react-native-community/cli-types';\nimport * as configUtils from '../../config/configUtils';\nimport {WindowsProjectConfig} from '../../config/projectConfig';\nimport {CodedError} from '@react-native-windows/telemetry';\nimport Version from './version';\n\nfunction pushd(pathArg: string): () => void {\n const cwd = process.cwd();\n process.chdir(pathArg);\n return () => process.chdir(cwd);\n}\n\nexport function getBuildConfiguration(options: RunWindowsOptions): BuildConfig {\n return options.release\n ? options.bundle\n ? 'ReleaseBundle'\n : 'Release'\n : options.bundle\n ? 'DebugBundle'\n : 'Debug';\n}\n\nfunction shouldDeployByPackage(\n options: RunWindowsOptions,\n config: Config,\n): boolean {\n if (options.deployFromLayout) {\n // Force deploy by layout\n return false;\n }\n\n let hasAppxSigningEnabled: boolean | null = null;\n let hasPackageCertificateKeyFile: boolean | null = null;\n\n // TODO: These two properties should really be determined by\n // getting the actual values msbuild used during the build,\n // but for now we'll try to get them manually\n\n // Check passed in msbuild property overrides\n if (options.msbuildprops) {\n const msbuildprops = build.parseMsBuildProps(options);\n if ('AppxSigningEnabled' in msbuildprops) {\n hasAppxSigningEnabled =\n msbuildprops.AppxSigningEnabled.toLowerCase() === 'true';\n }\n if ('PackageCertificateKeyFile' in msbuildprops) {\n hasPackageCertificateKeyFile = true;\n }\n }\n\n // If at least one override wasn't set, we need to parse the project file\n if (hasAppxSigningEnabled === null || hasPackageCertificateKeyFile === null) {\n const projectFile = build.getAppProjectFile(options, config);\n if (projectFile) {\n const projectContents = configUtils.readProjectFile(projectFile);\n\n // Find AppxSigningEnabled\n if (hasAppxSigningEnabled === null) {\n const appxSigningEnabled = configUtils.tryFindPropertyValue(\n projectContents,\n 'AppxSigningEnabled',\n );\n if (appxSigningEnabled !== null) {\n hasAppxSigningEnabled = appxSigningEnabled.toLowerCase() === 'true';\n }\n }\n\n // Find PackageCertificateKeyFile\n if (hasPackageCertificateKeyFile === null) {\n const packageCertificateKeyFile = configUtils.tryFindPropertyValue(\n projectContents,\n 'PackageCertificateKeyFile',\n );\n if (packageCertificateKeyFile !== null) {\n hasPackageCertificateKeyFile = true;\n }\n }\n }\n }\n\n return (\n hasAppxSigningEnabled === true && hasPackageCertificateKeyFile === true\n );\n}\n\nfunction shouldLaunchApp(options: RunWindowsOptions): boolean {\n return options.launch === true;\n}\n\nfunction getAppPackage(\n options: RunWindowsOptions,\n projectName?: string,\n): string {\n const configuration = getBuildConfiguration(options);\n const packageFolder =\n options.arch === 'x86'\n ? `{*_x86_${configuration}_*,*_Win32_${configuration}_*}`\n : `*_${options.arch}_${configuration}_*`;\n\n const appPackageGlob = `${options.root}/windows/{*/AppPackages,AppPackages/*}/${packageFolder}`;\n const appPackageCandidates = glob.sync(appPackageGlob);\n let appPackage;\n if (appPackageCandidates.length === 1 || !projectName) {\n appPackage = appPackageCandidates[0];\n } else if (appPackageCandidates.length > 1) {\n const filteredAppPackageCandidates = appPackageCandidates.filter(x =>\n x.includes(projectName),\n );\n if (filteredAppPackageCandidates.length >= 1) {\n appPackage = filteredAppPackageCandidates[0];\n }\n }\n\n if (!appPackage && options.release) {\n // in the latest vs, Release is removed\n newWarn(\n 'No package found in *_Release_* folder, removing the _Release_ prefix and checking again',\n );\n\n const rootGlob = `${options.root}/windows/{*/AppPackages,AppPackages/*}`;\n const newGlob = `${rootGlob}/*_${\n options.arch === 'x86' ? '{Win32,x86}' : options.arch\n }_Test`;\n\n const result = glob.sync(newGlob);\n if (result.length > 1 && projectName) {\n const newFilteredGlobs = result.filter(x => x.includes(projectName));\n if (newFilteredGlobs.length >= 1) {\n newWarn(`More than one app package found: ${result}`);\n }\n appPackage = newFilteredGlobs[0];\n } else if (result.length === 1) {\n // we're good\n appPackage = result[0];\n }\n }\n\n if (!appPackage) {\n throw new CodedError(\n 'NoAppPackage',\n `Unable to find app package using search path: \"${appPackageGlob}\"`,\n );\n }\n return appPackage;\n}\n\nfunction getWindowsStoreAppUtils(options: RunWindowsOptions) {\n const popd = pushd(options.root);\n const windowsStoreAppUtilsPath = path.resolve(\n __dirname,\n '..',\n '..',\n '..',\n 'powershell',\n 'WindowsStoreAppUtils.ps1',\n );\n execSync(\n `${powershell} -NoProfile Unblock-File \"${windowsStoreAppUtilsPath}\"`,\n );\n popd();\n return windowsStoreAppUtilsPath;\n}\n\nfunction getAppxManifestPath(\n options: RunWindowsOptions,\n projectName?: string,\n): string {\n const configuration = getBuildConfiguration(options);\n // C++ x86 manifest would go under windows/Debug whereas x64 goes under windows/x64/Debug\n // If we've built both, this causes us to end up with two matches, so we have to carefully select the right folder\n let archFolder;\n if (options.arch !== 'x86') {\n archFolder = `${options.arch}/${configuration}`;\n } else {\n archFolder = `${configuration}`;\n }\n\n const appxManifestGlob = `windows/{*/bin/${options.arch}/${configuration},${archFolder}/*,target/${options.arch}/${configuration}}/AppxManifest.xml`;\n const globs = glob.sync(path.join(options.root, appxManifestGlob));\n let appxPath: string;\n if (globs.length === 1 || !projectName) {\n appxPath = globs[0];\n } else {\n const filteredGlobs = globs.filter(x => x.includes(projectName));\n appxPath = filteredGlobs[0];\n if (filteredGlobs.length > 1) {\n newWarn(\n `More than one appxmanifest for ${projectName}: ${filteredGlobs.join(\n ',',\n )}`,\n );\n newWarn(`Choosing ${appxPath}`);\n }\n }\n\n if (!appxPath) {\n throw new CodedError(\n 'NoAppxManifest',\n `Unable to find AppxManifest from \"${options.root}\", using search path: \"${appxManifestGlob}\" `,\n );\n }\n return appxPath;\n}\n\nfunction parseAppxManifest(appxManifestPath: string): parse.Document {\n return parse(fs.readFileSync(appxManifestPath, 'utf8'));\n}\n\nfunction getAppxManifest(\n options: RunWindowsOptions,\n projectName?: string,\n): parse.Document {\n return parseAppxManifest(getAppxManifestPath(options, projectName));\n}\n\nfunction handleResponseError(e: Error): never {\n if (e.message.indexOf('Error code -2146233088')) {\n throw new CodedError(\n 'NoDevice',\n `No Windows Mobile device was detected: ${e.message}`,\n );\n } else {\n throw new CodedError(\n 'AppDidNotDeploy',\n `Unexpected error deploying app: ${e.message}`,\n );\n }\n}\n\n// Errors: 0x80073d10 - bad architecture\nexport async function deployToDevice(\n options: RunWindowsOptions,\n verbose: boolean,\n config: Config,\n) {\n const windowsConfig: Partial<WindowsProjectConfig> | undefined =\n config.project.windows;\n const projectName =\n windowsConfig && windowsConfig.project && windowsConfig.project.projectName\n ? windowsConfig.project.projectName\n : path.parse(options.proj!).name;\n const appPackageFolder = getAppPackage(options);\n\n const deployTarget = options.target\n ? options.target\n : options.emulator\n ? 'emulator'\n : 'device';\n const deployTool = new WinAppDeployTool();\n const appxManifest = getAppxManifest(options, projectName);\n const shouldLaunch = shouldLaunchApp(options);\n const identity = appxManifest.root.children.filter(x => {\n return x.name === 'mp:PhoneIdentity';\n })[0];\n const appName = identity.attributes.PhoneProductId;\n\n const device = deployTool.findDevice(deployTarget);\n\n try {\n await deployTool.uninstallAppPackage(appName, device, verbose);\n } catch (e) {\n newWarn('Failed to uninstall app from ' + device.name);\n }\n\n const appxFile = glob.sync(path.join(appPackageFolder, '*.appx'))[0];\n try {\n await deployTool.installAppPackage(\n appxFile,\n device,\n shouldLaunch,\n false,\n verbose,\n );\n } catch (e) {\n if ((e as Error).message.includes('Error code 2148734208 for command')) {\n await deployTool.installAppPackage(\n appxFile,\n device,\n shouldLaunch,\n true,\n verbose,\n );\n } else {\n handleResponseError(e as Error);\n }\n }\n}\n\nexport async function deployToDesktop(\n options: RunWindowsOptions,\n verbose: boolean,\n config: Config,\n buildTools: MSBuildTools,\n) {\n const windowsConfig: Partial<WindowsProjectConfig> | undefined =\n config.project.windows;\n const slnFile =\n windowsConfig && windowsConfig.solutionFile && windowsConfig.sourceDir\n ? path.join(windowsConfig.sourceDir, windowsConfig.solutionFile)\n : options.sln!;\n const projectName =\n windowsConfig && windowsConfig.project && windowsConfig.project.projectName\n ? windowsConfig.project.projectName\n : path.parse(options.proj!).name;\n const windowsStoreAppUtils = getWindowsStoreAppUtils(options);\n const appxManifestPath = getAppxManifestPath(options, projectName);\n const appxManifest = parseAppxManifest(appxManifestPath);\n const identity = appxManifest.root.children.filter(x => {\n return x.name === 'Identity';\n })[0];\n const appName = identity.attributes.Name;\n\n const vsVersion = Version.fromString(buildTools.installationVersion);\n\n const args = [];\n if (options.remoteDebugging) {\n args.push('--remote-debugging');\n }\n\n if (options.directDebugging) {\n args.push('--direct-debugging', options.directDebugging.toString());\n }\n\n await runPowerShellScriptFunction(\n 'Enabling Developer Mode',\n windowsStoreAppUtils,\n 'EnableDevMode',\n verbose,\n 'EnableDevModeFailure',\n );\n\n const appPackageFolder = getAppPackage(options, projectName);\n\n if (shouldDeployByPackage(options, config)) {\n // Deploy by package\n await runPowerShellScriptFunction(\n 'Removing old version of the app',\n windowsStoreAppUtils,\n `Uninstall-App ${appName}`,\n verbose,\n 'RemoveOldAppVersionFailure',\n );\n\n const script = glob.sync(\n path.join(appPackageFolder, 'Add-AppDevPackage.ps1'),\n )[0];\n\n await runPowerShellScriptFunction(\n 'Installing new version of the app',\n windowsStoreAppUtils,\n `Install-App \"${script}\" -Force`,\n verbose,\n 'InstallAppFailure',\n );\n } else {\n // Deploy from layout\n // If we have DeployAppRecipe.exe, use it (start in 16.8.4, earlier 16.8 versions have bugs)\n const appxRecipe = path.join(\n path.dirname(appxManifestPath),\n `${projectName}.build.appxrecipe`,\n );\n const ideFolder = `${buildTools.installationPath}\\\\Common7\\\\IDE`;\n const deployAppxRecipeExePath = `${ideFolder}\\\\DeployAppRecipe.exe`;\n if (\n vsVersion.gte(Version.fromString('16.8.30906.45')) &&\n fs.existsSync(deployAppxRecipeExePath)\n ) {\n await commandWithProgress(\n newSpinner('Deploying'),\n `Deploying ${appxRecipe}`,\n deployAppxRecipeExePath,\n [appxRecipe],\n verbose,\n 'DeployRecipeFailure',\n );\n } else {\n // Install the app package's dependencies before attempting to deploy.\n await runPowerShellScriptFunction(\n 'Installing dependent framework packages',\n windowsStoreAppUtils,\n `Install-AppDependencies ${appxManifestPath} ${appPackageFolder} ${options.arch}`,\n verbose,\n 'InstallAppDependenciesFailure',\n );\n await build.buildSolution(\n buildTools,\n slnFile,\n /* options.release ? 'Release' : */ 'Debug',\n options.arch,\n {DeployLayout: 'true'},\n verbose,\n 'deploy',\n options.buildLogDirectory,\n );\n }\n }\n\n const appFamilyName = execSync(\n `${powershell} -NoProfile -c $(Get-AppxPackage -Name ${appName}).PackageFamilyName`,\n )\n .toString()\n .trim();\n\n if (!appFamilyName) {\n throw new CodedError(\n 'AppDidNotDeploy',\n 'Fail to check the installed app, maybe developer mode is off on Windows',\n );\n }\n\n const loopbackText = 'Verifying loopbackExempt';\n const loopbackSpinner = newSpinner(loopbackText);\n\n await commandWithProgress(\n loopbackSpinner,\n loopbackText,\n 'CheckNetIsolation',\n `LoopbackExempt -a -n=${appFamilyName}`.split(' '),\n verbose,\n 'CheckNetIsolationFailure',\n );\n\n if (shouldLaunchApp(options)) {\n await runPowerShellScriptFunction(\n 'Starting the app',\n windowsStoreAppUtils,\n `Start-Locally ${appName} ${args}`,\n verbose,\n 'AppStartupFailure',\n );\n } else {\n newInfo('Skip the step to start the app');\n }\n}\n\nexport function startServerInNewWindow(\n options: RunWindowsOptions,\n verbose: boolean,\n): Promise<void> {\n return new Promise(resolve => {\n http\n .get('http://localhost:8081/status', res => {\n if (res.statusCode === 200) {\n newSuccess('React-Native Server already started');\n } else {\n newError('React-Native Server not responding');\n }\n resolve();\n })\n .on('error', () => {\n launchServer(options, verbose);\n resolve();\n });\n });\n}\n\nfunction launchServer(options: RunWindowsOptions, verbose: boolean) {\n newSuccess('Starting the React-Native Server');\n const opts: SpawnOptions = {\n cwd: options.root,\n detached: true,\n stdio: verbose ? 'inherit' : 'ignore',\n };\n\n spawn('cmd.exe', ['/C', 'start npx --no-install react-native start'], opts);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/runWindows/utils/deploy.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAA4D;AAC5D,kEAA0C;AAC1C,gDAAwB;AACxB,gDAAwB;AACxB,gDAAwB;AACxB,4DAA+B;AAC/B,0EAAkD;AAClD,+DAS+B;AAC/B,+CAAiC;AAIjC,sEAAwD;AAExD,+DAA2D;AAC3D,wDAAgC;AAEhC,SAAS,KAAK,CAAC,OAAe;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvB,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAClC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esContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {spawn, execSync, SpawnOptions} from 'child_process';\nimport fs from '@react-native-windows/fs';\nimport http from 'http';\nimport path from 'path';\nimport glob from 'glob';\nimport parse from 'xml-parser';\nimport WinAppDeployTool from './winappdeploytool';\nimport {\n newInfo,\n newSuccess,\n newError,\n newWarn,\n newSpinner,\n commandWithProgress,\n runPowerShellScriptFunction,\n powershell,\n} from './commandWithProgress';\nimport * as build from './build';\nimport {BuildConfig, RunWindowsOptions} from '../runWindowsOptions';\nimport MSBuildTools from './msbuildtools';\nimport {Config} from '@react-native-community/cli-types';\nimport * as configUtils from '../../config/configUtils';\nimport {WindowsProjectConfig} from '../../config/projectConfig';\nimport {CodedError} from '@react-native-windows/telemetry';\nimport Version from './version';\n\nfunction pushd(pathArg: string): () => void {\n const cwd = process.cwd();\n process.chdir(pathArg);\n return () => process.chdir(cwd);\n}\n\nexport function getBuildConfiguration(options: RunWindowsOptions): BuildConfig {\n return options.release\n ? options.bundle\n ? 'ReleaseBundle'\n : 'Release'\n : options.bundle\n ? 'DebugBundle'\n : 'Debug';\n}\n\nfunction shouldDeployByPackage(\n options: RunWindowsOptions,\n config: Config,\n): boolean {\n if (options.deployFromLayout) {\n // Force deploy by layout\n return false;\n }\n\n let hasAppxSigningEnabled: boolean | null = null;\n let hasPackageCertificateKeyFile: boolean | null = null;\n\n // TODO: These two properties should really be determined by\n // getting the actual values msbuild used during the build,\n // but for now we'll try to get them manually\n\n // Check passed in msbuild property overrides\n if (options.msbuildprops) {\n const msbuildprops = build.parseMsBuildProps(options);\n if ('AppxSigningEnabled' in msbuildprops) {\n hasAppxSigningEnabled =\n msbuildprops.AppxSigningEnabled.toLowerCase() === 'true';\n }\n if ('PackageCertificateKeyFile' in msbuildprops) {\n hasPackageCertificateKeyFile = true;\n }\n }\n\n // If at least one override wasn't set, we need to parse the project file\n if (hasAppxSigningEnabled === null || hasPackageCertificateKeyFile === null) {\n const projectFile = build.getAppProjectFile(options, config);\n if (projectFile) {\n const projectContents = configUtils.readProjectFile(projectFile);\n\n // Find AppxSigningEnabled\n if (hasAppxSigningEnabled === null) {\n const appxSigningEnabled = configUtils.tryFindPropertyValue(\n projectContents,\n 'AppxSigningEnabled',\n );\n if (appxSigningEnabled !== null) {\n hasAppxSigningEnabled = appxSigningEnabled.toLowerCase() === 'true';\n }\n }\n\n // Find PackageCertificateKeyFile\n if (hasPackageCertificateKeyFile === null) {\n const packageCertificateKeyFile = configUtils.tryFindPropertyValue(\n projectContents,\n 'PackageCertificateKeyFile',\n );\n if (packageCertificateKeyFile !== null) {\n hasPackageCertificateKeyFile = true;\n }\n }\n }\n }\n\n return (\n hasAppxSigningEnabled === true && hasPackageCertificateKeyFile === true\n );\n}\n\nfunction shouldLaunchApp(options: RunWindowsOptions): boolean {\n return options.launch === true;\n}\n\nfunction getAppPackage(\n options: RunWindowsOptions,\n projectName?: string,\n): string {\n const configuration = getBuildConfiguration(options);\n const packageFolder =\n options.arch === 'x86'\n ? `{*_x86_${configuration}_*,*_Win32_${configuration}_*}`\n : `*_${options.arch}_${configuration}_*`;\n\n const appPackageGlob = `${options.root}/windows/{*/AppPackages,AppPackages/*}/${packageFolder}`;\n const appPackageCandidates = glob.sync(appPackageGlob);\n let appPackage;\n if (appPackageCandidates.length === 1 || !projectName) {\n appPackage = appPackageCandidates[0];\n } else if (appPackageCandidates.length > 1) {\n const filteredAppPackageCandidates = appPackageCandidates.filter((x) =>\n x.includes(projectName),\n );\n if (filteredAppPackageCandidates.length >= 1) {\n appPackage = filteredAppPackageCandidates[0];\n }\n }\n\n if (!appPackage && options.release) {\n // in the latest vs, Release is removed\n newWarn(\n 'No package found in *_Release_* folder, removing the _Release_ prefix and checking again',\n );\n\n const rootGlob = `${options.root}/windows/{*/AppPackages,AppPackages/*}`;\n const newGlob = `${rootGlob}/*_${\n options.arch === 'x86' ? '{Win32,x86}' : options.arch\n }_Test`;\n\n const result = glob.sync(newGlob);\n if (result.length > 1 && projectName) {\n const newFilteredGlobs = result.filter((x) => x.includes(projectName));\n if (newFilteredGlobs.length >= 1) {\n newWarn(`More than one app package found: ${result}`);\n }\n appPackage = newFilteredGlobs[0];\n } else if (result.length === 1) {\n // we're good\n appPackage = result[0];\n }\n }\n\n if (!appPackage) {\n throw new CodedError(\n 'NoAppPackage',\n `Unable to find app package using search path: \"${appPackageGlob}\"`,\n );\n }\n return appPackage;\n}\n\nfunction getWindowsStoreAppUtils(options: RunWindowsOptions) {\n const popd = pushd(options.root);\n const windowsStoreAppUtilsPath = path.resolve(\n __dirname,\n '..',\n '..',\n '..',\n 'powershell',\n 'WindowsStoreAppUtils.ps1',\n );\n execSync(\n `${powershell} -NoProfile Unblock-File \"${windowsStoreAppUtilsPath}\"`,\n );\n popd();\n return windowsStoreAppUtilsPath;\n}\n\nfunction getAppxManifestPath(\n options: RunWindowsOptions,\n projectName?: string,\n): string {\n const configuration = getBuildConfiguration(options);\n // C++ x86 manifest would go under windows/Debug whereas x64 goes under windows/x64/Debug\n // If we've built both, this causes us to end up with two matches, so we have to carefully select the right folder\n let archFolder;\n if (options.arch !== 'x86') {\n archFolder = `${options.arch}/${configuration}`;\n } else {\n archFolder = `${configuration}`;\n }\n\n const appxManifestGlob = `windows/{*/bin/${options.arch}/${configuration},${archFolder}/*,target/${options.arch}/${configuration}}/AppxManifest.xml`;\n const globs = glob.sync(path.join(options.root, appxManifestGlob));\n let appxPath: string;\n if (globs.length === 1 || !projectName) {\n appxPath = globs[0];\n } else {\n const filteredGlobs = globs.filter((x) => x.includes(projectName));\n appxPath = filteredGlobs[0];\n if (filteredGlobs.length > 1) {\n newWarn(\n `More than one appxmanifest for ${projectName}: ${filteredGlobs.join(\n ',',\n )}`,\n );\n newWarn(`Choosing ${appxPath}`);\n }\n }\n\n if (!appxPath) {\n throw new CodedError(\n 'NoAppxManifest',\n `Unable to find AppxManifest from \"${options.root}\", using search path: \"${appxManifestGlob}\" `,\n );\n }\n return appxPath;\n}\n\nfunction parseAppxManifest(appxManifestPath: string): parse.Document {\n return parse(fs.readFileSync(appxManifestPath, 'utf8'));\n}\n\nfunction getAppxManifest(\n options: RunWindowsOptions,\n projectName?: string,\n): parse.Document {\n return parseAppxManifest(getAppxManifestPath(options, projectName));\n}\n\nfunction handleResponseError(e: Error): never {\n if (e.message.indexOf('Error code -2146233088')) {\n throw new CodedError(\n 'NoDevice',\n `No Windows Mobile device was detected: ${e.message}`,\n );\n } else {\n throw new CodedError(\n 'AppDidNotDeploy',\n `Unexpected error deploying app: ${e.message}`,\n );\n }\n}\n\n// Errors: 0x80073d10 - bad architecture\nexport async function deployToDevice(\n options: RunWindowsOptions,\n verbose: boolean,\n config: Config,\n) {\n const windowsConfig: Partial<WindowsProjectConfig> | undefined =\n config.project.windows;\n const projectName =\n windowsConfig && windowsConfig.project && windowsConfig.project.projectName\n ? windowsConfig.project.projectName\n : path.parse(options.proj!).name;\n const appPackageFolder = getAppPackage(options);\n\n const deployTarget = options.target\n ? options.target\n : options.emulator\n ? 'emulator'\n : 'device';\n const deployTool = new WinAppDeployTool();\n const appxManifest = getAppxManifest(options, projectName);\n const shouldLaunch = shouldLaunchApp(options);\n const identity = appxManifest.root.children.filter((x) => {\n return x.name === 'mp:PhoneIdentity';\n })[0];\n const appName = identity.attributes.PhoneProductId;\n\n const device = deployTool.findDevice(deployTarget);\n\n try {\n await deployTool.uninstallAppPackage(appName, device, verbose);\n } catch (e) {\n newWarn('Failed to uninstall app from ' + device.name);\n }\n\n const appxFile = glob.sync(path.join(appPackageFolder, '*.appx'))[0];\n try {\n await deployTool.installAppPackage(\n appxFile,\n device,\n shouldLaunch,\n false,\n verbose,\n );\n } catch (e) {\n if ((e as Error).message.includes('Error code 2148734208 for command')) {\n await deployTool.installAppPackage(\n appxFile,\n device,\n shouldLaunch,\n true,\n verbose,\n );\n } else {\n handleResponseError(e as Error);\n }\n }\n}\n\nexport async function deployToDesktop(\n options: RunWindowsOptions,\n verbose: boolean,\n config: Config,\n buildTools: MSBuildTools,\n) {\n const windowsConfig: Partial<WindowsProjectConfig> | undefined =\n config.project.windows;\n const slnFile =\n windowsConfig && windowsConfig.solutionFile && windowsConfig.sourceDir\n ? path.join(windowsConfig.sourceDir, windowsConfig.solutionFile)\n : options.sln!;\n const projectName =\n windowsConfig && windowsConfig.project && windowsConfig.project.projectName\n ? windowsConfig.project.projectName\n : path.parse(options.proj!).name;\n const windowsStoreAppUtils = getWindowsStoreAppUtils(options);\n const appxManifestPath = getAppxManifestPath(options, projectName);\n const appxManifest = parseAppxManifest(appxManifestPath);\n const identity = appxManifest.root.children.filter((x) => {\n return x.name === 'Identity';\n })[0];\n const appName = identity.attributes.Name;\n\n const vsVersion = Version.fromString(buildTools.installationVersion);\n\n const args = [];\n if (options.remoteDebugging) {\n args.push('--remote-debugging');\n }\n\n if (options.directDebugging) {\n args.push('--direct-debugging', options.directDebugging.toString());\n }\n\n await runPowerShellScriptFunction(\n 'Enabling Developer Mode',\n windowsStoreAppUtils,\n 'EnableDevMode',\n verbose,\n 'EnableDevModeFailure',\n );\n\n const appPackageFolder = getAppPackage(options, projectName);\n\n if (shouldDeployByPackage(options, config)) {\n // Deploy by package\n await runPowerShellScriptFunction(\n 'Removing old version of the app',\n windowsStoreAppUtils,\n `Uninstall-App ${appName}`,\n verbose,\n 'RemoveOldAppVersionFailure',\n );\n\n const script = glob.sync(\n path.join(appPackageFolder, 'Add-AppDevPackage.ps1'),\n )[0];\n\n await runPowerShellScriptFunction(\n 'Installing new version of the app',\n windowsStoreAppUtils,\n `Install-App \"${script}\" -Force`,\n verbose,\n 'InstallAppFailure',\n );\n } else {\n // Deploy from layout\n // If we have DeployAppRecipe.exe, use it (start in 16.8.4, earlier 16.8 versions have bugs)\n const appxRecipe = path.join(\n path.dirname(appxManifestPath),\n `${projectName}.build.appxrecipe`,\n );\n const ideFolder = `${buildTools.installationPath}\\\\Common7\\\\IDE`;\n const deployAppxRecipeExePath = `${ideFolder}\\\\DeployAppRecipe.exe`;\n if (\n vsVersion.gte(Version.fromString('16.8.30906.45')) &&\n fs.existsSync(deployAppxRecipeExePath)\n ) {\n await commandWithProgress(\n newSpinner('Deploying'),\n `Deploying ${appxRecipe}`,\n deployAppxRecipeExePath,\n [appxRecipe],\n verbose,\n 'DeployRecipeFailure',\n );\n } else {\n // Install the app package's dependencies before attempting to deploy.\n await runPowerShellScriptFunction(\n 'Installing dependent framework packages',\n windowsStoreAppUtils,\n `Install-AppDependencies ${appxManifestPath} ${appPackageFolder} ${options.arch}`,\n verbose,\n 'InstallAppDependenciesFailure',\n );\n await build.buildSolution(\n buildTools,\n slnFile,\n /* options.release ? 'Release' : */ 'Debug',\n options.arch,\n {DeployLayout: 'true'},\n verbose,\n 'deploy',\n options.buildLogDirectory,\n );\n }\n }\n\n const appFamilyName = execSync(\n `${powershell} -NoProfile -c $(Get-AppxPackage -Name ${appName}).PackageFamilyName`,\n )\n .toString()\n .trim();\n\n if (!appFamilyName) {\n throw new CodedError(\n 'AppDidNotDeploy',\n 'Fail to check the installed app, maybe developer mode is off on Windows',\n );\n }\n\n const loopbackText = 'Verifying loopbackExempt';\n const loopbackSpinner = newSpinner(loopbackText);\n\n await commandWithProgress(\n loopbackSpinner,\n loopbackText,\n 'CheckNetIsolation',\n `LoopbackExempt -a -n=${appFamilyName}`.split(' '),\n verbose,\n 'CheckNetIsolationFailure',\n );\n\n if (shouldLaunchApp(options)) {\n await runPowerShellScriptFunction(\n 'Starting the app',\n windowsStoreAppUtils,\n `Start-Locally ${appName} ${args}`,\n verbose,\n 'AppStartupFailure',\n );\n } else {\n newInfo('Skip the step to start the app');\n }\n}\n\nexport function startServerInNewWindow(\n options: RunWindowsOptions,\n verbose: boolean,\n): Promise<void> {\n return new Promise((resolve) => {\n http\n .get('http://localhost:8081/status', (res) => {\n if (res.statusCode === 200) {\n newSuccess('React-Native Server already started');\n } else {\n newError('React-Native Server not responding');\n }\n resolve();\n })\n .on('error', () => {\n launchServer(options, verbose);\n resolve();\n });\n });\n}\n\nfunction launchServer(options: RunWindowsOptions, verbose: boolean) {\n newSuccess('Starting the React-Native Server');\n const opts: SpawnOptions = {\n cwd: options.root,\n detached: true,\n stdio: verbose ? 'inherit' : 'ignore',\n };\n\n spawn('cmd.exe', ['/C', 'start npx react-native start'], opts);\n}\n"]}
|
|
@@ -20,6 +20,7 @@ export default class MSBuildTools {
|
|
|
20
20
|
*/
|
|
21
21
|
msbuildPath(): string;
|
|
22
22
|
cleanProject(slnFile: string): void;
|
|
23
|
+
restorePackageConfigs(slnFile: any): Promise<void>;
|
|
23
24
|
buildProject(slnFile: string, buildType: BuildConfig, buildArch: BuildArch, msBuildProps: Record<string, string>, verbose: boolean, target: 'build' | 'deploy', buildLogDirectory: string | undefined, singleproc?: boolean): Promise<void>;
|
|
24
25
|
static findAvailableVersion(buildArch: BuildArch, verbose: boolean, prerelease?: boolean): MSBuildTools;
|
|
25
26
|
static getAllAvailableUAPVersions(): Version[];
|
|
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
const os_1 = require("os");
|
|
31
|
-
const fs_1 = __importDefault(require("fs"));
|
|
31
|
+
const fs_1 = __importDefault(require("@react-native-windows/fs"));
|
|
32
32
|
const path_1 = __importDefault(require("path"));
|
|
33
33
|
const child_process_1 = __importDefault(require("child_process"));
|
|
34
34
|
const chalk_1 = __importDefault(require("chalk"));
|
|
@@ -59,11 +59,18 @@ class MSBuildTools {
|
|
|
59
59
|
}
|
|
60
60
|
cleanProject(slnFile) {
|
|
61
61
|
const cmd = `"${path_1.default.join(this.msbuildPath(), 'msbuild.exe')}" "${slnFile}" /t:Clean`;
|
|
62
|
-
const results = child_process_1.default
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
const results = child_process_1.default.execSync(cmd).toString().split(os_1.EOL);
|
|
63
|
+
results.forEach((result) => console.log(chalk_1.default.white(result)));
|
|
64
|
+
}
|
|
65
|
+
async restorePackageConfigs(slnFile) {
|
|
66
|
+
const text = 'Restoring NuGet packages ';
|
|
67
|
+
const spinner = (0, commandWithProgress_1.newSpinner)(text);
|
|
68
|
+
await (0, commandWithProgress_1.commandWithProgress)(spinner, text, path_1.default.join(this.msbuildPath(), 'msbuild.exe'), [
|
|
69
|
+
slnFile,
|
|
70
|
+
'/t:Restore',
|
|
71
|
+
'/p:RestoreProjectStyle=PackagesConfig',
|
|
72
|
+
'/p:RestorePackagesConfig=true',
|
|
73
|
+
], true, 'MSBuildError');
|
|
67
74
|
}
|
|
68
75
|
async buildProject(slnFile, buildType, buildArch, msBuildProps, verbose, target, buildLogDirectory, singleproc) {
|
|
69
76
|
(0, commandWithProgress_1.newSuccess)(`Found Solution: ${slnFile}`);
|
|
@@ -99,7 +106,7 @@ class MSBuildTools {
|
|
|
99
106
|
else {
|
|
100
107
|
args.push(`/t:Deploy`);
|
|
101
108
|
}
|
|
102
|
-
Object.keys(msBuildProps).forEach(key => {
|
|
109
|
+
Object.keys(msBuildProps).forEach((key) => {
|
|
103
110
|
args.push(`/p:${key}=${msBuildProps[key]}`);
|
|
104
111
|
});
|
|
105
112
|
try {
|
|
@@ -120,7 +127,7 @@ class MSBuildTools {
|
|
|
120
127
|
catch (e) {
|
|
121
128
|
let error = e;
|
|
122
129
|
if (!e) {
|
|
123
|
-
const firstMessage = (await fs_1.default.
|
|
130
|
+
const firstMessage = (await fs_1.default.readFile(errorLog))
|
|
124
131
|
.toString()
|
|
125
132
|
.split(os_1.EOL)[0];
|
|
126
133
|
error = new telemetry_1.CodedError('MSBuildError', firstMessage);
|
|
@@ -129,8 +136,8 @@ class MSBuildTools {
|
|
|
129
136
|
throw error;
|
|
130
137
|
}
|
|
131
138
|
// If we have no errors, delete the error log when we're done
|
|
132
|
-
if ((await fs_1.default.
|
|
133
|
-
await fs_1.default.
|
|
139
|
+
if ((await fs_1.default.stat(errorLog)).size === 0) {
|
|
140
|
+
await fs_1.default.unlink(errorLog);
|
|
134
141
|
}
|
|
135
142
|
}
|
|
136
143
|
static findAvailableVersion(buildArch, verbose, prerelease) {
|
|
@@ -184,9 +191,9 @@ class MSBuildTools {
|
|
|
184
191
|
}
|
|
185
192
|
shelljs_1.default
|
|
186
193
|
.ls(uapFolderPath)
|
|
187
|
-
.filter(uapDir => shelljs_1.default.test('-d', path_1.default.join(uapFolderPath, uapDir)))
|
|
194
|
+
.filter((uapDir) => shelljs_1.default.test('-d', path_1.default.join(uapFolderPath, uapDir)))
|
|
188
195
|
.map(version_1.default.tryParse)
|
|
189
|
-
.forEach(version => version && results.push(version));
|
|
196
|
+
.forEach((version) => version && results.push(version));
|
|
190
197
|
return results;
|
|
191
198
|
}
|
|
192
199
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msbuildtools.js","sourceRoot":"","sources":["../../../src/runWindows/utils/msbuildtools.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2BAAiC;AACjC,4CAAoB;AACpB,gDAAwB;AACxB,kEAA0C;AAC1C,kDAA0B;AAC1B,4CAAoB;AACpB,sDAA4B;AAC5B,wDAAgC;AAChC,uEAAyD;AACzD,+DAM+B;AAC/B,iDAAuC;AAEvC,6CAAiD;AACjD,+DAA2D;AAE3D,MAAqB,YAAY;IAC/B;;;;OAIG;IACH,YACkB,OAAe,EACf,gBAAwB,EACxB,mBAA2B;QAF3B,YAAO,GAAP,OAAO,CAAQ;QACf,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,wBAAmB,GAAnB,mBAAmB,CAAQ;IAC1C,CAAC;IAEJ;;OAEG;IACH,WAAW;QACT,OAAO,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;IACjE,CAAC;IAED,YAAY,CAAC,OAAe;QAC1B,MAAM,GAAG,GAAG,IAAI,cAAI,CAAC,IAAI,CACvB,IAA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M,CAAC,CAAC;IAC9B,IAAI,KAAK,EAAE;QACT,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {totalmem, EOL} from 'os';\nimport fs from 'fs';\nimport path from 'path';\nimport child_process from 'child_process';\nimport chalk from 'chalk';\nimport os from 'os';\nimport shell from 'shelljs';\nimport Version from './version';\nimport * as checkRequirements from './checkRequirements';\nimport {\n commandWithProgress,\n newInfo,\n newSpinner,\n newSuccess,\n newError,\n} from './commandWithProgress';\nimport {execSync} from 'child_process';\nimport {BuildArch, BuildConfig} from '../runWindowsOptions';\nimport {findLatestVsInstall} from './vsInstalls';\nimport {CodedError} from '@react-native-windows/telemetry';\n\nexport default class MSBuildTools {\n /**\n * @param version is something like 16.0 for 2019\n * @param installationPath Path to installation root\n * @param installationVersion is the full version e.g. 16.3.29411.108\n */\n constructor(\n public readonly version: string,\n public readonly installationPath: string,\n public readonly installationVersion: string,\n ) {}\n\n /**\n * @returns directory where x86 msbuild can be found\n */\n msbuildPath() {\n return path.join(this.installationPath, 'MSBuild/Current/Bin');\n }\n\n cleanProject(slnFile: string) {\n const cmd = `\"${path.join(\n this.msbuildPath(),\n 'msbuild.exe',\n )}\" \"${slnFile}\" /t:Clean`;\n const results = child_process\n .execSync(cmd)\n .toString()\n .split(EOL);\n results.forEach(result => console.log(chalk.white(result)));\n }\n\n async buildProject(\n slnFile: string,\n buildType: BuildConfig,\n buildArch: BuildArch,\n msBuildProps: Record<string, string>,\n verbose: boolean,\n target: 'build' | 'deploy',\n buildLogDirectory: string | undefined,\n singleproc?: boolean,\n ) {\n newSuccess(`Found Solution: ${slnFile}`);\n newInfo(`Build configuration: ${buildType}`);\n newInfo(`Build platform: ${buildArch}`);\n\n const verbosityOption = verbose ? 'normal' : 'minimal';\n const logPrefix = path.join(\n buildLogDirectory || os.tmpdir(),\n `msbuild_${process.pid}_${target}`,\n );\n\n const errorLog = logPrefix + '.err';\n const warnLog = logPrefix + '.wrn';\n\n const localBinLog = target === 'build' ? '' : ':deploy.binlog';\n const binlog = buildLogDirectory ? `:${logPrefix}.binlog` : localBinLog;\n\n const args = [\n `/clp:NoSummary;NoItemAndPropertyList;Verbosity=${verbosityOption}`,\n '/nologo',\n `/p:Configuration=${buildType}`,\n `/p:Platform=${buildArch}`,\n '/p:AppxBundle=Never',\n `/bl${binlog}`,\n `/flp1:errorsonly;logfile=${errorLog}`,\n `/flp2:warningsonly;logfile=${warnLog}`,\n ];\n\n // Building projects in parallel increases compiler memory usage and\n // doesn't lead to dramatic performance gains (See #4739). Only enable\n // parallel builds on machines with >16GB of memory to avoid OOM errors\n const highMemory = totalmem() > 16 * 1024 * 1024 * 1024;\n const enableParallelBuilds = singleproc === false || highMemory;\n\n if (enableParallelBuilds) {\n args.push('/maxCpuCount');\n }\n\n if (target === 'build') {\n args.push('/restore', '/p:RestorePackagesConfig=true');\n } else {\n args.push(`/t:Deploy`);\n }\n\n Object.keys(msBuildProps).forEach(key => {\n args.push(`/p:${key}=${msBuildProps[key]}`);\n });\n\n try {\n checkRequirements.isWinSdkPresent('10.0');\n } catch (e) {\n newError((e as Error).message);\n throw e;\n }\n\n if (verbose) {\n console.log(`Running MSBuild with args ${args.join(' ')}`);\n }\n\n const progressName =\n target === 'deploy' ? 'Deploying Solution' : 'Building Solution';\n const spinner = newSpinner(progressName);\n try {\n await commandWithProgress(\n spinner,\n progressName,\n path.join(this.msbuildPath(), 'msbuild.exe'),\n [slnFile].concat(args),\n verbose,\n 'MSBuildError',\n );\n } catch (e) {\n let error = e;\n if (!e) {\n const firstMessage = (await fs.promises.readFile(errorLog))\n .toString()\n .split(EOL)[0];\n error = new CodedError('MSBuildError', firstMessage);\n (error as any).logfile = errorLog;\n }\n throw error;\n }\n // If we have no errors, delete the error log when we're done\n if ((await fs.promises.stat(errorLog)).size === 0) {\n await fs.promises.unlink(errorLog);\n }\n }\n\n static findAvailableVersion(\n buildArch: BuildArch,\n verbose: boolean,\n prerelease?: boolean,\n ): MSBuildTools {\n // https://aka.ms/vs/workloads\n const requires = [\n 'Microsoft.Component.MSBuild',\n getVCToolsByArch(buildArch),\n ];\n const minVersion = process.env.VisualStudioVersion || '16.7';\n const vsInstallation = findLatestVsInstall({\n requires,\n minVersion,\n verbose,\n prerelease,\n });\n\n if (!vsInstallation) {\n if (process.env.VisualStudioVersion != null) {\n throw new CodedError(\n 'NoMSBuild',\n `MSBuild tools not found for version ${process.env.VisualStudioVersion} (from environment). Make sure all required components have been installed`,\n {VisualStudioVersionFromEnv: process.env.VisualStudioVersion},\n );\n } else {\n throw new CodedError(\n 'NoMSBuild',\n `Could not find MSBuild with VCTools for Visual Studio ${minVersion} or later. Make sure all required components have been installed`,\n {minVersion: minVersion},\n );\n }\n }\n\n const toolsPath = path.join(\n vsInstallation.installationPath,\n 'MSBuild/Current/Bin',\n );\n\n if (fs.existsSync(toolsPath)) {\n newSuccess(\n `Found compatible MSBuild at ${toolsPath} (${vsInstallation.installationVersion})`,\n );\n return new MSBuildTools(\n minVersion,\n vsInstallation.installationPath,\n vsInstallation.installationVersion,\n );\n } else {\n throw new CodedError(\n 'NoMSBuild',\n `MSBuild path '${toolsPath} does not exist'`,\n );\n }\n }\n\n static getAllAvailableUAPVersions(): Version[] {\n const results: Version[] = [];\n\n const programFilesFolder =\n process.env['ProgramFiles(x86)'] || process.env.ProgramFiles;\n // No Program Files folder found, so we won't be able to find UAP SDK\n if (!programFilesFolder) {\n return results;\n }\n\n let uapFolderPath = path.join(\n programFilesFolder,\n 'Windows Kits',\n '10',\n 'Platforms',\n 'UAP',\n );\n\n if (!shell.test('-e', uapFolderPath)) {\n // Check other installation folder from reg\n const sdkFolder = getSDK10InstallationFolder();\n if (sdkFolder) {\n uapFolderPath = path.join(sdkFolder, 'Platforms', 'UAP');\n }\n }\n\n // No UAP SDK exists on this machine\n if (!shell.test('-e', uapFolderPath)) {\n return results;\n }\n\n shell\n .ls(uapFolderPath)\n .filter(uapDir => shell.test('-d', path.join(uapFolderPath, uapDir)))\n .map(Version.tryParse)\n .forEach(version => version && results.push(version));\n\n return results;\n }\n}\n\nfunction getVCToolsByArch(buildArch: BuildArch): string {\n switch (buildArch) {\n case 'x86':\n case 'x64':\n return 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64';\n case 'ARM64':\n return 'Microsoft.VisualStudio.Component.VC.Tools.ARM64';\n }\n}\n\nfunction getSDK10InstallationFolder(): string {\n const folder = '';\n\n const execString =\n 'reg query \"HKLM\\\\SOFTWARE\\\\Microsoft\\\\Microsoft SDKs\\\\Windows\\\\v10.0\" /s /v InstallationFolder /reg:32';\n let output;\n try {\n output = execSync(execString).toString();\n } catch (e) {\n return folder;\n }\n\n const re = /\\\\Microsoft SDKs\\\\Windows\\\\v10.0\\s*InstallationFolder\\s+REG_SZ\\s+(.*)/gim;\n const match = re.exec(output);\n if (match) {\n return match[1];\n }\n\n return folder;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"msbuildtools.js","sourceRoot":"","sources":["../../../src/runWindows/utils/msbuildtools.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2BAAiC;AACjC,kEAA0C;AAC1C,gDAAwB;AACxB,kEAA0C;AAC1C,kDAA0B;AAC1B,4CAAoB;AACpB,sDAA4B;AAC5B,wDAAgC;AAChC,uEAAyD;AACzD,+DAM+B;AAC/B,iDAAuC;AAEvC,6CAAiD;AACjD,+DAA2D;AAE3D,MAAqB,YAAY;IAC/B;;;;OAIG;IACH,YACkB,OAAe,EACf,gBAAwB,EACxB,mBAA2B;QAF3B,YAAO,GAAP,OAAO,CAAQ;QACf,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,wBAAmB,GAAnB,mBAAmB,CAAQ;IAC1C,CAAC;IAEJ;;OAEG;IACH,WAAW;QACT,OAAO,cAAI,CAAC,IAAI,CAAC,IAAI,CA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AS,EAAE;QACjB,KAAK,KAAK,CAAC;QACX,KAAK,KAAK;YACR,OAAO,mDAAmD,CAAC;QAC7D,KAAK,OAAO;YACV,OAAO,iDAAiD,CAAC;KAC5D;AACH,CAAC;AAED,SAAS,0BAA0B;IACjC,MAAM,MAAM,GAAG,EAAE,CAAC;IAElB,MAAM,UAAU,GACd,wGAAwG,CAAC;IAC3G,IAAI,MAAM,CAAC;IACX,IAAI;QACF,MAAM,GAAG,IAAA,wBAAQ,EAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC;KAC1C;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,MAAM,CAAC;KACf;IAED,MAAM,EAAE,GACN,0EAA0E,CAAC;IAC7E,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAI,KAAK,EAAE;QACT,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {totalmem, EOL} from 'os';\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\nimport child_process from 'child_process';\nimport chalk from 'chalk';\nimport os from 'os';\nimport shell from 'shelljs';\nimport Version from './version';\nimport * as checkRequirements from './checkRequirements';\nimport {\n commandWithProgress,\n newInfo,\n newSpinner,\n newSuccess,\n newError,\n} from './commandWithProgress';\nimport {execSync} from 'child_process';\nimport {BuildArch, BuildConfig} from '../runWindowsOptions';\nimport {findLatestVsInstall} from './vsInstalls';\nimport {CodedError} from '@react-native-windows/telemetry';\n\nexport default class MSBuildTools {\n /**\n * @param version is something like 16.0 for 2019\n * @param installationPath Path to installation root\n * @param installationVersion is the full version e.g. 16.3.29411.108\n */\n constructor(\n public readonly version: string,\n public readonly installationPath: string,\n public readonly installationVersion: string,\n ) {}\n\n /**\n * @returns directory where x86 msbuild can be found\n */\n msbuildPath() {\n return path.join(this.installationPath, 'MSBuild/Current/Bin');\n }\n\n cleanProject(slnFile: string) {\n const cmd = `\"${path.join(\n this.msbuildPath(),\n 'msbuild.exe',\n )}\" \"${slnFile}\" /t:Clean`;\n const results = child_process.execSync(cmd).toString().split(EOL);\n results.forEach((result) => console.log(chalk.white(result)));\n }\n\n async restorePackageConfigs(slnFile: any) {\n const text = 'Restoring NuGet packages ';\n const spinner = newSpinner(text);\n await commandWithProgress(\n spinner,\n text,\n path.join(this.msbuildPath(), 'msbuild.exe'),\n [\n slnFile,\n '/t:Restore',\n '/p:RestoreProjectStyle=PackagesConfig',\n '/p:RestorePackagesConfig=true',\n ],\n true,\n 'MSBuildError',\n );\n }\n\n async buildProject(\n slnFile: string,\n buildType: BuildConfig,\n buildArch: BuildArch,\n msBuildProps: Record<string, string>,\n verbose: boolean,\n target: 'build' | 'deploy',\n buildLogDirectory: string | undefined,\n singleproc?: boolean,\n ) {\n newSuccess(`Found Solution: ${slnFile}`);\n newInfo(`Build configuration: ${buildType}`);\n newInfo(`Build platform: ${buildArch}`);\n\n const verbosityOption = verbose ? 'normal' : 'minimal';\n const logPrefix = path.join(\n buildLogDirectory || os.tmpdir(),\n `msbuild_${process.pid}_${target}`,\n );\n\n const errorLog = logPrefix + '.err';\n const warnLog = logPrefix + '.wrn';\n\n const localBinLog = target === 'build' ? '' : ':deploy.binlog';\n const binlog = buildLogDirectory ? `:${logPrefix}.binlog` : localBinLog;\n\n const args = [\n `/clp:NoSummary;NoItemAndPropertyList;Verbosity=${verbosityOption}`,\n '/nologo',\n `/p:Configuration=${buildType}`,\n `/p:Platform=${buildArch}`,\n '/p:AppxBundle=Never',\n `/bl${binlog}`,\n `/flp1:errorsonly;logfile=${errorLog}`,\n `/flp2:warningsonly;logfile=${warnLog}`,\n ];\n\n // Building projects in parallel increases compiler memory usage and\n // doesn't lead to dramatic performance gains (See #4739). Only enable\n // parallel builds on machines with >16GB of memory to avoid OOM errors\n const highMemory = totalmem() > 16 * 1024 * 1024 * 1024;\n const enableParallelBuilds = singleproc === false || highMemory;\n\n if (enableParallelBuilds) {\n args.push('/maxCpuCount');\n }\n\n if (target === 'build') {\n args.push('/restore', '/p:RestorePackagesConfig=true');\n } else {\n args.push(`/t:Deploy`);\n }\n\n Object.keys(msBuildProps).forEach((key) => {\n args.push(`/p:${key}=${msBuildProps[key]}`);\n });\n\n try {\n checkRequirements.isWinSdkPresent('10.0');\n } catch (e) {\n newError((e as Error).message);\n throw e;\n }\n\n if (verbose) {\n console.log(`Running MSBuild with args ${args.join(' ')}`);\n }\n\n const progressName =\n target === 'deploy' ? 'Deploying Solution' : 'Building Solution';\n const spinner = newSpinner(progressName);\n try {\n await commandWithProgress(\n spinner,\n progressName,\n path.join(this.msbuildPath(), 'msbuild.exe'),\n [slnFile].concat(args),\n verbose,\n 'MSBuildError',\n );\n } catch (e) {\n let error = e;\n if (!e) {\n const firstMessage = (await fs.readFile(errorLog))\n .toString()\n .split(EOL)[0];\n error = new CodedError('MSBuildError', firstMessage);\n (error as any).logfile = errorLog;\n }\n throw error;\n }\n // If we have no errors, delete the error log when we're done\n if ((await fs.stat(errorLog)).size === 0) {\n await fs.unlink(errorLog);\n }\n }\n\n static findAvailableVersion(\n buildArch: BuildArch,\n verbose: boolean,\n prerelease?: boolean,\n ): MSBuildTools {\n // https://aka.ms/vs/workloads\n const requires = [\n 'Microsoft.Component.MSBuild',\n getVCToolsByArch(buildArch),\n ];\n const minVersion = process.env.VisualStudioVersion || '16.7';\n const vsInstallation = findLatestVsInstall({\n requires,\n minVersion,\n verbose,\n prerelease,\n });\n\n if (!vsInstallation) {\n if (process.env.VisualStudioVersion != null) {\n throw new CodedError(\n 'NoMSBuild',\n `MSBuild tools not found for version ${process.env.VisualStudioVersion} (from environment). Make sure all required components have been installed`,\n {VisualStudioVersionFromEnv: process.env.VisualStudioVersion},\n );\n } else {\n throw new CodedError(\n 'NoMSBuild',\n `Could not find MSBuild with VCTools for Visual Studio ${minVersion} or later. Make sure all required components have been installed`,\n {minVersion: minVersion},\n );\n }\n }\n\n const toolsPath = path.join(\n vsInstallation.installationPath,\n 'MSBuild/Current/Bin',\n );\n\n if (fs.existsSync(toolsPath)) {\n newSuccess(\n `Found compatible MSBuild at ${toolsPath} (${vsInstallation.installationVersion})`,\n );\n return new MSBuildTools(\n minVersion,\n vsInstallation.installationPath,\n vsInstallation.installationVersion,\n );\n } else {\n throw new CodedError(\n 'NoMSBuild',\n `MSBuild path '${toolsPath} does not exist'`,\n );\n }\n }\n\n static getAllAvailableUAPVersions(): Version[] {\n const results: Version[] = [];\n\n const programFilesFolder =\n process.env['ProgramFiles(x86)'] || process.env.ProgramFiles;\n // No Program Files folder found, so we won't be able to find UAP SDK\n if (!programFilesFolder) {\n return results;\n }\n\n let uapFolderPath = path.join(\n programFilesFolder,\n 'Windows Kits',\n '10',\n 'Platforms',\n 'UAP',\n );\n\n if (!shell.test('-e', uapFolderPath)) {\n // Check other installation folder from reg\n const sdkFolder = getSDK10InstallationFolder();\n if (sdkFolder) {\n uapFolderPath = path.join(sdkFolder, 'Platforms', 'UAP');\n }\n }\n\n // No UAP SDK exists on this machine\n if (!shell.test('-e', uapFolderPath)) {\n return results;\n }\n\n shell\n .ls(uapFolderPath)\n .filter((uapDir) => shell.test('-d', path.join(uapFolderPath, uapDir)))\n .map(Version.tryParse)\n .forEach((version) => version && results.push(version));\n\n return results;\n }\n}\n\nfunction getVCToolsByArch(buildArch: BuildArch): string {\n switch (buildArch) {\n case 'x86':\n case 'x64':\n return 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64';\n case 'ARM64':\n return 'Microsoft.VisualStudio.Component.VC.Tools.ARM64';\n }\n}\n\nfunction getSDK10InstallationFolder(): string {\n const folder = '';\n\n const execString =\n 'reg query \"HKLM\\\\SOFTWARE\\\\Microsoft\\\\Microsoft SDKs\\\\Windows\\\\v10.0\" /s /v InstallationFolder /reg:32';\n let output;\n try {\n output = execSync(execString).toString();\n } catch (e) {\n return folder;\n }\n\n const re =\n /\\\\Microsoft SDKs\\\\Windows\\\\v10.0\\s*InstallationFolder\\s+REG_SZ\\s+(.*)/gim;\n const match = re.exec(output);\n if (match) {\n return match[1];\n }\n\n return folder;\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
import { Config, CommandOption } from '@react-native-community/cli-types';
|
|
7
|
+
import { CommanderOptionsType, OptionSanitizer } from '@react-native-windows/telemetry';
|
|
8
|
+
/**
|
|
9
|
+
* Calculates a the default values of a given react-native CLI command's options.
|
|
10
|
+
* @param config Config passed from react-native CLI.
|
|
11
|
+
* @param commandOptions The options definition for the command.
|
|
12
|
+
* @returns The default options for the command.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getDefaultOptions(config: Config, commandOptions: CommandOption[]): CommanderOptionsType;
|
|
15
|
+
/**
|
|
16
|
+
* Sets up and starts the telemetry gathering for the CLI command.
|
|
17
|
+
* @param commandName The name of the CLI command.
|
|
18
|
+
* @param config Config passed from react-native CLI.
|
|
19
|
+
* @param options Options passed from react-native CLI.
|
|
20
|
+
* @param defaultOptions Default options for the command.
|
|
21
|
+
* @param optionSanitizer Function to sanitize the option values for telemetry.
|
|
22
|
+
*/
|
|
23
|
+
export declare function startTelemetrySession(commandName: string, config: Config, options: CommanderOptionsType, defaultOptions: CommanderOptionsType, optionSanitizer: OptionSanitizer): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Ends the gathering of telemetry for the CLI command.
|
|
26
|
+
* @param error The error (if any) thrown during the command.
|
|
27
|
+
* @param getExtraProps Function to get any extra command-specific telemetry properties.
|
|
28
|
+
*/
|
|
29
|
+
export declare function endTelemetrySession(error?: Error, getExtraProps?: () => Promise<Record<string, any>>): Promise<void>;
|