Use fs.mkdirSync instead of execSync('mkdir -p ...')

Also consistently use {recursive: true} in case directory is nested
in an also-not-yet-existent directory.
This commit is contained in:
Christopher Allen
2021-07-10 13:13:53 +01:00
committed by Christopher Allen
parent 2c83652733
commit 85b50fcb73
3 changed files with 4 additions and 4 deletions

View File

@@ -28,8 +28,8 @@ function prepareDeployDir(done) {
if (fs.existsSync(demoTmpDir)) {
rimraf.sync(demoTmpDir);
}
fs.mkdirSync(demoStaticTmpDir, { recursive: true });
done()
fs.mkdir(demoStaticTmpDir, {recursive: true});
done();
}
/**

View File

@@ -448,7 +448,7 @@ function buildLangfiles(done) {
// Create output directory.
// TODO(#5000): does mkidr -p work on Windows?
const outputDir = path.join(BUILD_DIR, 'msg', 'js');
execSync(`mkdir -p ${outputDir}`, {stdio: 'inherit'});
fs.mkdirSync(outputDir, {recursive: true});
// Run create_messages.py.
let json_files = fs.readdirSync(path.join('msg', 'json'));

View File

@@ -374,7 +374,7 @@ function packageJSON(cb) {
const json = Object.assign({}, packageJson);
delete json['scripts'];
if (!fs.existsSync(RELEASE_DIR)) {
fs.mkdirSync(RELEASE_DIR);
fs.mkdirSync(RELEASE_DIR, {recursive: true});
}
fs.writeFileSync(`${RELEASE_DIR}/package.json`,
JSON.stringify(json, null, 2));