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

mkdirp module is obsolete #8417

Closed
simevo opened this issue Oct 27, 2020 · 4 comments
Closed

mkdirp module is obsolete #8417

simevo opened this issue Oct 27, 2020 · 4 comments

Comments

@simevo
Copy link
Contributor

simevo commented Oct 27, 2020

Bug description

yarnpkg isn't compatible with recent mkdirp (1.0), for more background: https://bugs.debian.org/972952

After so much effort to get an official Debian (and hence Ubuntu) package for yarnpkg (#1305), this issue combined with #8081 and #8083 will kick yarnpkg out of Debian.

@Daniel15 sadly your approach to maintenance of "yarn v1" as a frozen branch is not compatible with Debian.

Environment

  • Node Version: 12.19.0
  • Yarn v1 Version: 1.22.4
  • OS and version: Debian 11 bullseye (current testing)
@guimard
Copy link

guimard commented Oct 27, 2020

Hi,
migration is easy:

  1. replace any
  mkdirp( path /*, mode*/, function(err) {
    if(err) throw err;
    /* MAIN */
  })

by:

  mkdirp( path /*, mode*/ ).then( () => {
    /* MAIN */
  }).catch( (err) => {
    throw err
  })
  1. replace any
  mkdirp( path /*, mode*/, callback )

by

  mkdirp( path /*, mode*/ ).then( () => {
    callback()
  }).catch( (err) => {
    callback(err)
  })

@anomiex
Copy link

anomiex commented Nov 8, 2020

@guimard seems to have provided generic advice that doesn't really apply to yarn. I'm not all that well-versed in modern JavaScript, but it seems like all that's needed is

--- node-yarnpkg-1.22.4.orig/src/util/fs.js
+++ node-yarnpkg-1.22.4/src/util/fs.js
@@ -37,7 +37,7 @@ export const readdir: (path: string, opt
 export const rename: (oldPath: string, newPath: string) => Promise<void> = promisify(fs.rename);
 export const access: (path: string, mode?: number) => Promise<void> = promisify(fs.access);
 export const stat: (path: string) => Promise<fs.Stats> = promisify(fs.stat);
-export const mkdirp: (path: string) => Promise<void> = promisify(require('mkdirp'));
+export const mkdirp: (path: string) => Promise<void> = require('mkdirp');
 export const exists: (path: string) => Promise<boolean> = promisify(fs.exists, true);
 export const lstat: (path: string) => Promise<fs.Stats> = promisify(fs.lstat);
 export const chmod: (path: string, mode: number | string) => Promise<void> = promisify(fs.chmod);

@guimard
Copy link

guimard commented Nov 8, 2020

@anomiex: sure, my patch was a generic one

@merceyz
Copy link
Member

merceyz commented Jan 2, 2021

Closing as the lockfile in this repo prevents mkdirp from getting upgraded so this shouldn't be a problem

@merceyz merceyz closed this as completed Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants