@react-native-windows/cli 0.67.0-preview.1 → 0.68.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.
Files changed (55) hide show
  1. package/README.md +1 -1
  2. package/lib-commonjs/config/configUtils.js +1 -1
  3. package/lib-commonjs/config/configUtils.js.map +1 -1
  4. package/lib-commonjs/config/dependencyConfig.js +4 -2
  5. package/lib-commonjs/config/dependencyConfig.js.map +1 -1
  6. package/lib-commonjs/e2etest/autolink.test.js +20 -4
  7. package/lib-commonjs/e2etest/autolink.test.js.map +1 -1
  8. package/lib-commonjs/e2etest/dependencyConfig.test.js +2 -2
  9. package/lib-commonjs/e2etest/dependencyConfig.test.js.map +1 -1
  10. package/lib-commonjs/e2etest/projectConfig.test.js +2 -4
  11. package/lib-commonjs/e2etest/projectConfig.test.js.map +1 -1
  12. package/lib-commonjs/e2etest/projectConfig.utils.js +3 -10
  13. package/lib-commonjs/e2etest/projectConfig.utils.js.map +1 -1
  14. package/lib-commonjs/e2etest/runWindows.test.js +35 -14
  15. package/lib-commonjs/e2etest/runWindows.test.js.map +1 -1
  16. package/lib-commonjs/generator-common/index.js +7 -7
  17. package/lib-commonjs/generator-common/index.js.map +1 -1
  18. package/lib-commonjs/generator-windows/index.js +11 -26
  19. package/lib-commonjs/generator-windows/index.js.map +1 -1
  20. package/lib-commonjs/index.js +9 -60
  21. package/lib-commonjs/index.js.map +1 -1
  22. package/lib-commonjs/runWindows/runWindows.d.ts +0 -1
  23. package/lib-commonjs/runWindows/runWindows.js +107 -131
  24. package/lib-commonjs/runWindows/runWindows.js.map +1 -1
  25. package/lib-commonjs/runWindows/runWindowsOptions.js +6 -2
  26. package/lib-commonjs/runWindows/runWindowsOptions.js.map +1 -1
  27. package/lib-commonjs/runWindows/utils/autolink.d.ts +9 -1
  28. package/lib-commonjs/runWindows/utils/autolink.js +81 -28
  29. package/lib-commonjs/runWindows/utils/autolink.js.map +1 -1
  30. package/lib-commonjs/runWindows/utils/build.js +1 -1
  31. package/lib-commonjs/runWindows/utils/build.js.map +1 -1
  32. package/lib-commonjs/runWindows/utils/checkRequirements.js +1 -1
  33. package/lib-commonjs/runWindows/utils/checkRequirements.js.map +1 -1
  34. package/lib-commonjs/runWindows/utils/commandWithProgress.d.ts +6 -0
  35. package/lib-commonjs/runWindows/utils/commandWithProgress.js +26 -5
  36. package/lib-commonjs/runWindows/utils/commandWithProgress.js.map +1 -1
  37. package/lib-commonjs/runWindows/utils/deploy.js +9 -9
  38. package/lib-commonjs/runWindows/utils/deploy.js.map +1 -1
  39. package/lib-commonjs/runWindows/utils/msbuildtools.d.ts +1 -0
  40. package/lib-commonjs/runWindows/utils/msbuildtools.js +19 -12
  41. package/lib-commonjs/runWindows/utils/msbuildtools.js.map +1 -1
  42. package/lib-commonjs/runWindows/utils/telemetryHelpers.d.ts +29 -0
  43. package/lib-commonjs/runWindows/utils/telemetryHelpers.js +109 -0
  44. package/lib-commonjs/runWindows/utils/telemetryHelpers.js.map +1 -0
  45. package/lib-commonjs/runWindows/utils/version.js +1 -1
  46. package/lib-commonjs/runWindows/utils/version.js.map +1 -1
  47. package/lib-commonjs/runWindows/utils/vsInstalls.js +2 -2
  48. package/lib-commonjs/runWindows/utils/vsInstalls.js.map +1 -1
  49. package/lib-commonjs/runWindows/utils/vstools.js +4 -4
  50. package/lib-commonjs/runWindows/utils/vstools.js.map +1 -1
  51. package/lib-commonjs/runWindows/utils/winappdeploytool.js +3 -3
  52. package/lib-commonjs/runWindows/utils/winappdeploytool.js.map +1 -1
  53. package/package.json +10 -9
  54. package/CHANGELOG.json +0 -1761
  55. package/CHANGELOG.md +0 -781
@@ -1 +1 @@
1
- {"version":3,"file":"runWindows.js","sourceRoot":"","sources":["../../src/runWindows/runWindows.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAA4B;AAC5B,4CAAoB;AACpB,gDAAwB;AACxB,+DAOyC;AAEzC,q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C,CAAC;aACpE;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAA,8BAAQ,EAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACpE,MAAM,CAAC,CAAC;SACT;KACF;SAAM;QACL,IAAA,6BAAO,EAAC,wBAAwB,CAAC,CAAC;KACnC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,OAA0B;IACtD,OAAO,CACL,OAAO,CAAC,QAAQ,KAAK,IAAI;QACzB,OAAO,CAAC,MAAM,KAAK,IAAI;QACvB,OAAO,CAAC,OAAO,KAAK,IAAI,CACzB,CAAC;AACJ,CAAC;AAED;;;;;;;;EAQE;AAEF;;GAEG;AACU,QAAA,iBAAiB,GAAY;IACxC,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,kFAAkF;IACpF,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,qCAAiB;CAC3B,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport crypto from 'crypto';\nimport fs from 'fs';\nimport path from 'path';\nimport {\n Telemetry,\n isMSFTInternal,\n getDiskFreeSpace,\n CodedError,\n CodedErrorType,\n CodedErrors,\n} from '@react-native-windows/telemetry';\n\nimport * as build from './utils/build';\nimport chalk from 'chalk';\nimport * as deploy from './utils/deploy';\nimport {newError, newInfo, newWarn} from './utils/commandWithProgress';\nimport * as info from './utils/info';\nimport MSBuildTools from './utils/msbuildtools';\n\nimport {Command, Config} from '@react-native-community/cli-types';\nimport {runWindowsOptions, RunWindowsOptions} from './runWindowsOptions';\n\nimport {autoLinkCommand} from './utils/autolink';\nimport {totalmem, cpus} from 'os';\n\nfunction setExitProcessWithError(\n error: Error,\n loggingWasEnabled?: boolean,\n): void {\n if (loggingWasEnabled !== true) {\n console.log(\n `Re-run the command with ${chalk.bold('--logging')} for more information`,\n );\n if (Telemetry.client) {\n console.log(\n `Your session id was ${Telemetry.client.commonProperties.sessionId}`,\n );\n }\n }\n if (error instanceof CodedError) {\n process.exitCode = CodedErrors[error.name as CodedErrorType];\n } else {\n process.exitCode = 1;\n }\n}\n\nfunction getPkgVersion(pkgName: string): string {\n try {\n const pkgJsonPath = require.resolve(`${pkgName}/package.json`, {\n paths: [process.cwd(), __dirname],\n });\n const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath).toString());\n if (pkgJson.name === pkgName && pkgJson.version !== undefined) {\n return pkgJson.version;\n }\n } catch {}\n newWarn(`Could not determine ${pkgName} version`);\n return '';\n}\n\n/**\n * Labels used by telemtry to represent current operation\n */\ntype RunWindowsPhase =\n | 'None'\n | 'AutoLink'\n | 'FindBuildTools'\n | 'FindSolution'\n | 'Deploy';\n\nlet runWindowsPhase: RunWindowsPhase = 'None';\n/**\n * Performs build deploy and launch of RNW apps.\n * @param args Unprocessed args passed from react-native CLI.\n * @param config Config passed from react-native CLI.\n * @param options Options passed from react-native CLI.\n */\nasync function runWindows(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n if (!options.telemetry) {\n if (options.logging) {\n console.log('Disabling telemetry');\n }\n Telemetry.disable();\n } else {\n Telemetry.setup();\n }\n\n // https://github.com/yarnpkg/yarn/issues/8334 - Yarn on Windows breaks apps that read from the environment variables\n // Yarn will run node via CreateProcess and pass npm_config_* variables in lowercase without unifying their value\n // with their possibly existing uppercase counterparts. This breaks programs that read from the environment block\n // and write to a case-insensitive dictionary since they expect to encounter each variable only once.\n // The values of the lowercase variables are the one npm actually wants to use, plus they are seeded from the\n // uppercase variable values one if there are no overrides.\n delete process.env.NPM_CONFIG_CACHE;\n delete process.env.NPM_CONFIG_PREFIX;\n\n const hasRunRnwDependencies =\n process.env.LocalAppData &&\n fs.existsSync(path.join(process.env.LocalAppData, 'rnw-dependencies.txt')); // CODESYNC \\vnext\\scripts\\rnw-dependencies.ps1\n\n if (options.info) {\n try {\n const output = await info.getEnvironmentInfo();\n console.log(output.trimEnd());\n console.log(' Installed UWP SDKs:');\n const sdks = MSBuildTools.getAllAvailableUAPVersions();\n sdks.forEach(version => console.log(' ' + version));\n return;\n } catch (err) {\n const e = err as Error;\n Telemetry.trackException(e);\n newError('Unable to print environment info.\\n' + e.toString());\n return setExitProcessWithError(e, options.logging);\n }\n }\n\n let runWindowsError;\n try {\n await runWindowsInternal(args, config, options);\n } catch (e) {\n Telemetry.trackException(e as Error);\n runWindowsError = e;\n if (!hasRunRnwDependencies) {\n const rnwPkgJsonPath = require.resolve(\n 'react-native-windows/package.json',\n {\n paths: [process.cwd(), __dirname],\n },\n );\n const rnwDependenciesPath = path.join(\n path.dirname(rnwPkgJsonPath),\n 'scripts/rnw-dependencies.ps1',\n );\n\n newError(\n `It is possible your installation is missing required software dependencies. Dependencies can be automatically installed by running ${rnwDependenciesPath} from an elevated PowerShell prompt.\\nFor more information, go to http://aka.ms/rnw-deps`,\n );\n }\n return setExitProcessWithError(e as Error, options.logging);\n } finally {\n Telemetry.client?.trackEvent({\n name: 'run-windows',\n properties: {\n release: options.release,\n arch: options.arch,\n singleproc: options.singleproc,\n emulator: options.emulator,\n device: options.device,\n target: options.target,\n remoteDebugging: options.remoteDebugging,\n logging: options.logging,\n packager: options.packager,\n bundle: options.bundle,\n launch: options.launch,\n autolink: options.autolink,\n build: options.bundle,\n deploy: options.deploy,\n sln: options.sln !== undefined,\n proj: options.proj !== undefined,\n msBuildProps:\n options.msbuildprops !== undefined\n ? options.msbuildprops!.split(',').length\n : 0,\n info: options.info,\n directDebugging: options.directDebugging,\n 'react-native-windows': getPkgVersion('react-native-windows'),\n 'react-native': getPkgVersion('react-native'),\n 'cli-version': getPkgVersion('@react-native-windows/cli'),\n msftInternal: isMSFTInternal(),\n durationInSecs: process.uptime(),\n success: runWindowsError === undefined,\n phase: runWindowsPhase,\n totalMem: totalmem(),\n diskFree: getDiskFreeSpace(__dirname),\n cpus: cpus().length,\n project: await getAnonymizedProjectName(config.root),\n hasRunRnwDependencies: hasRunRnwDependencies,\n },\n });\n Telemetry.client?.flush();\n }\n}\n\nexport async function getAnonymizedProjectName(\n projectRoot: string,\n): Promise<string | null> {\n const projectJsonPath = path.join(projectRoot, 'package.json');\n if (!fs.existsSync(projectJsonPath)) {\n return null;\n }\n\n const projectJson = JSON.parse(\n (await fs.promises.readFile(projectJsonPath)).toString(),\n );\n\n const projectName = projectJson.name;\n if (typeof projectName !== 'string') {\n return null;\n }\n\n // Ensure the project name cannot be reverse engineered to avoid leaking PII\n return crypto\n .createHash('sha256')\n .update(projectName)\n .digest('hex')\n .toString();\n}\n\nasync function runWindowsInternal(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n const verbose = options.logging === true;\n\n if (verbose) {\n newInfo('Verbose: ON');\n }\n\n // Get the solution file\n let slnFile;\n try {\n slnFile = build.getAppSolutionFile(options, config);\n } catch (e) {\n newError(`Couldn't get app solution information. ${(e as Error).message}`);\n throw e;\n }\n\n try {\n if (options.autolink) {\n const autolinkArgs: string[] = [];\n const autolinkConfig = config;\n const autoLinkOptions = {\n logging: options.logging,\n proj: options.proj,\n sln: options.sln,\n };\n runWindowsPhase = 'AutoLink';\n await autoLinkCommand.func(autolinkArgs, autolinkConfig, autoLinkOptions);\n } else {\n newInfo('Autolink step is skipped');\n }\n } catch (e) {\n newError(`Autolinking failed. ${(e as Error).message}`);\n throw e;\n }\n\n let buildTools: MSBuildTools;\n runWindowsPhase = 'FindBuildTools';\n try {\n buildTools = MSBuildTools.findAvailableVersion(options.arch, verbose);\n } catch (error) {\n newWarn('No public VS release found');\n // Try prerelease\n try {\n newInfo('Trying pre-release VS');\n buildTools = MSBuildTools.findAvailableVersion(\n options.arch,\n verbose,\n true, // preRelease\n );\n } catch (e) {\n newError((e as Error).message);\n throw error;\n }\n }\n\n if (options.build) {\n runWindowsPhase = 'FindSolution';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n // Get build/deploy options\n const buildType = deploy.getBuildConfiguration(options);\n const msBuildProps = build.parseMsBuildProps(options);\n\n // Disable the autolink check since we just ran it\n msBuildProps.RunAutolinkCheck = 'false';\n\n try {\n runWindowsPhase = 'FindSolution';\n await build.buildSolution(\n buildTools,\n slnFile!,\n buildType,\n options.arch,\n msBuildProps,\n verbose,\n 'build',\n options.buildLogDirectory,\n options.singleproc,\n );\n } catch (e) {\n newError(\n `Build failed with message ${\n (e as Error).message\n }. Check your build configuration.`,\n );\n if ((e as any).logfile) {\n console.log('See', chalk.bold((e as any).logfile));\n }\n throw e;\n }\n } else {\n newInfo('Build step is skipped');\n }\n\n if (shouldLaunchPackager(options)) {\n await deploy.startServerInNewWindow(options, verbose);\n }\n\n if (options.deploy) {\n runWindowsPhase = 'FindSolution';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n try {\n runWindowsPhase = 'Deploy';\n if (options.device || options.emulator || options.target) {\n await deploy.deployToDevice(options, verbose, config);\n } else {\n await deploy.deployToDesktop(options, verbose, config, buildTools);\n }\n } catch (e) {\n newError(`Failed to deploy${e ? `: ${(e as Error).message}` : ''}`);\n throw e;\n }\n } else {\n newInfo('Deploy step is skipped');\n }\n}\n\nfunction shouldLaunchPackager(options: RunWindowsOptions): boolean {\n return (\n options.packager === true &&\n options.launch === true &&\n options.release !== true\n );\n}\n\n/*\n// Example of running the Windows Command\nrunWindows({\n root: 'C:\\\\github\\\\hack\\\\myapp',\n debug: true,\n arch: 'x86',\n nugetPath: 'C:\\\\github\\\\react\\\\react-native-windows\\\\local-cli\\\\runWindows\\\\.nuget\\\\nuget.exe'\n});\n*/\n\n/**\n * Starts the app on a connected Windows emulator or mobile device.\n */\nexport const runWindowsCommand: Command = {\n name: 'run-windows',\n description:\n 'builds your app and starts it on a connected Windows desktop, emulator or device',\n func: runWindows,\n options: runWindowsOptions,\n};\n"]}
1
+ {"version":3,"file":"runWindows.js","sourceRoot":"","sources":["../../src/runWindows/runWindows.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA0C;AAC1C,gDAAwB;AACxB,+DAAsE;AAEtE,qDAAuC;AACvC,kDAA0B;AAC1B,uDAAyC;AACzC,qEAKqC;AACrC,+DAIkC;AAClC,mDAAqC;AACrC,wEAAgD;AAGhD,2DAAyE;AAEzE,+CAA0E;AAE1E;;;;;GAKG;AACH,sCAAsC;AACtC,SAAS,eAAe,CAAC,GAA4B,EAAE,KAAU;IAC/D,kCAAkC;IAClC,2EAA2E;IAC3E,8DAA8D;IAC9D,QAAQ,GAAG,EAAE;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ,CAAC;QACd,KAAK,KAAK,CAAC;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,mBAAmB;YACtB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY;QACzD,KAAK,cAAc;YACjB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,mBAAmB;QAC/E,KAAK,SAAS,CAAC;QACf,KAAK,MAAM,CAAC;QACZ,KAAK,YAAY,CAAC;QAClB,KAAK,UAAU,CAAC;QAChB,KAAK,QAAQ,CAAC;QACd,KAAK,iBAAiB,CAAC;QACvB,KAAK,SAAS,CAAC;QACf,KAAK,UAAU,CAAC;QAChB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,UAAU,CAAC;QAChB,KAAK,OAAO,CAAC;QACb,KAAK,QAAQ,CAAC;QACd,KAAK,kBAAkB,CAAC;QACxB,KAAK,MAAM,CAAC;QACZ,KAAK,iBAAiB,CAAC;QAC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AM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACpE,MAAM,CAAC,CAAC;SACT;KACF;SAAM;QACL,IAAA,6BAAO,EAAC,wBAAwB,CAAC,CAAC;KACnC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,OAA0B;IACtD,OAAO,CACL,OAAO,CAAC,QAAQ,KAAK,IAAI;QACzB,OAAO,CAAC,MAAM,KAAK,IAAI;QACvB,OAAO,CAAC,OAAO,KAAK,IAAI,CACzB,CAAC;AACJ,CAAC;AAED;;;;;;;;EAQE;AAEF;;GAEG;AACU,QAAA,iBAAiB,GAAY;IACxC,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,kFAAkF;IACpF,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,qCAAiB;CAC3B,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\nimport {Telemetry, CodedError} from '@react-native-windows/telemetry';\n\nimport * as build from './utils/build';\nimport chalk from 'chalk';\nimport * as deploy from './utils/deploy';\nimport {\n newError,\n newInfo,\n newWarn,\n setExitProcessWithError,\n} from './utils/commandWithProgress';\nimport {\n getDefaultOptions,\n startTelemetrySession,\n endTelemetrySession,\n} from './utils/telemetryHelpers';\nimport * as info from './utils/info';\nimport MSBuildTools from './utils/msbuildtools';\n\nimport {Command, Config} from '@react-native-community/cli-types';\nimport {runWindowsOptions, RunWindowsOptions} from './runWindowsOptions';\n\nimport {autolinkWindowsInternal, AutoLinkOptions} from './utils/autolink';\n\n/**\n * Sanitizes the given option for telemetery.\n * @param key The key of the option.\n * @param value The unsanitized value of the option.\n * @returns The sanitized value of the option.\n */\n// eslint-disable-next-line complexity\nfunction optionSanitizer(key: keyof RunWindowsOptions, value: any): any {\n // Do not add a default case here.\n // Strings risking PII should just return true if present, false otherwise.\n // All others should return the value (or false if undefined).\n switch (key) {\n case 'root':\n case 'target':\n case 'sln':\n case 'proj':\n case 'buildLogDirectory':\n return value === undefined ? false : true; // Strip PII\n case 'msbuildprops':\n return value === undefined ? 0 : value.split(',').length; // Convert to count\n case 'release':\n case 'arch':\n case 'singleproc':\n case 'emulator':\n case 'device':\n case 'remoteDebugging':\n case 'logging':\n case 'packager':\n case 'bundle':\n case 'launch':\n case 'autolink':\n case 'build':\n case 'deploy':\n case 'deployFromLayout':\n case 'info':\n case 'directDebugging':\n case 'telemetry':\n return value === undefined ? false : value; // Return value\n }\n}\n\n/**\n * Get the extra props to add to the `run-windows` telemetry event.\n * @returns The extra props.\n */\nasync function getExtraProps(): Promise<Record<string, any>> {\n const extraProps: Record<string, any> = {\n phase: runWindowsPhase,\n hasRunRnwDependencies,\n };\n return extraProps;\n}\n\n/**\n * Labels used by telemetry to represent current operation\n */\ntype RunWindowsPhase =\n | 'None'\n | 'AutoLink'\n | 'FindBuildTools'\n | 'FindSolution'\n | 'Deploy';\n\nlet runWindowsPhase: RunWindowsPhase = 'None';\n\nlet hasRunRnwDependencies: boolean = false;\n\n/**\n * The function run when calling `react-native run-windows`.\n * @param args Unprocessed args passed from react-native CLI.\n * @param config Config passed from react-native CLI.\n * @param options Options passed from react-native CLI.\n */\nasync function runWindows(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n await startTelemetrySession(\n 'run-windows',\n config,\n options,\n getDefaultOptions(config, runWindowsOptions),\n optionSanitizer,\n );\n\n // https://github.com/yarnpkg/yarn/issues/8334 - Yarn on Windows breaks apps that read from the environment variables\n // Yarn will run node via CreateProcess and pass npm_config_* variables in lowercase without unifying their value\n // with their possibly existing uppercase counterparts. This breaks programs that read from the environment block\n // and write to a case-insensitive dictionary since they expect to encounter each variable only once.\n // The values of the lowercase variables are the one npm actually wants to use, plus they are seeded from the\n // uppercase variable values one if there are no overrides.\n delete process.env.NPM_CONFIG_CACHE;\n delete process.env.NPM_CONFIG_PREFIX;\n\n if (process.env.LocalAppData) {\n hasRunRnwDependencies = fs.existsSync(\n path.join(process.env.LocalAppData, 'rnw-dependencies.txt'),\n ); // CODESYNC \\vnext\\scripts\\rnw-dependencies.ps1\n }\n\n let runWindowsError: Error | undefined;\n if (options.info) {\n try {\n const output = await info.getEnvironmentInfo();\n console.log(output.trimEnd());\n console.log(' Installed UWP SDKs:');\n const sdks = MSBuildTools.getAllAvailableUAPVersions();\n sdks.forEach((version) => console.log(' ' + version));\n } catch (ex) {\n runWindowsError =\n ex instanceof Error ? (ex as Error) : new Error(String(ex));\n Telemetry.trackException(runWindowsError);\n\n newError(\n 'Unable to print environment info.\\n' + runWindowsError.toString(),\n );\n }\n await endTelemetrySession(runWindowsError, getExtraProps);\n setExitProcessWithError(options.logging, runWindowsError);\n return;\n }\n\n try {\n await runWindowsInternal(args, config, options);\n } catch (ex) {\n runWindowsError =\n ex instanceof Error ? (ex as Error) : new Error(String(ex));\n Telemetry.trackException(runWindowsError);\n\n if (!hasRunRnwDependencies) {\n const rnwPkgJsonPath = require.resolve(\n 'react-native-windows/package.json',\n {\n paths: [process.cwd(), __dirname],\n },\n );\n const rnwDependenciesPath = path.join(\n path.dirname(rnwPkgJsonPath),\n 'scripts/rnw-dependencies.ps1',\n );\n\n newError(\n `It is possible your installation is missing required software dependencies. Dependencies can be automatically installed by running ${rnwDependenciesPath} from an elevated PowerShell prompt.\\nFor more information, go to http://aka.ms/rnw-deps`,\n );\n }\n }\n await endTelemetrySession(runWindowsError, getExtraProps);\n setExitProcessWithError(options.logging, runWindowsError);\n}\n\n/**\n * Performs build deploy and launch of RNW apps.\n * @param args Unprocessed args passed from react-native CLI.\n * @param config Config passed from react-native CLI.\n * @param options Options passed from react-native CLI.\n */\nasync function runWindowsInternal(\n args: string[],\n config: Config,\n options: RunWindowsOptions,\n) {\n const verbose = options.logging === true;\n\n if (verbose) {\n newInfo('Verbose: ON');\n }\n\n // Get the solution file\n let slnFile;\n try {\n slnFile = build.getAppSolutionFile(options, config);\n } catch (e) {\n newError(`Couldn't get app solution information. ${(e as Error).message}`);\n throw e;\n }\n\n let buildTools: MSBuildTools;\n runWindowsPhase = 'FindBuildTools';\n try {\n buildTools = MSBuildTools.findAvailableVersion(options.arch, verbose);\n } catch (error) {\n newWarn('No public VS release found');\n // Try prerelease\n try {\n newInfo('Trying pre-release VS');\n buildTools = MSBuildTools.findAvailableVersion(\n options.arch,\n verbose,\n true, // preRelease\n );\n } catch (e) {\n newError((e as Error).message);\n throw error;\n }\n }\n\n // Restore packages.config files for dependencies that don't support PackageReference.\n try {\n await buildTools.restorePackageConfigs(slnFile);\n } catch (e) {\n newError(\n `Couldn't restore found packages.config instances. ${\n (e as Error).message\n }`,\n );\n throw e;\n }\n\n try {\n if (options.autolink) {\n const autolinkArgs: string[] = [];\n const autolinkConfig = config;\n const autoLinkOptions: AutoLinkOptions = {\n logging: options.logging,\n check: false,\n proj: options.proj,\n sln: options.sln,\n telemetry: options.telemetry,\n };\n runWindowsPhase = 'AutoLink';\n await autolinkWindowsInternal(\n autolinkArgs,\n autolinkConfig,\n autoLinkOptions,\n );\n } else {\n newInfo('Autolink step is skipped');\n }\n } catch (e) {\n newError(`Autolinking failed. ${(e as Error).message}`);\n throw e;\n }\n\n if (options.build) {\n runWindowsPhase = 'FindSolution';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n // Get build/deploy options\n const buildType = deploy.getBuildConfiguration(options);\n const msBuildProps = build.parseMsBuildProps(options);\n\n // Disable the autolink check since we just ran it\n msBuildProps.RunAutolinkCheck = 'false';\n\n try {\n runWindowsPhase = 'FindSolution';\n await build.buildSolution(\n buildTools,\n slnFile!,\n buildType,\n options.arch,\n msBuildProps,\n verbose,\n 'build',\n options.buildLogDirectory,\n options.singleproc,\n );\n } catch (e) {\n newError(\n `Build failed with message ${\n (e as Error).message\n }. Check your build configuration.`,\n );\n if ((e as any).logfile) {\n console.log('See', chalk.bold((e as any).logfile));\n }\n throw e;\n }\n } else {\n newInfo('Build step is skipped');\n }\n\n if (shouldLaunchPackager(options)) {\n await deploy.startServerInNewWindow(options, verbose);\n }\n\n if (options.deploy) {\n runWindowsPhase = 'FindSolution';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx react-native-windows-init\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n try {\n runWindowsPhase = 'Deploy';\n if (options.device || options.emulator || options.target) {\n await deploy.deployToDevice(options, verbose, config);\n } else {\n await deploy.deployToDesktop(options, verbose, config, buildTools);\n }\n } catch (e) {\n newError(`Failed to deploy${e ? `: ${(e as Error).message}` : ''}`);\n throw e;\n }\n } else {\n newInfo('Deploy step is skipped');\n }\n}\n\nfunction shouldLaunchPackager(options: RunWindowsOptions): boolean {\n return (\n options.packager === true &&\n options.launch === true &&\n options.release !== true\n );\n}\n\n/*\n// Example of running the Windows Command\nrunWindows({\n root: 'C:\\\\github\\\\hack\\\\myapp',\n debug: true,\n arch: 'x86',\n nugetPath: 'C:\\\\github\\\\react\\\\react-native-windows\\\\local-cli\\\\runWindows\\\\.nuget\\\\nuget.exe'\n});\n*/\n\n/**\n * Starts the app on a connected Windows emulator or mobile device.\n */\nexport const runWindowsCommand: Command = {\n name: 'run-windows',\n description:\n 'builds your app and starts it on a connected Windows desktop, emulator or device',\n func: runWindows,\n options: runWindowsOptions,\n};\n"]}
@@ -4,8 +4,12 @@
4
4
  * Licensed under the MIT License.
5
5
  * @format
6
6
  */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
7
10
  Object.defineProperty(exports, "__esModule", { value: true });
8
11
  exports.runWindowsOptions = void 0;
12
+ const os_1 = __importDefault(require("os"));
9
13
  exports.runWindowsOptions = [
10
14
  {
11
15
  name: '--release',
@@ -14,12 +18,12 @@ exports.runWindowsOptions = [
14
18
  {
15
19
  name: '--root [string]',
16
20
  description: 'Override the root directory for the windows build which contains the windows folder.',
17
- default: config => config.root,
21
+ default: (config) => config.root,
18
22
  },
19
23
  {
20
24
  name: '--arch [string]',
21
25
  description: 'The build architecture (ARM64, x86, x64)',
22
- default: 'x86',
26
+ default: os_1.default.arch(),
23
27
  parse: parseBuildArch,
24
28
  },
25
29
  {
@@ -1 +1 @@
1
- {"version":3,"file":"runWindowsOptions.js","sourceRoot":"","sources":["../../src/runWindows/runWindowsOptions.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAuDU,QAAA,iBAAiB,GAAoB;IAChD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,2BAA2B;KACzC;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,sFAAsF;QACxF,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI;KAC/B;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,0CAA0C;QACvD,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,cAAc;KACtB;IACD;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,2BAA2B;KACzC;IACD;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,gCAAgC;KAC9C;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,uCAAuC;KACrD;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,qDAAqD;KACnE;IACD;QACE,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,2CAA2C;KACzD;IACD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,iBAAiB;KAC/B;IACD;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,uCAAuC;KACrD;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,gGAAgG;KACnG;IACD;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,wCAAwC;KACtD;IACD;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,wBA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uDAAuD,CAAC,CAAC;KACnE;IACD,IAAI,GAAG,GAAG,IAAI,IAAI,GAAG,IAAI,KAAK,EAAE;QAC9B,QAAQ,CAAC,uCAAuC,CAAC,CAAC;KACnD;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,QAAQ,CAAC,GAAW;IAC3B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {CommandOption} from '@react-native-community/cli-types';\n\nexport type BuildArch = 'x86' | 'x64' | 'ARM64';\nexport type BuildConfig = 'Debug' | 'DebugBundle' | 'Release' | 'ReleaseBundle';\n\n/**\n * * Options are the following:\n * release: Boolean - Specifies release build\n * root: String - The root of the application\n * arch: String - The build architecture (ARM64, x86, x64)\n * singleproc: Boolean - opt out of multi-proc builds\n * emulator: Boolean - Deploy to the emulator\n * device: Boolean - Deploy to a device\n * target: String - Device GUID to deploy to\n * remote-debugging: Boolean - Run using remote JS proxy\n * logging: Boolean - Enables logging\n * no-packager: Boolean - Do not launch packager while building\n * bundle: Boolean - Enable Bundle configuration.\n * no-launch: Boolean - Do not launch the app after deployment\n * no-build: Boolean - Do not build the solution\n * no-deploy: Boolean - Do not deploy the app\n * deploy-from-layout: Force deploy from layout, even in release builds\n * sln: String - Solution file to build\n * msbuildprops: String - Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2\n * direct-debugging: Number - Enable direct debugging on specified port\n * no-telemetry: Boolean - Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI\n */\nexport interface RunWindowsOptions {\n release?: boolean;\n root: string;\n arch: BuildArch;\n singleproc?: boolean;\n emulator?: boolean;\n device?: boolean;\n target?: string;\n remoteDebugging?: string;\n logging?: boolean;\n packager?: boolean;\n bundle?: boolean;\n launch?: boolean;\n autolink?: boolean;\n build?: boolean;\n deploy?: boolean;\n deployFromLayout?: boolean;\n sln?: string;\n proj?: string;\n msbuildprops?: string;\n buildLogDirectory?: string;\n info?: boolean;\n directDebugging?: number;\n telemetry?: boolean;\n}\n\nexport const runWindowsOptions: CommandOption[] = [\n {\n name: '--release',\n description: 'Specifies a release build',\n },\n {\n name: '--root [string]',\n description:\n 'Override the root directory for the windows build which contains the windows folder.',\n default: config => config.root,\n },\n {\n name: '--arch [string]',\n description: 'The build architecture (ARM64, x86, x64)',\n default: 'x86',\n parse: parseBuildArch,\n },\n {\n name: '--singleproc',\n description: 'Disables multi-proc build',\n },\n {\n name: '--emulator',\n description: 'Deploys the app to an emulator',\n },\n {\n name: '--device',\n description: 'Deploys the app to a connected device',\n },\n {\n name: '--target [string]',\n description: 'Deploys the app to the specified GUID for a device.',\n },\n {\n name: '--remote-debugging',\n description: 'Deploys the app in remote debugging mode.',\n },\n {\n name: '--logging',\n description: 'Enables logging',\n },\n {\n name: '--no-packager',\n description: 'Do not launch packager while building',\n },\n {\n name: '--bundle',\n description:\n 'Enable Bundle configuration and it would be ReleaseBundle/DebugBundle other than Release/Debug',\n },\n {\n name: '--no-launch',\n description: 'Do not launch the app after deployment',\n },\n {\n name: '--no-autolink',\n description: 'Do not run autolinking',\n },\n {\n name: '--no-build',\n description: 'Do not build the solution',\n },\n {\n name: '--no-deploy',\n description: 'Do not deploy the app',\n },\n {\n name: '--deploy-from-layout',\n description: 'Force deploy from layout',\n },\n {\n name: '--sln [string]',\n description:\n \"Override the app solution file determined by 'react-native config', e.g. windows\\\\myApp.sln\",\n default: undefined,\n },\n {\n name: '--proj [string]',\n description:\n \"Override the app project file determined by 'react-native config', e.g. windows\\\\myApp\\\\myApp.vcxproj\",\n default: undefined,\n },\n {\n name: '--msbuildprops [string]',\n description:\n 'Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2',\n },\n {\n name: '--buildLogDirectory [string]',\n description: 'Optional directory where msbuild log files should be stored',\n },\n {\n name: '--info',\n description: 'Dump environment information',\n },\n {\n name: '--direct-debugging [number]',\n description: 'Enable direct debugging on specified port',\n parse: parseDirectDebuggingPort,\n },\n {\n name: '--no-telemetry',\n description:\n 'Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI',\n },\n];\n\nfunction parseBuildArch(arg: string): BuildArch {\n const supportedArches: BuildArch[] = ['x86', 'x64', 'ARM64'];\n for (const supported of supportedArches) {\n if (arg.toLowerCase() === supported.toLowerCase()) {\n return supported;\n }\n }\n\n errorOut(`Unrecognized --arch '${arg}'. Expected one of ${supportedArches}`);\n}\n\nfunction parseDirectDebuggingPort(arg: string): number {\n const num = parseInt(arg, 10);\n\n if (!Number.isInteger(num)) {\n errorOut(`Expected argument '--direct-debugging' to be a number`);\n }\n if (num < 1024 || num >= 65535) {\n errorOut('Direct debugging port it out of range');\n }\n\n return num;\n}\n\nfunction errorOut(arg: string): never {\n console.error(arg);\n process.exit(1);\n}\n"]}
1
+ {"version":3,"file":"runWindowsOptions.js","sourceRoot":"","sources":["../../src/runWindows/runWindowsOptions.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,4CAAoB;AAsDP,QAAA,iBAAiB,GAAoB;IAChD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,2BAA2B;KACzC;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,sFAAsF;QACxF,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI;KACjC;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,0CAA0C;QACvD,OAAO,EAAE,YAAE,CAAC,IAAI,EAAE;QAClB,KAAK,EAAE,cAAc;KACtB;IACD;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,2BAA2B;KACzC;IACD;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,gCAAgC;KAC9C;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,uCAAuC;KACrD;IACD;QACE,I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D,KAAK,MAAM,SAAS,IAAI,eAAe,EAAE;QACvC,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,WAAW,EAAE,EAAE;YACjD,OAAO,SAAS,CAAC;SAClB;KACF;IAED,QAAQ,CAAC,wBAAwB,GAAG,sBAAsB,eAAe,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,wBAAwB,CAAC,GAAW;IAC3C,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAE9B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;QAC1B,QAAQ,CAAC,uDAAuD,CAAC,CAAC;KACnE;IACD,IAAI,GAAG,GAAG,IAAI,IAAI,GAAG,IAAI,KAAK,EAAE;QAC9B,QAAQ,CAAC,uCAAuC,CAAC,CAAC;KACnD;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,QAAQ,CAAC,GAAW;IAC3B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport os from 'os';\nimport {CommandOption} from '@react-native-community/cli-types';\n\nexport type BuildArch = 'x86' | 'x64' | 'ARM64';\nexport type BuildConfig = 'Debug' | 'DebugBundle' | 'Release' | 'ReleaseBundle';\n\n/**\n * * Options are the following:\n * release: Boolean - Specifies release build\n * root: String - The root of the application\n * arch: String - The build architecture (ARM64, x86, x64)\n * singleproc: Boolean - opt out of multi-proc builds\n * emulator: Boolean - Deploy to the emulator\n * device: Boolean - Deploy to a device\n * target: String - Device GUID to deploy to\n * remote-debugging: Boolean - Run using remote JS proxy\n * logging: Boolean - Enables logging\n * no-packager: Boolean - Do not launch packager while building\n * bundle: Boolean - Enable Bundle configuration.\n * no-launch: Boolean - Do not launch the app after deployment\n * no-build: Boolean - Do not build the solution\n * no-deploy: Boolean - Do not deploy the app\n * deploy-from-layout: Force deploy from layout, even in release builds\n * sln: String - Solution file to build\n * msbuildprops: String - Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2\n * direct-debugging: Number - Enable direct debugging on specified port\n * no-telemetry: Boolean - Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI\n */\nexport interface RunWindowsOptions {\n release?: boolean;\n root: string;\n arch: BuildArch;\n singleproc?: boolean;\n emulator?: boolean;\n device?: boolean;\n target?: string;\n remoteDebugging?: string;\n logging?: boolean;\n packager?: boolean;\n bundle?: boolean;\n launch?: boolean;\n autolink?: boolean;\n build?: boolean;\n deploy?: boolean;\n deployFromLayout?: boolean;\n sln?: string;\n proj?: string;\n msbuildprops?: string;\n buildLogDirectory?: string;\n info?: boolean;\n directDebugging?: number;\n telemetry?: boolean;\n}\n\nexport const runWindowsOptions: CommandOption[] = [\n {\n name: '--release',\n description: 'Specifies a release build',\n },\n {\n name: '--root [string]',\n description:\n 'Override the root directory for the windows build which contains the windows folder.',\n default: (config) => config.root,\n },\n {\n name: '--arch [string]',\n description: 'The build architecture (ARM64, x86, x64)',\n default: os.arch(),\n parse: parseBuildArch,\n },\n {\n name: '--singleproc',\n description: 'Disables multi-proc build',\n },\n {\n name: '--emulator',\n description: 'Deploys the app to an emulator',\n },\n {\n name: '--device',\n description: 'Deploys the app to a connected device',\n },\n {\n name: '--target [string]',\n description: 'Deploys the app to the specified GUID for a device.',\n },\n {\n name: '--remote-debugging',\n description: 'Deploys the app in remote debugging mode.',\n },\n {\n name: '--logging',\n description: 'Enables logging',\n },\n {\n name: '--no-packager',\n description: 'Do not launch packager while building',\n },\n {\n name: '--bundle',\n description:\n 'Enable Bundle configuration and it would be ReleaseBundle/DebugBundle other than Release/Debug',\n },\n {\n name: '--no-launch',\n description: 'Do not launch the app after deployment',\n },\n {\n name: '--no-autolink',\n description: 'Do not run autolinking',\n },\n {\n name: '--no-build',\n description: 'Do not build the solution',\n },\n {\n name: '--no-deploy',\n description: 'Do not deploy the app',\n },\n {\n name: '--deploy-from-layout',\n description: 'Force deploy from layout',\n },\n {\n name: '--sln [string]',\n description:\n \"Override the app solution file determined by 'react-native config', e.g. windows\\\\myApp.sln\",\n default: undefined,\n },\n {\n name: '--proj [string]',\n description:\n \"Override the app project file determined by 'react-native config', e.g. windows\\\\myApp\\\\myApp.vcxproj\",\n default: undefined,\n },\n {\n name: '--msbuildprops [string]',\n description:\n 'Comma separated props to pass to msbuild, eg: prop1=value1,prop2=value2',\n },\n {\n name: '--buildLogDirectory [string]',\n description: 'Optional directory where msbuild log files should be stored',\n },\n {\n name: '--info',\n description: 'Dump environment information',\n },\n {\n name: '--direct-debugging [number]',\n description: 'Enable direct debugging on specified port',\n parse: parseDirectDebuggingPort,\n },\n {\n name: '--no-telemetry',\n description:\n 'Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI',\n },\n];\n\nfunction parseBuildArch(arg: string): BuildArch {\n const supportedArches: BuildArch[] = ['x86', 'x64', 'ARM64'];\n for (const supported of supportedArches) {\n if (arg.toLowerCase() === supported.toLowerCase()) {\n return supported;\n }\n }\n\n errorOut(`Unrecognized --arch '${arg}'. Expected one of ${supportedArches}`);\n}\n\nfunction parseDirectDebuggingPort(arg: string): number {\n const num = parseInt(arg, 10);\n\n if (!Number.isInteger(num)) {\n errorOut(`Expected argument '--direct-debugging' to be a number`);\n }\n if (num < 1024 || num >= 65535) {\n errorOut('Direct debugging port it out of range');\n }\n\n return num;\n}\n\nfunction errorOut(arg: string): never {\n console.error(arg);\n process.exit(1);\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  * @format
5
5
  */
6
- import { Command, CommandOption, Dependency, ProjectConfig } from '@react-native-community/cli-types';
6
+ import { Command, CommandOption, Config, Dependency, ProjectConfig } from '@react-native-community/cli-types';
7
7
  import { WindowsProjectConfig } from '../../config/projectConfig';
8
8
  import { Ora } from 'ora';
9
9
  export declare class AutolinkWindows {
@@ -73,11 +73,19 @@ export declare class AutolinkWindows {
73
73
  /** @return The CLI command to invoke autolink-windows independently */
74
74
  getAutolinkWindowsCommand(): string;
75
75
  }
76
+ /**
77
+ * Performs auto-linking for RNW native modules and apps.
78
+ * @param args Unprocessed args passed from react-native CLI.
79
+ * @param config Config passed from react-native CLI.
80
+ * @param options Options passed from react-native CLI.
81
+ */
82
+ export declare function autolinkWindowsInternal(args: string[], config: Config, options: AutoLinkOptions): Promise<void>;
76
83
  export interface AutoLinkOptions {
77
84
  logging?: boolean;
78
85
  check?: boolean;
79
86
  sln?: string;
80
87
  proj?: string;
88
+ telemetry?: boolean;
81
89
  }
82
90
  export declare const autolinkOptions: CommandOption[];
83
91
  /**
@@ -27,12 +27,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  return (mod && mod.__esModule) ? mod : { "default": mod };
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.autoLinkCommand = exports.autolinkOptions = exports.AutolinkWindows = void 0;
30
+ exports.autoLinkCommand = exports.autolinkOptions = exports.autolinkWindowsInternal = exports.AutolinkWindows = void 0;
31
31
  // Types in this file are inaccurate compared to usage in terms of falsiness.
32
32
  // We should try to rewrite some of this to do automated schema validation to
33
33
  // guarantee correct types
34
34
  /* eslint-disable @typescript-eslint/no-unnecessary-condition */
35
- const fs_1 = __importDefault(require("fs"));
35
+ const fs_1 = __importDefault(require("@react-native-windows/fs"));
36
36
  const path_1 = __importDefault(require("path"));
37
37
  const chalk_1 = __importDefault(require("chalk"));
38
38
  const perf_hooks_1 = require("perf_hooks");
@@ -41,6 +41,7 @@ const vstools = __importStar(require("./vstools"));
41
41
  const generatorCommon = __importStar(require("../../generator-common"));
42
42
  const configUtils = __importStar(require("../../config/configUtils"));
43
43
  const telemetry_1 = require("@react-native-windows/telemetry");
44
+ const telemetryHelpers_1 = require("./telemetryHelpers");
44
45
  const xmldom_1 = require("@xmldom/xmldom");
45
46
  const formatter = require('xml-formatter');
46
47
  class AutolinkWindows {
@@ -149,7 +150,7 @@ class AutolinkWindows {
149
150
  'solutionFile',
150
151
  'project',
151
152
  ];
152
- alwaysRequired.forEach(item => {
153
+ alwaysRequired.forEach((item) => {
153
154
  if (!(item in this.windowsAppConfig) ||
154
155
  this.windowsAppConfig[item] === null) {
155
156
  throw new telemetry_1.CodedError('IncompleteConfig', `${item} is required but not specified by react-native config`, { item: item });
@@ -174,7 +175,7 @@ class AutolinkWindows {
174
175
  'projectLang',
175
176
  'projectGuid',
176
177
  ];
177
- projectRequired.forEach(item => {
178
+ projectRequired.forEach((item) => {
178
179
  if (!(item in windowsAppProjectConfig) ||
179
180
  windowsAppProjectConfig[item] === null) {
180
181
  throw new telemetry_1.CodedError('IncompleteConfig', `project.${item} is required but not specified by react-native config`, { item: item });
@@ -203,14 +204,14 @@ class AutolinkWindows {
203
204
  let cppPackageProviders = '';
204
205
  const windowsDependencies = this.getWindowsDependencies();
205
206
  for (const dependencyName of Object.keys(windowsDependencies)) {
206
- windowsDependencies[dependencyName].projects.forEach(project => {
207
+ windowsDependencies[dependencyName].projects.forEach((project) => {
207
208
  if (project.directDependency) {
208
209
  cppIncludes += `\n\n// Includes from ${dependencyName}`;
209
- project.cppHeaders.forEach(header => {
210
+ project.cppHeaders.forEach((header) => {
210
211
  cppIncludes += `\n#include <${header}>`;
211
212
  });
212
213
  cppPackageProviders += `\n // IReactPackageProviders from ${dependencyName}`;
213
- project.cppPackageProviders.forEach(packageProvider => {
214
+ project.cppPackageProviders.forEach((packageProvider) => {
214
215
  cppPackageProviders += `\n packageProviders.Append(winrt::${packageProvider}());`;
215
216
  });
216
217
  }
@@ -224,7 +225,7 @@ class AutolinkWindows {
224
225
  return { cppPackageProviders, cppIncludes };
225
226
  }
226
227
  generateCSAutolinking(templateRoot, projectLang, projectDir) {
227
- const { csUsingNamespaces, csReactPackageProviders, } = this.getCsReplacements();
228
+ const { csUsingNamespaces, csReactPackageProviders } = this.getCsReplacements();
228
229
  const csFileName = 'AutolinkedNativeModules.g.cs';
229
230
  const srcCsFile = path_1.default.join(templateRoot, `${projectLang}-app`, 'src', csFileName);
230
231
  const destCsFile = path_1.default.join(projectDir, csFileName);
@@ -241,14 +242,14 @@ class AutolinkWindows {
241
242
  let csReactPackageProviders = '';
242
243
  const windowsDependencies = this.getWindowsDependencies();
243
244
  for (const dependencyName of Object.keys(windowsDependencies)) {
244
- windowsDependencies[dependencyName].projects.forEach(project => {
245
+ windowsDependencies[dependencyName].projects.forEach((project) => {
245
246
  if (project.directDependency) {
246
247
  csUsingNamespaces += `\n\n// Namespaces from ${dependencyName}`;
247
- project.csNamespaces.forEach(namespace => {
248
+ project.csNamespaces.forEach((namespace) => {
248
249
  csUsingNamespaces += `\nusing ${namespace};`;
249
250
  });
250
251
  csReactPackageProviders += `\n // IReactPackageProviders from ${dependencyName}`;
251
- project.csPackageProviders.forEach(packageProvider => {
252
+ project.csPackageProviders.forEach((packageProvider) => {
252
253
  csReactPackageProviders += `\n packageProviders.Add(new ${packageProvider}());`;
253
254
  });
254
255
  }
@@ -259,8 +260,7 @@ class AutolinkWindows {
259
260
  getWindowsDependencies() {
260
261
  if (Object.keys(this.windowsDependencies).length === 0) {
261
262
  for (const dependencyName of Object.keys(this.dependenciesConfig)) {
262
- const windowsDependency = this
263
- .dependenciesConfig[dependencyName].platforms.windows;
263
+ const windowsDependency = this.dependenciesConfig[dependencyName].platforms.windows;
264
264
  if (windowsDependency) {
265
265
  verboseMessage(`${chalk_1.default.bold(dependencyName)} has Windows implementation, config:`, this.options.logging);
266
266
  verboseMessage(windowsDependency, this.options.logging);
@@ -276,12 +276,12 @@ class AutolinkWindows {
276
276
  // the dependency is probably a react native module, but we didn't find a module project
277
277
  throw new telemetry_1.CodedError('Autolinking', `Found a Windows solution for ${dependencyName} but no React Native for Windows native module projects`);
278
278
  }
279
- windowsDependency.projects.forEach(project => {
279
+ windowsDependency.projects.forEach((project) => {
280
280
  const itemsToCheck = [
281
281
  'projectFile',
282
282
  'directDependency',
283
283
  ];
284
- itemsToCheck.forEach(item => {
284
+ itemsToCheck.forEach((item) => {
285
285
  dependencyIsValid = !!(dependencyIsValid &&
286
286
  item in project &&
287
287
  project[item] !== '' &&
@@ -311,14 +311,14 @@ class AutolinkWindows {
311
311
  const fileName = chalk_1.default.bold(path_1.default.basename(filePath));
312
312
  verboseMessage(`Reading ${fileName}...`, this.options.logging);
313
313
  const actualContents = fs_1.default.existsSync(filePath)
314
- ? (await fs_1.default.promises.readFile(filePath)).toString()
314
+ ? (await fs_1.default.readFile(filePath)).toString()
315
315
  : '';
316
316
  const contentsChanged = expectedContents !== actualContents;
317
317
  if (contentsChanged) {
318
318
  verboseMessage(chalk_1.default.yellow(`${fileName} needs to be updated.`), this.options.logging);
319
319
  if (!this.options.check) {
320
320
  verboseMessage(`Writing ${fileName}...`, this.options.logging);
321
- await fs_1.default.promises.writeFile(filePath, expectedContents, {
321
+ await fs_1.default.writeFile(filePath, expectedContents, {
322
322
  encoding: 'utf8',
323
323
  flag: 'w',
324
324
  });
@@ -333,7 +333,7 @@ class AutolinkWindows {
333
333
  let projectReferencesForTargets = '';
334
334
  const windowsDependencies = this.getWindowsDependencies();
335
335
  for (const dependencyName of Object.keys(windowsDependencies)) {
336
- windowsDependencies[dependencyName].projects.forEach(project => {
336
+ windowsDependencies[dependencyName].projects.forEach((project) => {
337
337
  if (project.directDependency) {
338
338
  const dependencyProjectFile = path_1.default.join(windowsDependencies[dependencyName].folder, windowsDependencies[dependencyName].sourceDir, project.projectFile);
339
339
  const relDependencyProjectFile = path_1.default.relative(projectDir, dependencyProjectFile);
@@ -370,7 +370,7 @@ class AutolinkWindows {
370
370
  const csModuleNames = [];
371
371
  const windowsDependencies = this.getWindowsDependencies();
372
372
  for (const dependencyName of Object.keys(windowsDependencies)) {
373
- windowsDependencies[dependencyName].projects.forEach(project => {
373
+ windowsDependencies[dependencyName].projects.forEach((project) => {
374
374
  if (project.directDependency && project.projectLang === 'cs') {
375
375
  csModuleNames.push(project.projectName);
376
376
  }
@@ -383,7 +383,7 @@ class AutolinkWindows {
383
383
  const windowsDependencies = this.getWindowsDependencies();
384
384
  for (const dependencyName of Object.keys(windowsDependencies)) {
385
385
  // Process dependency projects
386
- windowsDependencies[dependencyName].projects.forEach(project => {
386
+ windowsDependencies[dependencyName].projects.forEach((project) => {
387
387
  const dependencyProjectFile = path_1.default.join(windowsDependencies[dependencyName].folder, windowsDependencies[dependencyName].sourceDir, project.projectFile);
388
388
  projectsForSolution.push({
389
389
  projectFile: dependencyProjectFile,
@@ -412,7 +412,7 @@ class AutolinkWindows {
412
412
  }
413
413
  verboseMessage(`Calculating ${chalk_1.default.bold(path_1.default.basename(solutionFile))} changes...`, this.options.logging);
414
414
  let changesNecessary = false;
415
- projectsForSolution.forEach(project => {
415
+ projectsForSolution.forEach((project) => {
416
416
  const contentsChanged = vstools.addProjectToSolution(solutionFile, project, this.options.logging, this.options.check);
417
417
  changesNecessary = changesNecessary || contentsChanged;
418
418
  });
@@ -506,8 +506,8 @@ class AutolinkWindows {
506
506
  const packageElement = packageElements.item(i);
507
507
  const idAttr = packageElement.getAttributeNode('id');
508
508
  const id = idAttr.value;
509
- const keepPkg = keepPkgs.find(pkg => pkg.id === id);
510
- if (removePkgs.find(pkg => pkg.id === id)) {
509
+ const keepPkg = keepPkgs.find((pkg) => pkg.id === id);
510
+ if (removePkgs.find((pkg) => pkg.id === id)) {
511
511
  nodesToRemove.push(packageElement);
512
512
  changed = true;
513
513
  }
@@ -515,11 +515,11 @@ class AutolinkWindows {
515
515
  changed =
516
516
  changed || keepPkg.version !== packageElement.getAttribute('version');
517
517
  packageElement.setAttribute('version', keepPkg.version);
518
- keepPkgs = keepPkgs.filter(pkg => pkg.id !== keepPkg.id);
518
+ keepPkgs = keepPkgs.filter((pkg) => pkg.id !== keepPkg.id);
519
519
  }
520
520
  }
521
- nodesToRemove.forEach(pkg => packagesConfig.content.documentElement.removeChild(pkg));
522
- keepPkgs.forEach(keepPkg => {
521
+ nodesToRemove.forEach((pkg) => packagesConfig.content.documentElement.removeChild(pkg));
522
+ keepPkgs.forEach((keepPkg) => {
523
523
  const newPkg = packagesConfig.content.createElement('package');
524
524
  Object.entries(keepPkg).forEach(([attr, value]) => {
525
525
  newPkg.setAttribute(attr, value);
@@ -567,13 +567,61 @@ function verboseMessage(message, verbose) {
567
567
  console.log(message);
568
568
  }
569
569
  }
570
+ /**
571
+ * Sanitizes the given option for telemetery.
572
+ * @param key The key of the option.
573
+ * @param value The unsanitized value of the option.
574
+ * @returns The sanitized value of the option.
575
+ */
576
+ function optionSanitizer(key, value) {
577
+ // Do not add a default case here.
578
+ // Strings risking PII should just return true if present, false otherwise.
579
+ // All others should return the value (or false if undefined).
580
+ switch (key) {
581
+ case 'sln':
582
+ case 'proj':
583
+ return value === undefined ? false : true; // Strip PII
584
+ case 'logging':
585
+ case 'check':
586
+ case 'telemetry':
587
+ return value === undefined ? false : value; // Return value
588
+ }
589
+ }
590
+ /**
591
+ * Get the extra props to add to the `autolink-windows` telemetry event.
592
+ * @returns The extra props.
593
+ */
594
+ async function getExtraProps() {
595
+ const extraProps = {};
596
+ return extraProps;
597
+ }
598
+ /**
599
+ * The function run when calling `react-native autolink-windows`.
600
+ * @param args Unprocessed args passed from react-native CLI.
601
+ * @param config Config passed from react-native CLI.
602
+ * @param options Options passed from react-native CLI.
603
+ */
604
+ async function autolinkWindows(args, config, options) {
605
+ await (0, telemetryHelpers_1.startTelemetrySession)('autolink-windows', config, options, (0, telemetryHelpers_1.getDefaultOptions)(config, exports.autolinkOptions), optionSanitizer);
606
+ let autolinkWindowsError;
607
+ try {
608
+ await autolinkWindowsInternal(args, config, options);
609
+ }
610
+ catch (ex) {
611
+ autolinkWindowsError =
612
+ ex instanceof Error ? ex : new Error(String(ex));
613
+ telemetry_1.Telemetry.trackException(autolinkWindowsError);
614
+ }
615
+ await (0, telemetryHelpers_1.endTelemetrySession)(autolinkWindowsError, getExtraProps);
616
+ (0, commandWithProgress_1.setExitProcessWithError)(options.logging, autolinkWindowsError);
617
+ }
570
618
  /**
571
619
  * Performs auto-linking for RNW native modules and apps.
572
620
  * @param args Unprocessed args passed from react-native CLI.
573
621
  * @param config Config passed from react-native CLI.
574
622
  * @param options Options passed from react-native CLI.
575
623
  */
576
- async function updateAutoLink(args, config, options) {
624
+ async function autolinkWindowsInternal(args, config, options) {
577
625
  const startTime = perf_hooks_1.performance.now();
578
626
  const spinner = (0, commandWithProgress_1.newSpinner)(options.check ? 'Checking auto-linked files...' : 'Auto-linking...');
579
627
  try {
@@ -599,6 +647,7 @@ async function updateAutoLink(args, config, options) {
599
647
  throw e;
600
648
  }
601
649
  }
650
+ exports.autolinkWindowsInternal = autolinkWindowsInternal;
602
651
  exports.autolinkOptions = [
603
652
  {
604
653
  name: '--logging',
@@ -618,6 +667,10 @@ exports.autolinkOptions = [
618
667
  description: "Override the app project file determined by 'react-native config', e.g. windows\\myApp\\myApp.vcxproj",
619
668
  default: undefined,
620
669
  },
670
+ {
671
+ name: '--no-telemetry',
672
+ description: 'Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI',
673
+ },
621
674
  ];
622
675
  /**
623
676
  * Performs auto-linking for RNW native modules and apps.
@@ -625,7 +678,7 @@ exports.autolinkOptions = [
625
678
  exports.autoLinkCommand = {
626
679
  name: 'autolink-windows',
627
680
  description: 'performs autolinking',
628
- func: updateAutoLink,
681
+ func: autolinkWindows,
629
682
  options: exports.autolinkOptions,
630
683
  };
631
684
  //# sourceMappingURL=autolink.js.map