From 2c338b16fd97634dba907f7ad612f64893dcb01c Mon Sep 17 00:00:00 2001 From: PrathamLalwani <84996242+PrathamLalwani@users.noreply.github.com> Date: Thu, 16 Nov 2023 03:35:43 -0800 Subject: [PATCH] Added windows powershell syntax to build scripts (#27692) ## Summary I had to change the commands to be windows specific so that it doesn't cause any crashes ## How did you test this change? I successfully built the different types of devtools extenstions on my personal computer. In future may need to add a github action with windows config to test these errors #27193 --- package.json | 3 ++- packages/react-devtools-extensions/deploy.js | 8 ++------ .../build-release-locally-commands/build-artifacts.js | 3 ++- scripts/rollup/build-all-release-channels.js | 8 ++------ yarn.lock | 9 +++++++++ 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 488ce8a701..375c747940 100644 --- a/package.json +++ b/package.json @@ -91,6 +91,7 @@ "rollup-plugin-prettier": "^4.1.1", "rollup-plugin-strip-banner": "^3.0.0", "semver": "^7.1.1", + "shelljs":"^0.8.5", "signedsource": "^2.0.0", "targz": "^1.0.1", "through2": "^3.0.1", @@ -108,7 +109,7 @@ "scripts": { "build": "node ./scripts/rollup/build-all-release-channels.js", "build-combined": "echo 'build-combined is deprecated. yarn build instead.'", - "build-for-devtools": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react/jsx,react-dom/index,react-dom/unstable_testing,react-dom/test-utils,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh,react-art --type=NODE && cp -r ./build/node_modules build/oss-experimental/", + "build-for-devtools": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react/jsx,react-dom/index,react-dom/unstable_testing,react-dom/test-utils,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh,react-art --type=NODE", "build-for-devtools-dev": "yarn build-for-devtools --type=NODE_DEV", "build-for-devtools-prod": "yarn build-for-devtools --type=NODE_PROD", "linc": "node ./scripts/tasks/linc.js", diff --git a/packages/react-devtools-extensions/deploy.js b/packages/react-devtools-extensions/deploy.js index 37d06e4817..046a1b4696 100644 --- a/packages/react-devtools-extensions/deploy.js +++ b/packages/react-devtools-extensions/deploy.js @@ -5,7 +5,7 @@ const {exec, execSync} = require('child_process'); const {readFileSync, writeFileSync} = require('fs'); const {join} = require('path'); - +const shell = require('shelljs'); const main = async buildId => { const root = join(__dirname, buildId); const buildPath = join(root, 'build'); @@ -18,11 +18,7 @@ const main = async buildId => { }, stdio: 'inherit', }); - - await exec(`cp ${join(root, 'now.json')} ${join(buildPath, 'now.json')}`, { - cwd: root, - }); - + shell.cp(join(root, 'now.json'), join(buildPath, 'now.json')); const file = readFileSync(join(root, 'now.json')); const json = JSON.parse(file); const alias = json.alias[0]; diff --git a/scripts/release/build-release-locally-commands/build-artifacts.js b/scripts/release/build-release-locally-commands/build-artifacts.js index 65867052a0..0b45804822 100644 --- a/scripts/release/build-release-locally-commands/build-artifacts.js +++ b/scripts/release/build-release-locally-commands/build-artifacts.js @@ -5,6 +5,7 @@ const {exec} = require('child-process-promise'); const {join} = require('path'); const {logPromise} = require('../utils'); +const shell = require('shelljs'); const run = async ({cwd, dry, tempDirectory}) => { const defaultOptions = { @@ -17,7 +18,7 @@ const run = async ({cwd, dry, tempDirectory}) => { const tempNodeModulesPath = join(tempDirectory, 'build', 'node_modules'); const buildPath = join(cwd, 'build'); - await exec(`cp -r ${tempNodeModulesPath} ${buildPath}`); + shell.cp('-r', tempNodeModulesPath, buildPath); }; module.exports = async params => { diff --git a/scripts/rollup/build-all-release-channels.js b/scripts/rollup/build-all-release-channels.js index 25f2652ecf..b7427d135b 100644 --- a/scripts/rollup/build-all-release-channels.js +++ b/scripts/rollup/build-all-release-channels.js @@ -8,7 +8,7 @@ const fse = require('fs-extra'); const {spawnSync} = require('child_process'); const path = require('path'); const tmp = require('tmp'); - +const shell = require('shelljs'); const { ReactVersion, stablePackages, @@ -115,11 +115,7 @@ function processStable(buildDir) { if (fs.existsSync(buildDir + '/node_modules')) { // Identical to `oss-stable` but with real, semver versions. This is what // will get published to @latest. - spawnSync('cp', [ - '-r', - buildDir + '/node_modules', - buildDir + '/oss-stable-semver', - ]); + shell.cp('-r', buildDir + '/node_modules', buildDir + '/oss-stable-semver'); const defaultVersionIfNotFound = '0.0.0' + '-' + sha + '-' + dateString; const versionsMap = new Map(); diff --git a/yarn.lock b/yarn.lock index 00876fed7c..d12f18713b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13871,6 +13871,15 @@ shelljs@0.7.7: interpret "^1.0.0" rechoir "^0.6.2" +shelljs@^0.8.5: + version "0.8.5" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" + integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow== + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + shellwords@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"