Skip to content

Commit

Permalink
Remove deprecated rmdirSync usage from internal scripts (#3191)
Browse files Browse the repository at this point in the history
Backport of #2972 to 15.x.x branch
  • Loading branch information
IvanGoncharov authored Jun 20, 2021
1 parent b5dfb4c commit 38c2d57
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,16 @@ function exec(command, options = {}) {
// and returns path to its 'dist' directory.
function prepareBenchmarkProjects(revisionList) {
const tmpDir = path.join(os.tmpdir(), 'graphql-js-benchmark');
fs.rmdirSync(tmpDir, { recursive: true, force: true });
fs.rmSync(tmpDir, { recursive: true, force: true });
fs.mkdirSync(tmpDir);

const setupDir = path.join(tmpDir, 'setup');
fs.rmdirSync(setupDir, { recursive: true, force: true });
fs.mkdirSync(setupDir);

return revisionList.map((revision) => {
console.log(`🍳 Preparing ${revision}...`);
const projectPath = path.join(setupDir, revision);
fs.rmdirSync(projectPath, { recursive: true });
fs.rmSync(projectPath, { recursive: true, force: true });
fs.mkdirSync(projectPath);

fs.writeFileSync(
Expand Down Expand Up @@ -73,12 +72,12 @@ function prepareBenchmarkProjects(revisionList) {
}

const repoDir = path.join(tmpDir, hash);
fs.rmdirSync(repoDir, { recursive: true, force: true });
fs.rmSync(repoDir, { recursive: true, force: true });
fs.mkdirSync(repoDir);
exec(`git archive "${hash}" | tar -xC "${repoDir}"`);
exec('npm --quiet ci', { cwd: repoDir });
fs.renameSync(buildNPMArchive(repoDir), archivePath);
fs.rmdirSync(repoDir, { recursive: true, force: true });
fs.rmSync(repoDir, { recursive: true });
return archivePath;
}

Expand Down
2 changes: 1 addition & 1 deletion integrationTests/integration-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function exec(command, options = {}) {

describe('Integration Tests', () => {
const tmpDir = path.join(os.tmpdir(), 'graphql-js-integrationTmp');
fs.rmdirSync(tmpDir, { recursive: true, force: true });
fs.rmSync(tmpDir, { recursive: true, force: true });
fs.mkdirSync(tmpDir);

const distDir = path.resolve('./npmDist');
Expand Down
2 changes: 1 addition & 1 deletion resources/build-deno.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const babel = require('@babel/core');
const { readdirRecursive, showDirStats } = require('./utils');

if (require.main === module) {
fs.rmdirSync('./denoDist', { recursive: true, force: true });
fs.rmSync('./denoDist', { recursive: true, force: true });
fs.mkdirSync('./denoDist');

const srcFiles = readdirRecursive('./src', { ignoreDir: /^__.*__$/ });
Expand Down
2 changes: 1 addition & 1 deletion resources/build-npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const babel = require('@babel/core');
const { readdirRecursive, showDirStats } = require('./utils');

if (require.main === module) {
fs.rmdirSync('./npmDist', { recursive: true, force: true });
fs.rmSync('./npmDist', { recursive: true, force: true });
fs.mkdirSync('./npmDist');

const srcFiles = readdirRecursive('./src', { ignoreDir: /^__.*__$/ });
Expand Down

0 comments on commit 38c2d57

Please sign in to comment.