@react-native-windows/cli 0.0.0-canary.181 → 0.0.0-canary.183
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib-commonjs/generator-windows/index.js +5 -24
- package/lib-commonjs/generator-windows/index.js.map +1 -1
- package/lib-commonjs/runWindows/runWindowsOptions.js +2 -9
- package/lib-commonjs/runWindows/runWindowsOptions.js.map +1 -1
- package/lib-commonjs/runWindows/utils/telemetryHelpers.js +10 -2
- package/lib-commonjs/runWindows/utils/telemetryHelpers.js.map +1 -1
- package/package.json +6 -6
|
@@ -73,23 +73,11 @@ async function copyProjectTemplateAndReplace(srcRootPath, destPath, newProjectNa
|
|
|
73
73
|
if (options.experimentalNuGetDependency) {
|
|
74
74
|
console.log('Using experimental NuGet dependency.');
|
|
75
75
|
}
|
|
76
|
-
let realProjectType = projectType;
|
|
77
76
|
if (options.useWinUI3) {
|
|
78
|
-
|
|
79
|
-
if (projectType === 'lib') {
|
|
80
|
-
throw new telemetry_1.CodedError('IncompatibleOptions', 'WinUI 3 project template only supports apps at the moment', {
|
|
81
|
-
detail: 'useWinUI3 and lib',
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
else if (language !== 'cs') {
|
|
85
|
-
throw new telemetry_1.CodedError('IncompatibleOptions', 'WinUI 3 project template only support C# at the moment', {
|
|
86
|
-
detail: 'useWinUI3 and cpp',
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
realProjectType += '-WinAppSDK';
|
|
77
|
+
throw new telemetry_1.CodedError('IncompatibleOptions', 'Experimental WinUI 3 project has been deprecated.');
|
|
90
78
|
}
|
|
91
79
|
const projDir = 'proj';
|
|
92
|
-
const srcPath = path_1.default.join(srcRootPath, `${language}-${
|
|
80
|
+
const srcPath = path_1.default.join(srcRootPath, `${language}-${projectType}`);
|
|
93
81
|
const sharedPath = path_1.default.join(srcRootPath, `shared-${projectType}`);
|
|
94
82
|
const projectGuid = existingProjectGuid || uuid_1.default.v4();
|
|
95
83
|
const rnwVersion = require(resolveRnwPath('package.json')).version;
|
|
@@ -253,16 +241,9 @@ async function copyProjectTemplateAndReplace(srcRootPath, destPath, newProjectNa
|
|
|
253
241
|
if (fs_1.default.existsSync(path_1.default.join(sharedPath, 'assets'))) {
|
|
254
242
|
await (0, generator_common_1.copyAndReplaceAll)(path_1.default.join(sharedPath, 'assets'), destPath, path_1.default.join(windowsDir, newProjectName, 'Assets'), templateVars, options.overwrite);
|
|
255
243
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
await (0, generator_common_1.copyAndReplaceAll)(path_1.default.join(sharedPath, 'src'), destPath, path_1.default.join(windowsDir, newProjectName), templateVars, options.overwrite);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
if (fs_1.default.existsSync(path_1.default.join(srcPath, 'MyApp'))) {
|
|
264
|
-
await (0, generator_common_1.copyAndReplaceAll)(path_1.default.join(srcPath, 'MyApp'), destPath, path_1.default.join(windowsDir, newProjectName), templateVars, options.overwrite);
|
|
265
|
-
}
|
|
244
|
+
// shared src
|
|
245
|
+
if (fs_1.default.existsSync(path_1.default.join(sharedPath, 'src'))) {
|
|
246
|
+
await (0, generator_common_1.copyAndReplaceAll)(path_1.default.join(sharedPath, 'src'), destPath, path_1.default.join(windowsDir, newProjectName), templateVars, options.overwrite);
|
|
266
247
|
}
|
|
267
248
|
// src
|
|
268
249
|
if (fs_1.default.existsSync(path_1.default.join(srcPath, 'src'))) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator-windows/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,kDAA0B;AAC1B,gDAAwB;AACxB,wDAAgC;AAChC,gDAAwB;AACxB,kEAAyC;AACzC,kEAA0C;AAC1C,oDAA4B;AAC5B,oDAAuB;AACvB,sDAA6B;AAC7B,uDAAyE;AAEzE,0DAI6B;A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UAAU,CAAC;YAC9B,YAAY,EAAE,EAAC,cAAc,EAAE,gBAAgB,EAAC;SACjD,CAAC,CAAC;QAEH,qDAAqD;QACrD,MAAM,MAAM,GAAG,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC;QACpE,uBAAY,CAAC,QAAQ,CACnB,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EACzB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC,CAAC,CAAC,EAAE,CAC1C,CAAC;KACH;AACH,CAAC;AAhED,sEAgEC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport chalk from 'chalk';\nimport path from 'path';\nimport username from 'username';\nimport uuid from 'uuid';\nimport childProcess from 'child_process';\nimport fs from '@react-native-windows/fs';\nimport semver from 'semver';\nimport _ from 'lodash';\nimport findUp from 'find-up';\nimport {readProjectFile, findPropertyValue} from '../config/configUtils';\n\nimport {\n createDir,\n copyAndReplaceAll,\n copyAndReplaceWithChangedCallback,\n} from '../generator-common';\nimport {GenerateOptions} from '..';\nimport {\n CodedError,\n getVersionOfNpmPackage,\n} from '@react-native-windows/telemetry';\nimport {\n findPackage,\n WritableNpmPackage,\n} from '@react-native-windows/package-utils';\n\nconst windowsDir = 'windows';\nconst bundleDir = 'Bundle';\n\n/**\n * This represents the data to insert nuget packages\n */\ninterface NugetPackage {\n id: string;\n version: string;\n privateAssets: boolean;\n}\n\nfunction pascalCase(str: string) {\n const camelCase = _.camelCase(str);\n return camelCase[0].toUpperCase() + camelCase.substr(1);\n}\n\nfunction resolveRnwPath(subpath: string): string {\n return require.resolve(path.join('react-native-windows', subpath), {\n paths: [process.cwd()],\n });\n}\n\n// Existing high cyclomatic complexity\n// eslint-disable-next-line complexity\nexport async function copyProjectTemplateAndReplace(\n srcRootPath: string,\n destPath: string,\n newProjectName: string,\n namespace: string,\n options: GenerateOptions,\n) {\n if (!srcRootPath) {\n throw new CodedError(\n 'CopyProjectTemplateNoSourcePath',\n 'Need a path to copy from',\n );\n }\n\n if (!destPath) {\n throw new CodedError(\n 'CopyProjectTemplateNoDestPath',\n 'Need a path to copy to',\n );\n }\n\n if (!newProjectName) {\n throw new CodedError(\n 'CopyProjectTemplateNoProjectName',\n 'Need a project name',\n );\n }\n\n const projectType = options.projectType;\n const language = options.language;\n\n // React-native init only allows alphanumerics in project names, but other\n // new project tools (like create-react-native-module) are less strict.\n if (projectType === 'lib') {\n newProjectName = pascalCase(newProjectName);\n }\n\n // Similar to the above, but we want to retain namespace separators\n if (projectType === 'lib') {\n namespace = namespace.split(/[.:]+/).map(pascalCase).join('.');\n }\n\n // Checking if we're overwriting an existing project and re-uses their projectGUID\n const existingProjectPath = path.join(\n destPath,\n windowsDir,\n newProjectName,\n newProjectName + (language === 'cs' ? '.csproj' : '.vcxproj'),\n );\n let existingProjectGuid: string | undefined;\n if (fs.existsSync(existingProjectPath)) {\n console.log('Found existing project, extracting ProjectGuid.');\n existingProjectGuid = findPropertyValue(\n readProjectFile(existingProjectPath),\n 'ProjectGuid',\n existingProjectPath,\n ).replace(/[{}]/g, '');\n }\n\n createDir(path.join(destPath, windowsDir));\n createDir(path.join(destPath, windowsDir, newProjectName));\n\n if (projectType === 'app') {\n createDir(path.join(destPath, windowsDir, newProjectName, bundleDir));\n createDir(path.join(destPath, windowsDir, newProjectName, 'BundleBuilder'));\n }\n\n const namespaceCpp = toCppNamespace(namespace);\n if (options.experimentalNuGetDependency) {\n console.log('Using experimental NuGet dependency.');\n }\n\n let realProjectType = projectType;\n\n if (options.useWinUI3) {\n console.log('Using experimental WinUI3 dependency.');\n if (projectType === 'lib') {\n throw new CodedError(\n 'IncompatibleOptions',\n 'WinUI 3 project template only supports apps at the moment',\n {\n detail: 'useWinUI3 and lib',\n },\n );\n } else if (language !== 'cs') {\n throw new CodedError(\n 'IncompatibleOptions',\n 'WinUI 3 project template only support C# at the moment',\n {\n detail: 'useWinUI3 and cpp',\n },\n );\n }\n\n realProjectType += '-WinAppSDK';\n }\n\n const projDir = 'proj';\n const srcPath = path.join(srcRootPath, `${language}-${realProjectType}`);\n const sharedPath = path.join(srcRootPath, `shared-${projectType}`);\n const projectGuid = existingProjectGuid || uuid.v4();\n const rnwVersion = require(resolveRnwPath('package.json')).version;\n const nugetVersion = options.nuGetTestVersion || rnwVersion;\n const packageGuid = uuid.v4();\n const currentUser = username.sync()!; // Gets the current username depending on the platform.\n\n let mainComponentName = newProjectName;\n const appJsonPath = await findUp('app.json', {cwd: destPath});\n if (appJsonPath) {\n const appJson = await fs.readJsonFile<{name: string}>(appJsonPath);\n mainComponentName = appJson.name;\n }\n\n // We should prefer putting new, necessary PackageReference dependencies into the appropriate\n // external property sheets, but this is here if we \"must\" inject the dependency into the project file\n const csNugetPackages: NugetPackage[] = [];\n const cppNugetPackages: NugetPackage[] = [];\n\n const templateVars: Record<string, any> = {\n useMustache: true,\n regExpPatternsToRemove: [],\n\n name: newProjectName,\n namespace: namespace,\n namespaceCpp: namespaceCpp,\n languageIsCpp: language === 'cpp',\n\n rnwVersion: await getVersionOfNpmPackage('react-native-windows'),\n\n mainComponentName: mainComponentName,\n\n // Visual Studio is very picky about the casing of the guids for projects, project references and the solution\n // https://www.bing.com/search?q=visual+studio+project+guid+casing&cvid=311a5ad7f9fc41089507b24600d23ee7&FORM=ANAB01&PC=U531\n // we therefore have to precariously use the right casing in the right place or risk building in VS breaking.\n projectGuidLower: `{${projectGuid.toLowerCase()}}`,\n projectGuidUpper: `{${projectGuid.toUpperCase()}}`,\n\n // packaging and signing variables:\n packageGuid: packageGuid,\n currentUser: currentUser,\n\n useExperimentalNuget: options.experimentalNuGetDependency,\n nuGetTestFeed: options.nuGetTestFeed,\n nuGetADOFeed: nugetVersion.startsWith('0.0.0-'),\n\n // cpp template variables\n useWinUI3: options.useWinUI3,\n useHermes: options.useHermes,\n cppNugetPackages: cppNugetPackages,\n\n // cs template variables\n csNugetPackages: csNugetPackages,\n\n // autolinking template variables\n autolinkPropertiesForProps: '',\n autolinkProjectReferencesForTargets: '',\n autolinkCsUsingNamespaces: '',\n autolinkCsReactPackageProviders: '',\n autolinkCppIncludes: '',\n autolinkCppPackageProviders:\n '\\n UNREFERENCED_PARAMETER(packageProviders);', // CODESYNC: vnext\\local-cli\\runWindows\\utils\\autolink.js\n };\n\n const commonMappings =\n projectType === 'app'\n ? [\n // app common mappings\n {\n from: path.join(\n srcRootPath,\n options.useDevMode\n ? 'metro.devMode.config.js'\n : 'metro.config.js',\n ),\n to: 'metro.config.js',\n },\n {\n from: path.join(srcRootPath, '_gitignore'),\n to: path.join(windowsDir, '.gitignore'),\n },\n {\n from: path.join(srcRootPath, 'b_gitignore'),\n to: path.join(windowsDir, newProjectName, '.gitignore'),\n },\n {\n from: path.join(srcRootPath, 'index.windows.bundle'),\n to: path.join(\n windowsDir,\n newProjectName,\n bundleDir,\n 'index.windows.bundle',\n ),\n },\n {\n from: path.join(srcPath, projDir, 'MyApp.sln'),\n to: path.join(windowsDir, newProjectName + '.sln'),\n },\n ]\n : [\n // lib common mappings\n {\n from: path.join(srcRootPath, '_gitignore'),\n to: path.join(windowsDir, '.gitignore'),\n },\n {\n from: path.join(srcPath, projDir, 'MyLib.sln'),\n to: path.join(windowsDir, newProjectName + '.sln'),\n },\n ];\n\n for (const mapping of commonMappings) {\n await copyAndReplaceWithChangedCallback(\n mapping.from,\n destPath,\n mapping.to,\n templateVars,\n options.overwrite,\n );\n }\n\n if (language === 'cs') {\n const csMappings =\n projectType === 'app'\n ? [\n // cs app mappings\n {\n from: path.join(srcPath, projDir, 'MyApp.csproj'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.csproj',\n ),\n },\n ]\n : [\n // cs lib mappings\n {\n from: path.join(srcPath, projDir, 'MyLib.csproj'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.csproj',\n ),\n },\n ];\n\n for (const mapping of csMappings) {\n await copyAndReplaceWithChangedCallback(\n mapping.from,\n destPath,\n mapping.to,\n templateVars,\n options.overwrite,\n );\n }\n } else {\n const cppMappings =\n projectType === 'app'\n ? [\n // cpp app mappings\n {\n from: path.join(srcPath, projDir, 'MyApp.vcxproj'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.vcxproj',\n ),\n },\n {\n from: path.join(srcPath, projDir, 'MyApp.vcxproj.filters'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.vcxproj.filters',\n ),\n },\n ]\n : [\n // cpp lib mappings\n {\n from: path.join(srcPath, projDir, 'MyLib.vcxproj'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.vcxproj',\n ),\n },\n {\n from: path.join(srcPath, projDir, 'MyLib.vcxproj.filters'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.vcxproj.filters',\n ),\n },\n {\n from: path.join(srcPath, projDir, 'MyLib.def'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.def',\n ),\n },\n ];\n\n for (const mapping of cppMappings) {\n await copyAndReplaceWithChangedCallback(\n mapping.from,\n destPath,\n mapping.to,\n templateVars,\n options.overwrite,\n );\n }\n }\n\n // shared proj\n if (fs.existsSync(path.join(sharedPath, projDir))) {\n const sharedProjMappings = [];\n\n sharedProjMappings.push({\n from: path.join(sharedPath, projDir, 'NuGet_Config'),\n to: path.join(windowsDir, 'NuGet.Config'),\n });\n\n if (\n fs.existsSync(\n path.join(sharedPath, projDir, 'ExperimentalFeatures.props'),\n )\n ) {\n sharedProjMappings.push({\n from: path.join(sharedPath, projDir, 'ExperimentalFeatures.props'),\n to: path.join(windowsDir, 'ExperimentalFeatures.props'),\n });\n }\n\n for (const mapping of sharedProjMappings) {\n await copyAndReplaceWithChangedCallback(\n mapping.from,\n destPath,\n mapping.to,\n templateVars,\n options.overwrite,\n );\n }\n }\n\n // shared assets\n if (fs.existsSync(path.join(sharedPath, 'assets'))) {\n await copyAndReplaceAll(\n path.join(sharedPath, 'assets'),\n destPath,\n path.join(windowsDir, newProjectName, 'Assets'),\n templateVars,\n options.overwrite,\n );\n }\n\n if (!options.useWinUI3) {\n // shared src\n if (fs.existsSync(path.join(sharedPath, 'src'))) {\n await copyAndReplaceAll(\n path.join(sharedPath, 'src'),\n destPath,\n path.join(windowsDir, newProjectName),\n templateVars,\n options.overwrite,\n );\n }\n } else {\n if (fs.existsSync(path.join(srcPath, 'MyApp'))) {\n await copyAndReplaceAll(\n path.join(srcPath, 'MyApp'),\n destPath,\n path.join(windowsDir, newProjectName),\n templateVars,\n options.overwrite,\n );\n }\n }\n\n // src\n if (fs.existsSync(path.join(srcPath, 'src'))) {\n await copyAndReplaceAll(\n path.join(srcPath, 'src'),\n destPath,\n path.join(windowsDir, newProjectName),\n templateVars,\n options.overwrite,\n );\n }\n\n if (projectType === 'app') {\n console.log(chalk.white.bold('To run your app on UWP:'));\n console.log(chalk.white(' npx react-native run-windows'));\n }\n}\n\nfunction toCppNamespace(namespace: string) {\n return namespace.replace(/\\./g, '::');\n}\n\nexport async function installScriptsAndDependencies(options: {\n verbose: boolean;\n}) {\n const projectPackage = await WritableNpmPackage.fromPath(process.cwd());\n if (!projectPackage) {\n throw new Error(\n `The current directory '${process.cwd()}' is not the root of an npm package`,\n );\n }\n\n await projectPackage.mergeProps({\n scripts: {windows: 'react-native run-windows'},\n });\n\n const rnwPackage = await findPackage('react-native-windows');\n if (!rnwPackage) {\n throw new Error('Could not locate the package for react-native-windows');\n }\n\n const rnPackage = await findPackage('react-native');\n if (!rnPackage) {\n throw new Error('Could not locate the package for react-native');\n }\n\n // We add an exclusionList from metro config. This will be hoisted, but add\n // an explicit dep because we require it directly.\n const cliPackage = await findPackage('@react-native-community/cli', {\n searchPath: rnPackage.path,\n });\n const metroConfigPackage = await findPackage('metro-config', {\n searchPath: cliPackage?.path || rnPackage.path,\n });\n\n if (metroConfigPackage) {\n await projectPackage.mergeProps({\n devDependencies: {\n 'metro-config': `^${metroConfigPackage.json.version}`,\n },\n });\n }\n\n const rnPeerDependency = rnwPackage.json.peerDependencies['react-native'];\n\n if (\n !semver.satisfies(rnPackage.json.version, rnPeerDependency) &&\n projectPackage.json.dependencies?.['react-native']\n ) {\n console.log(\n chalk.green('Installing a compatible version of react-native:'),\n );\n console.log(chalk.white(` ${rnPeerDependency}`));\n\n // Patch package.json to have proper react-native version and install\n await projectPackage.mergeProps({\n dependencies: {'react-native': rnPeerDependency},\n });\n\n // Install dependencies using correct package manager\n const isYarn = fs.existsSync(path.join(process.cwd(), 'yarn.lock'));\n childProcess.execSync(\n isYarn ? 'yarn' : 'npm i',\n options.verbose ? {stdio: 'inherit'} : {},\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator-windows/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,kDAA0B;AAC1B,gDAAwB;AACxB,wDAAgC;AAChC,gDAAwB;AACxB,kEAAyC;AACzC,kEAA0C;AAC1C,oDAA4B;AAC5B,oDAAuB;AACvB,sDAA6B;AAC7B,uDAAyE;AAEzE,0DAI6B;AAE7B,+DAGyC;AACzC,uEAG6C;AAE7C,MAAM,UAAU,GAAG,SAAS,CAAC;AAC7B,MAAM,SAAS,GAAG,QAAQ,CAAC;AAW3B,SAAS,UAAU,CAAC,GAAW;IAC7B,MAAM,SAAS,GAAG,gBAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACnC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,cAAc,CAAC,OAAe;IACrC,OAAO,OAAO,CAAC,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,OAAO,CAAC,EAAE;QACjE,KAAK,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,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C;QAEpD,qEAAqE;QACrE,MAAM,cAAc,CAAC,UAAU,CAAC;YAC9B,YAAY,EAAE,EAAC,cAAc,EAAE,gBAAgB,EAAC;SACjD,CAAC,CAAC;QAEH,qDAAqD;QACrD,MAAM,MAAM,GAAG,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC;QACpE,uBAAY,CAAC,QAAQ,CACnB,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EACzB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC,CAAC,CAAC,EAAE,CAC1C,CAAC;KACH;AACH,CAAC;AAhED,sEAgEC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport chalk from 'chalk';\nimport path from 'path';\nimport username from 'username';\nimport uuid from 'uuid';\nimport childProcess from 'child_process';\nimport fs from '@react-native-windows/fs';\nimport semver from 'semver';\nimport _ from 'lodash';\nimport findUp from 'find-up';\nimport {readProjectFile, findPropertyValue} from '../config/configUtils';\n\nimport {\n createDir,\n copyAndReplaceAll,\n copyAndReplaceWithChangedCallback,\n} from '../generator-common';\nimport {GenerateOptions} from '..';\nimport {\n CodedError,\n getVersionOfNpmPackage,\n} from '@react-native-windows/telemetry';\nimport {\n findPackage,\n WritableNpmPackage,\n} from '@react-native-windows/package-utils';\n\nconst windowsDir = 'windows';\nconst bundleDir = 'Bundle';\n\n/**\n * This represents the data to insert nuget packages\n */\ninterface NugetPackage {\n id: string;\n version: string;\n privateAssets: boolean;\n}\n\nfunction pascalCase(str: string) {\n const camelCase = _.camelCase(str);\n return camelCase[0].toUpperCase() + camelCase.substr(1);\n}\n\nfunction resolveRnwPath(subpath: string): string {\n return require.resolve(path.join('react-native-windows', subpath), {\n paths: [process.cwd()],\n });\n}\n\n// Existing high cyclomatic complexity\n// eslint-disable-next-line complexity\nexport async function copyProjectTemplateAndReplace(\n srcRootPath: string,\n destPath: string,\n newProjectName: string,\n namespace: string,\n options: GenerateOptions,\n) {\n if (!srcRootPath) {\n throw new CodedError(\n 'CopyProjectTemplateNoSourcePath',\n 'Need a path to copy from',\n );\n }\n\n if (!destPath) {\n throw new CodedError(\n 'CopyProjectTemplateNoDestPath',\n 'Need a path to copy to',\n );\n }\n\n if (!newProjectName) {\n throw new CodedError(\n 'CopyProjectTemplateNoProjectName',\n 'Need a project name',\n );\n }\n\n const projectType = options.projectType;\n const language = options.language;\n\n // React-native init only allows alphanumerics in project names, but other\n // new project tools (like create-react-native-module) are less strict.\n if (projectType === 'lib') {\n newProjectName = pascalCase(newProjectName);\n }\n\n // Similar to the above, but we want to retain namespace separators\n if (projectType === 'lib') {\n namespace = namespace.split(/[.:]+/).map(pascalCase).join('.');\n }\n\n // Checking if we're overwriting an existing project and re-uses their projectGUID\n const existingProjectPath = path.join(\n destPath,\n windowsDir,\n newProjectName,\n newProjectName + (language === 'cs' ? '.csproj' : '.vcxproj'),\n );\n let existingProjectGuid: string | undefined;\n if (fs.existsSync(existingProjectPath)) {\n console.log('Found existing project, extracting ProjectGuid.');\n existingProjectGuid = findPropertyValue(\n readProjectFile(existingProjectPath),\n 'ProjectGuid',\n existingProjectPath,\n ).replace(/[{}]/g, '');\n }\n\n createDir(path.join(destPath, windowsDir));\n createDir(path.join(destPath, windowsDir, newProjectName));\n\n if (projectType === 'app') {\n createDir(path.join(destPath, windowsDir, newProjectName, bundleDir));\n createDir(path.join(destPath, windowsDir, newProjectName, 'BundleBuilder'));\n }\n\n const namespaceCpp = toCppNamespace(namespace);\n if (options.experimentalNuGetDependency) {\n console.log('Using experimental NuGet dependency.');\n }\n\n if (options.useWinUI3) {\n throw new CodedError(\n 'IncompatibleOptions',\n 'Experimental WinUI 3 project has been deprecated.',\n );\n }\n\n const projDir = 'proj';\n const srcPath = path.join(srcRootPath, `${language}-${projectType}`);\n const sharedPath = path.join(srcRootPath, `shared-${projectType}`);\n const projectGuid = existingProjectGuid || uuid.v4();\n const rnwVersion = require(resolveRnwPath('package.json')).version;\n const nugetVersion = options.nuGetTestVersion || rnwVersion;\n const packageGuid = uuid.v4();\n const currentUser = username.sync()!; // Gets the current username depending on the platform.\n\n let mainComponentName = newProjectName;\n const appJsonPath = await findUp('app.json', {cwd: destPath});\n if (appJsonPath) {\n const appJson = await fs.readJsonFile<{name: string}>(appJsonPath);\n mainComponentName = appJson.name;\n }\n\n // We should prefer putting new, necessary PackageReference dependencies into the appropriate\n // external property sheets, but this is here if we \"must\" inject the dependency into the project file\n const csNugetPackages: NugetPackage[] = [];\n const cppNugetPackages: NugetPackage[] = [];\n\n const templateVars: Record<string, any> = {\n useMustache: true,\n regExpPatternsToRemove: [],\n\n name: newProjectName,\n namespace: namespace,\n namespaceCpp: namespaceCpp,\n languageIsCpp: language === 'cpp',\n\n rnwVersion: await getVersionOfNpmPackage('react-native-windows'),\n\n mainComponentName: mainComponentName,\n\n // Visual Studio is very picky about the casing of the guids for projects, project references and the solution\n // https://www.bing.com/search?q=visual+studio+project+guid+casing&cvid=311a5ad7f9fc41089507b24600d23ee7&FORM=ANAB01&PC=U531\n // we therefore have to precariously use the right casing in the right place or risk building in VS breaking.\n projectGuidLower: `{${projectGuid.toLowerCase()}}`,\n projectGuidUpper: `{${projectGuid.toUpperCase()}}`,\n\n // packaging and signing variables:\n packageGuid: packageGuid,\n currentUser: currentUser,\n\n useExperimentalNuget: options.experimentalNuGetDependency,\n nuGetTestFeed: options.nuGetTestFeed,\n nuGetADOFeed: nugetVersion.startsWith('0.0.0-'),\n\n // cpp template variables\n useWinUI3: options.useWinUI3,\n useHermes: options.useHermes,\n cppNugetPackages: cppNugetPackages,\n\n // cs template variables\n csNugetPackages: csNugetPackages,\n\n // autolinking template variables\n autolinkPropertiesForProps: '',\n autolinkProjectReferencesForTargets: '',\n autolinkCsUsingNamespaces: '',\n autolinkCsReactPackageProviders: '',\n autolinkCppIncludes: '',\n autolinkCppPackageProviders:\n '\\n UNREFERENCED_PARAMETER(packageProviders);', // CODESYNC: vnext\\local-cli\\runWindows\\utils\\autolink.js\n };\n\n const commonMappings =\n projectType === 'app'\n ? [\n // app common mappings\n {\n from: path.join(\n srcRootPath,\n options.useDevMode\n ? 'metro.devMode.config.js'\n : 'metro.config.js',\n ),\n to: 'metro.config.js',\n },\n {\n from: path.join(srcRootPath, '_gitignore'),\n to: path.join(windowsDir, '.gitignore'),\n },\n {\n from: path.join(srcRootPath, 'b_gitignore'),\n to: path.join(windowsDir, newProjectName, '.gitignore'),\n },\n {\n from: path.join(srcRootPath, 'index.windows.bundle'),\n to: path.join(\n windowsDir,\n newProjectName,\n bundleDir,\n 'index.windows.bundle',\n ),\n },\n {\n from: path.join(srcPath, projDir, 'MyApp.sln'),\n to: path.join(windowsDir, newProjectName + '.sln'),\n },\n ]\n : [\n // lib common mappings\n {\n from: path.join(srcRootPath, '_gitignore'),\n to: path.join(windowsDir, '.gitignore'),\n },\n {\n from: path.join(srcPath, projDir, 'MyLib.sln'),\n to: path.join(windowsDir, newProjectName + '.sln'),\n },\n ];\n\n for (const mapping of commonMappings) {\n await copyAndReplaceWithChangedCallback(\n mapping.from,\n destPath,\n mapping.to,\n templateVars,\n options.overwrite,\n );\n }\n\n if (language === 'cs') {\n const csMappings =\n projectType === 'app'\n ? [\n // cs app mappings\n {\n from: path.join(srcPath, projDir, 'MyApp.csproj'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.csproj',\n ),\n },\n ]\n : [\n // cs lib mappings\n {\n from: path.join(srcPath, projDir, 'MyLib.csproj'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.csproj',\n ),\n },\n ];\n\n for (const mapping of csMappings) {\n await copyAndReplaceWithChangedCallback(\n mapping.from,\n destPath,\n mapping.to,\n templateVars,\n options.overwrite,\n );\n }\n } else {\n const cppMappings =\n projectType === 'app'\n ? [\n // cpp app mappings\n {\n from: path.join(srcPath, projDir, 'MyApp.vcxproj'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.vcxproj',\n ),\n },\n {\n from: path.join(srcPath, projDir, 'MyApp.vcxproj.filters'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.vcxproj.filters',\n ),\n },\n ]\n : [\n // cpp lib mappings\n {\n from: path.join(srcPath, projDir, 'MyLib.vcxproj'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.vcxproj',\n ),\n },\n {\n from: path.join(srcPath, projDir, 'MyLib.vcxproj.filters'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.vcxproj.filters',\n ),\n },\n {\n from: path.join(srcPath, projDir, 'MyLib.def'),\n to: path.join(\n windowsDir,\n newProjectName,\n newProjectName + '.def',\n ),\n },\n ];\n\n for (const mapping of cppMappings) {\n await copyAndReplaceWithChangedCallback(\n mapping.from,\n destPath,\n mapping.to,\n templateVars,\n options.overwrite,\n );\n }\n }\n\n // shared proj\n if (fs.existsSync(path.join(sharedPath, projDir))) {\n const sharedProjMappings = [];\n\n sharedProjMappings.push({\n from: path.join(sharedPath, projDir, 'NuGet_Config'),\n to: path.join(windowsDir, 'NuGet.Config'),\n });\n\n if (\n fs.existsSync(\n path.join(sharedPath, projDir, 'ExperimentalFeatures.props'),\n )\n ) {\n sharedProjMappings.push({\n from: path.join(sharedPath, projDir, 'ExperimentalFeatures.props'),\n to: path.join(windowsDir, 'ExperimentalFeatures.props'),\n });\n }\n\n for (const mapping of sharedProjMappings) {\n await copyAndReplaceWithChangedCallback(\n mapping.from,\n destPath,\n mapping.to,\n templateVars,\n options.overwrite,\n );\n }\n }\n\n // shared assets\n if (fs.existsSync(path.join(sharedPath, 'assets'))) {\n await copyAndReplaceAll(\n path.join(sharedPath, 'assets'),\n destPath,\n path.join(windowsDir, newProjectName, 'Assets'),\n templateVars,\n options.overwrite,\n );\n }\n\n // shared src\n if (fs.existsSync(path.join(sharedPath, 'src'))) {\n await copyAndReplaceAll(\n path.join(sharedPath, 'src'),\n destPath,\n path.join(windowsDir, newProjectName),\n templateVars,\n options.overwrite,\n );\n }\n\n // src\n if (fs.existsSync(path.join(srcPath, 'src'))) {\n await copyAndReplaceAll(\n path.join(srcPath, 'src'),\n destPath,\n path.join(windowsDir, newProjectName),\n templateVars,\n options.overwrite,\n );\n }\n\n if (projectType === 'app') {\n console.log(chalk.white.bold('To run your app on UWP:'));\n console.log(chalk.white(' npx react-native run-windows'));\n }\n}\n\nfunction toCppNamespace(namespace: string) {\n return namespace.replace(/\\./g, '::');\n}\n\nexport async function installScriptsAndDependencies(options: {\n verbose: boolean;\n}) {\n const projectPackage = await WritableNpmPackage.fromPath(process.cwd());\n if (!projectPackage) {\n throw new Error(\n `The current directory '${process.cwd()}' is not the root of an npm package`,\n );\n }\n\n await projectPackage.mergeProps({\n scripts: {windows: 'react-native run-windows'},\n });\n\n const rnwPackage = await findPackage('react-native-windows');\n if (!rnwPackage) {\n throw new Error('Could not locate the package for react-native-windows');\n }\n\n const rnPackage = await findPackage('react-native');\n if (!rnPackage) {\n throw new Error('Could not locate the package for react-native');\n }\n\n // We add an exclusionList from metro config. This will be hoisted, but add\n // an explicit dep because we require it directly.\n const cliPackage = await findPackage('@react-native-community/cli', {\n searchPath: rnPackage.path,\n });\n const metroConfigPackage = await findPackage('metro-config', {\n searchPath: cliPackage?.path || rnPackage.path,\n });\n\n if (metroConfigPackage) {\n await projectPackage.mergeProps({\n devDependencies: {\n 'metro-config': `^${metroConfigPackage.json.version}`,\n },\n });\n }\n\n const rnPeerDependency = rnwPackage.json.peerDependencies['react-native'];\n\n if (\n !semver.satisfies(rnPackage.json.version, rnPeerDependency) &&\n projectPackage.json.dependencies?.['react-native']\n ) {\n console.log(\n chalk.green('Installing a compatible version of react-native:'),\n );\n console.log(chalk.white(` ${rnPeerDependency}`));\n\n // Patch package.json to have proper react-native version and install\n await projectPackage.mergeProps({\n dependencies: {'react-native': rnPeerDependency},\n });\n\n // Install dependencies using correct package manager\n const isYarn = fs.existsSync(path.join(process.cwd(), 'yarn.lock'));\n childProcess.execSync(\n isYarn ? 'yarn' : 'npm i',\n options.verbose ? {stdio: 'inherit'} : {},\n );\n }\n}\n"]}
|
|
@@ -4,12 +4,9 @@
|
|
|
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
|
-
};
|
|
10
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
8
|
exports.runWindowsOptions = void 0;
|
|
12
|
-
const
|
|
9
|
+
const telemetry_1 = require("@react-native-windows/telemetry");
|
|
13
10
|
exports.runWindowsOptions = [
|
|
14
11
|
{
|
|
15
12
|
name: '--release',
|
|
@@ -23,11 +20,7 @@ exports.runWindowsOptions = [
|
|
|
23
20
|
{
|
|
24
21
|
name: '--arch [string]',
|
|
25
22
|
description: 'The build architecture (ARM64, x86, x64)',
|
|
26
|
-
default:
|
|
27
|
-
? 'x86'
|
|
28
|
-
: os_1.default.arch() === 'arm64'
|
|
29
|
-
? 'ARM64'
|
|
30
|
-
: os_1.default.arch(),
|
|
23
|
+
default: parseBuildArch((0, telemetry_1.deviceArchitecture)()),
|
|
31
24
|
parse: parseBuildArch,
|
|
32
25
|
},
|
|
33
26
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWindowsOptions.js","sourceRoot":"","sources":["../../src/runWindows/runWindowsOptions.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"runWindowsOptions.js","sourceRoot":"","sources":["../../src/runWindows/runWindowsOptions.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,+DAAmE;AAqDtD,QAAA,iBAAiB,GAAoB;IAChD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,2BAA2B;KACzC;IACD;QACE,IAAI,EAAE,iB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AAyB;QAC/B,WAAW,EACT,yEAAyE;KAC5E;IACD;QACE,IAAI,EAAE,8BAA8B;QACpC,WAAW,EAAE,6DAA6D;KAC3E;IACD;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,8BAA8B;KAC5C;IACD;QACE,IAAI,EAAE,6BAA6B;QACnC,WAAW,EAAE,2CAA2C;QACxD,KAAK,EAAE,wBAAwB;KAChC;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,uGAAuG;KAC1G;CACF,CAAC;AAEF,SAAS,cAAc,CAAC,GAAW;IACjC,MAAM,eAAe,GAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC7D,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 {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 * 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: 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: '--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"]}
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.endTelemetrySession = exports.startTelemetrySession = exports.getDefaultOptions = void 0;
|
|
9
9
|
const lodash_1 = require("lodash");
|
|
10
10
|
const telemetry_1 = require("@react-native-windows/telemetry");
|
|
11
|
+
const commandWithProgress_1 = require("./commandWithProgress");
|
|
11
12
|
/**
|
|
12
13
|
* Calculates a the default values of a given react-native CLI command's options.
|
|
13
14
|
* @param config Config passed from react-native CLI.
|
|
@@ -63,12 +64,19 @@ exports.getDefaultOptions = getDefaultOptions;
|
|
|
63
64
|
* @param optionSanitizer Function to sanitize the option values for telemetry.
|
|
64
65
|
*/
|
|
65
66
|
async function startTelemetrySession(commandName, config, options, defaultOptions, optionSanitizer) {
|
|
67
|
+
const verbose = options.logging === true;
|
|
66
68
|
if (!options.telemetry) {
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
+
if (verbose) {
|
|
70
|
+
(0, commandWithProgress_1.newInfo)('Telemetry is disabled');
|
|
69
71
|
}
|
|
70
72
|
return;
|
|
71
73
|
}
|
|
74
|
+
if (verbose) {
|
|
75
|
+
(0, commandWithProgress_1.newInfo)(`Running ${(0, telemetry_1.nodeArchitecture)()} node on a ${(0, telemetry_1.deviceArchitecture)()} machine`);
|
|
76
|
+
}
|
|
77
|
+
if ((0, telemetry_1.deviceArchitecture)() !== (0, telemetry_1.nodeArchitecture)()) {
|
|
78
|
+
(0, commandWithProgress_1.newWarn)('This version of node was built for a different architecture than this machine and may cause unintended behavior');
|
|
79
|
+
}
|
|
72
80
|
await telemetry_1.Telemetry.setup();
|
|
73
81
|
const sanitizedOptions = (0, telemetry_1.commanderOptionsToOptions)(options, optionSanitizer);
|
|
74
82
|
const sanitizedDefaultOptions = (0, telemetry_1.commanderOptionsToOptions)(defaultOptions, optionSanitizer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetryHelpers.js","sourceRoot":"","sources":["../../../src/runWindows/utils/telemetryHelpers.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,mCAAiC;AAQjC,+
|
|
1
|
+
{"version":3,"file":"telemetryHelpers.js","sourceRoot":"","sources":["../../../src/runWindows/utils/telemetryHelpers.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,mCAAiC;AAQjC,+DAayC;AAEzC,+DAAuD;AAEvD;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,MAAc,EACd,cAA+B;IAE/B,MAAM,MAAM,GAAyB;QACnC,OAAO,EAAE,KAAK;KACf,CAAC;IACF,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE;QACnC,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACpC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;YAChC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;QAChB,GAAG,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QAEjB,IAAI,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC;QAC3B,IAAI,KAAK,KAAK,SAAS,IAAK,KAAsC,CAAC,IAAI,EAAE;YACvE,KAAK,GAAI,KAAsC,CAAC,MAAM,CAAC,CAAC;SACzD;QAED,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;YAC7B,qBAAqB;YACrB,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACxC,qBAAqB;SACtB;aAAM,IAA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n\nimport {camelCase} from 'lodash';\n\nimport {\n Config,\n CommandOption,\n OptionValue,\n} from '@react-native-community/cli-types';\n\nimport {\n Telemetry,\n CodedError,\n CommandStartInfo,\n CommandEndInfo,\n CommanderOptionsType,\n commanderOptionsToOptions,\n optionsToArgs,\n OptionSanitizer,\n configToProjectInfo,\n getProjectFileFromConfig,\n deviceArchitecture,\n nodeArchitecture,\n} from '@react-native-windows/telemetry';\n\nimport {newInfo, newWarn} from './commandWithProgress';\n\n/**\n * Calculates a the default values of a given react-native CLI command's options.\n * @param config Config passed from react-native CLI.\n * @param commandOptions The options definition for the command.\n * @returns The default options for the command.\n */\nexport function getDefaultOptions(\n config: Config,\n commandOptions: CommandOption[],\n): CommanderOptionsType {\n const result: CommanderOptionsType = {\n logging: false,\n };\n for (const option of commandOptions) {\n let key = option.name.startsWith('--')\n ? option.name.slice('--'.length)\n : option.name;\n key = key.trim();\n\n let value = option.default;\n if (value !== undefined && (value as (ctx: Config) => OptionValue).name) {\n value = (value as (ctx: Config) => OptionValue)(config);\n }\n\n if (key.endsWith(' [string]')) {\n // Option is a string\n key = key.slice(0, -' [string]'.length);\n // Option is a number\n } else if (key.endsWith(' [number]')) {\n key = key.slice(0, -' [number]'.length);\n } else {\n // Option is a boolean\n // Note: Commander ignores the default property for booleans\n if (key.startsWith('no-')) {\n key = key.slice('no-'.length);\n // Commander always defaults to true for flags that start with --no\n value = true;\n } else {\n // Commander always defaults to undefined for flags\n value = undefined;\n }\n }\n\n key = camelCase(key);\n result[key] = value;\n }\n return result;\n}\n\n/**\n * Sets up and starts the telemetry gathering for the CLI command.\n * @param commandName The name of the CLI command.\n * @param config Config passed from react-native CLI.\n * @param options Options passed from react-native CLI.\n * @param defaultOptions Default options for the command.\n * @param optionSanitizer Function to sanitize the option values for telemetry.\n */\nexport async function startTelemetrySession(\n commandName: string,\n config: Config,\n options: CommanderOptionsType,\n defaultOptions: CommanderOptionsType,\n optionSanitizer: OptionSanitizer,\n) {\n const verbose = options.logging === true;\n\n if (!options.telemetry) {\n if (verbose) {\n newInfo('Telemetry is disabled');\n }\n return;\n }\n\n if (verbose) {\n newInfo(\n `Running ${nodeArchitecture()} node on a ${deviceArchitecture()} machine`,\n );\n }\n\n if (deviceArchitecture() !== nodeArchitecture()) {\n newWarn(\n 'This version of node was built for a different architecture than this machine and may cause unintended behavior',\n );\n }\n\n await Telemetry.setup();\n\n const sanitizedOptions = commanderOptionsToOptions(options, optionSanitizer);\n const sanitizedDefaultOptions = commanderOptionsToOptions(\n defaultOptions,\n optionSanitizer,\n );\n const sanitizedArgs = optionsToArgs(sanitizedOptions, process.argv);\n\n const startInfo: CommandStartInfo = {\n commandName,\n args: sanitizedArgs,\n options: sanitizedOptions,\n defaultOptions: sanitizedDefaultOptions,\n };\n\n Telemetry.startCommand(startInfo);\n\n const projectInfo = await configToProjectInfo(config);\n if (projectInfo) {\n Telemetry.setProjectInfo(projectInfo);\n }\n\n const projectFile = getProjectFileFromConfig(config);\n if (projectFile) {\n await Telemetry.populateNuGetPackageVersions(projectFile);\n }\n}\n\n/**\n * Ends the gathering of telemetry for the CLI command.\n * @param error The error (if any) thrown during the command.\n * @param getExtraProps Function to get any extra command-specific telemetry properties.\n */\nexport async function endTelemetrySession(\n error?: Error,\n getExtraProps?: () => Promise<Record<string, any>>,\n) {\n if (!Telemetry.isEnabled()) {\n // Bail early so don't waste time here\n return;\n }\n\n const endInfo: CommandEndInfo = {\n resultCode: 'Success',\n };\n\n if (error) {\n endInfo.resultCode =\n error instanceof CodedError ? (error as CodedError).type : 'Unknown';\n }\n\n Telemetry.endCommand(\n endInfo,\n getExtraProps ? await getExtraProps() : undefined,\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-windows/cli",
|
|
3
|
-
"version": "0.0.0-canary.
|
|
3
|
+
"version": "0.0.0-canary.183",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"watch": "rnw-scripts watch"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@react-native-windows/codegen": "0.0.0-canary.
|
|
21
|
-
"@react-native-windows/fs": "^0.0.0-canary.
|
|
22
|
-
"@react-native-windows/package-utils": "^0.0.0-canary.
|
|
23
|
-
"@react-native-windows/telemetry": "^0.0.0-canary.
|
|
20
|
+
"@react-native-windows/codegen": "0.0.0-canary.67",
|
|
21
|
+
"@react-native-windows/fs": "^0.0.0-canary.27",
|
|
22
|
+
"@react-native-windows/package-utils": "^0.0.0-canary.53",
|
|
23
|
+
"@react-native-windows/telemetry": "^0.0.0-canary.76",
|
|
24
24
|
"@xmldom/xmldom": "^0.7.7",
|
|
25
25
|
"chalk": "^4.1.0",
|
|
26
26
|
"cli-spinners": "^2.2.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@react-native-community/cli-types": "^12.0.0-alpha.3",
|
|
45
45
|
"@rnw-scripts/eslint-config": "1.2.2",
|
|
46
46
|
"@rnw-scripts/jest-unittest-config": "1.5.6",
|
|
47
|
-
"@rnw-scripts/just-task": "2.3.
|
|
47
|
+
"@rnw-scripts/just-task": "2.3.15",
|
|
48
48
|
"@rnw-scripts/ts-config": "2.0.5",
|
|
49
49
|
"@types/chalk": "^2.2.0",
|
|
50
50
|
"@types/jest": "^29.2.2",
|