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

How to run scripts like "next dev" (Next.js)? #226

Open
jasonkylefrank opened this issue Feb 28, 2022 · 2 comments
Open

How to run scripts like "next dev" (Next.js)? #226

jasonkylefrank opened this issue Feb 28, 2022 · 2 comments

Comments

@jasonkylefrank
Copy link

Hello!

I'm trying to use this library to run multiple commands in parallel. One of the npm scripts that my package.json currently has is like:

"dev": "next dev"

...where next refers to Next.js and their build scripts. "next" is not an npm script listed in my package.json but it works fine somehow (it gets set up after you start your project via npx create-next-app).

I want to turn the dev npm script into:

"dev": "npm-run-all --parallel firebase-emulate  'next dev'"

...where firebase-emulate refers to another one of my npm scripts and next dev would run Next.js's build scripts as it does when that part is it's own "value" of one of the npm scripts, as shown in the earlier snippet.

As I have it written, this does not work.

Is there a way to use this library to run the dev command that I want without having to make the next dev an explicit npm script? I would rather not have to make the built-in Next.js build scripts their own npm scripts since it would litter-up my npm scripts with dedicated scripts that we would not actually run on an individual basis.

@ulisses-cruz
Copy link

ulisses-cruz commented Mar 11, 2022

I think a way you can make this work, is by doing something like this:

{
    "scripts": {
        "dev": "run-p dev:*",
        "dev:firebase": "firebase-emulate",
        "dev:next": "next dev"
    }
}

now when you use npm run dev it should work.

@jasonkylefrank
Copy link
Author

@ulisses-cruz Yes, as I mentioned that would work but the point of my question is to find out if there is a way to do it without having to make an explicit npm script for each such script. 😀

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

2 participants