@react-native-windows/cli 0.0.0-canary.188 → 0.0.0-canary.189

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.
@@ -102,7 +102,8 @@ function isRnwDependencyProject(filePath) {
102
102
  return importProjectExists(projectContents, 'Microsoft.ReactNative.Uwp.CSharpLib.targets');
103
103
  }
104
104
  else if (projectLang === 'cpp') {
105
- return importProjectExists(projectContents, 'Microsoft.ReactNative.Uwp.CppLib.targets');
105
+ return (importProjectExists(projectContents, 'Microsoft.ReactNative.Uwp.CppLib.targets') ||
106
+ importProjectExists(projectContents, 'Microsoft.ReactNative.Composition.CppLib.targets'));
106
107
  }
107
108
  return false;
108
109
  }
@@ -161,7 +162,8 @@ function isRnwAppProject(filePath) {
161
162
  return importProjectExists(projectContents, 'Microsoft.ReactNative.Uwp.CSharpApp.targets');
162
163
  }
163
164
  else if (projectLang === 'cpp') {
164
- return importProjectExists(projectContents, 'Microsoft.ReactNative.Uwp.CppApp.targets');
165
+ return (importProjectExists(projectContents, 'Microsoft.ReactNative.Uwp.CppApp.targets') ||
166
+ importProjectExists(projectContents, 'Microsoft.ReactNative.Composition.CppApp.targets'));
165
167
  }
166
168
  return false;
167
169
  }
@@ -1 +1 @@
1
- {"version":3,"file":"configUtils.js","sourceRoot":"","sources":["../../../src/commands/config/configUtils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,kEAA0C;AAC1C,gDAAwB;AACxB,gDAAwB;AAExB,2CAAyC;AACzC,kDAA0B;AAC1B,+DAA2D;AAE3D,MAAM,aAAa,GAAG,eAAK,CAAC,aAAa,CAAC;IACxC,OAAO,EAAE,qDAAqD;CAC/D,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,MAAc,EAAE,eAAuB;IAC/D,MAAM,KAAK,GAAG,cAAI,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,EAAE;QAC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C,CAAC;IACjD,MAAM,KAAK,GAAG,aAAa,CACzB,mCAAmC,EACnC,aAAa,CACd,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,YAAY,GAAG,IAAY,CAAC;QAClC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC,WAAW,CAAC;KAC1D;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AApBD,0DAoBC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\nimport glob from 'glob';\n\nimport {DOMParser} from '@xmldom/xmldom';\nimport xpath from 'xpath';\nimport {CodedError} from '@react-native-windows/telemetry';\n\nconst msbuildSelect = xpath.useNamespaces({\n msbuild: 'http://schemas.microsoft.com/developer/msbuild/2003',\n});\n\n/**\n * Search for files matching the pattern under the target folder.\n * @param folder The absolute path to target folder.\n * @param filenamePattern The pattern to search for.\n * @return Return the array of relative file paths.\n */\nexport function findFiles(folder: string, filenamePattern: string): string[] {\n const files = glob.sync(path.join('**', filenamePattern), {\n cwd: folder,\n ignore: [\n 'node_modules/**',\n '**/Debug/**',\n '**/Release/**',\n '**/Generated Files/**',\n '**/packages/**',\n ],\n });\n\n return files;\n}\n\n/**\n * Search for the windows sub-folder under the target folder.\n * @param folder The absolute path to the target folder.\n * @return The absolute path to the windows folder, if it exists.\n */\nexport function findWindowsFolder(folder: string): string | null {\n const winDir = 'windows';\n const joinedDir = path.join(folder, winDir);\n if (fs.existsSync(joinedDir)) {\n return joinedDir;\n }\n\n return null;\n}\n\n/**\n * Checks if the target file path is a RNW solution file by checking if it contains the string \"ReactNative\".\n * @param filePath The absolute file path to check.\n * @return Whether the path is to a RNW solution file.\n */\nexport function isRnwSolution(filePath: string): boolean {\n return (\n fs\n .readFileSync(filePath)\n .toString()\n .search(/ReactNative/) > 0\n );\n}\n\n/**\n * Search for the RNW solution files under the target folder.\n * @param winFolder The absolute path to target folder.\n * @return Return the array of relative file paths.\n */\nexport function findSolutionFiles(winFolder: string): string[] {\n // First search for all potential solution files\n const allSolutions = findFiles(winFolder, '*.sln');\n\n if (allSolutions.length === 0) {\n // If there're no solution files, return 0\n return [];\n } else if (allSolutions.length === 1) {\n // If there is exactly one solution file, assume it's it\n return [allSolutions[0]];\n }\n\n const solutionFiles = [];\n\n // Try to find any solution file that appears to be a React Native solution\n for (const solutionFile of allSolutions) {\n if (isRnwSolution(path.join(winFolder, solutionFile))) {\n solutionFiles.push(path.normalize(solutionFile));\n }\n }\n\n return solutionFiles;\n}\n\n/**\n * Checks if the target file path is a RNW lib project file.\n * @param filePath The absolute file path to check.\n * @return Whether the path is to a RNW lib project file.\n */\nexport function isRnwDependencyProject(filePath: string): boolean {\n const projectContents = readProjectFile(filePath);\n\n const projectLang = getProjectLanguage(filePath);\n if (projectLang === 'cs') {\n return importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Uwp.CSharpLib.targets',\n );\n } else if (projectLang === 'cpp') {\n return importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Uwp.CppLib.targets',\n );\n }\n\n return false;\n}\n\n/**\n * Search for the RNW lib project files under the target folder.\n * @param winFolder The absolute path to target folder.\n * @return Return the array of relative file paths.\n */\nexport function findDependencyProjectFiles(winFolder: string): string[] {\n // First, search for all potential project files\n const allCppProj = findFiles(winFolder, '*.vcxproj');\n const allCsProj = findFiles(winFolder, '*.csproj');\n\n const allProjects = allCppProj.concat(allCsProj);\n\n if (allProjects.length === 0) {\n // If there're no project files, return 0\n return [];\n }\n\n const dependencyProjectFiles = [];\n\n // Try to find any project file that appears to be a dependency project\n for (const projectFile of allProjects) {\n // A project is marked as a RNW dependency iff either:\n // - If the project has the standard native module imports, or\n // - If we only have a single project (and it doesn't have the standard native module imports),\n // pick it and hope for the best. This enables autolinking for modules that were written\n // before the standard native module template existed.\n if (\n allProjects.length === 1 ||\n isRnwDependencyProject(path.join(winFolder, projectFile))\n ) {\n dependencyProjectFiles.push(path.normalize(projectFile));\n }\n }\n\n return dependencyProjectFiles;\n}\n\ntype ReactNativeProjectType = 'unknown' | 'App-WinAppSDK';\n\nfunction getReactNativeProjectType(\n value: string | null,\n): ReactNativeProjectType {\n switch (value) {\n case 'App-WinAppSDK':\n return value;\n\n default:\n return 'unknown';\n }\n}\n\n/**\n * Checks if the target file path is a RNW app project file.\n * @param filePath The absolute file path to check.\n * @return Whether the path is to a RNW app project file.\n */\nfunction isRnwAppProject(filePath: string): boolean {\n const projectContents = readProjectFile(filePath);\n\n const rnProjectType = getReactNativeProjectType(\n tryFindPropertyValue(projectContents, 'ReactNativeProjectType'),\n );\n\n if (rnProjectType !== 'unknown') {\n return true;\n }\n\n const projectLang = getProjectLanguage(filePath);\n if (projectLang === 'cs') {\n return importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Uwp.CSharpApp.targets',\n );\n } else if (projectLang === 'cpp') {\n return importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Uwp.CppApp.targets',\n );\n }\n\n return false;\n}\n\n/**\n * Search for the RNW app project files under the target folder.\n * @param winFolder The absolute path to target folder.\n * @return Return the array of relative file paths.\n */\nexport function findAppProjectFiles(winFolder: string): string[] {\n // First, search for all potential project files\n const allCppProj = findFiles(winFolder, '*.vcxproj');\n const allCsProj = findFiles(winFolder, '*.csproj');\n\n const allProjects = allCppProj.concat(allCsProj);\n\n if (allProjects.length === 0) {\n // If there're no project files, return 0\n return [];\n }\n\n const appProjectFiles = [];\n\n // Try to find any project file that appears to be an app project\n for (const projectFile of allProjects) {\n if (isRnwAppProject(path.join(winFolder, projectFile))) {\n appProjectFiles.push(path.normalize(projectFile));\n }\n }\n\n return appProjectFiles;\n}\n\n/**\n * Returns the programming language of the project file.\n * @param projectPath The project file path to check.\n * @return The language string: cpp, cs, or null if unknown.\n */\nexport function getProjectLanguage(projectPath: string): 'cpp' | 'cs' | null {\n if (projectPath.endsWith('.vcxproj')) {\n return 'cpp';\n } else if (projectPath.endsWith('.csproj')) {\n return 'cs';\n }\n\n return null;\n}\n\n/**\n * Reads in the contents of the target project file.\n * @param projectPath The target project file path.\n * @return The project file contents.\n */\nexport function readProjectFile(projectPath: string) {\n const projectContents = fs.readFileSync(projectPath, 'utf8').toString();\n return new DOMParser().parseFromString(projectContents, 'application/xml');\n}\n\n/**\n * Search for the given property in the project contents and return its value.\n * @param projectContents The XML project contents.\n * @param propertyName The property to look for.\n * @return The value of the tag if it exists.\n */\nexport function tryFindPropertyValue(\n projectContents: Node,\n propertyName: string,\n): string | null {\n const nodes = msbuildSelect(\n `//msbuild:PropertyGroup/msbuild:${propertyName}`,\n projectContents,\n );\n\n if (nodes.length > 0) {\n // Take the last one\n return (nodes[nodes.length - 1] as Node).textContent;\n } else {\n const noNamespaceNodes = xpath.select(\n `//PropertyGroup/${propertyName}`,\n projectContents,\n );\n if (noNamespaceNodes.length > 0) {\n return (noNamespaceNodes[noNamespaceNodes.length - 1] as Node)\n .textContent;\n }\n }\n\n return null;\n}\n\nexport function findPropertyValue(\n projectContents: Node,\n propertyName: string,\n filePath: string,\n): string {\n const res = tryFindPropertyValue(projectContents, propertyName);\n if (!res) {\n throw new CodedError(\n 'NoPropertyInProject',\n `Couldn't find property ${propertyName} from ${filePath}`,\n {propertyName: propertyName},\n );\n }\n return res;\n}\n\n/**\n * Search for the given import project in the project contents and return if it exists.\n * @param projectContents The XML project contents.\n * @param projectName The project to look for.\n * @return If the target exists.\n */\nexport function importProjectExists(\n projectContents: Node,\n projectName: string,\n): boolean {\n const nodes = msbuildSelect(\n `//msbuild:Import[contains(@Project,'${projectName}')]`,\n projectContents,\n );\n\n return nodes.length > 0;\n}\n\nexport type ConfigurationType =\n | 'application'\n | 'dynamiclibrary'\n | 'generic'\n | 'staticlibrary'\n | 'unknown';\n\n/**\n * Gets the configuration type of the project from the project contents.\n * @param projectContents The XML project contents.\n * @return The project configuration type.\n */\nexport function getConfigurationType(projectContents: Node): ConfigurationType {\n const configurationType = tryFindPropertyValue(\n projectContents,\n 'ConfigurationType',\n )?.toLowerCase();\n\n switch (configurationType) {\n case 'application':\n case 'dynamiclibrary':\n case 'generic':\n case 'staticlibrary':\n return configurationType;\n\n default:\n return 'unknown';\n }\n}\n\nexport type OutputType =\n | 'appcontainerexe'\n | 'exe'\n | 'library'\n | 'module'\n | 'unknown'\n | 'winexe'\n | 'winmdobj';\n\n/**\n * Gets the output type of the project from the project contents.\n * @param projectContents The XML project contents.\n * @return The project output type.\n */\nexport function getOutputType(projectContents: Node): OutputType {\n const outputType = tryFindPropertyValue(\n projectContents,\n 'OutputType',\n )?.toLowerCase();\n\n switch (outputType) {\n case 'appcontainerexe':\n case 'exe':\n case 'library':\n case 'module':\n case 'winexe':\n case 'winmdobj':\n return outputType;\n\n default:\n return 'unknown';\n }\n}\n\n/**\n * Gets the type of the project from the project contents.\n * @param projectPath The project file path to check.\n * @param projectContents The XML project contents.\n * @return The project type.\n */\nexport function getProjectType(\n projectPath: string,\n projectContents: Node,\n): ConfigurationType | OutputType {\n switch (getProjectLanguage(projectPath)) {\n case 'cpp':\n return getConfigurationType(projectContents);\n\n case 'cs':\n return getOutputType(projectContents);\n\n default:\n return 'unknown';\n }\n}\n\n/**\n * Gets the name of the project from the project contents.\n * @param projectPath The project file path to check.\n * @param projectContents The XML project contents.\n * @return The project name.\n */\nexport function getProjectName(\n projectPath: string,\n projectContents: Node,\n): string {\n const name =\n tryFindPropertyValue(projectContents, 'ProjectName') ||\n path.parse(projectPath).name ||\n '';\n\n return name;\n}\n\n/**\n * Gets the namespace of the project from the project contents.\n * @param projectContents The XML project contents.\n * @return The project namespace.\n */\nexport function getProjectNamespace(projectContents: Node): string | null {\n return tryFindPropertyValue(projectContents, 'RootNamespace');\n}\n\n/**\n * Gets the guid of the project from the project contents.\n * @param projectContents The XML project contents.\n * @return The project guid.\n */\nexport function getProjectGuid(projectContents: Node): string | null {\n return tryFindPropertyValue(projectContents, 'ProjectGuid');\n}\n\nexport function getExperimentalFeatures(\n solutionDir: string,\n): Record<string, string> | undefined {\n const propsFile = path.join(solutionDir, 'ExperimentalFeatures.props');\n\n if (!fs.existsSync(propsFile)) {\n return undefined;\n }\n\n const result: Record<string, any> = {};\n const propsContents = readProjectFile(propsFile);\n const nodes = msbuildSelect(\n `//msbuild:PropertyGroup/msbuild:*`,\n propsContents,\n );\n for (const node of nodes) {\n const propertyNode = node as Node;\n result[propertyNode.nodeName] = propertyNode.textContent;\n }\n return result;\n}\n"]}
1
+ {"version":3,"file":"configUtils.js","sourceRoot":"","sources":["../../../src/commands/config/configUtils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,kEAA0C;AAC1C,gDAAwB;AACxB,gDAAwB;AAExB,2CAAyC;AACzC,kDAA0B;AAC1B,+DAA2D;AAE3D,MAAM,aAAa,GAAG,eAAK,CAAC,aAAa,CAAC;IACxC,OAAO,EAAE,qDAAqD;CAC/D,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,MAAc,EAAE,eAAuB;IAC/D,MAAM,KAAK,GAAG,cAAI,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,EAAE;QACxD,GAAG,EAAE,MAAM;QACX,MAAM,EAAE;YACN,iBAAiB;YACjB,aAAa;YACb,eAAe;YACf,uBAAuB;YACvB,gBAAgB;SACjB;KACF,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAbD,8BAaC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,MAAc;IAC9C,MAAM,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,IAAI,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAC5B,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AARD,8CAQC;AAED;;;;GAIG;AACH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C;QAExC;YACE,OAAO,SAAS,CAAC;KACpB;AACH,CAAC;AAdD,wCAcC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAC5B,WAAmB,EACnB,eAAqB;IAErB,MAAM,IAAI,GACR,oBAAoB,CAAC,eAAe,EAAE,aAAa,CAAC;QACpD,cAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI;QAC5B,EAAE,CAAC;IAEL,OAAO,IAAI,CAAC;AACd,CAAC;AAVD,wCAUC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,eAAqB;IACvD,OAAO,oBAAoB,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;AAChE,CAAC;AAFD,kDAEC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,eAAqB;IAClD,OAAO,oBAAoB,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AAC9D,CAAC;AAFD,wCAEC;AAED,SAAgB,uBAAuB,CACrC,WAAmB;IAEnB,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,4BAA4B,CAAC,CAAC;IAEvE,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAC7B,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,MAAM,GAAwB,EAAE,CAAC;IACvC,MAAM,aAAa,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,aAAa,CACzB,mCAAmC,EACnC,aAAa,CACd,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,YAAY,GAAG,IAAY,CAAC;QAClC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC,WAAW,CAAC;KAC1D;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AApBD,0DAoBC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport fs from '@react-native-windows/fs';\nimport path from 'path';\nimport glob from 'glob';\n\nimport {DOMParser} from '@xmldom/xmldom';\nimport xpath from 'xpath';\nimport {CodedError} from '@react-native-windows/telemetry';\n\nconst msbuildSelect = xpath.useNamespaces({\n msbuild: 'http://schemas.microsoft.com/developer/msbuild/2003',\n});\n\n/**\n * Search for files matching the pattern under the target folder.\n * @param folder The absolute path to target folder.\n * @param filenamePattern The pattern to search for.\n * @return Return the array of relative file paths.\n */\nexport function findFiles(folder: string, filenamePattern: string): string[] {\n const files = glob.sync(path.join('**', filenamePattern), {\n cwd: folder,\n ignore: [\n 'node_modules/**',\n '**/Debug/**',\n '**/Release/**',\n '**/Generated Files/**',\n '**/packages/**',\n ],\n });\n\n return files;\n}\n\n/**\n * Search for the windows sub-folder under the target folder.\n * @param folder The absolute path to the target folder.\n * @return The absolute path to the windows folder, if it exists.\n */\nexport function findWindowsFolder(folder: string): string | null {\n const winDir = 'windows';\n const joinedDir = path.join(folder, winDir);\n if (fs.existsSync(joinedDir)) {\n return joinedDir;\n }\n\n return null;\n}\n\n/**\n * Checks if the target file path is a RNW solution file by checking if it contains the string \"ReactNative\".\n * @param filePath The absolute file path to check.\n * @return Whether the path is to a RNW solution file.\n */\nexport function isRnwSolution(filePath: string): boolean {\n return (\n fs\n .readFileSync(filePath)\n .toString()\n .search(/ReactNative/) > 0\n );\n}\n\n/**\n * Search for the RNW solution files under the target folder.\n * @param winFolder The absolute path to target folder.\n * @return Return the array of relative file paths.\n */\nexport function findSolutionFiles(winFolder: string): string[] {\n // First search for all potential solution files\n const allSolutions = findFiles(winFolder, '*.sln');\n\n if (allSolutions.length === 0) {\n // If there're no solution files, return 0\n return [];\n } else if (allSolutions.length === 1) {\n // If there is exactly one solution file, assume it's it\n return [allSolutions[0]];\n }\n\n const solutionFiles = [];\n\n // Try to find any solution file that appears to be a React Native solution\n for (const solutionFile of allSolutions) {\n if (isRnwSolution(path.join(winFolder, solutionFile))) {\n solutionFiles.push(path.normalize(solutionFile));\n }\n }\n\n return solutionFiles;\n}\n\n/**\n * Checks if the target file path is a RNW lib project file.\n * @param filePath The absolute file path to check.\n * @return Whether the path is to a RNW lib project file.\n */\nexport function isRnwDependencyProject(filePath: string): boolean {\n const projectContents = readProjectFile(filePath);\n\n const projectLang = getProjectLanguage(filePath);\n if (projectLang === 'cs') {\n return importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Uwp.CSharpLib.targets',\n );\n } else if (projectLang === 'cpp') {\n return (\n importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Uwp.CppLib.targets',\n ) ||\n importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Composition.CppLib.targets',\n )\n );\n }\n\n return false;\n}\n\n/**\n * Search for the RNW lib project files under the target folder.\n * @param winFolder The absolute path to target folder.\n * @return Return the array of relative file paths.\n */\nexport function findDependencyProjectFiles(winFolder: string): string[] {\n // First, search for all potential project files\n const allCppProj = findFiles(winFolder, '*.vcxproj');\n const allCsProj = findFiles(winFolder, '*.csproj');\n\n const allProjects = allCppProj.concat(allCsProj);\n\n if (allProjects.length === 0) {\n // If there're no project files, return 0\n return [];\n }\n\n const dependencyProjectFiles = [];\n\n // Try to find any project file that appears to be a dependency project\n for (const projectFile of allProjects) {\n // A project is marked as a RNW dependency iff either:\n // - If the project has the standard native module imports, or\n // - If we only have a single project (and it doesn't have the standard native module imports),\n // pick it and hope for the best. This enables autolinking for modules that were written\n // before the standard native module template existed.\n if (\n allProjects.length === 1 ||\n isRnwDependencyProject(path.join(winFolder, projectFile))\n ) {\n dependencyProjectFiles.push(path.normalize(projectFile));\n }\n }\n\n return dependencyProjectFiles;\n}\n\ntype ReactNativeProjectType = 'unknown' | 'App-WinAppSDK';\n\nfunction getReactNativeProjectType(\n value: string | null,\n): ReactNativeProjectType {\n switch (value) {\n case 'App-WinAppSDK':\n return value;\n\n default:\n return 'unknown';\n }\n}\n\n/**\n * Checks if the target file path is a RNW app project file.\n * @param filePath The absolute file path to check.\n * @return Whether the path is to a RNW app project file.\n */\nfunction isRnwAppProject(filePath: string): boolean {\n const projectContents = readProjectFile(filePath);\n\n const rnProjectType = getReactNativeProjectType(\n tryFindPropertyValue(projectContents, 'ReactNativeProjectType'),\n );\n\n if (rnProjectType !== 'unknown') {\n return true;\n }\n\n const projectLang = getProjectLanguage(filePath);\n if (projectLang === 'cs') {\n return importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Uwp.CSharpApp.targets',\n );\n } else if (projectLang === 'cpp') {\n return (\n importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Uwp.CppApp.targets',\n ) ||\n importProjectExists(\n projectContents,\n 'Microsoft.ReactNative.Composition.CppApp.targets',\n )\n );\n }\n\n return false;\n}\n\n/**\n * Search for the RNW app project files under the target folder.\n * @param winFolder The absolute path to target folder.\n * @return Return the array of relative file paths.\n */\nexport function findAppProjectFiles(winFolder: string): string[] {\n // First, search for all potential project files\n const allCppProj = findFiles(winFolder, '*.vcxproj');\n const allCsProj = findFiles(winFolder, '*.csproj');\n\n const allProjects = allCppProj.concat(allCsProj);\n\n if (allProjects.length === 0) {\n // If there're no project files, return 0\n return [];\n }\n\n const appProjectFiles = [];\n\n // Try to find any project file that appears to be an app project\n for (const projectFile of allProjects) {\n if (isRnwAppProject(path.join(winFolder, projectFile))) {\n appProjectFiles.push(path.normalize(projectFile));\n }\n }\n\n return appProjectFiles;\n}\n\n/**\n * Returns the programming language of the project file.\n * @param projectPath The project file path to check.\n * @return The language string: cpp, cs, or null if unknown.\n */\nexport function getProjectLanguage(projectPath: string): 'cpp' | 'cs' | null {\n if (projectPath.endsWith('.vcxproj')) {\n return 'cpp';\n } else if (projectPath.endsWith('.csproj')) {\n return 'cs';\n }\n\n return null;\n}\n\n/**\n * Reads in the contents of the target project file.\n * @param projectPath The target project file path.\n * @return The project file contents.\n */\nexport function readProjectFile(projectPath: string) {\n const projectContents = fs.readFileSync(projectPath, 'utf8').toString();\n return new DOMParser().parseFromString(projectContents, 'application/xml');\n}\n\n/**\n * Search for the given property in the project contents and return its value.\n * @param projectContents The XML project contents.\n * @param propertyName The property to look for.\n * @return The value of the tag if it exists.\n */\nexport function tryFindPropertyValue(\n projectContents: Node,\n propertyName: string,\n): string | null {\n const nodes = msbuildSelect(\n `//msbuild:PropertyGroup/msbuild:${propertyName}`,\n projectContents,\n );\n\n if (nodes.length > 0) {\n // Take the last one\n return (nodes[nodes.length - 1] as Node).textContent;\n } else {\n const noNamespaceNodes = xpath.select(\n `//PropertyGroup/${propertyName}`,\n projectContents,\n );\n if (noNamespaceNodes.length > 0) {\n return (noNamespaceNodes[noNamespaceNodes.length - 1] as Node)\n .textContent;\n }\n }\n\n return null;\n}\n\nexport function findPropertyValue(\n projectContents: Node,\n propertyName: string,\n filePath: string,\n): string {\n const res = tryFindPropertyValue(projectContents, propertyName);\n if (!res) {\n throw new CodedError(\n 'NoPropertyInProject',\n `Couldn't find property ${propertyName} from ${filePath}`,\n {propertyName: propertyName},\n );\n }\n return res;\n}\n\n/**\n * Search for the given import project in the project contents and return if it exists.\n * @param projectContents The XML project contents.\n * @param projectName The project to look for.\n * @return If the target exists.\n */\nexport function importProjectExists(\n projectContents: Node,\n projectName: string,\n): boolean {\n const nodes = msbuildSelect(\n `//msbuild:Import[contains(@Project,'${projectName}')]`,\n projectContents,\n );\n\n return nodes.length > 0;\n}\n\nexport type ConfigurationType =\n | 'application'\n | 'dynamiclibrary'\n | 'generic'\n | 'staticlibrary'\n | 'unknown';\n\n/**\n * Gets the configuration type of the project from the project contents.\n * @param projectContents The XML project contents.\n * @return The project configuration type.\n */\nexport function getConfigurationType(projectContents: Node): ConfigurationType {\n const configurationType = tryFindPropertyValue(\n projectContents,\n 'ConfigurationType',\n )?.toLowerCase();\n\n switch (configurationType) {\n case 'application':\n case 'dynamiclibrary':\n case 'generic':\n case 'staticlibrary':\n return configurationType;\n\n default:\n return 'unknown';\n }\n}\n\nexport type OutputType =\n | 'appcontainerexe'\n | 'exe'\n | 'library'\n | 'module'\n | 'unknown'\n | 'winexe'\n | 'winmdobj';\n\n/**\n * Gets the output type of the project from the project contents.\n * @param projectContents The XML project contents.\n * @return The project output type.\n */\nexport function getOutputType(projectContents: Node): OutputType {\n const outputType = tryFindPropertyValue(\n projectContents,\n 'OutputType',\n )?.toLowerCase();\n\n switch (outputType) {\n case 'appcontainerexe':\n case 'exe':\n case 'library':\n case 'module':\n case 'winexe':\n case 'winmdobj':\n return outputType;\n\n default:\n return 'unknown';\n }\n}\n\n/**\n * Gets the type of the project from the project contents.\n * @param projectPath The project file path to check.\n * @param projectContents The XML project contents.\n * @return The project type.\n */\nexport function getProjectType(\n projectPath: string,\n projectContents: Node,\n): ConfigurationType | OutputType {\n switch (getProjectLanguage(projectPath)) {\n case 'cpp':\n return getConfigurationType(projectContents);\n\n case 'cs':\n return getOutputType(projectContents);\n\n default:\n return 'unknown';\n }\n}\n\n/**\n * Gets the name of the project from the project contents.\n * @param projectPath The project file path to check.\n * @param projectContents The XML project contents.\n * @return The project name.\n */\nexport function getProjectName(\n projectPath: string,\n projectContents: Node,\n): string {\n const name =\n tryFindPropertyValue(projectContents, 'ProjectName') ||\n path.parse(projectPath).name ||\n '';\n\n return name;\n}\n\n/**\n * Gets the namespace of the project from the project contents.\n * @param projectContents The XML project contents.\n * @return The project namespace.\n */\nexport function getProjectNamespace(projectContents: Node): string | null {\n return tryFindPropertyValue(projectContents, 'RootNamespace');\n}\n\n/**\n * Gets the guid of the project from the project contents.\n * @param projectContents The XML project contents.\n * @return The project guid.\n */\nexport function getProjectGuid(projectContents: Node): string | null {\n return tryFindPropertyValue(projectContents, 'ProjectGuid');\n}\n\nexport function getExperimentalFeatures(\n solutionDir: string,\n): Record<string, string> | undefined {\n const propsFile = path.join(solutionDir, 'ExperimentalFeatures.props');\n\n if (!fs.existsSync(propsFile)) {\n return undefined;\n }\n\n const result: Record<string, any> = {};\n const propsContents = readProjectFile(propsFile);\n const nodes = msbuildSelect(\n `//msbuild:PropertyGroup/msbuild:*`,\n propsContents,\n );\n for (const node of nodes) {\n const propertyNode = node as Node;\n result[propertyNode.nodeName] = propertyNode.textContent;\n }\n return result;\n}\n"]}
@@ -64,7 +64,7 @@ function resolveContents(srcPath, replacements) {
64
64
  }
65
65
  exports.resolveContents = resolveContents;
66
66
  // Binary files, don't process these (avoid decoding as utf8)
67
- const binaryExtensions = ['.png', '.jar', '.keystore'];
67
+ const binaryExtensions = ['.png', '.jar', '.keystore', '.ico', '.rc'];
68
68
  /**
69
69
  * Copy a file to given destination, replacing parts of its contents.
70
70
  * @param srcPath Path to a file to be copied.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator-common/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,kEAA0C;AAC1C,kDAA0B;AAC1B,sDAA8B;AAC9B,gDAAwB;AACxB,wDAAgC;AAChC,+DAA2D;AAW3D,SAAS,IAAI,CAAC,OAAe;IAC3B,IAAI,CAAC,YAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;QACxC,OAAO,CAAC,OAAO,CAAC,CAAC;KAClB;IAED,MAAM,KAAK,GAAG,YAAE;SACb,WAAW,CAAC,OAAO,CAAC;SACpB,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAC7B,OAAe,EACf,YAA0B;IAE1B,IAAI,OAAO,GAAG,YAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAE/C,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAC5B,4DAA4D;QAC5D,KAAK,MAAM,GAAG,IAAI,MAAM,C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C,IAAI,cAAc,KAAK,KAAK,EAAE;QAC5B,OAAO,CAAC,GAAG,CAAC,GAAG,eAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,gBAAgB,EAAE,CAAC,CAAC;QACxD,OAAO,WAAW,CAAC;KACpB;IACD,IAAI,cAAc,KAAK,SAAS,EAAE;QAChC,OAAO,CAAC,GAAG,CACT,GAAG,eAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG;YAChC,6DAA6D,gBAAgB,0BAA0B;YACvG,0FAA0F;YAC1F,qCAAqC,mBAAmB,EAAE,CAC7D,CAAC;QAEF,MAAM,EAAC,aAAa,EAAC,GAAG,MAAM,IAAA,iBAAO,EAAC;YACpC;gBACE,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,0BAA0B,gBAAgB,GAAG;gBACtD,OAAO,EAAE,KAAK;aACf;SACF,CAAC,CAAC;QAEH,OAAO,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC;KAC7C;IACD,IAAI,cAAc,KAAK,WAAW,EAAE;QAClC,OAAO,MAAM,CAAC;KACf;IACD,MAAM,IAAI,sBAAU,CAClB,aAAa,EACb,+BAA+B,gBAAgB,KAAK,cAAc,EAAE,CACrE,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport fs from '@react-native-windows/fs';\nimport chalk from 'chalk';\nimport prompts from 'prompts';\nimport path from 'path';\nimport mustache from 'mustache';\nimport {CodedError} from '@react-native-windows/telemetry';\n\n/**\n * Text to replace, + config options\n */\nexport type Replacements = {\n useMustache?: boolean;\n regExpPatternsToRemove?: RegExp[];\n [key: string]: any;\n};\n\nfunction walk(current: string): string[] {\n if (!fs.lstatSync(current).isDirectory()) {\n return [current];\n }\n\n const files = fs\n .readdirSync(current)\n .map(child => walk(path.join(current, child)));\n const result: string[] = [];\n return result.concat.apply([current], files);\n}\n\n/**\n * Get a source file and replace parts of its contents.\n * @param srcPath Path to the source file.\n * @param replacements e.g. {'TextToBeReplaced': 'Replacement'}\n * @return The contents of the file with the replacements applied.\n */\nexport function resolveContents(\n srcPath: string,\n replacements: Replacements,\n): string {\n let content = fs.readFileSync(srcPath, 'utf8');\n\n if (content.includes('\\r\\n')) {\n // CRLF file, make sure multiline replacements are also CRLF\n for (const key of Object.keys(replacements)) {\n if (typeof replacements[key] === 'string') {\n replacements[key] = replacements[key].replace(/(?<!\\r)\\n/g, '\\r\\n');\n }\n }\n } else {\n // LF file, make sure multiline replacements are also LF\n for (const key of Object.keys(replacements)) {\n if (typeof replacements[key] === 'string') {\n replacements[key] = replacements[key].replace(/\\r\\n/g, '\\n');\n }\n }\n }\n\n if (replacements.useMustache) {\n content = mustache.render(content, replacements);\n (replacements.regExpPatternsToRemove || []).forEach(regexPattern => {\n content = content.replace(new RegExp(regexPattern, 'g'), '');\n });\n } else {\n Object.keys(replacements).forEach(regex => {\n content = content.replace(new RegExp(regex, 'g'), replacements[regex]);\n });\n }\n return content;\n}\n\n// Binary files, don't process these (avoid decoding as utf8)\nconst binaryExtensions = ['.png', '.jar', '.keystore'];\n\ntype ContentChangedCallbackOption = 'identical' | 'changed' | 'new' | null;\n\ntype ContentChangedCallback = (\n path: string,\n option: ContentChangedCallbackOption,\n) => Promise<'keep' | 'overwrite'>;\n\n/**\n * Copy a file to given destination, replacing parts of its contents.\n * @param srcPath Path to a file to be copied.\n * @param destPath Destination path.\n * @param replacements: e.g. {'TextToBeReplaced': 'Replacement'}\n * @param contentChangedCallback\n * Used when upgrading projects. Based on if file contents would change\n * when being replaced, allows the caller to specify whether the file\n * should be replaced or not.\n * If null, files will be overwritten.\n * Function(path, 'identical' | 'changed' | 'new') => 'keep' | 'overwrite'\n */\nexport async function copyAndReplace(\n srcPath: string,\n destPath: string,\n replacements: Replacements,\n contentChangedCallback: ContentChangedCallback | null,\n) {\n if (fs.lstatSync(srcPath).isDirectory()) {\n if (!fs.existsSync(destPath)) {\n fs.mkdirSync(destPath);\n }\n // Not recursive\n return;\n }\n\n const extension = path.extname(srcPath);\n if (binaryExtensions.includes(extension)) {\n // Binary file\n let shouldOverwrite = 'overwrite';\n if (contentChangedCallback) {\n const newContentBuffer = fs.readFileSync(srcPath);\n let contentChanged: ContentChangedCallbackOption = 'identical';\n try {\n const origContentBuffer = fs.readFileSync(destPath);\n if (Buffer.compare(origContentBuffer, newContentBuffer) !== 0) {\n contentChanged = 'changed';\n }\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n contentChanged = 'new';\n } else {\n throw err;\n }\n }\n shouldOverwrite = await contentChangedCallback(destPath, contentChanged);\n }\n if (shouldOverwrite === 'overwrite') {\n copyBinaryFile(srcPath, destPath, err => {\n if (err) {\n throw err;\n }\n });\n }\n } else {\n // Text file\n const srcPermissions = fs.statSync(srcPath).mode;\n const content = resolveContents(srcPath, replacements);\n\n let shouldOverwrite = 'overwrite';\n if (contentChangedCallback) {\n // Check if contents changed and ask to overwrite\n let contentChanged: ContentChangedCallbackOption = 'identical';\n try {\n const origContent = fs.readFileSync(destPath, 'utf8');\n if (content !== origContent) {\n // logger.info('Content changed: ' + destPath);\n contentChanged = 'changed';\n }\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n contentChanged = 'new';\n } else {\n throw err;\n }\n }\n shouldOverwrite = await contentChangedCallback(destPath, contentChanged);\n }\n if (shouldOverwrite === 'overwrite') {\n fs.writeFileSync(destPath, content, {\n encoding: 'utf8',\n mode: srcPermissions,\n });\n }\n }\n}\n\n/**\n * Same as 'cp' on Unix. Don't do any replacements.\n */\nfunction copyBinaryFile(\n srcPath: string,\n destPath: string,\n cb: (err?: Error) => void,\n) {\n let cbCalled = false;\n const srcPermissions = fs.statSync(srcPath).mode;\n const readStream = fs.createReadStream(srcPath);\n readStream.on('error', err => {\n done(err);\n });\n const writeStream = fs.createWriteStream(destPath, {\n mode: srcPermissions,\n });\n writeStream.on('error', err => {\n done(err);\n });\n writeStream.on('close', () => {\n done();\n });\n readStream.pipe(writeStream);\n function done(err?: Error) {\n if (!cbCalled) {\n cb(err);\n cbCalled = true;\n }\n }\n}\n\nexport function createDir(destPath: string) {\n if (!fs.existsSync(destPath)) {\n fs.mkdirSync(destPath);\n }\n}\n\nexport async function copyAndReplaceWithChangedCallback(\n srcPath: string,\n destRoot: string,\n relativeDestPath: string,\n replacements?: Record<string, string>,\n alwaysOverwrite?: boolean,\n) {\n if (!replacements) {\n replacements = {};\n }\n const contentChangedCallback: ContentChangedCallback = alwaysOverwrite\n ? (_, contentChanged) =>\n alwaysOverwriteContentChangedCallback(\n srcPath,\n relativeDestPath,\n contentChanged,\n )\n : (_, contentChanged) =>\n upgradeFileContentChangedCallback(\n srcPath,\n relativeDestPath,\n contentChanged,\n );\n\n await copyAndReplace(\n srcPath,\n path.join(destRoot, relativeDestPath),\n replacements,\n contentChangedCallback,\n );\n}\n\nexport async function copyAndReplaceAll(\n srcPath: string,\n destPath: string,\n relativeDestDir: string,\n replacements: Replacements,\n alwaysOverwrite: boolean,\n) {\n for (const absoluteSrcFilePath of walk(srcPath)) {\n const filename = path.relative(srcPath, absoluteSrcFilePath);\n const relativeDestPath = path.join(relativeDestDir, filename);\n await copyAndReplaceWithChangedCallback(\n absoluteSrcFilePath,\n destPath,\n relativeDestPath,\n replacements,\n alwaysOverwrite,\n );\n }\n}\n\nasync function alwaysOverwriteContentChangedCallback(\n absoluteSrcFilePath: string,\n relativeDestPath: string,\n contentChanged: ContentChangedCallbackOption,\n): Promise<'keep' | 'overwrite'> {\n if (contentChanged === 'new') {\n console.log(`${chalk.bold('new')} ${relativeDestPath}`);\n return 'overwrite';\n }\n if (contentChanged === 'changed') {\n console.log(\n `${chalk.bold('changed')} ${relativeDestPath} ${chalk.yellow(\n '[overwriting]',\n )}`,\n );\n return 'overwrite';\n }\n if (contentChanged === 'identical') {\n return 'keep';\n }\n throw new CodedError(\n 'Autolinking',\n `Unknown file changed state: ${relativeDestPath}, ${contentChanged}`,\n );\n}\n\nasync function upgradeFileContentChangedCallback(\n absoluteSrcFilePath: string,\n relativeDestPath: string,\n contentChanged: ContentChangedCallbackOption,\n): Promise<'keep' | 'overwrite'> {\n if (contentChanged === 'new') {\n console.log(`${chalk.bold('new')} ${relativeDestPath}`);\n return 'overwrite';\n }\n if (contentChanged === 'changed') {\n console.log(\n `${chalk.bold(relativeDestPath)} ` +\n `has changed in the new version.\\nDo you want to keep your ${relativeDestPath} or replace it with the ` +\n 'latest version?\\nMake sure you have any changes you made to this file saved somewhere.\\n' +\n `You can see the new version here: ${absoluteSrcFilePath}`,\n );\n\n const {shouldReplace} = await prompts([\n {\n name: 'shouldReplace',\n type: 'confirm',\n message: `Do you want to replace ${relativeDestPath}?`,\n initial: false,\n },\n ]);\n\n return shouldReplace ? 'overwrite' : 'keep';\n }\n if (contentChanged === 'identical') {\n return 'keep';\n }\n throw new CodedError(\n 'Autolinking',\n `Unknown file changed state: ${relativeDestPath}, ${contentChanged}`,\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator-common/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,kEAA0C;AAC1C,kDAA0B;AAC1B,sDAA8B;AAC9B,gDAAwB;AACxB,wDAAgC;AAChC,+DAA2D;AAW3D,SAAS,IAAI,CAAC,OAAe;IAC3B,IAAI,CAAC,YAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;QACxC,OAAO,CAAC,OAAO,CAAC,CAAC;KAClB;IAED,MAAM,KAAK,GAAG,YAAE;SACb,WAAW,CAAC,OAAO,CAAC;SACpB,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,OAAO,MAAM,CAAC,MAA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n\nimport fs from '@react-native-windows/fs';\nimport chalk from 'chalk';\nimport prompts from 'prompts';\nimport path from 'path';\nimport mustache from 'mustache';\nimport {CodedError} from '@react-native-windows/telemetry';\n\n/**\n * Text to replace, + config options\n */\nexport type Replacements = {\n useMustache?: boolean;\n regExpPatternsToRemove?: RegExp[];\n [key: string]: any;\n};\n\nfunction walk(current: string): string[] {\n if (!fs.lstatSync(current).isDirectory()) {\n return [current];\n }\n\n const files = fs\n .readdirSync(current)\n .map(child => walk(path.join(current, child)));\n const result: string[] = [];\n return result.concat.apply([current], files);\n}\n\n/**\n * Get a source file and replace parts of its contents.\n * @param srcPath Path to the source file.\n * @param replacements e.g. {'TextToBeReplaced': 'Replacement'}\n * @return The contents of the file with the replacements applied.\n */\nexport function resolveContents(\n srcPath: string,\n replacements: Replacements,\n): string {\n let content = fs.readFileSync(srcPath, 'utf8');\n\n if (content.includes('\\r\\n')) {\n // CRLF file, make sure multiline replacements are also CRLF\n for (const key of Object.keys(replacements)) {\n if (typeof replacements[key] === 'string') {\n replacements[key] = replacements[key].replace(/(?<!\\r)\\n/g, '\\r\\n');\n }\n }\n } else {\n // LF file, make sure multiline replacements are also LF\n for (const key of Object.keys(replacements)) {\n if (typeof replacements[key] === 'string') {\n replacements[key] = replacements[key].replace(/\\r\\n/g, '\\n');\n }\n }\n }\n\n if (replacements.useMustache) {\n content = mustache.render(content, replacements);\n (replacements.regExpPatternsToRemove || []).forEach(regexPattern => {\n content = content.replace(new RegExp(regexPattern, 'g'), '');\n });\n } else {\n Object.keys(replacements).forEach(regex => {\n content = content.replace(new RegExp(regex, 'g'), replacements[regex]);\n });\n }\n return content;\n}\n\n// Binary files, don't process these (avoid decoding as utf8)\nconst binaryExtensions = ['.png', '.jar', '.keystore', '.ico', '.rc'];\n\ntype ContentChangedCallbackOption = 'identical' | 'changed' | 'new' | null;\n\ntype ContentChangedCallback = (\n path: string,\n option: ContentChangedCallbackOption,\n) => Promise<'keep' | 'overwrite'>;\n\n/**\n * Copy a file to given destination, replacing parts of its contents.\n * @param srcPath Path to a file to be copied.\n * @param destPath Destination path.\n * @param replacements: e.g. {'TextToBeReplaced': 'Replacement'}\n * @param contentChangedCallback\n * Used when upgrading projects. Based on if file contents would change\n * when being replaced, allows the caller to specify whether the file\n * should be replaced or not.\n * If null, files will be overwritten.\n * Function(path, 'identical' | 'changed' | 'new') => 'keep' | 'overwrite'\n */\nexport async function copyAndReplace(\n srcPath: string,\n destPath: string,\n replacements: Replacements,\n contentChangedCallback: ContentChangedCallback | null,\n) {\n if (fs.lstatSync(srcPath).isDirectory()) {\n if (!fs.existsSync(destPath)) {\n fs.mkdirSync(destPath);\n }\n // Not recursive\n return;\n }\n\n const extension = path.extname(srcPath);\n if (binaryExtensions.includes(extension)) {\n // Binary file\n let shouldOverwrite = 'overwrite';\n if (contentChangedCallback) {\n const newContentBuffer = fs.readFileSync(srcPath);\n let contentChanged: ContentChangedCallbackOption = 'identical';\n try {\n const origContentBuffer = fs.readFileSync(destPath);\n if (Buffer.compare(origContentBuffer, newContentBuffer) !== 0) {\n contentChanged = 'changed';\n }\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n contentChanged = 'new';\n } else {\n throw err;\n }\n }\n shouldOverwrite = await contentChangedCallback(destPath, contentChanged);\n }\n if (shouldOverwrite === 'overwrite') {\n copyBinaryFile(srcPath, destPath, err => {\n if (err) {\n throw err;\n }\n });\n }\n } else {\n // Text file\n const srcPermissions = fs.statSync(srcPath).mode;\n const content = resolveContents(srcPath, replacements);\n\n let shouldOverwrite = 'overwrite';\n if (contentChangedCallback) {\n // Check if contents changed and ask to overwrite\n let contentChanged: ContentChangedCallbackOption = 'identical';\n try {\n const origContent = fs.readFileSync(destPath, 'utf8');\n if (content !== origContent) {\n // logger.info('Content changed: ' + destPath);\n contentChanged = 'changed';\n }\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n contentChanged = 'new';\n } else {\n throw err;\n }\n }\n shouldOverwrite = await contentChangedCallback(destPath, contentChanged);\n }\n if (shouldOverwrite === 'overwrite') {\n fs.writeFileSync(destPath, content, {\n encoding: 'utf8',\n mode: srcPermissions,\n });\n }\n }\n}\n\n/**\n * Same as 'cp' on Unix. Don't do any replacements.\n */\nfunction copyBinaryFile(\n srcPath: string,\n destPath: string,\n cb: (err?: Error) => void,\n) {\n let cbCalled = false;\n const srcPermissions = fs.statSync(srcPath).mode;\n const readStream = fs.createReadStream(srcPath);\n readStream.on('error', err => {\n done(err);\n });\n const writeStream = fs.createWriteStream(destPath, {\n mode: srcPermissions,\n });\n writeStream.on('error', err => {\n done(err);\n });\n writeStream.on('close', () => {\n done();\n });\n readStream.pipe(writeStream);\n function done(err?: Error) {\n if (!cbCalled) {\n cb(err);\n cbCalled = true;\n }\n }\n}\n\nexport function createDir(destPath: string) {\n if (!fs.existsSync(destPath)) {\n fs.mkdirSync(destPath);\n }\n}\n\nexport async function copyAndReplaceWithChangedCallback(\n srcPath: string,\n destRoot: string,\n relativeDestPath: string,\n replacements?: Record<string, string>,\n alwaysOverwrite?: boolean,\n) {\n if (!replacements) {\n replacements = {};\n }\n const contentChangedCallback: ContentChangedCallback = alwaysOverwrite\n ? (_, contentChanged) =>\n alwaysOverwriteContentChangedCallback(\n srcPath,\n relativeDestPath,\n contentChanged,\n )\n : (_, contentChanged) =>\n upgradeFileContentChangedCallback(\n srcPath,\n relativeDestPath,\n contentChanged,\n );\n\n await copyAndReplace(\n srcPath,\n path.join(destRoot, relativeDestPath),\n replacements,\n contentChangedCallback,\n );\n}\n\nexport async function copyAndReplaceAll(\n srcPath: string,\n destPath: string,\n relativeDestDir: string,\n replacements: Replacements,\n alwaysOverwrite: boolean,\n) {\n for (const absoluteSrcFilePath of walk(srcPath)) {\n const filename = path.relative(srcPath, absoluteSrcFilePath);\n const relativeDestPath = path.join(relativeDestDir, filename);\n await copyAndReplaceWithChangedCallback(\n absoluteSrcFilePath,\n destPath,\n relativeDestPath,\n replacements,\n alwaysOverwrite,\n );\n }\n}\n\nasync function alwaysOverwriteContentChangedCallback(\n absoluteSrcFilePath: string,\n relativeDestPath: string,\n contentChanged: ContentChangedCallbackOption,\n): Promise<'keep' | 'overwrite'> {\n if (contentChanged === 'new') {\n console.log(`${chalk.bold('new')} ${relativeDestPath}`);\n return 'overwrite';\n }\n if (contentChanged === 'changed') {\n console.log(\n `${chalk.bold('changed')} ${relativeDestPath} ${chalk.yellow(\n '[overwriting]',\n )}`,\n );\n return 'overwrite';\n }\n if (contentChanged === 'identical') {\n return 'keep';\n }\n throw new CodedError(\n 'Autolinking',\n `Unknown file changed state: ${relativeDestPath}, ${contentChanged}`,\n );\n}\n\nasync function upgradeFileContentChangedCallback(\n absoluteSrcFilePath: string,\n relativeDestPath: string,\n contentChanged: ContentChangedCallbackOption,\n): Promise<'keep' | 'overwrite'> {\n if (contentChanged === 'new') {\n console.log(`${chalk.bold('new')} ${relativeDestPath}`);\n return 'overwrite';\n }\n if (contentChanged === 'changed') {\n console.log(\n `${chalk.bold(relativeDestPath)} ` +\n `has changed in the new version.\\nDo you want to keep your ${relativeDestPath} or replace it with the ` +\n 'latest version?\\nMake sure you have any changes you made to this file saved somewhere.\\n' +\n `You can see the new version here: ${absoluteSrcFilePath}`,\n );\n\n const {shouldReplace} = await prompts([\n {\n name: 'shouldReplace',\n type: 'confirm',\n message: `Do you want to replace ${relativeDestPath}?`,\n initial: false,\n },\n ]);\n\n return shouldReplace ? 'overwrite' : 'keep';\n }\n if (contentChanged === 'identical') {\n return 'keep';\n }\n throw new CodedError(\n 'Autolinking',\n `Unknown file changed state: ${relativeDestPath}, ${contentChanged}`,\n );\n}\n"]}
@@ -183,6 +183,27 @@ function getAppxManifestPath(options, projectName) {
183
183
  }
184
184
  return appxPath;
185
185
  }
186
+ function getAppxRecipePath(options, projectName) {
187
+ const appxManifestPath = path_1.default.dirname(getAppxManifestPath(options, projectName));
188
+ const appxRecipeGlob = `*.build.appxrecipe`;
189
+ const globs = glob_1.default.sync(path_1.default.join(appxManifestPath, appxRecipeGlob));
190
+ let appxRecipePath;
191
+ if (globs.length === 1 || !projectName) {
192
+ appxRecipePath = globs[0];
193
+ }
194
+ else {
195
+ const filteredGlobs = globs.filter(x => x.includes(projectName));
196
+ appxRecipePath = filteredGlobs[0];
197
+ if (filteredGlobs.length > 1) {
198
+ (0, commandWithProgress_1.newWarn)(`More than one appxrecipe for ${projectName}: ${filteredGlobs.join(',')}`);
199
+ (0, commandWithProgress_1.newWarn)(`Choosing ${appxRecipePath}`);
200
+ }
201
+ }
202
+ if (!appxRecipePath) {
203
+ throw new telemetry_1.CodedError('DeployRecipeFailure', `Unable to find AppxRecipe from "${appxManifestPath}", using search path: "${appxRecipeGlob}" `);
204
+ }
205
+ return appxRecipePath;
206
+ }
186
207
  function parseAppxManifest(appxManifestPath) {
187
208
  return (0, xml_parser_1.default)(fs_1.default.readFileSync(appxManifestPath, 'utf8'));
188
209
  }
@@ -271,7 +292,7 @@ async function deployToDesktop(options, verbose, config, buildTools) {
271
292
  else {
272
293
  // Deploy from layout
273
294
  // If we have DeployAppRecipe.exe, use it (start in 16.8.4, earlier 16.8 versions have bugs)
274
- const appxRecipe = path_1.default.join(path_1.default.dirname(appxManifestPath), `${projectName}.build.appxrecipe`);
295
+ const appxRecipe = getAppxRecipePath(options, projectName);
275
296
  const ideFolder = `${buildTools.installationPath}\\Common7\\IDE`;
276
297
  const deployAppxRecipeExePath = `${ideFolder}\\DeployAppRecipe.exe`;
277
298
  if (vsVersion.gte(version_1.default.fromString('16.8.30906.45')) &&
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/utils/deploy.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAA4D;AAC5D,kEAA0C;AAC1C,gDAAwB;AACxB,gDAAwB;AACxB,gDAAwB;AACxB,4DAA+B;AAC/B,0EAAkD;AAClD,+DAS+B;AAC/B,+CAAiC;AAOjC,4EAA8D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,IAAI;QACd,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;KACtC,CAAC;IAEF,IAAA,qBAAK,EAAC,SAAS,EAAE,CAAC,IAAI,EAAE,8BAA8B,CAAC,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {spawn, execSync, SpawnOptions} from 'child_process';\nimport fs from '@react-native-windows/fs';\nimport http from 'http';\nimport path from 'path';\nimport glob from 'glob';\nimport parse from 'xml-parser';\nimport WinAppDeployTool from './winappdeploytool';\nimport {\n newInfo,\n newSuccess,\n newError,\n newWarn,\n newSpinner,\n commandWithProgress,\n runPowerShellScriptFunction,\n powershell,\n} from './commandWithProgress';\nimport * as build from './build';\nimport {\n BuildConfig,\n RunWindowsOptions,\n} from '../commands/runWindows/runWindowsOptions';\nimport MSBuildTools from './msbuildtools';\nimport {Config} from '@react-native-community/cli-types';\nimport * as configUtils from '../commands/config/configUtils';\nimport {WindowsProjectConfig} from '../commands/config/projectConfig';\nimport {CodedError} from '@react-native-windows/telemetry';\nimport Version from './version';\n\nfunction pushd(pathArg: string): () => void {\n const cwd = process.cwd();\n process.chdir(pathArg);\n return () => process.chdir(cwd);\n}\n\nexport function getBuildConfiguration(options: RunWindowsOptions): BuildConfig {\n return options.release\n ? options.bundle\n ? 'ReleaseBundle'\n : 'Release'\n : options.bundle\n ? 'DebugBundle'\n : 'Debug';\n}\n\nfunction shouldDeployByPackage(\n options: RunWindowsOptions,\n config: Config,\n): boolean {\n if (options.deployFromLayout) {\n // Force deploy by layout\n return false;\n }\n\n let hasAppxSigningEnabled: boolean | null = null;\n let hasPackageCertificateKeyFile: boolean | null = null;\n\n // TODO: These two properties should really be determined by\n // getting the actual values msbuild used during the build,\n // but for now we'll try to get them manually\n\n // Check passed in msbuild property overrides\n if (options.msbuildprops) {\n const msbuildprops = build.parseMsBuildProps(options);\n if ('AppxSigningEnabled' in msbuildprops) {\n hasAppxSigningEnabled =\n msbuildprops.AppxSigningEnabled.toLowerCase() === 'true';\n }\n if ('PackageCertificateKeyFile' in msbuildprops) {\n hasPackageCertificateKeyFile = true;\n }\n }\n\n // If at least one override wasn't set, we need to parse the project file\n if (hasAppxSigningEnabled === null || hasPackageCertificateKeyFile === null) {\n const projectFile = build.getAppProjectFile(options, config);\n if (projectFile) {\n const projectContents = configUtils.readProjectFile(projectFile);\n\n // Find AppxSigningEnabled\n if (hasAppxSigningEnabled === null) {\n const appxSigningEnabled = configUtils.tryFindPropertyValue(\n projectContents,\n 'AppxSigningEnabled',\n );\n if (appxSigningEnabled !== null) {\n hasAppxSigningEnabled = appxSigningEnabled.toLowerCase() === 'true';\n }\n }\n\n // Find PackageCertificateKeyFile\n if (hasPackageCertificateKeyFile === null) {\n const packageCertificateKeyFile = configUtils.tryFindPropertyValue(\n projectContents,\n 'PackageCertificateKeyFile',\n );\n if (packageCertificateKeyFile !== null) {\n hasPackageCertificateKeyFile = true;\n }\n }\n }\n }\n\n return (\n hasAppxSigningEnabled === true && hasPackageCertificateKeyFile === true\n );\n}\n\nfunction shouldLaunchApp(options: RunWindowsOptions): boolean {\n return options.launch === true;\n}\n\nfunction getAppPackage(\n options: RunWindowsOptions,\n projectName?: string,\n): string {\n const configuration = getBuildConfiguration(options);\n const packageFolder =\n options.arch === 'x86'\n ? `{*_x86_${configuration}_*,*_Win32_${configuration}_*}`\n : `*_${options.arch}_${configuration}_*`;\n\n const appPackageGlob = `${options.root}/windows/{*/AppPackages,AppPackages/*}/${packageFolder}`;\n const appPackageCandidates = glob.sync(appPackageGlob);\n let appPackage;\n if (appPackageCandidates.length === 1 || !projectName) {\n appPackage = appPackageCandidates[0];\n } else if (appPackageCandidates.length > 1) {\n const filteredAppPackageCandidates = appPackageCandidates.filter(x =>\n x.includes(projectName),\n );\n if (filteredAppPackageCandidates.length >= 1) {\n appPackage = filteredAppPackageCandidates[0];\n }\n }\n\n if (!appPackage && options.release) {\n // in the latest vs, Release is removed\n newWarn(\n 'No package found in *_Release_* folder, removing the _Release_ prefix and checking again',\n );\n\n const rootGlob = `${options.root}/windows/{*/AppPackages,AppPackages/*}`;\n const newGlob = `${rootGlob}/*_${\n options.arch === 'x86' ? '{Win32,x86}' : options.arch\n }_Test`;\n\n const result = glob.sync(newGlob);\n if (result.length > 1 && projectName) {\n const newFilteredGlobs = result.filter(x => x.includes(projectName));\n if (newFilteredGlobs.length >= 1) {\n newWarn(`More than one app package found: ${result}`);\n }\n appPackage = newFilteredGlobs[0];\n } else if (result.length === 1) {\n // we're good\n appPackage = result[0];\n }\n }\n\n if (!appPackage) {\n throw new CodedError(\n 'NoAppPackage',\n `Unable to find app package using search path: \"${appPackageGlob}\"`,\n );\n }\n return appPackage;\n}\n\nfunction getWindowsStoreAppUtils(options: RunWindowsOptions) {\n const popd = pushd(options.root);\n const windowsStoreAppUtilsPath = path.resolve(\n __dirname,\n '..',\n '..',\n 'src',\n 'powershell',\n 'WindowsStoreAppUtils.ps1',\n );\n execSync(\n `${powershell} -NoProfile Unblock-File '${windowsStoreAppUtilsPath}'`,\n );\n popd();\n return windowsStoreAppUtilsPath;\n}\n\nfunction getAppxManifestPath(\n options: RunWindowsOptions,\n projectName?: string,\n): string {\n const configuration = getBuildConfiguration(options);\n // C++ x86 manifest would go under windows/Debug whereas x64 goes under windows/x64/Debug\n // If we've built both, this causes us to end up with two matches, so we have to carefully select the right folder\n let archFolder;\n if (options.arch !== 'x86') {\n archFolder = `${options.arch}/${configuration}`;\n } else {\n archFolder = `${configuration}`;\n }\n\n const appxManifestGlob = `windows/{*/bin/${options.arch}/${configuration},${archFolder}/*,target/${options.arch}/${configuration}}/AppxManifest.xml`;\n const globs = glob.sync(path.join(options.root, appxManifestGlob));\n let appxPath: string;\n if (globs.length === 1 || !projectName) {\n appxPath = globs[0];\n } else {\n const filteredGlobs = globs.filter(x => x.includes(projectName));\n appxPath = filteredGlobs[0];\n if (filteredGlobs.length > 1) {\n newWarn(\n `More than one appxmanifest for ${projectName}: ${filteredGlobs.join(\n ',',\n )}`,\n );\n newWarn(`Choosing ${appxPath}`);\n }\n }\n\n if (!appxPath) {\n throw new CodedError(\n 'NoAppxManifest',\n `Unable to find AppxManifest from \"${options.root}\", using search path: \"${appxManifestGlob}\" `,\n );\n }\n return appxPath;\n}\n\nfunction parseAppxManifest(appxManifestPath: string): parse.Document {\n return parse(fs.readFileSync(appxManifestPath, 'utf8'));\n}\n\nfunction getAppxManifest(\n options: RunWindowsOptions,\n projectName?: string,\n): parse.Document {\n return parseAppxManifest(getAppxManifestPath(options, projectName));\n}\n\nfunction handleResponseError(e: Error): never {\n if (e.message.indexOf('Error code -2146233088')) {\n throw new CodedError(\n 'NoDevice',\n `No Windows Mobile device was detected: ${e.message}`,\n );\n } else {\n throw new CodedError(\n 'AppDidNotDeploy',\n `Unexpected error deploying app: ${e.message}`,\n );\n }\n}\n\n// Errors: 0x80073d10 - bad architecture\nexport async function deployToDevice(\n options: RunWindowsOptions,\n verbose: boolean,\n config: Config,\n) {\n const windowsConfig: Partial<WindowsProjectConfig> | undefined =\n config.project.windows;\n const projectName =\n windowsConfig && windowsConfig.project && windowsConfig.project.projectName\n ? windowsConfig.project.projectName\n : path.parse(options.proj!).name;\n const appPackageFolder = getAppPackage(options);\n\n const deployTarget = options.target\n ? options.target\n : options.emulator\n ? 'emulator'\n : 'device';\n const deployTool = new WinAppDeployTool();\n const appxManifest = getAppxManifest(options, projectName);\n const shouldLaunch = shouldLaunchApp(options);\n const identity = appxManifest.root.children.filter(x => {\n return x.name === 'mp:PhoneIdentity';\n })[0];\n const appName = identity.attributes.PhoneProductId;\n\n const device = deployTool.findDevice(deployTarget);\n\n try {\n await deployTool.uninstallAppPackage(appName, device, verbose);\n } catch (e) {\n newWarn('Failed to uninstall app from ' + device.name);\n }\n\n const appxFile = glob.sync(path.join(appPackageFolder, '*.appx'))[0];\n try {\n await deployTool.installAppPackage(\n appxFile,\n device,\n shouldLaunch,\n false,\n verbose,\n );\n } catch (e) {\n if ((e as Error).message.includes('Error code 2148734208 for command')) {\n await deployTool.installAppPackage(\n appxFile,\n device,\n shouldLaunch,\n true,\n verbose,\n );\n } else {\n handleResponseError(e as Error);\n }\n }\n}\n\nexport async function deployToDesktop(\n options: RunWindowsOptions,\n verbose: boolean,\n config: Config,\n buildTools: MSBuildTools,\n) {\n const windowsConfig: Partial<WindowsProjectConfig> | undefined =\n config.project.windows;\n const slnFile =\n windowsConfig && windowsConfig.solutionFile && windowsConfig.sourceDir\n ? path.join(windowsConfig.sourceDir, windowsConfig.solutionFile)\n : options.sln!;\n const projectName =\n windowsConfig && windowsConfig.project && windowsConfig.project.projectName\n ? windowsConfig.project.projectName\n : path.parse(options.proj!).name;\n const windowsStoreAppUtils = getWindowsStoreAppUtils(options);\n const appxManifestPath = getAppxManifestPath(options, projectName);\n const appxManifest = parseAppxManifest(appxManifestPath);\n const identity = appxManifest.root.children.filter(x => {\n return x.name === 'Identity';\n })[0];\n const appName = identity.attributes.Name;\n\n const vsVersion = Version.fromString(buildTools.installationVersion);\n\n const args = [];\n if (options.remoteDebugging) {\n args.push('--remote-debugging');\n }\n\n if (options.directDebugging) {\n args.push('--direct-debugging', options.directDebugging.toString());\n }\n\n await runPowerShellScriptFunction(\n 'Enabling Developer Mode',\n windowsStoreAppUtils,\n 'EnableDevMode',\n verbose,\n 'EnableDevModeFailure',\n );\n\n const appPackageFolder = getAppPackage(options, projectName);\n\n if (shouldDeployByPackage(options, config)) {\n // Deploy by package\n await runPowerShellScriptFunction(\n 'Removing old version of the app',\n windowsStoreAppUtils,\n `Uninstall-App ${appName}`,\n verbose,\n 'RemoveOldAppVersionFailure',\n );\n\n const script = glob.sync(\n path.join(appPackageFolder, 'Add-AppDevPackage.ps1'),\n )[0];\n\n await runPowerShellScriptFunction(\n 'Installing new version of the app',\n windowsStoreAppUtils,\n `Install-App \"${script}\" -Force`,\n verbose,\n 'InstallAppFailure',\n );\n } else {\n // Deploy from layout\n // If we have DeployAppRecipe.exe, use it (start in 16.8.4, earlier 16.8 versions have bugs)\n const appxRecipe = path.join(\n path.dirname(appxManifestPath),\n `${projectName}.build.appxrecipe`,\n );\n const ideFolder = `${buildTools.installationPath}\\\\Common7\\\\IDE`;\n const deployAppxRecipeExePath = `${ideFolder}\\\\DeployAppRecipe.exe`;\n if (\n vsVersion.gte(Version.fromString('16.8.30906.45')) &&\n fs.existsSync(deployAppxRecipeExePath)\n ) {\n await commandWithProgress(\n newSpinner('Deploying'),\n `Deploying ${appxRecipe}`,\n deployAppxRecipeExePath,\n [appxRecipe],\n verbose,\n 'DeployRecipeFailure',\n );\n } else {\n // Install the app package's dependencies before attempting to deploy.\n await runPowerShellScriptFunction(\n 'Installing dependent framework packages',\n windowsStoreAppUtils,\n `Install-AppDependencies ${appxManifestPath} ${appPackageFolder} ${options.arch}`,\n verbose,\n 'InstallAppDependenciesFailure',\n );\n await build.buildSolution(\n buildTools,\n slnFile,\n /* options.release ? 'Release' : */ 'Debug',\n options.arch,\n {DeployLayout: 'true'},\n verbose,\n 'deploy',\n options.buildLogDirectory,\n );\n }\n }\n\n const appFamilyName = execSync(\n `${powershell} -NoProfile -c $(Get-AppxPackage -Name ${appName}).PackageFamilyName`,\n )\n .toString()\n .trim();\n\n if (!appFamilyName) {\n throw new CodedError(\n 'AppDidNotDeploy',\n 'Fail to check the installed app, maybe developer mode is off on Windows',\n );\n }\n\n const loopbackText = 'Verifying loopbackExempt';\n const loopbackSpinner = newSpinner(loopbackText);\n\n await commandWithProgress(\n loopbackSpinner,\n loopbackText,\n 'CheckNetIsolation',\n `LoopbackExempt -a -n=${appFamilyName}`.split(' '),\n verbose,\n 'CheckNetIsolationFailure',\n );\n\n if (shouldLaunchApp(options)) {\n await runPowerShellScriptFunction(\n 'Starting the app',\n windowsStoreAppUtils,\n `Start-Locally ${appName} ${args}`,\n verbose,\n 'AppStartupFailure',\n );\n } else {\n newInfo('Skip the step to start the app');\n }\n}\n\nexport function startServerInNewWindow(\n options: RunWindowsOptions,\n verbose: boolean,\n): Promise<void> {\n return new Promise(resolve => {\n http\n .get('http://localhost:8081/status', res => {\n if (res.statusCode === 200) {\n newSuccess('React-Native Server already started');\n } else {\n newError('React-Native Server not responding');\n }\n resolve();\n })\n .on('error', () => {\n launchServer(options, verbose);\n resolve();\n });\n });\n}\n\nfunction launchServer(options: RunWindowsOptions, verbose: boolean) {\n newSuccess('Starting the React-Native Server');\n const opts: SpawnOptions = {\n cwd: options.root,\n detached: true,\n stdio: verbose ? 'inherit' : 'ignore',\n };\n\n spawn('cmd.exe', ['/C', 'start npx react-native start'], opts);\n}\n"]}
1
+ {"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/utils/deploy.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAA4D;AAC5D,kEAA0C;AAC1C,gDAAwB;AACxB,gDAAwB;AACxB,gDAAwB;AACxB,4DAA+B;AAC/B,0EAAkD;AAClD,+DAS+B;AAC/B,+CAAiC;AAOjC,4EAA8D;AAE9D,+DAA2D;AAC3D,wDAAgC;AAEhC,SAAS,KAAK,CAAC,OAAe;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvB,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,SAAgB,qBAAqB,CAAC,OAA0B;IAC9D,OAAO,OAAO,CAAC,OAAO;QACpB,CAAC,CAAC,OAAO,CAAC,MAAM;YACd,CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,SAAS;QACb,CAAC,CAAC,OAAO,CAAC,MAAM;YAChB,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,OAAO,CAAC;AACd,CAAC;AARD,sDAQC;AAED,SAAS,qBAAqB,CAC5B,OAA0B,EAC1B,MAAc;IAEd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AAC;QACZ,CAAC,CAAC;aACD,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YAChB,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC/B,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC;AAnBD,wDAmBC;AAED,SAAS,YAAY,CAAC,OAA0B,EAAE,OAAgB;IAChE,IAAA,gCAAU,EAAC,kCAAkC,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAiB;QACzB,GAAG,EAAE,OAAO,CAAC,IAAI;QACjB,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;KACtC,CAAC;IAEF,IAAA,qBAAK,EAAC,SAAS,EAAE,CAAC,IAAI,EAAE,8BAA8B,CAAC,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {spawn, execSync, SpawnOptions} from 'child_process';\nimport fs from '@react-native-windows/fs';\nimport http from 'http';\nimport path from 'path';\nimport glob from 'glob';\nimport parse from 'xml-parser';\nimport WinAppDeployTool from './winappdeploytool';\nimport {\n newInfo,\n newSuccess,\n newError,\n newWarn,\n newSpinner,\n commandWithProgress,\n runPowerShellScriptFunction,\n powershell,\n} from './commandWithProgress';\nimport * as build from './build';\nimport {\n BuildConfig,\n RunWindowsOptions,\n} from '../commands/runWindows/runWindowsOptions';\nimport MSBuildTools from './msbuildtools';\nimport {Config} from '@react-native-community/cli-types';\nimport * as configUtils from '../commands/config/configUtils';\nimport {WindowsProjectConfig} from '../commands/config/projectConfig';\nimport {CodedError} from '@react-native-windows/telemetry';\nimport Version from './version';\n\nfunction pushd(pathArg: string): () => void {\n const cwd = process.cwd();\n process.chdir(pathArg);\n return () => process.chdir(cwd);\n}\n\nexport function getBuildConfiguration(options: RunWindowsOptions): BuildConfig {\n return options.release\n ? options.bundle\n ? 'ReleaseBundle'\n : 'Release'\n : options.bundle\n ? 'DebugBundle'\n : 'Debug';\n}\n\nfunction shouldDeployByPackage(\n options: RunWindowsOptions,\n config: Config,\n): boolean {\n if (options.deployFromLayout) {\n // Force deploy by layout\n return false;\n }\n\n let hasAppxSigningEnabled: boolean | null = null;\n let hasPackageCertificateKeyFile: boolean | null = null;\n\n // TODO: These two properties should really be determined by\n // getting the actual values msbuild used during the build,\n // but for now we'll try to get them manually\n\n // Check passed in msbuild property overrides\n if (options.msbuildprops) {\n const msbuildprops = build.parseMsBuildProps(options);\n if ('AppxSigningEnabled' in msbuildprops) {\n hasAppxSigningEnabled =\n msbuildprops.AppxSigningEnabled.toLowerCase() === 'true';\n }\n if ('PackageCertificateKeyFile' in msbuildprops) {\n hasPackageCertificateKeyFile = true;\n }\n }\n\n // If at least one override wasn't set, we need to parse the project file\n if (hasAppxSigningEnabled === null || hasPackageCertificateKeyFile === null) {\n const projectFile = build.getAppProjectFile(options, config);\n if (projectFile) {\n const projectContents = configUtils.readProjectFile(projectFile);\n\n // Find AppxSigningEnabled\n if (hasAppxSigningEnabled === null) {\n const appxSigningEnabled = configUtils.tryFindPropertyValue(\n projectContents,\n 'AppxSigningEnabled',\n );\n if (appxSigningEnabled !== null) {\n hasAppxSigningEnabled = appxSigningEnabled.toLowerCase() === 'true';\n }\n }\n\n // Find PackageCertificateKeyFile\n if (hasPackageCertificateKeyFile === null) {\n const packageCertificateKeyFile = configUtils.tryFindPropertyValue(\n projectContents,\n 'PackageCertificateKeyFile',\n );\n if (packageCertificateKeyFile !== null) {\n hasPackageCertificateKeyFile = true;\n }\n }\n }\n }\n\n return (\n hasAppxSigningEnabled === true && hasPackageCertificateKeyFile === true\n );\n}\n\nfunction shouldLaunchApp(options: RunWindowsOptions): boolean {\n return options.launch === true;\n}\n\nfunction getAppPackage(\n options: RunWindowsOptions,\n projectName?: string,\n): string {\n const configuration = getBuildConfiguration(options);\n const packageFolder =\n options.arch === 'x86'\n ? `{*_x86_${configuration}_*,*_Win32_${configuration}_*}`\n : `*_${options.arch}_${configuration}_*`;\n\n const appPackageGlob = `${options.root}/windows/{*/AppPackages,AppPackages/*}/${packageFolder}`;\n const appPackageCandidates = glob.sync(appPackageGlob);\n let appPackage;\n if (appPackageCandidates.length === 1 || !projectName) {\n appPackage = appPackageCandidates[0];\n } else if (appPackageCandidates.length > 1) {\n const filteredAppPackageCandidates = appPackageCandidates.filter(x =>\n x.includes(projectName),\n );\n if (filteredAppPackageCandidates.length >= 1) {\n appPackage = filteredAppPackageCandidates[0];\n }\n }\n\n if (!appPackage && options.release) {\n // in the latest vs, Release is removed\n newWarn(\n 'No package found in *_Release_* folder, removing the _Release_ prefix and checking again',\n );\n\n const rootGlob = `${options.root}/windows/{*/AppPackages,AppPackages/*}`;\n const newGlob = `${rootGlob}/*_${\n options.arch === 'x86' ? '{Win32,x86}' : options.arch\n }_Test`;\n\n const result = glob.sync(newGlob);\n if (result.length > 1 && projectName) {\n const newFilteredGlobs = result.filter(x => x.includes(projectName));\n if (newFilteredGlobs.length >= 1) {\n newWarn(`More than one app package found: ${result}`);\n }\n appPackage = newFilteredGlobs[0];\n } else if (result.length === 1) {\n // we're good\n appPackage = result[0];\n }\n }\n\n if (!appPackage) {\n throw new CodedError(\n 'NoAppPackage',\n `Unable to find app package using search path: \"${appPackageGlob}\"`,\n );\n }\n return appPackage;\n}\n\nfunction getWindowsStoreAppUtils(options: RunWindowsOptions) {\n const popd = pushd(options.root);\n const windowsStoreAppUtilsPath = path.resolve(\n __dirname,\n '..',\n '..',\n 'src',\n 'powershell',\n 'WindowsStoreAppUtils.ps1',\n );\n execSync(\n `${powershell} -NoProfile Unblock-File '${windowsStoreAppUtilsPath}'`,\n );\n popd();\n return windowsStoreAppUtilsPath;\n}\n\nfunction getAppxManifestPath(\n options: RunWindowsOptions,\n projectName?: string,\n): string {\n const configuration = getBuildConfiguration(options);\n // C++ x86 manifest would go under windows/Debug whereas x64 goes under windows/x64/Debug\n // If we've built both, this causes us to end up with two matches, so we have to carefully select the right folder\n let archFolder;\n if (options.arch !== 'x86') {\n archFolder = `${options.arch}/${configuration}`;\n } else {\n archFolder = `${configuration}`;\n }\n\n const appxManifestGlob = `windows/{*/bin/${options.arch}/${configuration},${archFolder}/*,target/${options.arch}/${configuration}}/AppxManifest.xml`;\n const globs = glob.sync(path.join(options.root, appxManifestGlob));\n let appxPath: string;\n if (globs.length === 1 || !projectName) {\n appxPath = globs[0];\n } else {\n const filteredGlobs = globs.filter(x => x.includes(projectName));\n appxPath = filteredGlobs[0];\n if (filteredGlobs.length > 1) {\n newWarn(\n `More than one appxmanifest for ${projectName}: ${filteredGlobs.join(\n ',',\n )}`,\n );\n newWarn(`Choosing ${appxPath}`);\n }\n }\n\n if (!appxPath) {\n throw new CodedError(\n 'NoAppxManifest',\n `Unable to find AppxManifest from \"${options.root}\", using search path: \"${appxManifestGlob}\" `,\n );\n }\n return appxPath;\n}\n\nfunction getAppxRecipePath(\n options: RunWindowsOptions,\n projectName?: string,\n): string {\n const appxManifestPath = path.dirname(\n getAppxManifestPath(options, projectName),\n );\n\n const appxRecipeGlob = `*.build.appxrecipe`;\n\n const globs = glob.sync(path.join(appxManifestPath, appxRecipeGlob));\n\n let appxRecipePath: string;\n if (globs.length === 1 || !projectName) {\n appxRecipePath = globs[0];\n } else {\n const filteredGlobs = globs.filter(x => x.includes(projectName));\n appxRecipePath = filteredGlobs[0];\n if (filteredGlobs.length > 1) {\n newWarn(\n `More than one appxrecipe for ${projectName}: ${filteredGlobs.join(\n ',',\n )}`,\n );\n newWarn(`Choosing ${appxRecipePath}`);\n }\n }\n\n if (!appxRecipePath) {\n throw new CodedError(\n 'DeployRecipeFailure',\n `Unable to find AppxRecipe from \"${appxManifestPath}\", using search path: \"${appxRecipeGlob}\" `,\n );\n }\n\n return appxRecipePath;\n}\n\nfunction parseAppxManifest(appxManifestPath: string): parse.Document {\n return parse(fs.readFileSync(appxManifestPath, 'utf8'));\n}\n\nfunction getAppxManifest(\n options: RunWindowsOptions,\n projectName?: string,\n): parse.Document {\n return parseAppxManifest(getAppxManifestPath(options, projectName));\n}\n\nfunction handleResponseError(e: Error): never {\n if (e.message.indexOf('Error code -2146233088')) {\n throw new CodedError(\n 'NoDevice',\n `No Windows Mobile device was detected: ${e.message}`,\n );\n } else {\n throw new CodedError(\n 'AppDidNotDeploy',\n `Unexpected error deploying app: ${e.message}`,\n );\n }\n}\n\n// Errors: 0x80073d10 - bad architecture\nexport async function deployToDevice(\n options: RunWindowsOptions,\n verbose: boolean,\n config: Config,\n) {\n const windowsConfig: Partial<WindowsProjectConfig> | undefined =\n config.project.windows;\n const projectName =\n windowsConfig && windowsConfig.project && windowsConfig.project.projectName\n ? windowsConfig.project.projectName\n : path.parse(options.proj!).name;\n const appPackageFolder = getAppPackage(options);\n\n const deployTarget = options.target\n ? options.target\n : options.emulator\n ? 'emulator'\n : 'device';\n const deployTool = new WinAppDeployTool();\n const appxManifest = getAppxManifest(options, projectName);\n const shouldLaunch = shouldLaunchApp(options);\n const identity = appxManifest.root.children.filter(x => {\n return x.name === 'mp:PhoneIdentity';\n })[0];\n const appName = identity.attributes.PhoneProductId;\n\n const device = deployTool.findDevice(deployTarget);\n\n try {\n await deployTool.uninstallAppPackage(appName, device, verbose);\n } catch (e) {\n newWarn('Failed to uninstall app from ' + device.name);\n }\n\n const appxFile = glob.sync(path.join(appPackageFolder, '*.appx'))[0];\n try {\n await deployTool.installAppPackage(\n appxFile,\n device,\n shouldLaunch,\n false,\n verbose,\n );\n } catch (e) {\n if ((e as Error).message.includes('Error code 2148734208 for command')) {\n await deployTool.installAppPackage(\n appxFile,\n device,\n shouldLaunch,\n true,\n verbose,\n );\n } else {\n handleResponseError(e as Error);\n }\n }\n}\n\nexport async function deployToDesktop(\n options: RunWindowsOptions,\n verbose: boolean,\n config: Config,\n buildTools: MSBuildTools,\n) {\n const windowsConfig: Partial<WindowsProjectConfig> | undefined =\n config.project.windows;\n const slnFile =\n windowsConfig && windowsConfig.solutionFile && windowsConfig.sourceDir\n ? path.join(windowsConfig.sourceDir, windowsConfig.solutionFile)\n : options.sln!;\n const projectName =\n windowsConfig && windowsConfig.project && windowsConfig.project.projectName\n ? windowsConfig.project.projectName\n : path.parse(options.proj!).name;\n const windowsStoreAppUtils = getWindowsStoreAppUtils(options);\n const appxManifestPath = getAppxManifestPath(options, projectName);\n const appxManifest = parseAppxManifest(appxManifestPath);\n const identity = appxManifest.root.children.filter(x => {\n return x.name === 'Identity';\n })[0];\n const appName = identity.attributes.Name;\n\n const vsVersion = Version.fromString(buildTools.installationVersion);\n\n const args = [];\n if (options.remoteDebugging) {\n args.push('--remote-debugging');\n }\n\n if (options.directDebugging) {\n args.push('--direct-debugging', options.directDebugging.toString());\n }\n\n await runPowerShellScriptFunction(\n 'Enabling Developer Mode',\n windowsStoreAppUtils,\n 'EnableDevMode',\n verbose,\n 'EnableDevModeFailure',\n );\n\n const appPackageFolder = getAppPackage(options, projectName);\n\n if (shouldDeployByPackage(options, config)) {\n // Deploy by package\n await runPowerShellScriptFunction(\n 'Removing old version of the app',\n windowsStoreAppUtils,\n `Uninstall-App ${appName}`,\n verbose,\n 'RemoveOldAppVersionFailure',\n );\n\n const script = glob.sync(\n path.join(appPackageFolder, 'Add-AppDevPackage.ps1'),\n )[0];\n\n await runPowerShellScriptFunction(\n 'Installing new version of the app',\n windowsStoreAppUtils,\n `Install-App \"${script}\" -Force`,\n verbose,\n 'InstallAppFailure',\n );\n } else {\n // Deploy from layout\n // If we have DeployAppRecipe.exe, use it (start in 16.8.4, earlier 16.8 versions have bugs)\n const appxRecipe = getAppxRecipePath(options, projectName);\n const ideFolder = `${buildTools.installationPath}\\\\Common7\\\\IDE`;\n const deployAppxRecipeExePath = `${ideFolder}\\\\DeployAppRecipe.exe`;\n if (\n vsVersion.gte(Version.fromString('16.8.30906.45')) &&\n fs.existsSync(deployAppxRecipeExePath)\n ) {\n await commandWithProgress(\n newSpinner('Deploying'),\n `Deploying ${appxRecipe}`,\n deployAppxRecipeExePath,\n [appxRecipe],\n verbose,\n 'DeployRecipeFailure',\n );\n } else {\n // Install the app package's dependencies before attempting to deploy.\n await runPowerShellScriptFunction(\n 'Installing dependent framework packages',\n windowsStoreAppUtils,\n `Install-AppDependencies ${appxManifestPath} ${appPackageFolder} ${options.arch}`,\n verbose,\n 'InstallAppDependenciesFailure',\n );\n await build.buildSolution(\n buildTools,\n slnFile,\n /* options.release ? 'Release' : */ 'Debug',\n options.arch,\n {DeployLayout: 'true'},\n verbose,\n 'deploy',\n options.buildLogDirectory,\n );\n }\n }\n\n const appFamilyName = execSync(\n `${powershell} -NoProfile -c $(Get-AppxPackage -Name ${appName}).PackageFamilyName`,\n )\n .toString()\n .trim();\n\n if (!appFamilyName) {\n throw new CodedError(\n 'AppDidNotDeploy',\n 'Fail to check the installed app, maybe developer mode is off on Windows',\n );\n }\n\n const loopbackText = 'Verifying loopbackExempt';\n const loopbackSpinner = newSpinner(loopbackText);\n\n await commandWithProgress(\n loopbackSpinner,\n loopbackText,\n 'CheckNetIsolation',\n `LoopbackExempt -a -n=${appFamilyName}`.split(' '),\n verbose,\n 'CheckNetIsolationFailure',\n );\n\n if (shouldLaunchApp(options)) {\n await runPowerShellScriptFunction(\n 'Starting the app',\n windowsStoreAppUtils,\n `Start-Locally ${appName} ${args}`,\n verbose,\n 'AppStartupFailure',\n );\n } else {\n newInfo('Skip the step to start the app');\n }\n}\n\nexport function startServerInNewWindow(\n options: RunWindowsOptions,\n verbose: boolean,\n): Promise<void> {\n return new Promise(resolve => {\n http\n .get('http://localhost:8081/status', res => {\n if (res.statusCode === 200) {\n newSuccess('React-Native Server already started');\n } else {\n newError('React-Native Server not responding');\n }\n resolve();\n })\n .on('error', () => {\n launchServer(options, verbose);\n resolve();\n });\n });\n}\n\nfunction launchServer(options: RunWindowsOptions, verbose: boolean) {\n newSuccess('Starting the React-Native Server');\n const opts: SpawnOptions = {\n cwd: options.root,\n detached: true,\n stdio: verbose ? 'inherit' : 'ignore',\n };\n\n spawn('cmd.exe', ['/C', 'start npx react-native start'], opts);\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.188",
3
+ "version": "0.0.0-canary.189",
4
4
  "license": "MIT",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "repository": {