Skip to content

Commit

Permalink
fix: get rid of fs-extra (#1418)
Browse files Browse the repository at this point in the history
* fix: get rid of fs-extra, upgrade rimraf

* fix: revert rimraf to v3
  • Loading branch information
alexander-fenster committed Feb 3, 2023
1 parent fa4f8a7 commit 082e006
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@grpc/grpc-js": "~1.8.0",
"@grpc/proto-loader": "^0.7.0",
"@types/long": "^4.0.0",
"@types/rimraf": "^3.0.2",
"abort-controller": "^3.0.0",
"duplexify": "^4.0.0",
"fast-text-encoding": "^1.0.3",
Expand All @@ -32,21 +33,19 @@
},
"devDependencies": {
"@compodoc/compodoc": "1.1.19",
"@types/fs-extra": "^9.0.0",
"@types/mkdirp": "^1.0.2",
"@types/mocha": "^9.0.0",
"@types/ncp": "^2.0.1",
"@types/node": "^18.0.0",
"@types/node-fetch": "^2.5.4",
"@types/object-hash": "^3.0.0",
"@types/proxyquire": "^1.3.28",
"@types/pumpify": "^1.4.1",
"@types/rimraf": "^3.0.0",
"@types/sinon": "^10.0.0",
"@types/uglify-js": "^3.17.0",
"c8": "^7.0.0",
"codecov": "^3.1.0",
"execa": "^5.0.0",
"fs-extra": "^10.0.0",
"google-proto-files": "^3.0.0",
"gts": "^3.1.0",
"linkinator": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion test/system-test/test.clientlibs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import * as rimraf from 'rimraf';
import * as util from 'util';
import {describe, it, before} from 'mocha';

const mkdir = util.promisify(fs.mkdir);
const rmrf = util.promisify(rimraf);
const mkdir = util.promisify(fs.mkdir);
const readFile = util.promisify(fs.readFile);
const writeFile = util.promisify(fs.writeFile);

Expand Down
4 changes: 2 additions & 2 deletions test/unit/minify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import * as fs from 'fs';
import {promises as fsp} from 'fs';
import * as rimraf from 'rimraf';
import * as path from 'path';
import * as util from 'util';
import * as minify from '../../tools/minify';
import {promisify} from 'util';

const rmrf = util.promisify(rimraf);
const rmrf = promisify(rimraf);
const testDir = path.join(process.cwd(), '.minify-test');
const fixturesDir = path.join(__dirname, '..', 'fixtures');

Expand Down
23 changes: 17 additions & 6 deletions tools/prepublish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@
* limitations under the License.
*/

import * as fs from 'fs-extra';
import {getProtoPath} from 'google-proto-files';
import * as path from 'path';
// Note: the following three imports will be all gone when we support Node.js 16+.
// But until then, we'll use these modules.
import * as rimraf from 'rimraf';
import * as mkdirp from 'mkdirp';
import * as ncp from 'ncp';
import {promisify} from 'util';

const ncpp = promisify(ncp);
const rmrf = promisify(rimraf);

const subdirs = [
'api',
Expand All @@ -31,14 +39,17 @@ const subdirs = [
];

async function main() {
await fs.remove(path.join('protos', 'google'));
await fs.ensureDir(path.join('protos', 'google'));
await rmrf(path.join('protos', 'google'));
await mkdirp(path.join('protos', 'google'));

subdirs.forEach(async subdir => {
for (const subdir of subdirs) {
const src = getProtoPath(subdir);
const target = path.join('protos', 'google', subdir);
await fs.copy(src, target);
});
console.log(`Copying protos from ${src} to ${target}`);
await mkdirp(target);
await ncpp(src, target);
}
console.log('Protos have been copied successfully');
}

main().catch(console.error);

0 comments on commit 082e006

Please sign in to comment.