Skip to content

Commit

Permalink
[Refactor] use fs.promises instead of util.promisify; use built-i…
Browse files Browse the repository at this point in the history
…n `copyFile`
  • Loading branch information
ljharb committed Jan 7, 2022
1 parent f18f1ed commit 1e8d387
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
4 changes: 1 addition & 3 deletions bin.js
Expand Up @@ -5,14 +5,12 @@
const npx = require('libnpx');
const getLockfile = require('npm-lockfile/getLockfile');
const finder = require('find-package-json');
const promisify = require('util.promisify');
const semver = require('semver');
const colors = require('colors/safe');

const path = require('path');
const { existsSync } = require('fs');
const writeFile = promisify(require('fs').writeFile);
const copyFile = promisify(require('fs-copy-file'));
const { copyFile, writeFile } = require('fs').promises;
const { execSync } = require('child_process');

const getProjectTempDir = require('./getProjectTempDir');
Expand Down
3 changes: 1 addition & 2 deletions getProjectTempDir.js
Expand Up @@ -3,13 +3,12 @@
const tmp = require('tmp');
const nodeCleanup = require('node-cleanup');
const semver = require('semver');
const promisify = require('util.promisify');
const rimraf = require('rimraf');
const colors = require('colors/safe');

const path = require('path');
const { exec, execSync } = require('child_process');
const writeFile = promisify(require('fs').writeFile);
const { writeFile } = require('fs').promises;

const cleanupHandlers = [];
const finalCleanup = function finalCleanup() {
Expand Down
4 changes: 1 addition & 3 deletions package.json
Expand Up @@ -37,13 +37,11 @@
"dependencies": {
"colors": "^1.4.0",
"find-package-json": "^1.2.0",
"fs-copy-file": "^2.1.2",
"libnpx": "^10.2.4",
"node-cleanup": "^2.1.2",
"npm-lockfile": "^3.0.0",
"semver": "^7.3.5",
"tmp": "^0.2.1",
"util.promisify": "^1.1.1"
"tmp": "^0.2.1"
},
"devDependencies": {
"@ljharb/eslint-config": "^20.1.0",
Expand Down

0 comments on commit 1e8d387

Please sign in to comment.