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

feat: don’t sort scripts when npm-run-all2 is installed #309

Merged
merged 1 commit into from
Jan 29, 2024
Merged

feat: don’t sort scripts when npm-run-all2 is installed #309

merged 1 commit into from
Jan 29, 2024

Conversation

kachkaev
Copy link
Contributor

@kachkaev kachkaev commented Jan 29, 2024

Closes #308. Context: #232

Copy link
Owner

@keithamus keithamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

@keithamus keithamus merged commit 542d8ba into keithamus:main Jan 29, 2024
4 checks passed
Copy link

🎉 This PR is included in version 2.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bcomnes
Copy link

bcomnes commented Jan 29, 2024

You can also add numerics to your script names to force a specific sort order while retaining the ability to alphanumeric sort. IMO this is preferable than adding tool specific behaviors.

@kachkaev kachkaev deleted the npm-run-all2 branch January 29, 2024 16:36
@viceice
Copy link

viceice commented Jan 29, 2024

You can also add numerics to your script names to force a specific sort order while retaining the ability to alphanumeric sort. IMO this is preferable than adding tool specific behaviors.

doesn't work for postinstall. I would expect to have scripts sorted alphanumeric, but postinstall was sorted before lint. 🤔

@benquarmby
Copy link

If I wanted to control the order of execution with a tool like npm-run-all2, why the flerking shnit wouldn't I be explicit about it?:

{
-    "do": "run-s do:*"
+    "do": "run-s do:clean do:build do:translate do:version do:publish"
}

Relying on a magic * and the arbitrary order of scripts is fragile.

Excuse the rant, but I'm frustrated that I can no longer use npm-run-all2 as an escape hatch from this silly "skip sorting scripts when npm-run-all is installed" behavior. Scripts should always be sorted! This behavior is promoting bad practice.

@bcomnes
Copy link

bcomnes commented Mar 5, 2024

I generally agree that disabling behavior automatically as a side effect of other tools being detected is an odd design choice. If order of execution matters in your npm-run-all scripts, you should add numerics to your scripts to guarantee order, even when external tools run stylistic sorts on them. This approach lets you keep your top level script short, but still define explicit order. If no such sorting is ever going to occur, you don't need to do this.

{
"do": "run-s do:*"
"do:01-clean": "clean"
"do:02-build": "build"
"do:03-translate": "translate"
"do:04-version": "version"
"do:05-publish": "publish"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sorting scripts fails when switching from npm-run-all to npm-run-all2
5 participants