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
This commit is contained in:
PrathamLalwani 2023-11-16 03:35:43 -08:00 committed by GitHub
parent ee68446ff1
commit 2c338b16fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 14 deletions

View File

@ -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",

View File

@ -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];

View File

@ -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 => {

View File

@ -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();

View File

@ -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"