@react-native-windows/cli 0.0.0-canary.106 → 0.0.0-canary.107
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.
|
@@ -51,12 +51,9 @@ function getAppSolutionFile(options, config) {
|
|
|
51
51
|
exports.getAppSolutionFile = getAppSolutionFile;
|
|
52
52
|
function restorePackageConfigs(options) {
|
|
53
53
|
const pkgConfigs = new Array();
|
|
54
|
-
if (!options.sln) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
54
|
findFiles(options.root, 'packages.config', pkgConfigs);
|
|
58
55
|
for (const pkgConfig of pkgConfigs) {
|
|
59
|
-
const cmd = `NuGet.exe Restore -PackagesDirectory ${path_1.default.join(options.root, 'packages')}
|
|
56
|
+
const cmd = `NuGet.exe Restore -PackagesDirectory ${path_1.default.join(options.root, 'windows', 'packages')}
|
|
60
57
|
${pkgConfig}`;
|
|
61
58
|
const results = (0, child_process_1.execSync)(cmd).toString().split(os_1.EOL);
|
|
62
59
|
results.forEach((result) => console.log(chalk_1.default.white(result)));
|
|
@@ -65,13 +62,14 @@ function restorePackageConfigs(options) {
|
|
|
65
62
|
exports.restorePackageConfigs = restorePackageConfigs;
|
|
66
63
|
function findFiles(dir, name, result) {
|
|
67
64
|
fs_1.default.readdirSync(dir).forEach((file) => {
|
|
68
|
-
const
|
|
65
|
+
const filePath = path_1.default.join(dir, file);
|
|
66
|
+
const stat = fs_1.default.lstatSync(filePath);
|
|
69
67
|
if (stat.isDirectory()) {
|
|
70
|
-
findFiles(
|
|
68
|
+
findFiles(filePath, name, result);
|
|
71
69
|
}
|
|
72
70
|
else if ((stat.isFile() || stat.isSymbolicLink()) &&
|
|
73
71
|
`${file}`.endsWith('packages.config')) {
|
|
74
|
-
result.push(
|
|
72
|
+
result.push(filePath);
|
|
75
73
|
}
|
|
76
74
|
});
|
|
77
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources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,OAAO,CAAC,OAAO,CAAC;IAChD,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC;IAE/C,IACE,OAAO,aAAa,KAAK,QAAQ;QACjC,aAAa,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAC3C;QACA,IAAA,8BAAQ,EACN,aAAa,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC;YAC5C,qCAAqC,CACxC,CAAC;QACF,OAAO,IAAI,CAAC;KACb;SAAM;QACL,MAAM,iBAAiB,GAAG,aAAa,CAAC,WAAW,CAAC;QACpD,IAAI,iBAAiB,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;YACnD,IAAA,8BAAQ,EACN,iBAAiB,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC;gBAChD,qCAAqC,CACxC,CAAC;YACF,OAAO,IAAI,CAAC;SACb;QACD,OAAO,cAAI,CAAC,IAAI,CACd,gBAAgB,CAAC,MAAM,EACvB,gBAAgB,CAAC,SAAS,EAC1B,iBAAiB,CAClB,CAAC;KACH;AACH,CAAC;AAlCD,8CAkCC;AAED,SAAgB,iBAAiB,CAC/B,OAA0B;IAE1B,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,IAAI,OAAO,CAAC,YAAY,EAAE;QACxB,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACvC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;SAC/C;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAZD,8CAYC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport path from 'path';\n\nimport {EOL} from 'os';\nimport fs from '@react-native-windows/fs';\nimport MSBuildTools from './msbuildtools';\nimport Version from './version';\nimport {execSync} from 'child_process';\nimport {newError} from './commandWithProgress';\nimport {RunWindowsOptions, BuildConfig, BuildArch} from '../runWindowsOptions';\nimport {Config} from '@react-native-community/cli-types';\nimport {CodedError} from '@react-native-windows/telemetry';\nimport chalk from 'chalk';\n\nexport async function buildSolution(\n buildTools: MSBuildTools,\n slnFile: string,\n buildType: BuildConfig,\n buildArch: BuildArch,\n msBuildProps: Record<string, string>,\n verbose: boolean,\n target: 'build' | 'deploy',\n buildLogDirectory?: string,\n singleproc?: boolean,\n) {\n const minVersion = new Version(10, 0, 19041, 0);\n const allVersions = MSBuildTools.getAllAvailableUAPVersions();\n if (!allVersions.some((v) => v.gte(minVersion))) {\n throw new CodedError(\n 'MinSDKVersionNotMet',\n 'Must have a minimum Windows SDK version 10.0.19041.0 installed',\n );\n }\n\n await buildTools.buildProject(\n slnFile,\n buildType,\n buildArch,\n msBuildProps,\n verbose,\n target,\n buildLogDirectory,\n singleproc,\n );\n}\n\nconst configErrorString = 'Error: ';\n\nexport function getAppSolutionFile(options: RunWindowsOptions, config: Config) {\n // Use the solution file if specified\n if (options.sln) {\n return path.join(options.root, options.sln);\n }\n\n // Check the answer from react-native config\n const windowsAppConfig = config.project.windows;\n if (!windowsAppConfig) {\n throw new CodedError(\n 'NoWindowsConfig',\n \"Couldn't determine Windows app config\",\n );\n }\n const configSolutionFile = windowsAppConfig.solutionFile;\n\n if (configSolutionFile.startsWith(configErrorString)) {\n newError(\n configSolutionFile.substr(configErrorString.length) +\n ' Optionally, use --sln {slnFile}.',\n );\n return null;\n } else {\n return path.join(\n windowsAppConfig.folder,\n windowsAppConfig.sourceDir,\n configSolutionFile,\n );\n }\n}\n\nexport function restorePackageConfigs(options: RunWindowsOptions) {\n const pkgConfigs = new Array();\n\n findFiles(options.root, 'packages.config', pkgConfigs);\n\n for (const pkgConfig of pkgConfigs) {\n const cmd = `NuGet.exe Restore -PackagesDirectory ${path.join(\n options.root,\n 'windows',\n 'packages',\n )}\n ${pkgConfig}`;\n const results = execSync(cmd).toString().split(EOL);\n results.forEach((result) => console.log(chalk.white(result)));\n }\n}\n\nfunction findFiles(dir: any, name: string, result: Array<string>) {\n fs.readdirSync(dir).forEach((file: string) => {\n const filePath = path.join(dir, file);\n const stat = fs.lstatSync(filePath);\n if (stat.isDirectory()) {\n findFiles(filePath, name, result);\n } else if (\n (stat.isFile() || stat.isSymbolicLink()) &&\n `${file}`.endsWith('packages.config')\n ) {\n result.push(filePath);\n }\n });\n}\n\nexport function getAppProjectFile(options: RunWindowsOptions, config: Config) {\n // Use the project file if specified\n if (options.proj) {\n return path.join(options.root, options.proj);\n }\n\n // Check the answer from react-native config\n const windowsAppConfig = config.project.windows;\n const configProject = windowsAppConfig.project;\n\n if (\n typeof configProject === 'string' &&\n configProject.startsWith(configErrorString)\n ) {\n newError(\n configProject.substr(configErrorString.length) +\n ' Optionally, use --proj {projFile}.',\n );\n return null;\n } else {\n const configProjectFile = configProject.projectFile;\n if (configProjectFile.startsWith(configErrorString)) {\n newError(\n configProjectFile.substr(configErrorString.length) +\n ' Optionally, use --proj {projFile}.',\n );\n return null;\n }\n return path.join(\n windowsAppConfig.folder,\n windowsAppConfig.sourceDir,\n configProjectFile,\n );\n }\n}\n\nexport function parseMsBuildProps(\n options: RunWindowsOptions,\n): Record<string, string> {\n const result: Record<string, string> = {};\n if (options.msbuildprops) {\n const props = options.msbuildprops.split(',');\n for (const prop of props) {\n const propAssignment = prop.split('=');\n result[propAssignment[0]] = propAssignment[1];\n }\n }\n return result;\n}\n"]}
|