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

Replace mkdirp with make-dir #152

Merged
merged 1 commit into from Nov 4, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 17 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -23,9 +23,9 @@
"node": ">=10"
},
"dependencies": {
"make-dir": "3.1.0",
"mime": "2.3.1",
"minimatch": "3.0.4",
"mkdirp": "0.5.0",
"xxhashjs": "0.2.1"
},
"devDependencies": {
Expand Down
16 changes: 2 additions & 14 deletions src/type/copy.js
Expand Up @@ -2,7 +2,7 @@

const path = require('path');
const fs = require('fs');
const mkdirp = require('mkdirp');
const makeDir = require('make-dir');

const calcHash = require('../lib/hash');
const paths = require('../lib/paths');
Expand All @@ -17,18 +17,6 @@ const getHashName = (file, options) =>
+ calcHash(file.contents, options)
+ path.extname(file.path);

const createDirAsync = (dirPath) => {
return new Promise((resolve, reject) => {
mkdirp(dirPath, (err) => {
if (err) {
reject(err);
}

resolve();
});
});
};

const writeFileAsync = (file, dest) => {
return new Promise((resolve, reject) => {
fs.writeFile(dest, file.contents, { flag: 'wx' }, (err) => {
Expand Down Expand Up @@ -79,7 +67,7 @@ module.exports = function processCopy(asset, dir, options, decl, warn, result, a
const newAssetPath = path.join(newAssetBaseDir, assetRelativePath);
const newRelativeAssetPath = normalize(path.relative(targetDir, newAssetPath));

return createDirAsync(path.dirname(newAssetPath))
return makeDir(path.dirname(newAssetPath))
.then(() => writeFileAsync(file, newAssetPath))
.then(() => {
addDependency(file.path);
Expand Down