Skip to content

Commit

Permalink
Added windows powershell syntax to build scripts (#27692)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
PrathamLalwani authored Nov 16, 2023
1 parent ee68446 commit 2c338b1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
8 changes: 2 additions & 6 deletions packages/react-devtools-extensions/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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 => {
Expand Down
8 changes: 2 additions & 6 deletions scripts/rollup/build-all-release-channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down
9 changes: 9 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13871,6 +13871,15 @@ [email protected]:
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"
Expand Down

0 comments on commit 2c338b1

Please sign in to comment.