Skip to content

Update to mkdirp ≥ 1 #142

@guimard

Description

@guimard

Hi,

it looks like this quick-and-dirty patch is enough to switch to mkdirp ≥ 1 :

--- a/lib/millstone.js
+++ b/lib/millstone.js
@@ -214,8 +214,14 @@
             }
         }
         var dir_path = path.dirname(options.filepath);
-        mkdirp(dir_path, 0755, function(err) {
-            if (err && err.code !== 'EEXIST') {
+        mkdirp(dir_path, 0755).then(() => {
+                download(url, options, function(err, filepath) {
+                    if (err) return callback(err);
+                    callback(null, filepath);
+                });
+        })
+        .catch((err) => {
+            if ( err.code !== 'EEXIST') {
                 if (env == 'development') console.error('[millstone] could not create directory: ' + dir_path);
                 callback(err);
             } else {
@@ -533,8 +539,9 @@
         benchmark = options.benchmark;

     Step(function setup() {
-        if (nosymlink) mkdirp(base, 0755, this);
-        else mkdirp(path.join(base, 'layers'), 0755, this);
+        var me = this;
+        if (nosymlink) mkdirp(base, 0755).then(() => {me()}).catch((e)=>{me(e)});
+        else mkdirp(path.join(base, 'layers'), 0755).then(() => {me()}).catch((e)=>{me(e)});
     }, function style_externals(err) {
         if (err && err.code !== 'EEXIST') throw err;
         if (benchmark) console.time("[millstone][benchmark] Resolving style (mss) externals");
--- a/package.json
+++ b/package.json
@@ -27,7 +27,7 @@
         "zipfile": "~0.5.5",
         "sqlite3": "4.1.0",
         "mime": "~1.2.11",
-        "mkdirp": "~0.5.0",
+        "mkdirp": "^1.0.3",
         "optimist": "~0.6.1"
     },
     "devDependencies": {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions