diff --git a/node_modules/@react-native-windows/cli/lib-commonjs/runWindows/utils/deploy.js b/node_modules/@react-native-windows/cli/lib-commonjs/runWindows/utils/deploy.js index 1cce6ef..f4ee852 100644 --- a/node_modules/@react-native-windows/cli/lib-commonjs/runWindows/utils/deploy.js +++ b/node_modules/@react-native-windows/cli/lib-commonjs/runWindows/utils/deploy.js @@ -106,12 +106,12 @@ function shouldDeployByPackage(options, config) { function shouldLaunchApp(options) { return options.launch === true; } -function getAppPackage(options, projectName) { +function getAppPackage(config, options, projectName) { const configuration = getBuildConfiguration(options); const packageFolder = options.arch === 'x86' ? `{*_x86_${configuration}_*,*_Win32_${configuration}_*}` : `*_${options.arch}_${configuration}_*`; - const appPackageGlob = `${options.root}/windows/{*/AppPackages,AppPackages/*}/${packageFolder}`; + const appPackageGlob = `${options.root}/${config.project.windows?.sourceDir || windows}/{*/AppPackages,AppPackages/*}/${packageFolder}`; const appPackageCandidates = glob_1.default.sync(appPackageGlob); let appPackage; if (appPackageCandidates.length === 1 || !projectName) { @@ -126,7 +126,7 @@ function getAppPackage(options, projectName) { if (!appPackage && options.release) { // in the latest vs, Release is removed (0, commandWithProgress_1.newWarn)('No package found in *_Release_* folder, removing the _Release_ prefix and checking again'); - const rootGlob = `${options.root}/windows/{*/AppPackages,AppPackages/*}`; + const rootGlob = `${options.root}/${config.project.windows?.sourceDir || windows}/{*/AppPackages,AppPackages/*}`; const newGlob = `${rootGlob}/*_${options.arch === 'x86' ? '{Win32,x86}' : options.arch}_Test`; const result = glob_1.default.sync(newGlob); if (result.length > 1 && projectName) { @@ -153,7 +153,7 @@ function getWindowsStoreAppUtils(options) { popd(); return windowsStoreAppUtilsPath; } -function getAppxManifestPath(options, projectName) { +function getAppxManifestPath(config, options, projectName) { const configuration = getBuildConfiguration(options); // C++ x86 manifest would go under windows/Debug whereas x64 goes under windows/x64/Debug // If we've built both, this causes us to end up with two matches, so we have to carefully select the right folder @@ -164,7 +164,7 @@ function getAppxManifestPath(options, projectName) { else { archFolder = `${configuration}`; } - const appxManifestGlob = `windows/{*/bin/${options.arch}/${configuration},${archFolder}/*,target/${options.arch}/${configuration}}/AppxManifest.xml`; + const appxManifestGlob = `${config.project.windows?.sourceDir || 'windows'}/{*/bin/${options.arch}/${configuration},${archFolder}/*,target/${options.arch}/${configuration}}/AppxManifest.xml`; const globs = glob_1.default.sync(path_1.default.join(options.root, appxManifestGlob)); let appxPath; if (globs.length === 1 || !projectName) { @@ -186,8 +186,8 @@ function getAppxManifestPath(options, projectName) { function parseAppxManifest(appxManifestPath) { return (0, xml_parser_1.default)(fs_1.default.readFileSync(appxManifestPath, 'utf8')); } -function getAppxManifest(options, projectName) { - return parseAppxManifest(getAppxManifestPath(options, projectName)); +function getAppxManifest(config, options, projectName) { + return parseAppxManifest(getAppxManifestPath(config, options, projectName)); } function handleResponseError(e) { if (e.message.indexOf('Error code -2146233088')) { @@ -203,14 +203,14 @@ async function deployToDevice(options, verbose, config) { const projectName = windowsConfig && windowsConfig.project && windowsConfig.project.projectName ? windowsConfig.project.projectName : path_1.default.parse(options.proj).name; - const appPackageFolder = getAppPackage(options); + const appPackageFolder = getAppPackage(config, options); const deployTarget = options.target ? options.target : options.emulator ? 'emulator' : 'device'; const deployTool = new winappdeploytool_1.default(); - const appxManifest = getAppxManifest(options, projectName); + const appxManifest = getAppxManifest(config, options, projectName); const shouldLaunch = shouldLaunchApp(options); const identity = appxManifest.root.children.filter(x => { return x.name === 'mp:PhoneIdentity'; @@ -246,7 +246,7 @@ async function deployToDesktop(options, verbose, config, buildTools) { ? windowsConfig.project.projectName : path_1.default.parse(options.proj).name; const windowsStoreAppUtils = getWindowsStoreAppUtils(options); - const appxManifestPath = getAppxManifestPath(options, projectName); + const appxManifestPath = getAppxManifestPath(config, options, projectName); const appxManifest = parseAppxManifest(appxManifestPath); const identity = appxManifest.root.children.filter(x => { return x.name === 'Identity'; @@ -261,7 +261,7 @@ async function deployToDesktop(options, verbose, config, buildTools) { args.push('--direct-debugging', options.directDebugging.toString()); } await (0, commandWithProgress_1.runPowerShellScriptFunction)('Enabling Developer Mode', windowsStoreAppUtils, 'EnableDevMode', verbose, 'EnableDevModeFailure'); - const appPackageFolder = getAppPackage(options, projectName); + const appPackageFolder = getAppPackage(config, options, projectName); if (shouldDeployByPackage(options, config)) { // Deploy by package await (0, commandWithProgress_1.runPowerShellScriptFunction)('Removing old version of the app', windowsStoreAppUtils, `Uninstall-App ${appName}`, verbose, 'RemoveOldAppVersionFailure');