Skip to content

Commit

Permalink
fix(deps): remove rimraf in favor of native node rm function (#1626)
Browse files Browse the repository at this point in the history
* fix(deps): remove rimraf in favor of native node rm function

* use fsp.rm instead of rmSync

* pin additional deps

* move pinned deps to devDeps
  • Loading branch information
ddelgrosso1 authored Jul 8, 2024
1 parent e3cf430 commit dd87646
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
4 changes: 3 additions & 1 deletion gax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@
"c8": "^9.0.0",
"codecov": "^3.1.0",
"execa": "^5.0.0",
"glob": "10.4.0",
"google-proto-files": "^4.2.0",
"gts": "^5.0.0",
"jackspeak": "3.4.0",
"linkinator": "^4.0.0",
"lru-cache": "10.3.0",
"long": "^4.0.0",
"mkdirp": "^2.0.0",
"mocha": "^9.0.0",
Expand All @@ -50,7 +53,6 @@
"protobufjs-cli": "1.1.2",
"proxyquire": "^2.0.1",
"pumpify": "^2.0.0",
"rimraf": "^5.0.1",
"sinon": "^18.0.0",
"stream-events": "^1.0.4",
"ts-loader": "^8.0.0",
Expand Down
6 changes: 4 additions & 2 deletions gax/test/showcase-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
},
"dependencies": {
"download": "^8.0.0",
"execa": "^5.0.0",
"rimraf": "^5.0.1"
"execa": "^5.0.0"
},
"devDependencies": {
"@types/download": "^8.0.1",
"@types/node": "^14.11.2",
"typescript": "^4.0.3"
},
"engines": {
"node": ">=14"
}
}
4 changes: 2 additions & 2 deletions gax/test/showcase-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import * as execa from 'execa';
import * as download from 'download';
import * as fs from 'fs';
import * as fsp from 'fs/promises';
import * as path from 'path';
import {rimraf} from 'rimraf';
import * as util from 'util';

const mkdir = util.promisify(fs.mkdir);
Expand All @@ -41,7 +41,7 @@ export class ShowcaseServer {
const fallbackServerUrl = `https://github.com/googleapis/gapic-showcase/releases/download/v${showcaseVersion}/${tarballFilename}`;
const binaryName = './gapic-showcase';

await rimraf(testDir);
await fsp.rm(testDir, {recursive: true, force: true});
await mkdir(testDir);
process.chdir(testDir);
console.log(`Server will be run from ${testDir}.`);
Expand Down
4 changes: 2 additions & 2 deletions gax/test/system-test/test.clientlibs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import * as execa from 'execa';
import * as fs from 'fs';
import * as fsp from 'fs/promises';
import * as path from 'path';
import {rimraf} from 'rimraf';
import * as util from 'util';
import {describe, it, before} from 'mocha';

Expand Down Expand Up @@ -189,7 +189,7 @@ describe('Run system tests for some libraries', () => {
throw new Error(`npm pack tarball ${toolsTarball} does not exist`);
}

await rimraf(testDir);
await fsp.rm(testDir, {recursive: true, force: true});
await mkdir(testDir);
process.chdir(testDir);
console.log(`Running tests in ${testDir}.`);
Expand Down
6 changes: 3 additions & 3 deletions gax/test/unit/grpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import * as path from 'path';
import * as proxyquire from 'proxyquire';
import * as sinon from 'sinon';
import {mkdirSync, writeFileSync} from 'fs';
import {sync as rimrafSync} from 'rimraf';
import * as fsp from 'fs/promises';
import {afterEach, describe, it, beforeEach} from 'mocha';

import {protobuf} from '../../src/index';
Expand Down Expand Up @@ -683,7 +683,7 @@ dvorak
const [cert, key] = await client._detectClientCertificate();
assert.ok(cert.includes('qwerty'));
assert.ok(key.includes('dvorak'));
rimrafSync(tmpFolder); // Cleanup.
await fsp.rm(tmpFolder, {recursive: true, force: true}); // Cleanup.
});
it('throws if attempted to use mTLS in non-default universe', async () => {
// Pretend that "tmp-secure-context" in the current folder is the
Expand All @@ -702,7 +702,7 @@ dvorak
client.createStub(DummyStub, {universeDomain: 'example.com'}),
/configured universe domain/
);
rimrafSync(tmpFolder); // Cleanup.
await fsp.rm(tmpFolder, {recursive: true, force: true}); // Cleanup.
});
});
});
1 change: 0 additions & 1 deletion tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"google-gax": "^4.3.2",
"google-proto-files": "^4.2.0",
"protobufjs-cli": "1.1.2",
"rimraf": "^5.0.1",
"uglify-js": "^3.17.0",
"walk-up-path": "^3.0.1",
"walkdir": "^0.4.0"
Expand Down
3 changes: 1 addition & 2 deletions tools/test/compileProtos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import * as assert from 'assert';
import {describe, it, beforeEach, afterEach} from 'mocha';
import * as fs from 'fs';
import * as fsp from 'fs/promises';
import {rimraf} from 'rimraf';
import {ncp} from 'ncp';
import * as util from 'util';
import * as path from 'path';
Expand All @@ -42,7 +41,7 @@ const expectedCommonJSResultFile = path.join(resultDir, 'protos.cjs');
describe('compileProtos tool', () => {
beforeEach(async () => {
if (fs.existsSync(testDir)) {
await rimraf(testDir);
await fsp.rm(testDir, {recursive: true, force: true});
}
await mkdir(testDir);
await mkdir(resultDir);
Expand Down
3 changes: 1 addition & 2 deletions tools/test/minify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import * as assert from 'assert';
import {describe, it, beforeEach} from 'mocha';
import * as fs from 'fs';
import {promises as fsp} from 'fs';
import {rimraf} from 'rimraf';
import * as path from 'path';
import * as minify from '../src/minify';

Expand All @@ -26,7 +25,7 @@ const fixturesDir = path.join(__dirname, '..', 'test', 'fixtures');
describe('minify tool', () => {
beforeEach(async () => {
if (fs.existsSync(testDir)) {
await rimraf(testDir);
await fsp.rm(testDir, {recursive: true, force: true});
}
await fsp.mkdir(testDir);
});
Expand Down

0 comments on commit dd87646

Please sign in to comment.