@react-native-windows/cli 0.0.0-canary.277 → 0.0.0-canary.279
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/lib-commonjs/commands/runWindows/runWindows.js +0 -1
- package/lib-commonjs/commands/runWindows/runWindows.js.map +1 -1
- package/lib-commonjs/commands/runWindows/runWindowsOptions.d.ts +0 -2
- package/lib-commonjs/commands/runWindows/runWindowsOptions.js +0 -4
- package/lib-commonjs/commands/runWindows/runWindowsOptions.js.map +1 -1
- package/lib-commonjs/e2etest/createRnwApp.test.js +2 -90
- package/lib-commonjs/e2etest/createRnwApp.test.js.map +1 -1
- package/lib-commonjs/e2etest/dependencyConfig.test.js +2 -22
- package/lib-commonjs/e2etest/dependencyConfig.test.js.map +1 -1
- package/lib-commonjs/e2etest/projectConfig.test.js +0 -4
- package/lib-commonjs/e2etest/projectConfig.test.js.map +1 -1
- package/lib-commonjs/e2etest/projectConfig.utils.d.ts +1 -1
- package/lib-commonjs/e2etest/projectConfig.utils.js +6 -28
- package/lib-commonjs/e2etest/projectConfig.utils.js.map +1 -1
- package/lib-commonjs/e2etest/runWindows.test.js +0 -1
- package/lib-commonjs/e2etest/runWindows.test.js.map +1 -1
- package/lib-commonjs/utils/deploy.js +1 -4
- package/lib-commonjs/utils/deploy.js.map +1 -1
- package/package.json +9 -9
- package/src/powershell/{WindowsStoreAppUtils.ps1 → WindowsStoreAppUtils.psm1} +465 -274
package/README.md
CHANGED
|
@@ -93,7 +93,6 @@ Here are the options that `npx @react-native-community/cli run-windows` takes:
|
|
|
93
93
|
| `--emulator` | boolean | Deploys the app to an emulator |
|
|
94
94
|
| `--device` | boolean | Deploys the app to a connected device |
|
|
95
95
|
| `--target` | string | Deploys the app to the specified `GUID` for a device |
|
|
96
|
-
| `--remote-debugging` | boolean | **(Deprecated)** Deploys the app in remote debugging mode |
|
|
97
96
|
| `--logging` | boolean | Verbose output logging |
|
|
98
97
|
| `--no-packager` | boolean | Do not launch the packager while building |
|
|
99
98
|
| `--bundle` | boolean | Enable Bundle configuration, i.e. `ReleaseBundle`/`DebugBundle` rather than `Release`/`Debug` |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWindows.js","sourceRoot":"","sources":["../../../src/commands/runWindows/runWindows.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+BAA+B;AAE/B,kEAA0C;AAC1C,gDAAwB;AAExB,+DAAsE;AAGtE,yDAA2C;AAC3C,kDAA0B;AAC1B,2DAA6C;AAC7C,yEAKyC;AACzC,mEAIsC;AACtC,qEAAuD;AACvD,uDAAyC;AACzC,4EAAoD;AAEpD,2DAAsD;AACtD,wEAA2E;AAE3E,+DAAsE;AAEtE;;;;;GAKG;AACH,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,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAmB;QACrF,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,KAA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ACH,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,sFAAsF;IACxF,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\n/* eslint-disable complexity */\n\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\n\nimport {Telemetry, CodedError} from '@react-native-windows/telemetry';\nimport type {Command, Config} from '@react-native-community/cli-types';\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 pathHelpers from '../../utils/pathHelpers';\nimport * as info from '../../utils/info';\nimport MSBuildTools from '../../utils/msbuildtools';\nimport type {RunWindowsOptions} from './runWindowsOptions';\nimport {runWindowsOptions} from './runWindowsOptions';\nimport {autolinkWindowsInternal} from '../autolinkWindows/autolinkWindows';\nimport type {AutoLinkOptions} from '../autolinkWindows/autolinkWindowsOptions';\nimport {showOldArchitectureWarning} from '../../utils/oldArchWarning';\n\n/**\n * Sanitizes the given option for telemetry.\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 */\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 typeof value === 'string' ? value.split(',').length : 0; // 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 msBuildProps: evaluateMSBuildPropsCallback\n ? evaluateMSBuildPropsCallback()\n : {},\n };\n return extraProps;\n}\n\n/**\n * Labels used by telemetry to represent current operation\n */\ntype RunWindowsPhase =\n | 'None'\n | 'Info'\n | 'FindSolution'\n | 'FindBuildTools'\n | 'Autolink'\n | 'RestorePackagesConfig'\n | 'Build'\n | 'Deploy';\n\nlet runWindowsPhase: RunWindowsPhase = 'None';\n\nlet hasRunRnwDependencies: boolean = false;\n\nlet evaluateMSBuildPropsCallback:\n | (() => Record<string, string> | null)\n | undefined;\n\n/**\n * The function run when calling `npx @react-native-community/cli 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 runWindowsPhase = '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 rnwDependenciesPath = path.join(\n pathHelpers.resolveRnwRoot([process.cwd(), __dirname]),\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 // Warn about old architecture projects\n if (config.project.windows?.rnwConfig?.projectArch === 'old') {\n showOldArchitectureWarning();\n }\n\n // Get the solution file\n let slnFile: string | null;\n runWindowsPhase = 'FindSolution';\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 // Set up the callback to capture MSBuild properties after the command completes\n evaluateMSBuildPropsCallback = () => {\n const projectFile = build.getAppProjectFile(options, config);\n if (projectFile) {\n if (verbose) {\n newInfo('Gathering MSBuild data for telemetry.');\n }\n\n const msBuildPropertiesJsonPath = path.resolve(\n path.dirname(projectFile),\n 'Generated Files',\n 'msbuildproperties.g.json',\n );\n\n if (fs.existsSync(msBuildPropertiesJsonPath)) {\n if (verbose) {\n newInfo('Loading properties from msbuildproperties.g.json');\n }\n return fs.readJsonFileSync(msBuildPropertiesJsonPath);\n }\n\n if (verbose) {\n newInfo('Unable to find msbuildproperties.g.json');\n }\n }\n\n return {};\n };\n\n // Restore packages.config files for dependencies that don't support PackageReference.\n runWindowsPhase = 'RestorePackagesConfig';\n const buildType = deploy.getBuildConfiguration(options);\n try {\n await buildTools.restorePackageConfigs(slnFile, options.arch, buildType);\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 if (options.autolink) {\n runWindowsPhase = 'Autolink';\n try {\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 await autolinkWindowsInternal(\n autolinkArgs,\n autolinkConfig,\n autolinkOptions,\n );\n } catch (e) {\n newError(`Autolinking failed. ${(e as Error).message}`);\n throw e;\n }\n } else {\n newInfo('Autolink step is skipped');\n }\n\n if (options.build) {\n runWindowsPhase = 'Build';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx @react-native-community/cli init-windows\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n // Get build/deploy 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 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 = 'Deploy';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx @react-native-community/cli init-windows\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n try {\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 RNW 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/commands/runWindows/runWindows.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+BAA+B;AAE/B,kEAA0C;AAC1C,gDAAwB;AAExB,+DAAsE;AAGtE,yDAA2C;AAC3C,kDAA0B;AAC1B,2DAA6C;AAC7C,yEAKyC;AACzC,mEAIsC;AACtC,qEAAuD;AACvD,uDAAyC;AACzC,4EAAoD;AAEpD,2DAAsD;AACtD,wEAA2E;AAE3E,+DAAsE;AAEtE;;;;;GAKG;AACH,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,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAmB;QACrF,KAAK,SAAS,CAAC;QACf,KAAK,MAAM,CAAC;QACZ,KAAK,YAAY,CAAC;QAClB,KAAK,UAAU,CA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AAE,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,sFAAsF;IACxF,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\n/* eslint-disable complexity */\n\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\n\nimport {Telemetry, CodedError} from '@react-native-windows/telemetry';\nimport type {Command, Config} from '@react-native-community/cli-types';\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 pathHelpers from '../../utils/pathHelpers';\nimport * as info from '../../utils/info';\nimport MSBuildTools from '../../utils/msbuildtools';\nimport type {RunWindowsOptions} from './runWindowsOptions';\nimport {runWindowsOptions} from './runWindowsOptions';\nimport {autolinkWindowsInternal} from '../autolinkWindows/autolinkWindows';\nimport type {AutoLinkOptions} from '../autolinkWindows/autolinkWindowsOptions';\nimport {showOldArchitectureWarning} from '../../utils/oldArchWarning';\n\n/**\n * Sanitizes the given option for telemetry.\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 */\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 typeof value === 'string' ? value.split(',').length : 0; // Convert to count\n case 'release':\n case 'arch':\n case 'singleproc':\n case 'emulator':\n case 'device':\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 msBuildProps: evaluateMSBuildPropsCallback\n ? evaluateMSBuildPropsCallback()\n : {},\n };\n return extraProps;\n}\n\n/**\n * Labels used by telemetry to represent current operation\n */\ntype RunWindowsPhase =\n | 'None'\n | 'Info'\n | 'FindSolution'\n | 'FindBuildTools'\n | 'Autolink'\n | 'RestorePackagesConfig'\n | 'Build'\n | 'Deploy';\n\nlet runWindowsPhase: RunWindowsPhase = 'None';\n\nlet hasRunRnwDependencies: boolean = false;\n\nlet evaluateMSBuildPropsCallback:\n | (() => Record<string, string> | null)\n | undefined;\n\n/**\n * The function run when calling `npx @react-native-community/cli 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 runWindowsPhase = '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 rnwDependenciesPath = path.join(\n pathHelpers.resolveRnwRoot([process.cwd(), __dirname]),\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 // Warn about old architecture projects\n if (config.project.windows?.rnwConfig?.projectArch === 'old') {\n showOldArchitectureWarning();\n }\n\n // Get the solution file\n let slnFile: string | null;\n runWindowsPhase = 'FindSolution';\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 // Set up the callback to capture MSBuild properties after the command completes\n evaluateMSBuildPropsCallback = () => {\n const projectFile = build.getAppProjectFile(options, config);\n if (projectFile) {\n if (verbose) {\n newInfo('Gathering MSBuild data for telemetry.');\n }\n\n const msBuildPropertiesJsonPath = path.resolve(\n path.dirname(projectFile),\n 'Generated Files',\n 'msbuildproperties.g.json',\n );\n\n if (fs.existsSync(msBuildPropertiesJsonPath)) {\n if (verbose) {\n newInfo('Loading properties from msbuildproperties.g.json');\n }\n return fs.readJsonFileSync(msBuildPropertiesJsonPath);\n }\n\n if (verbose) {\n newInfo('Unable to find msbuildproperties.g.json');\n }\n }\n\n return {};\n };\n\n // Restore packages.config files for dependencies that don't support PackageReference.\n runWindowsPhase = 'RestorePackagesConfig';\n const buildType = deploy.getBuildConfiguration(options);\n try {\n await buildTools.restorePackageConfigs(slnFile, options.arch, buildType);\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 if (options.autolink) {\n runWindowsPhase = 'Autolink';\n try {\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 await autolinkWindowsInternal(\n autolinkArgs,\n autolinkConfig,\n autolinkOptions,\n );\n } catch (e) {\n newError(`Autolinking failed. ${(e as Error).message}`);\n throw e;\n }\n } else {\n newInfo('Autolink step is skipped');\n }\n\n if (options.build) {\n runWindowsPhase = 'Build';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx @react-native-community/cli init-windows\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n // Get build/deploy 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 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 = 'Deploy';\n if (!slnFile) {\n newError(\n 'Visual Studio Solution file not found. Maybe run \"npx @react-native-community/cli init-windows\" first?',\n );\n throw new CodedError('NoSolution', 'Cannot find solution file');\n }\n\n try {\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 RNW app and starts it on a connected Windows desktop, emulator or device',\n func: runWindows,\n options: runWindowsOptions,\n};\n"]}
|
|
@@ -15,7 +15,6 @@ export type BuildConfig = 'Debug' | 'DebugBundle' | 'Release' | 'ReleaseBundle';
|
|
|
15
15
|
* emulator: Boolean - Deploy to the emulator
|
|
16
16
|
* device: Boolean - Deploy to a device
|
|
17
17
|
* target: String - Device GUID to deploy to
|
|
18
|
-
* remote-debugging: Boolean - Run using remote JS proxy
|
|
19
18
|
* logging: Boolean - Enables logging
|
|
20
19
|
* no-packager: Boolean - Do not launch packager while building
|
|
21
20
|
* bundle: Boolean - Enable Bundle configuration.
|
|
@@ -36,7 +35,6 @@ export interface RunWindowsOptions {
|
|
|
36
35
|
emulator?: boolean;
|
|
37
36
|
device?: boolean;
|
|
38
37
|
target?: string;
|
|
39
|
-
remoteDebugging?: string;
|
|
40
38
|
logging?: boolean;
|
|
41
39
|
packager?: boolean;
|
|
42
40
|
bundle?: boolean;
|
|
@@ -39,10 +39,6 @@ exports.runWindowsOptions = [
|
|
|
39
39
|
name: '--target [string]',
|
|
40
40
|
description: 'Deploys the app to the specified GUID for a device',
|
|
41
41
|
},
|
|
42
|
-
{
|
|
43
|
-
name: '--remote-debugging',
|
|
44
|
-
description: '(Deprecated) Deploys the app in remote debugging mode',
|
|
45
|
-
},
|
|
46
42
|
{
|
|
47
43
|
name: '--logging',
|
|
48
44
|
description: 'Verbose output logging',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWindowsOptions.js","sourceRoot":"","sources":["../../../src/commands/runWindows/runWindowsOptions.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,+DAAmE;
|
|
1
|
+
{"version":3,"file":"runWindowsOptions.js","sourceRoot":"","sources":["../../../src/commands/runWindows/runWindowsOptions.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,+DAAmE;AAmDtD,QAAA,iBAAiB,GAAoB;IAChD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,2BAA2B;KACzC;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,+EAA+E;QACjF,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI;KAC/B;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,8CAA8C;QAC3D,OAAO,EAAE,cAAc,CAAC,IAAA,8BAAkB,GAAE,CAAC;QAC7C,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,oDAAoD;KAClE;IACD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,wBAAwB;KACtC;IACD;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,2CAA2C;KACzD;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,uFAAuF;KAC1F;IACD;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,wCAAwC;KACtD;IACD;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,wBAAwB;KACtC;IACD;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,2BAA2B;KACzC;IACD;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAA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,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 type {CommandOption} from '@react-native-community/cli-types';\nimport {deviceArchitecture} from '@react-native-windows/telemetry';\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 * 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 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 project which contains the windows folder',\n default: config => config.root,\n },\n {\n name: '--arch [string]',\n description: 'The build architecture, i.e. ARM64, x86, x64',\n default: parseBuildArch(deviceArchitecture()),\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: '--logging',\n description: 'Verbose output logging',\n },\n {\n name: '--no-packager',\n description: 'Do not launch the packager while building',\n },\n {\n name: '--bundle',\n description:\n 'Enable Bundle configuration, i.e. ReleaseBundle/DebugBundle rather 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 even in Release builds',\n },\n {\n name: '--sln [string]',\n description:\n \"Override the app solution file determined by 'npx @react-native-community/cli config', i.e. windows\\\\myApp.sln\",\n default: undefined,\n },\n {\n name: '--proj [string]',\n description:\n \"Override the app project file determined by 'npx @react-native-community/cli config', i.e. 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"]}
|
|
@@ -117,14 +117,8 @@ describe('creaternwapp Configuration Tests - Stable Version', () => {
|
|
|
117
117
|
// Default template should be cpp-app (fabric/new arch)
|
|
118
118
|
expect(scriptContent).toContain('set RNW_TEMPLATE_TYPE=cpp-app');
|
|
119
119
|
});
|
|
120
|
-
test('should validate old UWP templates are available', () => {
|
|
121
|
-
const oldTemplatesDir = path.join(repoRoot, 'vnext/templates/old');
|
|
122
|
-
expect(fs_1.default.existsSync(oldTemplatesDir)).toBe(true);
|
|
123
|
-
const uwpCppAppTemplate = path.join(oldTemplatesDir, 'uwp-cpp-app');
|
|
124
|
-
expect(fs_1.default.existsSync(uwpCppAppTemplate)).toBe(true);
|
|
125
|
-
});
|
|
126
120
|
test('should validate new fabric templates are available', () => {
|
|
127
|
-
const newTemplatesDir = path.join(repoRoot, 'vnext/
|
|
121
|
+
const newTemplatesDir = path.join(repoRoot, 'vnext/templates');
|
|
128
122
|
expect(fs_1.default.existsSync(newTemplatesDir)).toBe(true);
|
|
129
123
|
const cppAppTemplate = path.join(newTemplatesDir, 'cpp-app');
|
|
130
124
|
expect(fs_1.default.existsSync(cppAppTemplate)).toBe(true);
|
|
@@ -156,14 +150,6 @@ describe('creaternwapp Configuration Tests - Stable Version', () => {
|
|
|
156
150
|
expect(expectedCommand).toContain('test-app-name');
|
|
157
151
|
expect(expectedCommand).not.toContain('/t'); // No template specified = default fabric
|
|
158
152
|
});
|
|
159
|
-
test('should validate old architecture (paper/UWP) command structure', () => {
|
|
160
|
-
// Test the command that would be used for old arch:
|
|
161
|
-
// creaternwapp.cmd /rnw preview /t old/uwp-cpp-app test-app-name
|
|
162
|
-
const expectedCommand = `creaternwapp.cmd /rnw preview /t old/uwp-cpp-app test-app-name`;
|
|
163
|
-
expect(expectedCommand).toContain('/rnw preview');
|
|
164
|
-
expect(expectedCommand).toContain('/t old/uwp-cpp-app');
|
|
165
|
-
expect(expectedCommand).toContain('test-app-name');
|
|
166
|
-
});
|
|
167
153
|
test('should validate yarn windows command variations', () => {
|
|
168
154
|
// Test the commands that would be used to build apps:
|
|
169
155
|
const debugCommand = 'yarn windows';
|
|
@@ -187,20 +173,6 @@ describe('creaternwapp Configuration Tests - Stable Version', () => {
|
|
|
187
173
|
expect(workflow.buildDebug).toBe('yarn windows');
|
|
188
174
|
expect(workflow.buildRelease).toBe('yarn windows --release');
|
|
189
175
|
});
|
|
190
|
-
test('should validate complete old architecture workflow commands', () => {
|
|
191
|
-
const workflow = {
|
|
192
|
-
create: `creaternwapp.cmd /rnw ${RNW_VERSION} /t old/uwp-cpp-app TestAppPaper`,
|
|
193
|
-
start: 'yarn start',
|
|
194
|
-
buildDebug: 'yarn windows',
|
|
195
|
-
buildRelease: 'yarn windows --release',
|
|
196
|
-
};
|
|
197
|
-
expect(workflow.create).toContain(RNW_VERSION);
|
|
198
|
-
expect(workflow.create).toContain('/t old/uwp-cpp-app');
|
|
199
|
-
expect(workflow.create).toContain('TestAppPaper');
|
|
200
|
-
expect(workflow.start).toBe('yarn start');
|
|
201
|
-
expect(workflow.buildDebug).toBe('yarn windows');
|
|
202
|
-
expect(workflow.buildRelease).toBe('yarn windows --release');
|
|
203
|
-
});
|
|
204
176
|
});
|
|
205
177
|
describe('Documentation and Example Validation', () => {
|
|
206
178
|
test('should document the testing procedure for new architecture', () => {
|
|
@@ -218,22 +190,6 @@ describe('creaternwapp Configuration Tests - Stable Version', () => {
|
|
|
218
190
|
expect(procedure.steps[2]).toContain('yarn windows');
|
|
219
191
|
expect(procedure.steps[3]).toContain('yarn windows --release');
|
|
220
192
|
});
|
|
221
|
-
test('should document the testing procedure for old architecture', () => {
|
|
222
|
-
const procedure = {
|
|
223
|
-
title: 'Old Architecture (Paper/UWP) Testing',
|
|
224
|
-
steps: [
|
|
225
|
-
`creaternwapp.cmd /rnw ${RNW_VERSION} /t old/uwp-cpp-app test-app-name`,
|
|
226
|
-
'yarn start (in test-app-name path)',
|
|
227
|
-
'cd test-app-name && yarn windows',
|
|
228
|
-
'cd test-app-name && yarn windows --release',
|
|
229
|
-
],
|
|
230
|
-
};
|
|
231
|
-
expect(procedure.steps[0]).toContain(RNW_VERSION);
|
|
232
|
-
expect(procedure.steps[0]).toContain('/t old/uwp-cpp-app');
|
|
233
|
-
expect(procedure.steps[1]).toContain('yarn start');
|
|
234
|
-
expect(procedure.steps[2]).toContain('yarn windows');
|
|
235
|
-
expect(procedure.steps[3]).toContain('yarn windows --release');
|
|
236
|
-
});
|
|
237
193
|
});
|
|
238
194
|
});
|
|
239
195
|
describe('creaternwapp Configuration Tests - Preview Version', () => {
|
|
@@ -262,14 +218,8 @@ describe('creaternwapp Configuration Tests - Preview Version', () => {
|
|
|
262
218
|
// Default template should be cpp-app (fabric/new arch)
|
|
263
219
|
expect(scriptContent).toContain('set RNW_TEMPLATE_TYPE=cpp-app');
|
|
264
220
|
});
|
|
265
|
-
test('should validate old UWP templates are available', () => {
|
|
266
|
-
const oldTemplatesDir = path.join(repoRoot, 'vnext/templates/old');
|
|
267
|
-
expect(fs_1.default.existsSync(oldTemplatesDir)).toBe(true);
|
|
268
|
-
const uwpCppAppTemplate = path.join(oldTemplatesDir, 'uwp-cpp-app');
|
|
269
|
-
expect(fs_1.default.existsSync(uwpCppAppTemplate)).toBe(true);
|
|
270
|
-
});
|
|
271
221
|
test('should validate new fabric templates are available', () => {
|
|
272
|
-
const newTemplatesDir = path.join(repoRoot, 'vnext/
|
|
222
|
+
const newTemplatesDir = path.join(repoRoot, 'vnext/templates');
|
|
273
223
|
expect(fs_1.default.existsSync(newTemplatesDir)).toBe(true);
|
|
274
224
|
const cppAppTemplate = path.join(newTemplatesDir, 'cpp-app');
|
|
275
225
|
expect(fs_1.default.existsSync(cppAppTemplate)).toBe(true);
|
|
@@ -301,14 +251,6 @@ describe('creaternwapp Configuration Tests - Preview Version', () => {
|
|
|
301
251
|
expect(expectedCommand).toContain('test-app-name');
|
|
302
252
|
expect(expectedCommand).not.toContain('/t'); // No template specified = default fabric
|
|
303
253
|
});
|
|
304
|
-
test('should validate old architecture (paper/UWP) command structure', () => {
|
|
305
|
-
// Test the command that would be used for old arch:
|
|
306
|
-
// creaternwapp.cmd /rnw preview /t old/uwp-cpp-app test-app-name
|
|
307
|
-
const expectedCommand = `creaternwapp.cmd /rnw preview /t old/uwp-cpp-app test-app-name`;
|
|
308
|
-
expect(expectedCommand).toContain('/rnw preview');
|
|
309
|
-
expect(expectedCommand).toContain('/t old/uwp-cpp-app');
|
|
310
|
-
expect(expectedCommand).toContain('test-app-name');
|
|
311
|
-
});
|
|
312
254
|
test('should validate yarn windows command variations', () => {
|
|
313
255
|
// Test the commands that would be used to build apps:
|
|
314
256
|
const debugCommand = 'yarn windows';
|
|
@@ -332,20 +274,6 @@ describe('creaternwapp Configuration Tests - Preview Version', () => {
|
|
|
332
274
|
expect(workflow.buildDebug).toBe('yarn windows');
|
|
333
275
|
expect(workflow.buildRelease).toBe('yarn windows --release');
|
|
334
276
|
});
|
|
335
|
-
test('should validate complete old architecture workflow commands', () => {
|
|
336
|
-
const workflow = {
|
|
337
|
-
create: `creaternwapp.cmd /rnw ${RNW_VERSION} /t old/uwp-cpp-app TestAppPaper`,
|
|
338
|
-
start: 'yarn start',
|
|
339
|
-
buildDebug: 'yarn windows',
|
|
340
|
-
buildRelease: 'yarn windows --release',
|
|
341
|
-
};
|
|
342
|
-
expect(workflow.create).toContain(RNW_VERSION);
|
|
343
|
-
expect(workflow.create).toContain('/t old/uwp-cpp-app');
|
|
344
|
-
expect(workflow.create).toContain('TestAppPaper');
|
|
345
|
-
expect(workflow.start).toBe('yarn start');
|
|
346
|
-
expect(workflow.buildDebug).toBe('yarn windows');
|
|
347
|
-
expect(workflow.buildRelease).toBe('yarn windows --release');
|
|
348
|
-
});
|
|
349
277
|
});
|
|
350
278
|
describe('Documentation and Example Validation', () => {
|
|
351
279
|
test('should document the testing procedure for new architecture', () => {
|
|
@@ -363,22 +291,6 @@ describe('creaternwapp Configuration Tests - Preview Version', () => {
|
|
|
363
291
|
expect(procedure.steps[2]).toContain('yarn windows');
|
|
364
292
|
expect(procedure.steps[3]).toContain('yarn windows --release');
|
|
365
293
|
});
|
|
366
|
-
test('should document the testing procedure for old architecture', () => {
|
|
367
|
-
const procedure = {
|
|
368
|
-
title: 'Old Architecture (Paper/UWP) Testing',
|
|
369
|
-
steps: [
|
|
370
|
-
`creaternwapp.cmd /rnw ${RNW_VERSION} /t old/uwp-cpp-app test-app-name`,
|
|
371
|
-
'yarn start (in test-app-name path)',
|
|
372
|
-
'cd test-app-name && yarn windows',
|
|
373
|
-
'cd test-app-name && yarn windows --release',
|
|
374
|
-
],
|
|
375
|
-
};
|
|
376
|
-
expect(procedure.steps[0]).toContain(RNW_VERSION);
|
|
377
|
-
expect(procedure.steps[0]).toContain('/t old/uwp-cpp-app');
|
|
378
|
-
expect(procedure.steps[1]).toContain('yarn start');
|
|
379
|
-
expect(procedure.steps[2]).toContain('yarn windows');
|
|
380
|
-
expect(procedure.steps[3]).toContain('yarn windows --release');
|
|
381
|
-
});
|
|
382
294
|
});
|
|
383
295
|
});
|
|
384
296
|
//# sourceMappingURL=createRnwApp.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRnwApp.test.js","sourceRoot":"","sources":["../../src/e2etest/createRnwApp.test.ts"],"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AAC,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;YACrD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,4DAA4D,EAAE,GAAG,EAAE;YACtE,MAAM,SAAS,GAAG;gBAChB,KAAK,EAAE,sCAAsC;gBAC7C,KAAK,EAAE;oBACL,yBAAyB,WAAW,mCAAmC;oBACvE,oCAAoC;oBACpC,kCAAkC;oBAClC,4CAA4C;iBAC7C;aACF,CAAC;YAEF,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YAClD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;YAC3D,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YACnD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;YACrD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n * @format\n */\n\nimport fs from '@react-native-windows/fs';\nimport * as path from 'path';\nimport {execSync} from 'child_process';\n\n/**\n * Get latest stable version from npm\n */\nfunction getLatestStableVersion(): string {\n try {\n return execSync('npm view react-native-windows version', {\n encoding: 'utf8',\n }).trim();\n } catch (error) {\n throw new Error(`Could not fetch latest stable version from npm: ${error}`);\n }\n}\n\n/**\n * Get latest preview version from npm\n */\nfunction getLatestPreviewVersion(): string | undefined {\n try {\n const versions = JSON.parse(\n execSync('npm view react-native-windows versions --json', {\n encoding: 'utf8',\n }),\n ) as string[];\n // Preview versions usually have \"preview\" in the string\n return versions.reverse().find(v => v.includes('preview'));\n } catch (error) {\n console.warn('Could not fetch preview versions from npm:', error);\n return undefined;\n }\n}\n\nconst LATEST_STABLE_VERSION = getLatestStableVersion();\nconst LATEST_PREVIEW_VERSION = getLatestPreviewVersion();\n\n// Ensure we have valid versions for testing\nif (!LATEST_STABLE_VERSION) {\n throw new Error('Could not fetch latest stable version from npm');\n}\nif (!LATEST_PREVIEW_VERSION) {\n throw new Error('Could not fetch latest preview version from npm');\n}\n\n/**\n * Mock NPM registry response for version check\n */\nconst mockNpmShow = (packageNameWithVersion: string, version: string) => {\n if (packageNameWithVersion === `react-native-windows@${version}`) {\n const rnVersion = `^${version.split('-')[0]}`;\n return {\n version: version,\n devDependencies: {\n 'react-native': rnVersion,\n },\n dependencies: {\n '@react-native-community/cli': '^17.0.0',\n },\n };\n }\n return null;\n};\n\n// Test suites for stable and preview versions\ndescribe('creaternwapp Configuration Tests - Stable Version', () => {\n const repoRoot = path.resolve(__dirname, '../../../../..');\n const createRnwAppScript = path.join(\n repoRoot,\n 'vnext/Scripts/creaternwapp.cmd',\n );\n const RNW_VERSION = LATEST_STABLE_VERSION;\n\n beforeAll(() => {\n // Verify the script exists in the repository\n expect(fs.existsSync(createRnwAppScript)).toBe(true);\n\n // Verify we have a stable version to test\n expect(RNW_VERSION).toBeTruthy();\n expect(RNW_VERSION).not.toContain('preview');\n });\n\n describe('Script Configuration Validation', () => {\n test('creaternwapp.cmd script should exist and be readable', () => {\n expect(fs.existsSync(createRnwAppScript)).toBe(true);\n\n const scriptContent = fs.readFileSync(createRnwAppScript, 'utf8');\n\n // Verify script contains expected parameters\n expect(scriptContent).toContain('/rnw');\n expect(scriptContent).toContain('/t');\n expect(scriptContent).toContain('/verdaccio');\n expect(scriptContent).toContain('cpp-app');\n });\n\n test('should validate fabric template is the default', () => {\n const scriptContent = fs.readFileSync(createRnwAppScript, 'utf8');\n\n // Default template should be cpp-app (fabric/new arch)\n expect(scriptContent).toContain('set RNW_TEMPLATE_TYPE=cpp-app');\n });\n\n test('should validate old UWP templates are available', () => {\n const oldTemplatesDir = path.join(repoRoot, 'vnext/templates/old');\n expect(fs.existsSync(oldTemplatesDir)).toBe(true);\n\n const uwpCppAppTemplate = path.join(oldTemplatesDir, 'uwp-cpp-app');\n expect(fs.existsSync(uwpCppAppTemplate)).toBe(true);\n });\n\n test('should validate new fabric templates are available', () => {\n const newTemplatesDir = path.join(repoRoot, 'vnext/template');\n expect(fs.existsSync(newTemplatesDir)).toBe(true);\n\n const cppAppTemplate = path.join(newTemplatesDir, 'cpp-app');\n expect(fs.existsSync(cppAppTemplate)).toBe(true);\n });\n });\n\n describe('Version Configuration Tests', () => {\n test('should validate target version is available', async () => {\n // This test validates that the specified version exists in npm\n // In a real environment, this would use npm show to check the version\n expect(RNW_VERSION).toBeTruthy();\n\n // Mock version validation - in actual Windows CI this would call npm show\n const versionInfo = mockNpmShow(\n `react-native-windows@${RNW_VERSION}`,\n RNW_VERSION,\n );\n expect(versionInfo).toBeTruthy();\n expect(versionInfo?.version).toBe(RNW_VERSION);\n });\n\n test('should validate required dependencies for target version', () => {\n const versionInfo = mockNpmShow(\n `react-native-windows@${RNW_VERSION}`,\n RNW_VERSION,\n );\n\n // Validate that the version has the expected dependency structure\n expect(versionInfo?.devDependencies).toHaveProperty('react-native');\n expect(versionInfo?.dependencies).toHaveProperty(\n '@react-native-community/cli',\n );\n });\n });\n\n describe('Template Configuration Tests', () => {\n test('should validate new architecture (fabric) command structure', () => {\n // Test the command that would be used for new arch:\n // creaternwapp.cmd /rnw preview test-app-name\n const expectedCommand = `creaternwapp.cmd /rnw preview test-app-name`;\n\n expect(expectedCommand).toContain('/rnw preview');\n expect(expectedCommand).toContain('test-app-name');\n expect(expectedCommand).not.toContain('/t'); // No template specified = default fabric\n });\n\n test('should validate old architecture (paper/UWP) command structure', () => {\n // Test the command that would be used for old arch:\n // creaternwapp.cmd /rnw preview /t old/uwp-cpp-app test-app-name\n const expectedCommand = `creaternwapp.cmd /rnw preview /t old/uwp-cpp-app test-app-name`;\n\n expect(expectedCommand).toContain('/rnw preview');\n expect(expectedCommand).toContain('/t old/uwp-cpp-app');\n expect(expectedCommand).toContain('test-app-name');\n });\n\n test('should validate yarn windows command variations', () => {\n // Test the commands that would be used to build apps:\n const debugCommand = 'yarn windows';\n const releaseCommand = 'yarn windows --release';\n\n expect(debugCommand).toBe('yarn windows');\n expect(releaseCommand).toBe('yarn windows --release');\n expect(releaseCommand).toContain('--release');\n });\n });\n\n describe('Workflow Integration Tests', () => {\n test('should validate complete new architecture workflow commands', () => {\n const workflow = {\n create: `creaternwapp.cmd /rnw ${RNW_VERSION} TestAppFabric`,\n start: 'yarn start',\n buildDebug: 'yarn windows',\n buildRelease: 'yarn windows --release',\n };\n\n expect(workflow.create).toContain(RNW_VERSION);\n expect(workflow.create).toContain('TestAppFabric');\n expect(workflow.start).toBe('yarn start');\n expect(workflow.buildDebug).toBe('yarn windows');\n expect(workflow.buildRelease).toBe('yarn windows --release');\n });\n\n test('should validate complete old architecture workflow commands', () => {\n const workflow = {\n create: `creaternwapp.cmd /rnw ${RNW_VERSION} /t old/uwp-cpp-app TestAppPaper`,\n start: 'yarn start',\n buildDebug: 'yarn windows',\n buildRelease: 'yarn windows --release',\n };\n\n expect(workflow.create).toContain(RNW_VERSION);\n expect(workflow.create).toContain('/t old/uwp-cpp-app');\n expect(workflow.create).toContain('TestAppPaper');\n expect(workflow.start).toBe('yarn start');\n expect(workflow.buildDebug).toBe('yarn windows');\n expect(workflow.buildRelease).toBe('yarn windows --release');\n });\n });\n\n describe('Documentation and Example Validation', () => {\n test('should document the testing procedure for new architecture', () => {\n const procedure = {\n title: 'New Architecture (Fabric) Testing',\n steps: [\n `creaternwapp.cmd /rnw ${RNW_VERSION} test-app-name`,\n 'yarn start (in test-app-name path)',\n 'cd test-app-name && yarn windows',\n 'cd test-app-name && yarn windows --release',\n ],\n };\n\n expect(procedure.steps[0]).toContain(RNW_VERSION);\n expect(procedure.steps[1]).toContain('yarn start');\n expect(procedure.steps[2]).toContain('yarn windows');\n expect(procedure.steps[3]).toContain('yarn windows --release');\n });\n\n test('should document the testing procedure for old architecture', () => {\n const procedure = {\n title: 'Old Architecture (Paper/UWP) Testing',\n steps: [\n `creaternwapp.cmd /rnw ${RNW_VERSION} /t old/uwp-cpp-app test-app-name`,\n 'yarn start (in test-app-name path)',\n 'cd test-app-name && yarn windows',\n 'cd test-app-name && yarn windows --release',\n ],\n };\n\n expect(procedure.steps[0]).toContain(RNW_VERSION);\n expect(procedure.steps[0]).toContain('/t old/uwp-cpp-app');\n expect(procedure.steps[1]).toContain('yarn start');\n expect(procedure.steps[2]).toContain('yarn windows');\n expect(procedure.steps[3]).toContain('yarn windows --release');\n });\n });\n});\n\ndescribe('creaternwapp Configuration Tests - Preview Version', () => {\n const repoRoot = path.resolve(__dirname, '../../../../..');\n const createRnwAppScript = path.join(\n repoRoot,\n 'vnext/Scripts/creaternwapp.cmd',\n );\n const RNW_VERSION = LATEST_PREVIEW_VERSION;\n\n beforeAll(() => {\n // Verify the script exists in the repository\n expect(fs.existsSync(createRnwAppScript)).toBe(true);\n\n // Verify we have a preview version to test\n expect(RNW_VERSION).toBeTruthy();\n expect(RNW_VERSION).toContain('preview');\n });\n\n describe('Script Configuration Validation', () => {\n test('creaternwapp.cmd script should exist and be readable', () => {\n expect(fs.existsSync(createRnwAppScript)).toBe(true);\n\n const scriptContent = fs.readFileSync(createRnwAppScript, 'utf8');\n\n // Verify script contains expected parameters\n expect(scriptContent).toContain('/rnw');\n expect(scriptContent).toContain('/t');\n expect(scriptContent).toContain('/verdaccio');\n expect(scriptContent).toContain('cpp-app');\n });\n\n test('should validate fabric template is the default', () => {\n const scriptContent = fs.readFileSync(createRnwAppScript, 'utf8');\n\n // Default template should be cpp-app (fabric/new arch)\n expect(scriptContent).toContain('set RNW_TEMPLATE_TYPE=cpp-app');\n });\n\n test('should validate old UWP templates are available', () => {\n const oldTemplatesDir = path.join(repoRoot, 'vnext/templates/old');\n expect(fs.existsSync(oldTemplatesDir)).toBe(true);\n\n const uwpCppAppTemplate = path.join(oldTemplatesDir, 'uwp-cpp-app');\n expect(fs.existsSync(uwpCppAppTemplate)).toBe(true);\n });\n\n test('should validate new fabric templates are available', () => {\n const newTemplatesDir = path.join(repoRoot, 'vnext/template');\n expect(fs.existsSync(newTemplatesDir)).toBe(true);\n\n const cppAppTemplate = path.join(newTemplatesDir, 'cpp-app');\n expect(fs.existsSync(cppAppTemplate)).toBe(true);\n });\n });\n\n describe('Version Configuration Tests', () => {\n test('should validate target version is available', async () => {\n // This test validates that the specified version exists in npm\n // In a real environment, this would use npm show to check the version\n expect(RNW_VERSION).toBeTruthy();\n\n // Mock version validation - in actual Windows CI this would call npm show\n const versionInfo = mockNpmShow(\n `react-native-windows@${RNW_VERSION}`,\n RNW_VERSION,\n );\n expect(versionInfo).toBeTruthy();\n expect(versionInfo?.version).toBe(RNW_VERSION);\n });\n\n test('should validate required dependencies for target version', () => {\n const versionInfo = mockNpmShow(\n `react-native-windows@${RNW_VERSION}`,\n RNW_VERSION,\n );\n\n // Validate that the version has the expected dependency structure\n expect(versionInfo?.devDependencies).toHaveProperty('react-native');\n expect(versionInfo?.dependencies).toHaveProperty(\n '@react-native-community/cli',\n );\n });\n });\n\n describe('Template Configuration Tests', () => {\n test('should validate new architecture (fabric) command structure', () => {\n // Test the command that would be used for new arch:\n // creaternwapp.cmd /rnw preview test-app-name\n const expectedCommand = `creaternwapp.cmd /rnw preview test-app-name`;\n\n expect(expectedCommand).toContain('/rnw preview');\n expect(expectedCommand).toContain('test-app-name');\n expect(expectedCommand).not.toContain('/t'); // No template specified = default fabric\n });\n\n test('should validate old architecture (paper/UWP) command structure', () => {\n // Test the command that would be used for old arch:\n // creaternwapp.cmd /rnw preview /t old/uwp-cpp-app test-app-name\n const expectedCommand = `creaternwapp.cmd /rnw preview /t old/uwp-cpp-app test-app-name`;\n\n expect(expectedCommand).toContain('/rnw preview');\n expect(expectedCommand).toContain('/t old/uwp-cpp-app');\n expect(expectedCommand).toContain('test-app-name');\n });\n\n test('should validate yarn windows command variations', () => {\n // Test the commands that would be used to build apps:\n const debugCommand = 'yarn windows';\n const releaseCommand = 'yarn windows --release';\n\n expect(debugCommand).toBe('yarn windows');\n expect(releaseCommand).toBe('yarn windows --release');\n expect(releaseCommand).toContain('--release');\n });\n });\n\n describe('Workflow Integration Tests', () => {\n test('should validate complete new architecture workflow commands', () => {\n const workflow = {\n create: `creaternwapp.cmd /rnw ${RNW_VERSION} TestAppFabric`,\n start: 'yarn start',\n buildDebug: 'yarn windows',\n buildRelease: 'yarn windows --release',\n };\n\n expect(workflow.create).toContain(RNW_VERSION);\n expect(workflow.create).toContain('TestAppFabric');\n expect(workflow.start).toBe('yarn start');\n expect(workflow.buildDebug).toBe('yarn windows');\n expect(workflow.buildRelease).toBe('yarn windows --release');\n });\n\n test('should validate complete old architecture workflow commands', () => {\n const workflow = {\n create: `creaternwapp.cmd /rnw ${RNW_VERSION} /t old/uwp-cpp-app TestAppPaper`,\n start: 'yarn start',\n buildDebug: 'yarn windows',\n buildRelease: 'yarn windows --release',\n };\n\n expect(workflow.create).toContain(RNW_VERSION);\n expect(workflow.create).toContain('/t old/uwp-cpp-app');\n expect(workflow.create).toContain('TestAppPaper');\n expect(workflow.start).toBe('yarn start');\n expect(workflow.buildDebug).toBe('yarn windows');\n expect(workflow.buildRelease).toBe('yarn windows --release');\n });\n });\n\n describe('Documentation and Example Validation', () => {\n test('should document the testing procedure for new architecture', () => {\n const procedure = {\n title: 'New Architecture (Fabric) Testing',\n steps: [\n `creaternwapp.cmd /rnw ${RNW_VERSION} test-app-name`,\n 'yarn start (in test-app-name path)',\n 'cd test-app-name && yarn windows',\n 'cd test-app-name && yarn windows --release',\n ],\n };\n\n expect(procedure.steps[0]).toContain(RNW_VERSION);\n expect(procedure.steps[1]).toContain('yarn start');\n expect(procedure.steps[2]).toContain('yarn windows');\n expect(procedure.steps[3]).toContain('yarn windows --release');\n });\n\n test('should document the testing procedure for old architecture', () => {\n const procedure = {\n title: 'Old Architecture (Paper/UWP) Testing',\n steps: [\n `creaternwapp.cmd /rnw ${RNW_VERSION} /t old/uwp-cpp-app test-app-name`,\n 'yarn start (in test-app-name path)',\n 'cd test-app-name && yarn windows',\n 'cd test-app-name && yarn windows --release',\n ],\n };\n\n expect(procedure.steps[0]).toContain(RNW_VERSION);\n expect(procedure.steps[0]).toContain('/t old/uwp-cpp-app');\n expect(procedure.steps[1]).toContain('yarn start');\n expect(procedure.steps[2]).toContain('yarn windows');\n expect(procedure.steps[3]).toContain('yarn windows --release');\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"createRnwApp.test.js","sourceRoot":"","sources":["../../src/e2etest/createRnwApp.test.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAA0C;AAC1C,2CAA6B;AAC7B,iDAAuC;AAEvC;;GAEG;AACH,SAAS,sBAAsB;IAC7B,IAAI;QACF,OAAO,IAAA,wBAAQ,EAAC,uCAAuC,EAAE;YACvD,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC,IAAI,EAAE,CAAC;KACX;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,mDAAmD,KAAK,EAAE,CAAC,CAAC;KAC7E;AACH,CAAC;AAED;;GAEG;AACH,SAAS,uBAAuB;IAC9B,IAAI;QACF,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CACzB,IAAA,wBAAQ,EAAC,+CAA+C,EAAE;YACxD,QAAQ,EAAE,MAAM;SACjB,CAAC,CACS,CAAC;QACd,wDAAwD;QACxD,OAAO,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE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,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;QACpD,IAAI,CAAC,4DAA4D,EAAE,GAAG,EAAE;YACtE,MAAM,SAAS,GAAG;gBAChB,KAAK,EAAE,mCAAmC;gBAC1C,KAAK,EAAE;oBACL,yBAAyB,WAAW,gBAAgB;oBACpD,oCAAoC;oBACpC,kCAAkC;oBAClC,4CAA4C;iBAC7C;aACF,CAAC;YAEF,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YAClD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YACnD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;YACrD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n * @format\n */\n\nimport fs from '@react-native-windows/fs';\nimport * as path from 'path';\nimport {execSync} from 'child_process';\n\n/**\n * Get latest stable version from npm\n */\nfunction getLatestStableVersion(): string {\n try {\n return execSync('npm view react-native-windows version', {\n encoding: 'utf8',\n }).trim();\n } catch (error) {\n throw new Error(`Could not fetch latest stable version from npm: ${error}`);\n }\n}\n\n/**\n * Get latest preview version from npm\n */\nfunction getLatestPreviewVersion(): string | undefined {\n try {\n const versions = JSON.parse(\n execSync('npm view react-native-windows versions --json', {\n encoding: 'utf8',\n }),\n ) as string[];\n // Preview versions usually have \"preview\" in the string\n return versions.reverse().find(v => v.includes('preview'));\n } catch (error) {\n console.warn('Could not fetch preview versions from npm:', error);\n return undefined;\n }\n}\n\nconst LATEST_STABLE_VERSION = getLatestStableVersion();\nconst LATEST_PREVIEW_VERSION = getLatestPreviewVersion();\n\n// Ensure we have valid versions for testing\nif (!LATEST_STABLE_VERSION) {\n throw new Error('Could not fetch latest stable version from npm');\n}\nif (!LATEST_PREVIEW_VERSION) {\n throw new Error('Could not fetch latest preview version from npm');\n}\n\n/**\n * Mock NPM registry response for version check\n */\nconst mockNpmShow = (packageNameWithVersion: string, version: string) => {\n if (packageNameWithVersion === `react-native-windows@${version}`) {\n const rnVersion = `^${version.split('-')[0]}`;\n return {\n version: version,\n devDependencies: {\n 'react-native': rnVersion,\n },\n dependencies: {\n '@react-native-community/cli': '^17.0.0',\n },\n };\n }\n return null;\n};\n\n// Test suites for stable and preview versions\ndescribe('creaternwapp Configuration Tests - Stable Version', () => {\n const repoRoot = path.resolve(__dirname, '../../../../..');\n const createRnwAppScript = path.join(\n repoRoot,\n 'vnext/Scripts/creaternwapp.cmd',\n );\n const RNW_VERSION = LATEST_STABLE_VERSION;\n\n beforeAll(() => {\n // Verify the script exists in the repository\n expect(fs.existsSync(createRnwAppScript)).toBe(true);\n\n // Verify we have a stable version to test\n expect(RNW_VERSION).toBeTruthy();\n expect(RNW_VERSION).not.toContain('preview');\n });\n\n describe('Script Configuration Validation', () => {\n test('creaternwapp.cmd script should exist and be readable', () => {\n expect(fs.existsSync(createRnwAppScript)).toBe(true);\n\n const scriptContent = fs.readFileSync(createRnwAppScript, 'utf8');\n\n // Verify script contains expected parameters\n expect(scriptContent).toContain('/rnw');\n expect(scriptContent).toContain('/t');\n expect(scriptContent).toContain('/verdaccio');\n expect(scriptContent).toContain('cpp-app');\n });\n\n test('should validate fabric template is the default', () => {\n const scriptContent = fs.readFileSync(createRnwAppScript, 'utf8');\n\n // Default template should be cpp-app (fabric/new arch)\n expect(scriptContent).toContain('set RNW_TEMPLATE_TYPE=cpp-app');\n });\n\n test('should validate new fabric templates are available', () => {\n const newTemplatesDir = path.join(repoRoot, 'vnext/templates');\n expect(fs.existsSync(newTemplatesDir)).toBe(true);\n\n const cppAppTemplate = path.join(newTemplatesDir, 'cpp-app');\n expect(fs.existsSync(cppAppTemplate)).toBe(true);\n });\n });\n\n describe('Version Configuration Tests', () => {\n test('should validate target version is available', async () => {\n // This test validates that the specified version exists in npm\n // In a real environment, this would use npm show to check the version\n expect(RNW_VERSION).toBeTruthy();\n\n // Mock version validation - in actual Windows CI this would call npm show\n const versionInfo = mockNpmShow(\n `react-native-windows@${RNW_VERSION}`,\n RNW_VERSION,\n );\n expect(versionInfo).toBeTruthy();\n expect(versionInfo?.version).toBe(RNW_VERSION);\n });\n\n test('should validate required dependencies for target version', () => {\n const versionInfo = mockNpmShow(\n `react-native-windows@${RNW_VERSION}`,\n RNW_VERSION,\n );\n\n // Validate that the version has the expected dependency structure\n expect(versionInfo?.devDependencies).toHaveProperty('react-native');\n expect(versionInfo?.dependencies).toHaveProperty(\n '@react-native-community/cli',\n );\n });\n });\n\n describe('Template Configuration Tests', () => {\n test('should validate new architecture (fabric) command structure', () => {\n // Test the command that would be used for new arch:\n // creaternwapp.cmd /rnw preview test-app-name\n const expectedCommand = `creaternwapp.cmd /rnw preview test-app-name`;\n\n expect(expectedCommand).toContain('/rnw preview');\n expect(expectedCommand).toContain('test-app-name');\n expect(expectedCommand).not.toContain('/t'); // No template specified = default fabric\n });\n\n test('should validate yarn windows command variations', () => {\n // Test the commands that would be used to build apps:\n const debugCommand = 'yarn windows';\n const releaseCommand = 'yarn windows --release';\n\n expect(debugCommand).toBe('yarn windows');\n expect(releaseCommand).toBe('yarn windows --release');\n expect(releaseCommand).toContain('--release');\n });\n });\n\n describe('Workflow Integration Tests', () => {\n test('should validate complete new architecture workflow commands', () => {\n const workflow = {\n create: `creaternwapp.cmd /rnw ${RNW_VERSION} TestAppFabric`,\n start: 'yarn start',\n buildDebug: 'yarn windows',\n buildRelease: 'yarn windows --release',\n };\n\n expect(workflow.create).toContain(RNW_VERSION);\n expect(workflow.create).toContain('TestAppFabric');\n expect(workflow.start).toBe('yarn start');\n expect(workflow.buildDebug).toBe('yarn windows');\n expect(workflow.buildRelease).toBe('yarn windows --release');\n });\n });\n\n describe('Documentation and Example Validation', () => {\n test('should document the testing procedure for new architecture', () => {\n const procedure = {\n title: 'New Architecture (Fabric) Testing',\n steps: [\n `creaternwapp.cmd /rnw ${RNW_VERSION} test-app-name`,\n 'yarn start (in test-app-name path)',\n 'cd test-app-name && yarn windows',\n 'cd test-app-name && yarn windows --release',\n ],\n };\n\n expect(procedure.steps[0]).toContain(RNW_VERSION);\n expect(procedure.steps[1]).toContain('yarn start');\n expect(procedure.steps[2]).toContain('yarn windows');\n expect(procedure.steps[3]).toContain('yarn windows --release');\n });\n });\n});\n\ndescribe('creaternwapp Configuration Tests - Preview Version', () => {\n const repoRoot = path.resolve(__dirname, '../../../../..');\n const createRnwAppScript = path.join(\n repoRoot,\n 'vnext/Scripts/creaternwapp.cmd',\n );\n const RNW_VERSION = LATEST_PREVIEW_VERSION;\n\n beforeAll(() => {\n // Verify the script exists in the repository\n expect(fs.existsSync(createRnwAppScript)).toBe(true);\n\n // Verify we have a preview version to test\n expect(RNW_VERSION).toBeTruthy();\n expect(RNW_VERSION).toContain('preview');\n });\n\n describe('Script Configuration Validation', () => {\n test('creaternwapp.cmd script should exist and be readable', () => {\n expect(fs.existsSync(createRnwAppScript)).toBe(true);\n\n const scriptContent = fs.readFileSync(createRnwAppScript, 'utf8');\n\n // Verify script contains expected parameters\n expect(scriptContent).toContain('/rnw');\n expect(scriptContent).toContain('/t');\n expect(scriptContent).toContain('/verdaccio');\n expect(scriptContent).toContain('cpp-app');\n });\n\n test('should validate fabric template is the default', () => {\n const scriptContent = fs.readFileSync(createRnwAppScript, 'utf8');\n\n // Default template should be cpp-app (fabric/new arch)\n expect(scriptContent).toContain('set RNW_TEMPLATE_TYPE=cpp-app');\n });\n\n test('should validate new fabric templates are available', () => {\n const newTemplatesDir = path.join(repoRoot, 'vnext/templates');\n expect(fs.existsSync(newTemplatesDir)).toBe(true);\n\n const cppAppTemplate = path.join(newTemplatesDir, 'cpp-app');\n expect(fs.existsSync(cppAppTemplate)).toBe(true);\n });\n });\n\n describe('Version Configuration Tests', () => {\n test('should validate target version is available', async () => {\n // This test validates that the specified version exists in npm\n // In a real environment, this would use npm show to check the version\n expect(RNW_VERSION).toBeTruthy();\n\n // Mock version validation - in actual Windows CI this would call npm show\n const versionInfo = mockNpmShow(\n `react-native-windows@${RNW_VERSION}`,\n RNW_VERSION,\n );\n expect(versionInfo).toBeTruthy();\n expect(versionInfo?.version).toBe(RNW_VERSION);\n });\n\n test('should validate required dependencies for target version', () => {\n const versionInfo = mockNpmShow(\n `react-native-windows@${RNW_VERSION}`,\n RNW_VERSION,\n );\n\n // Validate that the version has the expected dependency structure\n expect(versionInfo?.devDependencies).toHaveProperty('react-native');\n expect(versionInfo?.dependencies).toHaveProperty(\n '@react-native-community/cli',\n );\n });\n });\n\n describe('Template Configuration Tests', () => {\n test('should validate new architecture (fabric) command structure', () => {\n // Test the command that would be used for new arch:\n // creaternwapp.cmd /rnw preview test-app-name\n const expectedCommand = `creaternwapp.cmd /rnw preview test-app-name`;\n\n expect(expectedCommand).toContain('/rnw preview');\n expect(expectedCommand).toContain('test-app-name');\n expect(expectedCommand).not.toContain('/t'); // No template specified = default fabric\n });\n\n test('should validate yarn windows command variations', () => {\n // Test the commands that would be used to build apps:\n const debugCommand = 'yarn windows';\n const releaseCommand = 'yarn windows --release';\n\n expect(debugCommand).toBe('yarn windows');\n expect(releaseCommand).toBe('yarn windows --release');\n expect(releaseCommand).toContain('--release');\n });\n });\n\n describe('Workflow Integration Tests', () => {\n test('should validate complete new architecture workflow commands', () => {\n const workflow = {\n create: `creaternwapp.cmd /rnw ${RNW_VERSION} TestAppFabric`,\n start: 'yarn start',\n buildDebug: 'yarn windows',\n buildRelease: 'yarn windows --release',\n };\n\n expect(workflow.create).toContain(RNW_VERSION);\n expect(workflow.create).toContain('TestAppFabric');\n expect(workflow.start).toBe('yarn start');\n expect(workflow.buildDebug).toBe('yarn windows');\n expect(workflow.buildRelease).toBe('yarn windows --release');\n });\n });\n\n describe('Documentation and Example Validation', () => {\n test('should document the testing procedure for new architecture', () => {\n const procedure = {\n title: 'New Architecture (Fabric) Testing',\n steps: [\n `creaternwapp.cmd /rnw ${RNW_VERSION} test-app-name`,\n 'yarn start (in test-app-name path)',\n 'cd test-app-name && yarn windows',\n 'cd test-app-name && yarn windows --release',\n ],\n };\n\n expect(procedure.steps[0]).toContain(RNW_VERSION);\n expect(procedure.steps[1]).toContain('yarn start');\n expect(procedure.steps[2]).toContain('yarn windows');\n expect(procedure.steps[3]).toContain('yarn windows --release');\n });\n });\n});\n"]}
|
|
@@ -38,30 +38,10 @@ const projects = [
|
|
|
38
38
|
projectGuidUpper: projectConfig_utils_1.testProjectGuid,
|
|
39
39
|
projectGuidLower: projectConfig_utils_1.testProjectGuid.toLowerCase(),
|
|
40
40
|
};
|
|
41
|
-
await (0, generator_common_1.copyAndReplace)(path_1.default.join(projectConfig_utils_1.templateRoot, 'cpp-lib/
|
|
41
|
+
await (0, generator_common_1.copyAndReplace)(path_1.default.join(projectConfig_utils_1.templateRoot, 'cpp-lib/windows/MyLib.sln'), path_1.default.join(windowsDir, 'SimpleCppLib.sln'), replacements, null);
|
|
42
42
|
const projDir = path_1.default.join(windowsDir, 'SimpleCppLib');
|
|
43
43
|
await (0, projectConfig_utils_1.tryMkdir)(projDir);
|
|
44
|
-
await (0, generator_common_1.copyAndReplace)(path_1.default.join(projectConfig_utils_1.templateRoot, 'cpp-lib/
|
|
45
|
-
}),
|
|
46
|
-
// New C# app project based on the template
|
|
47
|
-
project('SimpleCSharpApp', async (folder) => {
|
|
48
|
-
await (0, projectConfig_utils_1.ensureCSharpAppProject)(folder, 'SimpleCSharpApp');
|
|
49
|
-
}),
|
|
50
|
-
// New C# project based on the template
|
|
51
|
-
project('SimpleCSharpLib', async (folder) => {
|
|
52
|
-
const windowsDir = path_1.default.join(folder, 'windows');
|
|
53
|
-
await (0, projectConfig_utils_1.tryMkdir)(windowsDir);
|
|
54
|
-
const replacements = {
|
|
55
|
-
name: 'SimpleCSharpLib',
|
|
56
|
-
namespace: 'SimpleCSharpLib',
|
|
57
|
-
useMustache: true,
|
|
58
|
-
projectGuidUpper: projectConfig_utils_1.testProjectGuid,
|
|
59
|
-
projectGuidLower: projectConfig_utils_1.testProjectGuid.toLowerCase(),
|
|
60
|
-
};
|
|
61
|
-
await (0, generator_common_1.copyAndReplace)(path_1.default.join(projectConfig_utils_1.templateRoot, 'cs-lib/proj/MyLib.sln'), path_1.default.join(windowsDir, 'SimpleCSharpLib.sln'), replacements, null);
|
|
62
|
-
const projDir = path_1.default.join(windowsDir, 'SimpleCSharpLib');
|
|
63
|
-
await (0, projectConfig_utils_1.tryMkdir)(projDir);
|
|
64
|
-
await (0, generator_common_1.copyAndReplace)(path_1.default.join(projectConfig_utils_1.templateRoot, 'cs-lib/proj/MyLib.csproj'), path_1.default.join(projDir, 'SimpleCSharpLib.csproj'), replacements, null);
|
|
44
|
+
await (0, generator_common_1.copyAndReplace)(path_1.default.join(projectConfig_utils_1.templateRoot, 'cpp-lib/windows/MyLib/MyLib.vcxproj'), path_1.default.join(projDir, 'SimpleCppLib.vcxproj'), replacements, null);
|
|
65
45
|
}),
|
|
66
46
|
project('WithIndirectDependency'),
|
|
67
47
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyConfig.test.js","sourceRoot":"","sources":["../../src/e2etest/dependencyConfig.test.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AAEH,gDAAwB;AAExB,0EAG6C;AAE7C,+DAM+B;AAE/B,0DAAmD;AAInD,SAAS,OAAO,CACd,IAAY,EACZ,KAAyC;IAEzC,OAAO,CAAC,IAAI,EAAE,K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CAAC,IAAA,0CAAuB,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC;YAClE,MAAM,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC;SACtC,CAAC,CAAC;KACJ;AACH,CAAC,CACF,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n * @format\n */\n\nimport path from 'path';\n\nimport {\n dependencyConfigWindows,\n WindowsDependencyConfig,\n} from '../commands/config/dependencyConfig';\n\nimport {\n ensureCppAppProject,\n ensureCSharpAppProject,\n tryMkdir,\n templateRoot,\n testProjectGuid,\n} from './projectConfig.utils';\n\nimport {copyAndReplace} from '../generator-common';\n\ntype TargetProject = [string, ((folder: string) => Promise<void>)?];\n\nfunction project(\n name: string,\n setup?: (folder: string) => Promise<void>,\n): TargetProject {\n return [name, setup];\n}\n\nconst projects: TargetProject[] = [\n // Nothing but a react-native.config.js, with nulls\n project('BlankLib'),\n // Nothing but a windows folder\n project('MissingProjectFilesLib', async (folder: string) => {\n const windowsDir = path.join(folder, 'windows');\n await tryMkdir(windowsDir);\n }),\n // New C++ app project based on the template\n project('SimpleCppApp', async (folder: string) => {\n await ensureCppAppProject(folder, 'SimpleCppApp');\n }),\n // New C++ project based on the template\n project('SimpleCppLib', async (folder: string) => {\n const windowsDir = path.join(folder, 'windows');\n await tryMkdir(windowsDir);\n\n const replacements = {\n name: 'SimpleCppLib',\n namespace: 'SimpleCppLib',\n useMustache: true,\n projectGuidUpper: testProjectGuid,\n projectGuidLower: testProjectGuid.toLowerCase(),\n };\n\n await copyAndReplace(\n path.join(templateRoot, 'cpp-lib/proj/MyLib.sln'),\n path.join(windowsDir, 'SimpleCppLib.sln'),\n replacements,\n null,\n );\n\n const projDir = path.join(windowsDir, 'SimpleCppLib');\n await tryMkdir(projDir);\n\n await copyAndReplace(\n path.join(templateRoot, 'cpp-lib/proj/MyLib.vcxproj'),\n path.join(projDir, 'SimpleCppLib.vcxproj'),\n replacements,\n null,\n );\n }),\n // New C# app project based on the template\n project('SimpleCSharpApp', async (folder: string) => {\n await ensureCSharpAppProject(folder, 'SimpleCSharpApp');\n }),\n // New C# project based on the template\n project('SimpleCSharpLib', async (folder: string) => {\n const windowsDir = path.join(folder, 'windows');\n await tryMkdir(windowsDir);\n\n const replacements = {\n name: 'SimpleCSharpLib',\n namespace: 'SimpleCSharpLib',\n useMustache: true,\n projectGuidUpper: testProjectGuid,\n projectGuidLower: testProjectGuid.toLowerCase(),\n };\n\n await copyAndReplace(\n path.join(templateRoot, 'cs-lib/proj/MyLib.sln'),\n path.join(windowsDir, 'SimpleCSharpLib.sln'),\n replacements,\n null,\n );\n\n const projDir = path.join(windowsDir, 'SimpleCSharpLib');\n await tryMkdir(projDir);\n\n await copyAndReplace(\n path.join(templateRoot, 'cs-lib/proj/MyLib.csproj'),\n path.join(projDir, 'SimpleCSharpLib.csproj'),\n replacements,\n null,\n );\n }),\n project('WithIndirectDependency'),\n];\n\n// Tests that given userConfig is null, the result will always be null\ntest.each(projects)(\n 'dependencyConfig - %s (userConfig is null)',\n async (name, setup) => {\n const folder = path.resolve('src/e2etest/projects/', name);\n\n if (setup !== undefined) {\n await setup(folder);\n }\n\n const userConfig = null;\n\n expect(dependencyConfigWindows(folder, userConfig)).toBeNull();\n },\n);\n\n// Tests the result given a windows project config in react-native.config.js\ntest.each(projects)(\n 'dependencyConfig - %s (Use react-native.config.js)',\n async (name, setup) => {\n const folder = path.resolve('src/e2etest/projects/', name);\n const rnc = require(path.join(folder, 'react-native.config.js'));\n\n if (setup !== undefined) {\n await setup(folder);\n }\n\n const userConfig: Partial<WindowsDependencyConfig> =\n rnc.dependency.platforms.windows;\n\n if (name === 'BlankLib') {\n expect(dependencyConfigWindows(folder, userConfig)).toMatchSnapshot();\n } else if (name.endsWith('App')) {\n expect(dependencyConfigWindows(folder, userConfig)).toMatchSnapshot({\n folder: expect.stringContaining(name),\n projects: expect.arrayContaining([\n expect.objectContaining({\n projectFile: expect.stringMatching(\n /Error: .*\\.(?:cs|vcx)proj is type '\\w+'/,\n ),\n }),\n ]),\n });\n } else {\n expect(dependencyConfigWindows(folder, userConfig)).toMatchSnapshot({\n folder: expect.stringContaining(name),\n });\n }\n },\n);\n\n// Tests the result of ignoring the windows project config in react-native.config.js\ntest.each(projects)(\n 'dependencyConfig - %s (Ignore react-native.config.js)',\n async (name, setup) => {\n const folder = path.resolve('src/e2etest/projects/', name);\n\n if (setup !== undefined) {\n await setup(folder);\n }\n\n const userConfig: Partial<WindowsDependencyConfig> = {};\n\n if (name === 'BlankLib') {\n expect(dependencyConfigWindows(folder, userConfig)).toMatchSnapshot();\n } else if (name.endsWith('App')) {\n expect(dependencyConfigWindows(folder, userConfig)).toMatchSnapshot({\n folder: expect.stringContaining(name),\n projects: expect.arrayContaining([\n expect.objectContaining({\n projectFile: expect.stringMatching(\n /Error: .*\\.(?:cs|vcx)proj is type '\\w+'/,\n ),\n }),\n ]),\n });\n } else {\n expect(dependencyConfigWindows(folder, userConfig)).toMatchSnapshot({\n folder: expect.stringContaining(name),\n });\n }\n },\n);\n"]}
|
|
1
|
+
{"version":3,"file":"dependencyConfig.test.js","sourceRoot":"","sources":["../../src/e2etest/dependencyConfig.test.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AAEH,gDAAwB;AAExB,0EAG6C;AAE7C,+DAK+B;AAE/B,0DAAmD;AAInD,SAAS,OAAO,CACd,IAAY,EACZ,KAAyC;IAEzC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,QAAQ,GAAoB;IAChC,mDAAmD;IACnD,OAAO,CAAC,UAAU,CAAC;IACnB,+BAA+B;IAC/B,OAAO,CAAC,wBAAwB,EAAE,KAAK,EAAE,MAAc,EAAE,EAAE;QACzD,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAChD,MAAM,IAAA,8BAAQ,EAAC,UAA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CAAC,IAAI,CAAC;SACtC,CAAC,CAAC;KACJ;AACH,CAAC,CACF,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n * @format\n */\n\nimport path from 'path';\n\nimport {\n dependencyConfigWindows,\n WindowsDependencyConfig,\n} from '../commands/config/dependencyConfig';\n\nimport {\n ensureCppAppProject,\n tryMkdir,\n templateRoot,\n testProjectGuid,\n} from './projectConfig.utils';\n\nimport {copyAndReplace} from '../generator-common';\n\ntype TargetProject = [string, ((folder: string) => Promise<void>)?];\n\nfunction project(\n name: string,\n setup?: (folder: string) => Promise<void>,\n): TargetProject {\n return [name, setup];\n}\n\nconst projects: TargetProject[] = [\n // Nothing but a react-native.config.js, with nulls\n project('BlankLib'),\n // Nothing but a windows folder\n project('MissingProjectFilesLib', async (folder: string) => {\n const windowsDir = path.join(folder, 'windows');\n await tryMkdir(windowsDir);\n }),\n // New C++ app project based on the template\n project('SimpleCppApp', async (folder: string) => {\n await ensureCppAppProject(folder, 'SimpleCppApp');\n }),\n // New C++ project based on the template\n project('SimpleCppLib', async (folder: string) => {\n const windowsDir = path.join(folder, 'windows');\n await tryMkdir(windowsDir);\n\n const replacements = {\n name: 'SimpleCppLib',\n namespace: 'SimpleCppLib',\n useMustache: true,\n projectGuidUpper: testProjectGuid,\n projectGuidLower: testProjectGuid.toLowerCase(),\n };\n\n await copyAndReplace(\n path.join(templateRoot, 'cpp-lib/windows/MyLib.sln'),\n path.join(windowsDir, 'SimpleCppLib.sln'),\n replacements,\n null,\n );\n\n const projDir = path.join(windowsDir, 'SimpleCppLib');\n await tryMkdir(projDir);\n\n await copyAndReplace(\n path.join(templateRoot, 'cpp-lib/windows/MyLib/MyLib.vcxproj'),\n path.join(projDir, 'SimpleCppLib.vcxproj'),\n replacements,\n null,\n );\n }),\n project('WithIndirectDependency'),\n];\n\n// Tests that given userConfig is null, the result will always be null\ntest.each(projects)(\n 'dependencyConfig - %s (userConfig is null)',\n async (name, setup) => {\n const folder = path.resolve('src/e2etest/projects/', name);\n\n if (setup !== undefined) {\n await setup(folder);\n }\n\n const userConfig = null;\n\n expect(dependencyConfigWindows(folder, userConfig)).toBeNull();\n },\n);\n\n// Tests the result given a windows project config in react-native.config.js\ntest.each(projects)(\n 'dependencyConfig - %s (Use react-native.config.js)',\n async (name, setup) => {\n const folder = path.resolve('src/e2etest/projects/', name);\n const rnc = require(path.join(folder, 'react-native.config.js'));\n\n if (setup !== undefined) {\n await setup(folder);\n }\n\n const userConfig: Partial<WindowsDependencyConfig> =\n rnc.dependency.platforms.windows;\n\n if (name === 'BlankLib') {\n expect(dependencyConfigWindows(folder, userConfig)).toMatchSnapshot();\n } else if (name.endsWith('App')) {\n expect(dependencyConfigWindows(folder, userConfig)).toMatchSnapshot({\n folder: expect.stringContaining(name),\n projects: expect.arrayContaining([\n expect.objectContaining({\n projectFile: expect.stringMatching(\n /Error: .*\\.(?:cs|vcx)proj is type '\\w+'/,\n ),\n }),\n ]),\n });\n } else {\n expect(dependencyConfigWindows(folder, userConfig)).toMatchSnapshot({\n folder: expect.stringContaining(name),\n });\n }\n },\n);\n\n// Tests the result of ignoring the windows project config in react-native.config.js\ntest.each(projects)(\n 'dependencyConfig - %s (Ignore react-native.config.js)',\n async (name, setup) => {\n const folder = path.resolve('src/e2etest/projects/', name);\n\n if (setup !== undefined) {\n await setup(folder);\n }\n\n const userConfig: Partial<WindowsDependencyConfig> = {};\n\n if (name === 'BlankLib') {\n expect(dependencyConfigWindows(folder, userConfig)).toMatchSnapshot();\n } else if (name.endsWith('App')) {\n expect(dependencyConfigWindows(folder, userConfig)).toMatchSnapshot({\n folder: expect.stringContaining(name),\n projects: expect.arrayContaining([\n expect.objectContaining({\n projectFile: expect.stringMatching(\n /Error: .*\\.(?:cs|vcx)proj is type '\\w+'/,\n ),\n }),\n ]),\n });\n } else {\n expect(dependencyConfigWindows(folder, userConfig)).toMatchSnapshot({\n folder: expect.stringContaining(name),\n });\n }\n },\n);\n"]}
|
|
@@ -28,10 +28,6 @@ const projects = [
|
|
|
28
28
|
project('SimpleCppApp', async (folder) => {
|
|
29
29
|
await (0, projectConfig_utils_1.ensureCppAppProject)(folder, 'SimpleCppApp');
|
|
30
30
|
}),
|
|
31
|
-
// New C# project based on the template
|
|
32
|
-
project('SimpleCSharpApp', async (folder) => {
|
|
33
|
-
await (0, projectConfig_utils_1.ensureCSharpAppProject)(folder, 'SimpleCSharpApp');
|
|
34
|
-
}),
|
|
35
31
|
project('WithWinUI3', async (folder) => {
|
|
36
32
|
await (0, projectConfig_utils_1.ensureWinUI3Project)(folder);
|
|
37
33
|
}),
|