@react-native-windows/cli 0.73.2 → 0.74.0-preview.2
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/lib-commonjs/commands/autolinkWindows/autolinkWindows.d.ts +87 -87
- package/lib-commonjs/commands/autolinkWindows/autolinkWindows.js +654 -654
- package/lib-commonjs/commands/autolinkWindows/autolinkWindowsOptions.d.ts +14 -14
- package/lib-commonjs/commands/autolinkWindows/autolinkWindowsOptions.js +32 -32
- package/lib-commonjs/commands/codegenWindows/codegenWindows.d.ts +27 -27
- package/lib-commonjs/commands/codegenWindows/codegenWindows.js +205 -205
- package/lib-commonjs/commands/codegenWindows/codegenWindowsOptions.d.ts +12 -12
- package/lib-commonjs/commands/codegenWindows/codegenWindowsOptions.js +22 -22
- package/lib-commonjs/commands/config/configUtils.d.ts +123 -123
- package/lib-commonjs/commands/config/configUtils.js +380 -380
- package/lib-commonjs/commands/config/dependencyConfig.d.ts +37 -37
- package/lib-commonjs/commands/config/dependencyConfig.js +227 -227
- package/lib-commonjs/commands/config/projectConfig.d.ts +27 -27
- package/lib-commonjs/commands/config/projectConfig.js +180 -180
- package/lib-commonjs/commands/healthCheck/healthCheckList.d.ts +6 -6
- package/lib-commonjs/commands/healthCheck/healthCheckList.js +20 -20
- package/lib-commonjs/commands/healthCheck/healthCheckList.js.map +1 -1
- package/lib-commonjs/commands/healthCheck/healthChecks.d.ts +7 -7
- package/lib-commonjs/commands/healthCheck/healthChecks.js +123 -123
- package/lib-commonjs/commands/initWindows/initWindows.d.ts +46 -46
- package/lib-commonjs/commands/initWindows/initWindows.js +243 -243
- package/lib-commonjs/commands/initWindows/initWindowsOptions.d.ts +15 -15
- package/lib-commonjs/commands/initWindows/initWindowsOptions.js +37 -37
- package/lib-commonjs/commands/runWindows/runWindows.d.ts +10 -10
- package/lib-commonjs/commands/runWindows/runWindows.js +321 -321
- package/lib-commonjs/commands/runWindows/runWindowsOptions.d.ts +56 -56
- package/lib-commonjs/commands/runWindows/runWindowsOptions.js +132 -132
- package/lib-commonjs/e2etest/autolink.test.d.ts +6 -6
- package/lib-commonjs/e2etest/autolink.test.js +366 -366
- package/lib-commonjs/e2etest/dependencyConfig.test.d.ts +6 -6
- package/lib-commonjs/e2etest/dependencyConfig.test.js +129 -129
- package/lib-commonjs/e2etest/healthChecks.test.d.ts +6 -6
- package/lib-commonjs/e2etest/healthChecks.test.js +30 -30
- package/lib-commonjs/e2etest/initWindows.test.d.ts +6 -6
- package/lib-commonjs/e2etest/initWindows.test.js +42 -42
- package/lib-commonjs/e2etest/projectConfig.test.d.ts +6 -6
- package/lib-commonjs/e2etest/projectConfig.test.js +110 -110
- package/lib-commonjs/e2etest/projectConfig.utils.d.ts +8 -8
- package/lib-commonjs/e2etest/projectConfig.utils.js +76 -76
- package/lib-commonjs/e2etest/runWindows.test.d.ts +6 -6
- package/lib-commonjs/e2etest/runWindows.test.js +60 -60
- package/lib-commonjs/e2etest/typesUpToDate.test.d.ts +6 -0
- package/lib-commonjs/e2etest/typesUpToDate.test.js +21 -0
- package/lib-commonjs/e2etest/typesUpToDate.test.js.map +1 -0
- package/lib-commonjs/generator-common/index.d.ts +39 -39
- package/lib-commonjs/generator-common/index.js +242 -242
- package/lib-commonjs/generator-windows/index.d.ts +10 -10
- package/lib-commonjs/generator-windows/index.js +316 -316
- package/lib-commonjs/index.d.ts +50 -50
- package/lib-commonjs/index.js +77 -77
- package/lib-commonjs/utils/build.d.ts +12 -12
- package/lib-commonjs/utils/build.js +84 -84
- package/lib-commonjs/utils/checkRequirements.d.ts +6 -6
- package/lib-commonjs/utils/checkRequirements.js +69 -69
- package/lib-commonjs/utils/commandWithProgress.d.ts +21 -21
- package/lib-commonjs/utils/commandWithProgress.js +149 -149
- package/lib-commonjs/utils/deploy.d.ts +12 -12
- package/lib-commonjs/utils/deploy.js +353 -353
- package/lib-commonjs/utils/info.d.ts +6 -6
- package/lib-commonjs/utils/info.js +28 -28
- package/lib-commonjs/utils/msbuildtools.d.ts +28 -28
- package/lib-commonjs/utils/msbuildtools.js +273 -273
- package/lib-commonjs/utils/msbuildtools.js.map +1 -1
- package/lib-commonjs/utils/pathHelpers.d.ts +9 -9
- package/lib-commonjs/utils/pathHelpers.js +36 -36
- package/lib-commonjs/utils/telemetryHelpers.d.ts +29 -29
- package/lib-commonjs/utils/telemetryHelpers.js +120 -120
- package/lib-commonjs/utils/version.d.ts +19 -19
- package/lib-commonjs/utils/version.js +109 -109
- package/lib-commonjs/utils/vsInstalls.d.ts +34 -34
- package/lib-commonjs/utils/vsInstalls.js +99 -99
- package/lib-commonjs/utils/vstools.d.ts +16 -16
- package/lib-commonjs/utils/vstools.js +189 -189
- package/lib-commonjs/utils/winappdeploytool.d.ts +24 -24
- package/lib-commonjs/utils/winappdeploytool.js +108 -108
- package/package.json +16 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msbuildtools.js","sourceRoot":"","sources":["../../src/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,+DAO+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,I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EAAE,CAAC;YACnD,OAAO,CAAC,OAAO,EAAE,CAAC;YAElB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAA2B,CAAC;YACvE,OAAO,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,UAAU,CAAC;SACnB;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,IAAI,CACV,6CAA6C,GAAI,CAAW,CAAC,OAAO,CACrE,CAAC;YACF,MAAM,CAAC,CAAC;SACT;IACH,CAAC;CACF;AArTD,+BAqTC;AAED,SAAS,gBAAgB,CAAC,SAAoB;IAC5C,QAAQ,SAAS,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 powershell,\n} from './commandWithProgress';\nimport {execSync} from 'child_process';\nimport {BuildArch, BuildConfig} from '../commands/runWindows/runWindowsOptions';\nimport {findLatestVsInstall} from './vsInstalls';\nimport {CodedError} from '@react-native-windows/telemetry';\n\nexport default class MSBuildTools {\n /**\n * @param version is something like 17.0 for 2022\n * @param installationPath Path to installation root\n * @param installationVersion is the full version e.g. 17.3.32929.385\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(\n slnFile: any,\n buildArch: BuildArch,\n buildType: BuildConfig,\n ) {\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 `/p:Platform=${buildArch}`,\n `/p:Configuration=${buildType}`,\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 instanceof CodedError) {\n const origCodedError = e as CodedError;\n if (origCodedError.type === 'MSBuildError') {\n // Try to parse msbuild errors from errorLog\n const errorLogContents = (await fs.readFile(errorLog))\n .toString()\n .split(EOL)\n .filter(s => s)\n .map(s => s.trim());\n if (errorLogContents.length > 0) {\n const firstMessage = errorLogContents[0];\n error = new CodedError(\n 'MSBuildError',\n firstMessage,\n origCodedError.data,\n );\n // Hide error messages in a field that won't automatically get reported\n // with telemetry but is still available to be parsed and sanitized\n (error as any).msBuildErrorMessages = errorLogContents;\n }\n }\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 || '17.0';\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 if (verbose) {\n newSuccess(\n `Found compatible MSBuild at ${toolsPath} (${vsInstallation.installationVersion})`,\n );\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 evaluateMSBuildProperties(\n solutionFile: string,\n projectFile: string,\n propertyNames?: string[],\n extraMsBuildProps?: Record<string, string>,\n ): Record<string, string> {\n const spinner = newSpinner('Running Eval-MsBuildProperties.ps1');\n\n try {\n const msbuildEvalScriptPath = path.resolve(\n __dirname,\n '..',\n '..',\n 'src',\n 'powershell',\n 'Eval-MsBuildProperties.ps1',\n );\n\n let command = `${powershell} -ExecutionPolicy Unrestricted -NoProfile \"${msbuildEvalScriptPath}\" -SolutionFile '${solutionFile}' -ProjectFile '${projectFile}' -MSBuildPath '${this.msbuildPath()}'`;\n\n if (propertyNames && propertyNames.length > 0) {\n command += ` -PropertyNames '${propertyNames.join(',')}'`;\n }\n\n if (extraMsBuildProps) {\n command += \" -ExtraMSBuildProps '\";\n for (const extraProp in extraMsBuildProps) {\n if (!(extraProp in Object.prototype)) {\n command += `,${extraProp}=${extraMsBuildProps[extraProp]}`;\n }\n }\n command += \"'\";\n }\n\n const commandOutput = execSync(command).toString();\n spinner.succeed();\n\n const properties = JSON.parse(commandOutput) as Record<string, string>;\n spinner.succeed();\n return properties;\n } catch (e) {\n spinner.fail(\n 'Running Eval-MsBuildProperties.ps1 failed: ' + (e as Error).message,\n );\n throw e;\n }\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"]}
|
|
1
|
+
{"version":3,"file":"msbuildtools.js","sourceRoot":"","sources":["../../src/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,+DAO+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,2BAA2B,CAAC,CAAC;IACvE,CAAC;IAED,YAAY,CAAC,OAAe;QAC1B,MAAM,GAAG,GAAG,IAAI,cAAI,CAAC,IAAI,CACvB,IAAI,CAAC,WAAW,EAAE,EAClB,aAAa,CACd,MAAM,OAAO,YAAY,CAAC;QAC3B,MAAM,OAAO,GAAG,uBAAa,CAAC,QAAQ,CAAC,GAAG,CAAC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B,OAAO,UAAU,CAAC;SACnB;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,IAAI,CACV,6CAA6C,GAAI,CAAW,CAAC,OAAO,CACrE,CAAC;YACF,MAAM,CAAC,CAAC;SACT;IACH,CAAC;CACF;AArTD,+BAqTC;AAED,SAAS,gBAAgB,CAAC,SAAoB;IAC5C,QAAQ,SAAS,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 powershell,\n} from './commandWithProgress';\nimport {execSync} from 'child_process';\nimport {BuildArch, BuildConfig} from '../commands/runWindows/runWindowsOptions';\nimport {findLatestVsInstall} from './vsInstalls';\nimport {CodedError} from '@react-native-windows/telemetry';\n\nexport default class MSBuildTools {\n /**\n * @param version is something like 17.0 for 2022\n * @param installationPath Path to installation root\n * @param installationVersion is the full version e.g. 17.3.32929.385\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 x64 msbuild can be found\n */\n msbuildPath() {\n return path.join(this.installationPath, 'MSBuild/Current/Bin/amd64');\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(\n slnFile: any,\n buildArch: BuildArch,\n buildType: BuildConfig,\n ) {\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 `/p:Platform=${buildArch}`,\n `/p:Configuration=${buildType}`,\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 instanceof CodedError) {\n const origCodedError = e as CodedError;\n if (origCodedError.type === 'MSBuildError') {\n // Try to parse msbuild errors from errorLog\n const errorLogContents = (await fs.readFile(errorLog))\n .toString()\n .split(EOL)\n .filter(s => s)\n .map(s => s.trim());\n if (errorLogContents.length > 0) {\n const firstMessage = errorLogContents[0];\n error = new CodedError(\n 'MSBuildError',\n firstMessage,\n origCodedError.data,\n );\n // Hide error messages in a field that won't automatically get reported\n // with telemetry but is still available to be parsed and sanitized\n (error as any).msBuildErrorMessages = errorLogContents;\n }\n }\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 || '17.0';\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/amd64',\n );\n\n if (fs.existsSync(toolsPath)) {\n if (verbose) {\n newSuccess(\n `Found compatible MSBuild at ${toolsPath} (${vsInstallation.installationVersion})`,\n );\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 evaluateMSBuildProperties(\n solutionFile: string,\n projectFile: string,\n propertyNames?: string[],\n extraMsBuildProps?: Record<string, string>,\n ): Record<string, string> {\n const spinner = newSpinner('Running Eval-MsBuildProperties.ps1');\n\n try {\n const msbuildEvalScriptPath = path.resolve(\n __dirname,\n '..',\n '..',\n 'src',\n 'powershell',\n 'Eval-MsBuildProperties.ps1',\n );\n\n let command = `${powershell} -ExecutionPolicy Unrestricted -NoProfile \"${msbuildEvalScriptPath}\" -SolutionFile '${solutionFile}' -ProjectFile '${projectFile}' -MSBuildPath '${this.msbuildPath()}'`;\n\n if (propertyNames && propertyNames.length > 0) {\n command += ` -PropertyNames '${propertyNames.join(',')}'`;\n }\n\n if (extraMsBuildProps) {\n command += \" -ExtraMSBuildProps '\";\n for (const extraProp in extraMsBuildProps) {\n if (!(extraProp in Object.prototype)) {\n command += `,${extraProp}=${extraMsBuildProps[extraProp]}`;\n }\n }\n command += \"'\";\n }\n\n const commandOutput = execSync(command).toString();\n spinner.succeed();\n\n const properties = JSON.parse(commandOutput) as Record<string, string>;\n spinner.succeed();\n return properties;\n } catch (e) {\n spinner.fail(\n 'Running Eval-MsBuildProperties.ps1 failed: ' + (e as Error).message,\n );\n throw e;\n }\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"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
* @format
|
|
5
|
-
*/
|
|
6
|
-
export declare function resolveRnRoot(paths: string | string[] | undefined): string;
|
|
7
|
-
export declare function resolveRnCliRoot(paths: string | string[] | undefined): string;
|
|
8
|
-
export declare function resolveRnwRoot(paths: string | string[] | undefined): string;
|
|
9
|
-
export declare function resolveRnwCliRoot(paths: string | string[] | undefined): string;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveRnRoot(paths: string | string[] | undefined): string;
|
|
7
|
+
export declare function resolveRnCliRoot(paths: string | string[] | undefined): string;
|
|
8
|
+
export declare function resolveRnwRoot(paths: string | string[] | undefined): string;
|
|
9
|
+
export declare function resolveRnwCliRoot(paths: string | string[] | undefined): string;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Microsoft Corporation.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.resolveRnwCliRoot = exports.resolveRnwRoot = exports.resolveRnCliRoot = exports.resolveRnRoot = void 0;
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
13
|
-
function resolveRnRoot(paths) {
|
|
14
|
-
return path_1.default.dirname(require.resolve('react-native/package.json', {
|
|
15
|
-
paths: typeof paths === 'string' ? [paths] : paths,
|
|
16
|
-
}));
|
|
17
|
-
}
|
|
18
|
-
exports.resolveRnRoot = resolveRnRoot;
|
|
19
|
-
function resolveRnCliRoot(paths) {
|
|
20
|
-
return path_1.default.dirname(require.resolve('@react-native-community/cli/package.json', {
|
|
21
|
-
paths: typeof paths === 'string' ? [paths] : paths,
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
exports.resolveRnCliRoot = resolveRnCliRoot;
|
|
25
|
-
function resolveRnwRoot(paths) {
|
|
26
|
-
return path_1.default.dirname(require.resolve('react-native-windows/package.json', {
|
|
27
|
-
paths: typeof paths === 'string' ? [paths] : paths,
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
exports.resolveRnwRoot = resolveRnwRoot;
|
|
31
|
-
function resolveRnwCliRoot(paths) {
|
|
32
|
-
return path_1.default.dirname(require.resolve('@react-native-windows/cli/package.json', {
|
|
33
|
-
paths: typeof paths === 'string' ? [paths] : paths,
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
exports.resolveRnwCliRoot = resolveRnwCliRoot;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.resolveRnwCliRoot = exports.resolveRnwRoot = exports.resolveRnCliRoot = exports.resolveRnRoot = void 0;
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
function resolveRnRoot(paths) {
|
|
14
|
+
return path_1.default.dirname(require.resolve('react-native/package.json', {
|
|
15
|
+
paths: typeof paths === 'string' ? [paths] : paths,
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
exports.resolveRnRoot = resolveRnRoot;
|
|
19
|
+
function resolveRnCliRoot(paths) {
|
|
20
|
+
return path_1.default.dirname(require.resolve('@react-native-community/cli/package.json', {
|
|
21
|
+
paths: typeof paths === 'string' ? [paths] : paths,
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
exports.resolveRnCliRoot = resolveRnCliRoot;
|
|
25
|
+
function resolveRnwRoot(paths) {
|
|
26
|
+
return path_1.default.dirname(require.resolve('react-native-windows/package.json', {
|
|
27
|
+
paths: typeof paths === 'string' ? [paths] : paths,
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
exports.resolveRnwRoot = resolveRnwRoot;
|
|
31
|
+
function resolveRnwCliRoot(paths) {
|
|
32
|
+
return path_1.default.dirname(require.resolve('@react-native-windows/cli/package.json', {
|
|
33
|
+
paths: typeof paths === 'string' ? [paths] : paths,
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
exports.resolveRnwCliRoot = resolveRnwCliRoot;
|
|
37
37
|
//# sourceMappingURL=pathHelpers.js.map
|
|
@@ -1,29 +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>;
|
|
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>;
|
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Microsoft Corporation.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.endTelemetrySession = exports.startTelemetrySession = exports.getDefaultOptions = void 0;
|
|
9
|
-
const lodash_1 = require("lodash");
|
|
10
|
-
const telemetry_1 = require("@react-native-windows/telemetry");
|
|
11
|
-
const commandWithProgress_1 = require("./commandWithProgress");
|
|
12
|
-
/**
|
|
13
|
-
* Calculates a the default values of a given react-native CLI command's options.
|
|
14
|
-
* @param config Config passed from react-native CLI.
|
|
15
|
-
* @param commandOptions The options definition for the command.
|
|
16
|
-
* @returns The default options for the command.
|
|
17
|
-
*/
|
|
18
|
-
function getDefaultOptions(config, commandOptions) {
|
|
19
|
-
const result = {
|
|
20
|
-
logging: false,
|
|
21
|
-
};
|
|
22
|
-
for (const option of commandOptions) {
|
|
23
|
-
let key = option.name.startsWith('--')
|
|
24
|
-
? option.name.slice('--'.length)
|
|
25
|
-
: option.name;
|
|
26
|
-
key = key.trim();
|
|
27
|
-
let value = option.default;
|
|
28
|
-
if (value !== undefined && value.name) {
|
|
29
|
-
value = value(config);
|
|
30
|
-
}
|
|
31
|
-
if (key.endsWith(' [string]')) {
|
|
32
|
-
// Option is a string
|
|
33
|
-
key = key.slice(0, -' [string]'.length);
|
|
34
|
-
// Option is a number
|
|
35
|
-
}
|
|
36
|
-
else if (key.endsWith(' [number]')) {
|
|
37
|
-
key = key.slice(0, -' [number]'.length);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
// Option is a boolean
|
|
41
|
-
// Note: Commander ignores the default property for booleans
|
|
42
|
-
if (key.startsWith('no-')) {
|
|
43
|
-
key = key.slice('no-'.length);
|
|
44
|
-
// Commander always defaults to true for flags that start with --no
|
|
45
|
-
value = true;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
// Commander always defaults to undefined for flags
|
|
49
|
-
value = undefined;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
key = (0, lodash_1.camelCase)(key);
|
|
53
|
-
result[key] = value;
|
|
54
|
-
}
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
exports.getDefaultOptions = getDefaultOptions;
|
|
58
|
-
/**
|
|
59
|
-
* Sets up and starts the telemetry gathering for the CLI command.
|
|
60
|
-
* @param commandName The name of the CLI command.
|
|
61
|
-
* @param config Config passed from react-native CLI.
|
|
62
|
-
* @param options Options passed from react-native CLI.
|
|
63
|
-
* @param defaultOptions Default options for the command.
|
|
64
|
-
* @param optionSanitizer Function to sanitize the option values for telemetry.
|
|
65
|
-
*/
|
|
66
|
-
async function startTelemetrySession(commandName, config, options, defaultOptions, optionSanitizer) {
|
|
67
|
-
const verbose = options.logging === true;
|
|
68
|
-
if (!options.telemetry) {
|
|
69
|
-
if (verbose) {
|
|
70
|
-
(0, commandWithProgress_1.newInfo)('Telemetry is disabled');
|
|
71
|
-
}
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (verbose) {
|
|
75
|
-
(0, commandWithProgress_1.newInfo)(`Running ${(0, telemetry_1.nodeArchitecture)()} node on a ${(0, telemetry_1.deviceArchitecture)()} machine`);
|
|
76
|
-
}
|
|
77
|
-
if ((0, telemetry_1.deviceArchitecture)() !== (0, telemetry_1.nodeArchitecture)()) {
|
|
78
|
-
(0, commandWithProgress_1.newWarn)('This version of node was built for a different architecture than this machine and may cause unintended behavior');
|
|
79
|
-
}
|
|
80
|
-
await telemetry_1.Telemetry.setup();
|
|
81
|
-
const sanitizedOptions = (0, telemetry_1.commanderOptionsToOptions)(options, optionSanitizer);
|
|
82
|
-
const sanitizedDefaultOptions = (0, telemetry_1.commanderOptionsToOptions)(defaultOptions, optionSanitizer);
|
|
83
|
-
const sanitizedArgs = (0, telemetry_1.optionsToArgs)(sanitizedOptions, process.argv);
|
|
84
|
-
const startInfo = {
|
|
85
|
-
commandName,
|
|
86
|
-
args: sanitizedArgs,
|
|
87
|
-
options: sanitizedOptions,
|
|
88
|
-
defaultOptions: sanitizedDefaultOptions,
|
|
89
|
-
};
|
|
90
|
-
telemetry_1.Telemetry.startCommand(startInfo);
|
|
91
|
-
const projectInfo = await (0, telemetry_1.configToProjectInfo)(config);
|
|
92
|
-
if (projectInfo) {
|
|
93
|
-
telemetry_1.Telemetry.setProjectInfo(projectInfo);
|
|
94
|
-
}
|
|
95
|
-
const projectFile = (0, telemetry_1.getProjectFileFromConfig)(config);
|
|
96
|
-
if (projectFile) {
|
|
97
|
-
await telemetry_1.Telemetry.populateNuGetPackageVersions(projectFile);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
exports.startTelemetrySession = startTelemetrySession;
|
|
101
|
-
/**
|
|
102
|
-
* Ends the gathering of telemetry for the CLI command.
|
|
103
|
-
* @param error The error (if any) thrown during the command.
|
|
104
|
-
* @param getExtraProps Function to get any extra command-specific telemetry properties.
|
|
105
|
-
*/
|
|
106
|
-
async function endTelemetrySession(error, getExtraProps) {
|
|
107
|
-
if (!telemetry_1.Telemetry.isEnabled()) {
|
|
108
|
-
// Bail early so don't waste time here
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
const endInfo = {
|
|
112
|
-
resultCode: 'Success',
|
|
113
|
-
};
|
|
114
|
-
if (error) {
|
|
115
|
-
endInfo.resultCode =
|
|
116
|
-
error instanceof telemetry_1.CodedError ? error.type : 'Unknown';
|
|
117
|
-
}
|
|
118
|
-
telemetry_1.Telemetry.endCommand(endInfo, getExtraProps ? await getExtraProps() : undefined);
|
|
119
|
-
}
|
|
120
|
-
exports.endTelemetrySession = endTelemetrySession;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.endTelemetrySession = exports.startTelemetrySession = exports.getDefaultOptions = void 0;
|
|
9
|
+
const lodash_1 = require("lodash");
|
|
10
|
+
const telemetry_1 = require("@react-native-windows/telemetry");
|
|
11
|
+
const commandWithProgress_1 = require("./commandWithProgress");
|
|
12
|
+
/**
|
|
13
|
+
* Calculates a the default values of a given react-native CLI command's options.
|
|
14
|
+
* @param config Config passed from react-native CLI.
|
|
15
|
+
* @param commandOptions The options definition for the command.
|
|
16
|
+
* @returns The default options for the command.
|
|
17
|
+
*/
|
|
18
|
+
function getDefaultOptions(config, commandOptions) {
|
|
19
|
+
const result = {
|
|
20
|
+
logging: false,
|
|
21
|
+
};
|
|
22
|
+
for (const option of commandOptions) {
|
|
23
|
+
let key = option.name.startsWith('--')
|
|
24
|
+
? option.name.slice('--'.length)
|
|
25
|
+
: option.name;
|
|
26
|
+
key = key.trim();
|
|
27
|
+
let value = option.default;
|
|
28
|
+
if (value !== undefined && value.name) {
|
|
29
|
+
value = value(config);
|
|
30
|
+
}
|
|
31
|
+
if (key.endsWith(' [string]')) {
|
|
32
|
+
// Option is a string
|
|
33
|
+
key = key.slice(0, -' [string]'.length);
|
|
34
|
+
// Option is a number
|
|
35
|
+
}
|
|
36
|
+
else if (key.endsWith(' [number]')) {
|
|
37
|
+
key = key.slice(0, -' [number]'.length);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// Option is a boolean
|
|
41
|
+
// Note: Commander ignores the default property for booleans
|
|
42
|
+
if (key.startsWith('no-')) {
|
|
43
|
+
key = key.slice('no-'.length);
|
|
44
|
+
// Commander always defaults to true for flags that start with --no
|
|
45
|
+
value = true;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// Commander always defaults to undefined for flags
|
|
49
|
+
value = undefined;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
key = (0, lodash_1.camelCase)(key);
|
|
53
|
+
result[key] = value;
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
exports.getDefaultOptions = getDefaultOptions;
|
|
58
|
+
/**
|
|
59
|
+
* Sets up and starts the telemetry gathering for the CLI command.
|
|
60
|
+
* @param commandName The name of the CLI command.
|
|
61
|
+
* @param config Config passed from react-native CLI.
|
|
62
|
+
* @param options Options passed from react-native CLI.
|
|
63
|
+
* @param defaultOptions Default options for the command.
|
|
64
|
+
* @param optionSanitizer Function to sanitize the option values for telemetry.
|
|
65
|
+
*/
|
|
66
|
+
async function startTelemetrySession(commandName, config, options, defaultOptions, optionSanitizer) {
|
|
67
|
+
const verbose = options.logging === true;
|
|
68
|
+
if (!options.telemetry) {
|
|
69
|
+
if (verbose) {
|
|
70
|
+
(0, commandWithProgress_1.newInfo)('Telemetry is disabled');
|
|
71
|
+
}
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (verbose) {
|
|
75
|
+
(0, commandWithProgress_1.newInfo)(`Running ${(0, telemetry_1.nodeArchitecture)()} node on a ${(0, telemetry_1.deviceArchitecture)()} machine`);
|
|
76
|
+
}
|
|
77
|
+
if ((0, telemetry_1.deviceArchitecture)() !== (0, telemetry_1.nodeArchitecture)()) {
|
|
78
|
+
(0, commandWithProgress_1.newWarn)('This version of node was built for a different architecture than this machine and may cause unintended behavior');
|
|
79
|
+
}
|
|
80
|
+
await telemetry_1.Telemetry.setup();
|
|
81
|
+
const sanitizedOptions = (0, telemetry_1.commanderOptionsToOptions)(options, optionSanitizer);
|
|
82
|
+
const sanitizedDefaultOptions = (0, telemetry_1.commanderOptionsToOptions)(defaultOptions, optionSanitizer);
|
|
83
|
+
const sanitizedArgs = (0, telemetry_1.optionsToArgs)(sanitizedOptions, process.argv);
|
|
84
|
+
const startInfo = {
|
|
85
|
+
commandName,
|
|
86
|
+
args: sanitizedArgs,
|
|
87
|
+
options: sanitizedOptions,
|
|
88
|
+
defaultOptions: sanitizedDefaultOptions,
|
|
89
|
+
};
|
|
90
|
+
telemetry_1.Telemetry.startCommand(startInfo);
|
|
91
|
+
const projectInfo = await (0, telemetry_1.configToProjectInfo)(config);
|
|
92
|
+
if (projectInfo) {
|
|
93
|
+
telemetry_1.Telemetry.setProjectInfo(projectInfo);
|
|
94
|
+
}
|
|
95
|
+
const projectFile = (0, telemetry_1.getProjectFileFromConfig)(config);
|
|
96
|
+
if (projectFile) {
|
|
97
|
+
await telemetry_1.Telemetry.populateNuGetPackageVersions(projectFile);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.startTelemetrySession = startTelemetrySession;
|
|
101
|
+
/**
|
|
102
|
+
* Ends the gathering of telemetry for the CLI command.
|
|
103
|
+
* @param error The error (if any) thrown during the command.
|
|
104
|
+
* @param getExtraProps Function to get any extra command-specific telemetry properties.
|
|
105
|
+
*/
|
|
106
|
+
async function endTelemetrySession(error, getExtraProps) {
|
|
107
|
+
if (!telemetry_1.Telemetry.isEnabled()) {
|
|
108
|
+
// Bail early so don't waste time here
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const endInfo = {
|
|
112
|
+
resultCode: 'Success',
|
|
113
|
+
};
|
|
114
|
+
if (error) {
|
|
115
|
+
endInfo.resultCode =
|
|
116
|
+
error instanceof telemetry_1.CodedError ? error.type : 'Unknown';
|
|
117
|
+
}
|
|
118
|
+
telemetry_1.Telemetry.endCommand(endInfo, getExtraProps ? await getExtraProps() : undefined);
|
|
119
|
+
}
|
|
120
|
+
exports.endTelemetrySession = endTelemetrySession;
|
|
121
121
|
//# sourceMappingURL=telemetryHelpers.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
* @format
|
|
5
|
-
*/
|
|
6
|
-
export default class Version {
|
|
7
|
-
private readonly major;
|
|
8
|
-
private readonly minor;
|
|
9
|
-
private readonly build;
|
|
10
|
-
private readonly qfe;
|
|
11
|
-
constructor(major: number, minor?: number, build?: number, qfe?: number);
|
|
12
|
-
eq(other: Version): boolean;
|
|
13
|
-
gt(other: Version): boolean;
|
|
14
|
-
gte(other: Version): boolean;
|
|
15
|
-
toString(): string;
|
|
16
|
-
static compare(x: Version, y: Version): number;
|
|
17
|
-
static fromString(str: string): Version;
|
|
18
|
-
static tryParse(str: string): Version | null;
|
|
19
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
export default class Version {
|
|
7
|
+
private readonly major;
|
|
8
|
+
private readonly minor;
|
|
9
|
+
private readonly build;
|
|
10
|
+
private readonly qfe;
|
|
11
|
+
constructor(major: number, minor?: number, build?: number, qfe?: number);
|
|
12
|
+
eq(other: Version): boolean;
|
|
13
|
+
gt(other: Version): boolean;
|
|
14
|
+
gte(other: Version): boolean;
|
|
15
|
+
toString(): string;
|
|
16
|
+
static compare(x: Version, y: Version): number;
|
|
17
|
+
static fromString(str: string): Version;
|
|
18
|
+
static tryParse(str: string): Version | null;
|
|
19
|
+
}
|