Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: get rid of fs-extra #1418

Merged
merged 4 commits into from
Feb 3, 2023
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
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);