GeezerVison is showing github.com — fix: get rid of fs-extra (#1418) · googleapis/google-cloud-node@3525457
File treeExpand file treeCollapse file tree Open diff view settings packages/packages/google-gax
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/packages/google-gax/package.json +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 18 | 18 | "@grpc/grpc-js": "~1.8.0", | 19 | 19 | "@grpc/proto-loader": "^0.7.0", | 20 | 20 | "@types/long": "^4.0.0", | | 21 | + "@types/rimraf": "^3.0.2", | 21 | 22 | "abort-controller": "^3.0.0", | 22 | 23 | "duplexify": "^4.0.0", | 23 | 24 | "fast-text-encoding": "^1.0.3", | | 32 | 33 | }, | 33 | 34 | "devDependencies": { | 34 | 35 | "@compodoc/compodoc": "1.1.19", | 35 | | - "@types/fs-extra": "^9.0.0", | | 36 | + "@types/mkdirp": "^1.0.2", | 36 | 37 | "@types/mocha": "^9.0.0", | 37 | 38 | "@types/ncp": "^2.0.1", | 38 | 39 | "@types/node": "^18.0.0", | 39 | 40 | "@types/node-fetch": "^2.5.4", | 40 | 41 | "@types/object-hash": "^3.0.0", | 41 | 42 | "@types/proxyquire": "^1.3.28", | 42 | 43 | "@types/pumpify": "^1.4.1", | 43 | | - "@types/rimraf": "^3.0.0", | 44 | 44 | "@types/sinon": "^10.0.0", | 45 | 45 | "@types/uglify-js": "^3.17.0", | 46 | 46 | "c8": "^7.0.0", | 47 | 47 | "codecov": "^3.1.0", | 48 | 48 | "execa": "^5.0.0", | 49 | | - "fs-extra": "^10.0.0", | 50 | 49 | "google-proto-files": "^3.0.0", | 51 | 50 | "gts": "^3.1.0", | 52 | 51 | "linkinator": "^4.0.0", | |
Collapse file Copy file name to clipboardExpand all lines: packages/packages/google-gax/test/system-test/test.clientlibs.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -21,8 +21,8 @@ import * as rimraf from 'rimraf'; | 21 | 21 | import * as util from 'util'; | 22 | 22 | import {describe, it, before} from 'mocha'; | 23 | 23 |
| 24 | | -const mkdir = util.promisify(fs.mkdir); | 25 | 24 | const rmrf = util.promisify(rimraf); | | 25 | +const mkdir = util.promisify(fs.mkdir); | 26 | 26 | const readFile = util.promisify(fs.readFile); | 27 | 27 | const writeFile = util.promisify(fs.writeFile); | 28 | 28 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/packages/google-gax/test/unit/minify.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -18,10 +18,10 @@ import * as fs from 'fs'; | 18 | 18 | import {promises as fsp} from 'fs'; | 19 | 19 | import * as rimraf from 'rimraf'; | 20 | 20 | import * as path from 'path'; | 21 | | -import * as util from 'util'; | 22 | 21 | import * as minify from '../../tools/minify'; | | 22 | +import {promisify} from 'util'; | 23 | 23 |
| 24 | | -const rmrf = util.promisify(rimraf); | | 24 | +const rmrf = promisify(rimraf); | 25 | 25 | const testDir = path.join(process.cwd(), '.minify-test'); | 26 | 26 | const fixturesDir = path.join(__dirname, '..', 'fixtures'); | 27 | 27 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/packages/google-gax/tools/prepublish.ts +17-6Lines changed: 17 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 14 | 14 | * limitations under the License. | 15 | 15 | */ | 16 | 16 |
| 17 | | -import * as fs from 'fs-extra'; | 18 | 17 | import {getProtoPath} from 'google-proto-files'; | 19 | 18 | 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); | 20 | 28 |
| 21 | 29 | const subdirs = [ | 22 | 30 | 'api', | @@ -31,14 +39,17 @@ const subdirs = [ | 31 | 39 | ]; | 32 | 40 |
| 33 | 41 | 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')); | 36 | 44 |
| 37 | | - subdirs.forEach(async subdir => { | | 45 | + for (const subdir of subdirs) { | 38 | 46 | const src = getProtoPath(subdir); | 39 | 47 | 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'); | 42 | 53 | } | 43 | 54 |
| 44 | 55 | main().catch(console.error); |
|