@samitouri / QOS-React-2 / commits / 2c338b16fd

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

PrathamLalwani committed Nov 16, 2023 at 03:35 UTC 2c338b16fd97634dba907f7ad612f64893dcb01c
5 files changed +17 -14
package.json
+2 -1
@@ -91,6 +91,7 @@
91 "rollup-plugin-prettier": "^4.1.1",
92 "rollup-plugin-strip-banner": "^3.0.0",
93 "semver": "^7.1.1",
94 + "shelljs":"^0.8.5",
95 "signedsource": "^2.0.0",
96 "targz": "^1.0.1",
97 "through2": "^3.0.1",
@@ -108,7 +109,7 @@
109 "scripts": {
110 "build": "node ./scripts/rollup/build-all-release-channels.js",
111 "build-combined": "echo 'build-combined is deprecated. yarn build instead.'",
111 - "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/",
112 + "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",
113 "build-for-devtools-dev": "yarn build-for-devtools --type=NODE_DEV",
114 "build-for-devtools-prod": "yarn build-for-devtools --type=NODE_PROD",
115 "linc": "node ./scripts/tasks/linc.js",
packages/react-devtools-extensions/deploy.js
+2 -6
@@ -5,7 +5,7 @@
5 const {exec, execSync} = require('child_process');
6 const {readFileSync, writeFileSync} = require('fs');
7 const {join} = require('path');
8 -
8 +const shell = require('shelljs');
9 const main = async buildId => {
10 const root = join(__dirname, buildId);
11 const buildPath = join(root, 'build');
@@ -18,11 +18,7 @@ const main = async buildId => {
18 },
19 stdio: 'inherit',
20 });
21 -
22 - await exec(`cp ${join(root, 'now.json')} ${join(buildPath, 'now.json')}`, {
23 - cwd: root,
24 - });
25 -
21 + shell.cp(join(root, 'now.json'), join(buildPath, 'now.json'));
22 const file = readFileSync(join(root, 'now.json'));
23 const json = JSON.parse(file);
24 const alias = json.alias[0];
scripts/release/build-release-locally-commands/build-artifacts.js
+2 -1
@@ -5,6 +5,7 @@
5 const {exec} = require('child-process-promise');
6 const {join} = require('path');
7 const {logPromise} = require('../utils');
8 +const shell = require('shelljs');
9
10 const run = async ({cwd, dry, tempDirectory}) => {
11 const defaultOptions = {
@@ -17,7 +18,7 @@ const run = async ({cwd, dry, tempDirectory}) => {
18 const tempNodeModulesPath = join(tempDirectory, 'build', 'node_modules');
19 const buildPath = join(cwd, 'build');
20
20 - await exec(`cp -r ${tempNodeModulesPath} ${buildPath}`);
21 + shell.cp('-r', tempNodeModulesPath, buildPath);
22 };
23
24 module.exports = async params => {
scripts/rollup/build-all-release-channels.js
+2 -6
@@ -8,7 +8,7 @@ const fse = require('fs-extra');
8 const {spawnSync} = require('child_process');
9 const path = require('path');
10 const tmp = require('tmp');
11 -
11 +const shell = require('shelljs');
12 const {
13 ReactVersion,
14 stablePackages,
@@ -115,11 +115,7 @@ function processStable(buildDir) {
115 if (fs.existsSync(buildDir + '/node_modules')) {
116 // Identical to `oss-stable` but with real, semver versions. This is what
117 // will get published to @latest.
118 - spawnSync('cp', [
119 - '-r',
120 - buildDir + '/node_modules',
121 - buildDir + '/oss-stable-semver',
122 - ]);
118 + shell.cp('-r', buildDir + '/node_modules', buildDir + '/oss-stable-semver');
119
120 const defaultVersionIfNotFound = '0.0.0' + '-' + sha + '-' + dateString;
121 const versionsMap = new Map();
yarn.lock
+9
@@ -13871,6 +13871,15 @@ shelljs@0.7.7:
13871 interpret "^1.0.0"
13872 rechoir "^0.6.2"
13873
13874 +shelljs@^0.8.5:
13875 + version "0.8.5"
13876 + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c"
13877 + integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==
13878 + dependencies:
13879 + glob "^7.0.0"
13880 + interpret "^1.0.0"
13881 + rechoir "^0.6.2"
13882 +
13883 shellwords@^0.1.1:
13884 version "0.1.1"
13885 resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"