@react-native-windows/cli
Advanced tools
Comparing version 0.0.0-canary.3 to 0.0.0-canary.4
@@ -5,3 +5,18 @@ { | ||
{ | ||
"date": "Fri, 14 Aug 2020 05:04:53 GMT", | ||
"date": "Wed, 19 Aug 2020 05:04:17 GMT", | ||
"tag": "@react-native-windows/cli_v0.0.0-canary.4", | ||
"version": "0.0.0-canary.4", | ||
"comments": { | ||
"prerelease": [ | ||
{ | ||
"comment": "Fixing config and autolinking", | ||
"author": "jthysell@microsoft.com", | ||
"commit": "286f393305bb13cf5982545d4e6b7de68e9a35c9", | ||
"package": "@react-native-windows/cli" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Fri, 14 Aug 2020 05:05:34 GMT", | ||
"tag": "@react-native-windows/cli_v0.0.0-canary.3", | ||
@@ -8,0 +23,0 @@ "version": "0.0.0-canary.3", |
# Change Log - @react-native-windows/cli | ||
This log was last generated on Fri, 14 Aug 2020 05:04:53 GMT and should not be manually modified. | ||
This log was last generated on Wed, 19 Aug 2020 05:04:17 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 0.0.0-canary.4 | ||
Wed, 19 Aug 2020 05:04:17 GMT | ||
### Changes | ||
- Fixing config and autolinking (jthysell@microsoft.com) | ||
## 0.0.0-canary.3 | ||
Fri, 14 Aug 2020 05:04:53 GMT | ||
Fri, 14 Aug 2020 05:05:34 GMT | ||
@@ -11,0 +19,0 @@ ### Changes |
@@ -54,3 +54,3 @@ /** | ||
*/ | ||
export declare function getProjectLanguage(projectPath: string): 'cpp' | 'cs'; | ||
export declare function getProjectLanguage(projectPath: string): 'cpp' | 'cs' | null; | ||
/** | ||
@@ -82,16 +82,14 @@ * Reads in the contents of the target project file. | ||
*/ | ||
export declare function getProjectName(projectPath: string, projectContents: Node): string; | ||
export declare function getProjectName(projectContents: Node): string; | ||
/** | ||
* Gets the namespace of the project from the project contents. | ||
* @param projectPath The project file path to check. | ||
* @param projectContents The XML project contents. | ||
* @return The project namespace. | ||
*/ | ||
export declare function getProjectNamespace(projectPath: string, projectContents: Node): string; | ||
export declare function getProjectNamespace(projectContents: Node): string | null; | ||
/** | ||
* Gets the guid of the project from the project contents. | ||
* @param projectPath The project file path to check. | ||
* @param projectContents The XML project contents. | ||
* @return The project guid. | ||
*/ | ||
export declare function getProjectGuid(projectPath: string, projectContents: Node): string; | ||
export declare function getProjectGuid(projectContents: Node): string | null; |
@@ -183,3 +183,3 @@ "use strict"; | ||
} | ||
throw new Error(`Cannot determine langauge for project '${projectPath}'`); | ||
return null; | ||
} | ||
@@ -229,8 +229,6 @@ exports.getProjectLanguage = getProjectLanguage; | ||
*/ | ||
function getProjectName(projectPath, projectContents) { | ||
function getProjectName(projectContents) { | ||
const name = findPropertyValue(projectContents, 'ProjectName') || | ||
findPropertyValue(projectContents, 'AssemblyName'); | ||
if (name === null) { | ||
throw new Error(`Could not determine name of project ${projectPath}`); | ||
} | ||
findPropertyValue(projectContents, 'AssemblyName') || | ||
''; | ||
return name; | ||
@@ -241,12 +239,7 @@ } | ||
* Gets the namespace of the project from the project contents. | ||
* @param projectPath The project file path to check. | ||
* @param projectContents The XML project contents. | ||
* @return The project namespace. | ||
*/ | ||
function getProjectNamespace(projectPath, projectContents) { | ||
const namespace = findPropertyValue(projectContents, 'RootNamespace'); | ||
if (namespace === null) { | ||
throw new Error(`Could not determine namespace of project ${projectPath}`); | ||
} | ||
return namespace; | ||
function getProjectNamespace(projectContents) { | ||
return findPropertyValue(projectContents, 'RootNamespace'); | ||
} | ||
@@ -256,14 +249,9 @@ exports.getProjectNamespace = getProjectNamespace; | ||
* Gets the guid of the project from the project contents. | ||
* @param projectPath The project file path to check. | ||
* @param projectContents The XML project contents. | ||
* @return The project guid. | ||
*/ | ||
function getProjectGuid(projectPath, projectContents) { | ||
const guid = findPropertyValue(projectContents, 'ProjectGuid'); | ||
if (guid === null) { | ||
throw new Error(`Could not determine GUID of project ${projectPath}`); | ||
} | ||
return guid; | ||
function getProjectGuid(projectContents) { | ||
return findPropertyValue(projectContents, 'ProjectGuid'); | ||
} | ||
exports.getProjectGuid = getProjectGuid; | ||
//# sourceMappingURL=configUtils.js.map |
@@ -10,4 +10,4 @@ /** | ||
projectName: string; | ||
projectLang: 'cpp' | 'cs'; | ||
projectGuid: string; | ||
projectLang: 'cpp' | 'cs' | null; | ||
projectGuid: string | null; | ||
cppHeaders: string[]; | ||
@@ -29,3 +29,3 @@ cppPackageProviders: string[]; | ||
sourceDir?: string; | ||
solutionFile: string | null; | ||
solutionFile?: string | null; | ||
projects: ProjectDependency[]; | ||
@@ -32,0 +32,0 @@ nugetPackages: NuGetPackageDependency[]; |
@@ -32,3 +32,3 @@ "use strict"; | ||
if (usingManualProjectsOverride && result.projects.length > 0) { | ||
// Manaully provided projects, so extract the sourceDir | ||
// Manually provided projects, so extract the sourceDir | ||
if (!('sourceDir' in userConfig)) { | ||
@@ -50,6 +50,12 @@ sourceDir = | ||
} | ||
if (sourceDir === null || | ||
(result.projects.length === 0 && result.nugetPackages.length === 0)) { | ||
// Nothing to look for here, bail | ||
return null; | ||
if (sourceDir === null) { | ||
// Try to salvage the missing sourceDir | ||
if (result.projects.length === 0 && result.nugetPackages.length > 0) { | ||
// Only nuget packages, no sourceDir required | ||
return result; | ||
} | ||
else if (result.projects.length > 0) { | ||
// Projects overridden but no sourceDir, assume the sourceDir === folder | ||
sourceDir = folder; | ||
} | ||
} | ||
@@ -61,2 +67,7 @@ else if (sourceDir.startsWith('Error: ')) { | ||
} | ||
if (sourceDir === null) { | ||
// After everything above, if sourceDir is still null, | ||
// there's nothing more to look for here, bail | ||
return null; | ||
} | ||
result.sourceDir = sourceDir.substr(folder.length + 1); | ||
@@ -99,18 +110,20 @@ const usingManualSolutionFile = 'solutionFile' in userConfig; | ||
// Calculating (auto) items | ||
project.projectName = configUtils.getProjectName(projectFile, projectContents); | ||
project.projectName = configUtils.getProjectName(projectContents); | ||
project.projectLang = configUtils.getProjectLanguage(projectFile); | ||
project.projectGuid = configUtils.getProjectGuid(projectFile, projectContents); | ||
project.projectGuid = configUtils.getProjectGuid(projectContents); | ||
if (project.directDependency) { | ||
// Calculating more (auto) items | ||
const projectNamespace = configUtils.getProjectNamespace(projectFile, projectContents); | ||
const cppNamespace = projectNamespace.replace(/\./g, '::'); | ||
const csNamespace = projectNamespace.replace(/::/g, '.'); | ||
project.cppHeaders = project.cppHeaders || [`winrt/${csNamespace}.h`]; | ||
project.cppPackageProviders = project.cppPackageProviders || [ | ||
`${cppNamespace}::ReactPackageProvider`, | ||
]; | ||
project.csNamespaces = project.csNamespaces || [`${csNamespace}`]; | ||
project.csPackageProviders = project.csPackageProviders || [ | ||
`${csNamespace}.ReactPackageProvider`, | ||
]; | ||
const projectNamespace = configUtils.getProjectNamespace(projectContents); | ||
if (projectNamespace !== null) { | ||
const cppNamespace = projectNamespace.replace(/\./g, '::'); | ||
const csNamespace = projectNamespace.replace(/::/g, '.'); | ||
project.cppHeaders = project.cppHeaders || [`winrt/${csNamespace}.h`]; | ||
project.cppPackageProviders = project.cppPackageProviders || [ | ||
`${cppNamespace}::ReactPackageProvider`, | ||
]; | ||
project.csNamespaces = project.csNamespaces || [`${csNamespace}`]; | ||
project.csPackageProviders = project.csPackageProviders || [ | ||
`${csNamespace}.ReactPackageProvider`, | ||
]; | ||
} | ||
} | ||
@@ -126,12 +139,18 @@ } | ||
const projectContents = configUtils.readProjectFile(projectFile); | ||
const projectName = configUtils.getProjectName(projectFile, projectContents); | ||
const projectGuid = configUtils.getProjectGuid(projectFile, projectContents); | ||
const projectNamespace = configUtils.getProjectNamespace(projectFile, projectContents); | ||
const projectName = configUtils.getProjectName(projectContents); | ||
const projectGuid = configUtils.getProjectGuid(projectContents); | ||
const projectNamespace = configUtils.getProjectNamespace(projectContents); | ||
const directDependency = true; | ||
const cppNamespace = projectNamespace.replace(/\./g, '::'); | ||
const csNamespace = projectNamespace.replace(/::/g, '.'); | ||
const cppHeaders = [`winrt/${csNamespace}.h`]; | ||
const cppPackageProviders = [`${cppNamespace}::ReactPackageProvider`]; | ||
const csNamespaces = [`${csNamespace}`]; | ||
const csPackageProviders = [`${csNamespace}.ReactPackageProvider`]; | ||
let cppHeaders = []; | ||
let cppPackageProviders = []; | ||
let csNamespaces = []; | ||
let csPackageProviders = []; | ||
if (projectNamespace !== null) { | ||
const cppNamespace = projectNamespace.replace(/\./g, '::'); | ||
const csNamespace = projectNamespace.replace(/::/g, '.'); | ||
cppHeaders.push(`winrt/${csNamespace}.h`); | ||
cppPackageProviders.push(`${cppNamespace}::ReactPackageProvider`); | ||
csNamespaces.push(`${csNamespace}`); | ||
csPackageProviders.push(`${csNamespace}.ReactPackageProvider`); | ||
} | ||
result.projects.push({ | ||
@@ -138,0 +157,0 @@ projectFile: projectFile.substr(sourceDir.length + 1), |
@@ -9,4 +9,4 @@ /** | ||
projectName: string; | ||
projectLang: 'cpp' | 'cs'; | ||
projectGuid: string; | ||
projectLang: 'cpp' | 'cs' | null; | ||
projectGuid: string | null; | ||
} | ||
@@ -13,0 +13,0 @@ export interface WindowsProjectConfig { |
@@ -114,5 +114,5 @@ "use strict"; | ||
// Add missing (auto) items | ||
result.project.projectName = configUtils.getProjectName(projectFile, projectContents); | ||
result.project.projectName = configUtils.getProjectName(projectContents); | ||
result.project.projectLang = configUtils.getProjectLanguage(projectFile); | ||
result.project.projectGuid = configUtils.getProjectGuid(projectFile, projectContents); | ||
result.project.projectGuid = configUtils.getProjectGuid(projectContents); | ||
} | ||
@@ -119,0 +119,0 @@ return result; |
@@ -112,5 +112,5 @@ "use strict"; | ||
projectFile: path.relative(path.join(windowsAppConfig.folder, windowsAppConfig.sourceDir), projFile), | ||
projectName: configUtils.getProjectName(projFile, projectContents), | ||
projectName: configUtils.getProjectName(projectContents), | ||
projectLang: configUtils.getProjectLanguage(projFile), | ||
projectGuid: configUtils.getProjectGuid(projFile, projectContents), | ||
projectGuid: configUtils.getProjectGuid(projectContents), | ||
}; | ||
@@ -117,0 +117,0 @@ } |
@@ -77,2 +77,8 @@ "use strict"; | ||
function addProjectToSolution(slnFile, project, verbose = false, checkMode = false) { | ||
if (project.projectLang === null) { | ||
throw new Error('Unable to add project to solution, projectLang is null'); | ||
} | ||
if (project.projectGuid === null) { | ||
throw new Error('Unable to add project to solution, projectGuid is null'); | ||
} | ||
if (verbose) { | ||
@@ -79,0 +85,0 @@ console.log(`Processing ${chalk.bold(path.basename(project.projectFile))}...`); |
{ | ||
"name": "@react-native-windows/cli", | ||
"version": "0.0.0-canary.3", | ||
"version": "0.0.0-canary.4", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "lib-commonjs/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
354220
3365