Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ function exec(command, options = {}) {
// and returns path to its 'dist' directory.
function prepareBenchmarkProjects(revisionList) {
const tmpDir = path.join(os.tmpdir(), 'graphql-js-benchmark');
fs.mkdirSync(tmpDir, { recursive: true });
fs.mkdirSync(tmpDir);

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

return revisionList.map((revision) => {
Expand Down Expand Up @@ -72,12 +72,12 @@ function prepareBenchmarkProjects(revisionList) {
}

const repoDir = path.join(tmpDir, hash);
fs.rmdirSync(repoDir, { recursive: true });
fs.rmdirSync(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 });
fs.rmdirSync(repoDir, { recursive: true, force: 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 });
fs.rmdirSync(tmpDir, { recursive: true, force: true });
fs.mkdirSync(tmpDir);

const distDir = path.resolve('./npmDist');
Expand Down
4 changes: 2 additions & 2 deletions resources/build-deno.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const path = require('path');

const babel = require('@babel/core');

const { rmdirRecursive, readdirRecursive, showDirStats } = require('./utils');
const { readdirRecursive, showDirStats } = require('./utils');

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

const srcFiles = readdirRecursive('./src', { ignoreDir: /^__.*__$/ });
Expand Down
4 changes: 2 additions & 2 deletions resources/build-npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const assert = require('assert');

const babel = require('@babel/core');

const { rmdirRecursive, readdirRecursive, showDirStats } = require('./utils');
const { readdirRecursive, showDirStats } = require('./utils');

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

const srcFiles = readdirRecursive('./src', { ignoreDir: /^__.*__$/ });
Expand Down
15 changes: 0 additions & 15 deletions resources/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,6 @@ function removeTrailingNewLine(str) {
return str.split('\n').slice(0, -1).join('\n');
}

function rmdirRecursive(dirPath) {
if (fs.existsSync(dirPath)) {
for (const dirent of fs.readdirSync(dirPath, { withFileTypes: true })) {
const fullPath = path.join(dirPath, dirent.name);
if (dirent.isDirectory()) {
rmdirRecursive(fullPath);
} else {
fs.unlinkSync(fullPath);
}
}
fs.rmdirSync(dirPath);
}
}

function readdirRecursive(dirPath, opts = {}) {
const { ignoreDir } = opts;
const result = [];
Expand Down Expand Up @@ -116,7 +102,6 @@ function showDirStats(dirPath) {
module.exports = {
exec,
execAsync,
rmdirRecursive,
readdirRecursive,
showDirStats,
};