Skip to content

-o dist/my-parser.js errors if dist/ doesn't exist #440

@jcbhmr

Description

@jcbhmr

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch peggy@3.0.2 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/peggy/bin/peggy-cli.js b/node_modules/peggy/bin/peggy-cli.js
index b3130a0..0107699 100644
--- a/node_modules/peggy/bin/peggy-cli.js
+++ b/node_modules/peggy/bin/peggy-cli.js
@@ -439,6 +439,7 @@ class PeggyCLI extends Command {
       return Promise.resolve(hasTest ? this.std.out : null);
     }
     return new Promise((resolve, reject) => {
+      fs.mkdirSync(path.dirname(this.outputFile), { recursive: true });
       const outputStream = fs.createWriteStream(this.outputFile);
       outputStream.on("error", reject);
       outputStream.on("open", () => resolve(outputStream));

This issue body was partially generated by patch-package.

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