Skip to content

Commit 082e006

Browse files
fix: get rid of fs-extra (#1418)
* fix: get rid of fs-extra, upgrade rimraf * fix: revert rimraf to v3
1 parent fa4f8a7 commit 082e006

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@grpc/grpc-js": "~1.8.0",
1919
"@grpc/proto-loader": "^0.7.0",
2020
"@types/long": "^4.0.0",
21+
"@types/rimraf": "^3.0.2",
2122
"abort-controller": "^3.0.0",
2223
"duplexify": "^4.0.0",
2324
"fast-text-encoding": "^1.0.3",
@@ -32,21 +33,19 @@
3233
},
3334
"devDependencies": {
3435
"@compodoc/compodoc": "1.1.19",
35-
"@types/fs-extra": "^9.0.0",
36+
"@types/mkdirp": "^1.0.2",
3637
"@types/mocha": "^9.0.0",
3738
"@types/ncp": "^2.0.1",
3839
"@types/node": "^18.0.0",
3940
"@types/node-fetch": "^2.5.4",
4041
"@types/object-hash": "^3.0.0",
4142
"@types/proxyquire": "^1.3.28",
4243
"@types/pumpify": "^1.4.1",
43-
"@types/rimraf": "^3.0.0",
4444
"@types/sinon": "^10.0.0",
4545
"@types/uglify-js": "^3.17.0",
4646
"c8": "^7.0.0",
4747
"codecov": "^3.1.0",
4848
"execa": "^5.0.0",
49-
"fs-extra": "^10.0.0",
5049
"google-proto-files": "^3.0.0",
5150
"gts": "^3.1.0",
5251
"linkinator": "^4.0.0",

test/system-test/test.clientlibs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import * as rimraf from 'rimraf';
2121
import * as util from 'util';
2222
import {describe, it, before} from 'mocha';
2323

24-
const mkdir = util.promisify(fs.mkdir);
2524
const rmrf = util.promisify(rimraf);
25+
const mkdir = util.promisify(fs.mkdir);
2626
const readFile = util.promisify(fs.readFile);
2727
const writeFile = util.promisify(fs.writeFile);
2828

test/unit/minify.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ import * as fs from 'fs';
1818
import {promises as fsp} from 'fs';
1919
import * as rimraf from 'rimraf';
2020
import * as path from 'path';
21-
import * as util from 'util';
2221
import * as minify from '../../tools/minify';
22+
import {promisify} from 'util';
2323

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

tools/prepublish.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17-
import * as fs from 'fs-extra';
1817
import {getProtoPath} from 'google-proto-files';
1918
import * as path from 'path';
19+
// Note: the following three imports will be all gone when we support Node.js 16+.
20+
// But until then, we'll use these modules.
21+
import * as rimraf from 'rimraf';
22+
import * as mkdirp from 'mkdirp';
23+
import * as ncp from 'ncp';
24+
import {promisify} from 'util';
25+
26+
const ncpp = promisify(ncp);
27+
const rmrf = promisify(rimraf);
2028

2129
const subdirs = [
2230
'api',
@@ -31,14 +39,17 @@ const subdirs = [
3139
];
3240

3341
async function main() {
34-
await fs.remove(path.join('protos', 'google'));
35-
await fs.ensureDir(path.join('protos', 'google'));
42+
await rmrf(path.join('protos', 'google'));
43+
await mkdirp(path.join('protos', 'google'));
3644

37-
subdirs.forEach(async subdir => {
45+
for (const subdir of subdirs) {
3846
const src = getProtoPath(subdir);
3947
const target = path.join('protos', 'google', subdir);
40-
await fs.copy(src, target);
41-
});
48+
console.log(`Copying protos from ${src} to ${target}`);
49+
await mkdirp(target);
50+
await ncpp(src, target);
51+
}
52+
console.log('Protos have been copied successfully');
4253
}
4354

4455
main().catch(console.error);

0 commit comments

Comments
 (0)