Giter Club home page Giter Club logo

Comments (12)

searls avatar searls commented on July 4, 2024

Scripty is already so close to being able to do this since it's just using async.series here.

The trick of implementing this would be:

  1. How should users flag it? A package.json-wide option would be too broad, a CLI arg would be problematic given the expectation they be forwarded in #5 and #6 -- maybe an ENV var? SCRIPTY_PARALLEL npm run test?
  2. Testing it well sounds like work.

from scripty.

texastoland avatar texastoland commented on July 4, 2024

How should users flag it?

I intentionally left it out of the description 😅

A package.json-wide option would be too broad

Agreed.

a CLI arg would be problematic

Makes sense.

maybe an ENV var

Too broad? I'd expect to only run specific aggregate tasks in parallel. The only idea I had was a naming convention like &test (& inspired by Bash to run all test:*).

from scripty.

searls avatar searls commented on July 4, 2024

Ahh, considering parent/aggregate tasks specifically, that is a good point. Maybe the answer is there.

I don't feel like an ENV var is too broad if it's defined inline (since it won't stick the shell session), but the idea of tweaking the naming convention is really clever. I'm going to play with that

from scripty.

searls avatar searls commented on July 4, 2024

Turns out that using & (as in npm run &test or npm run test&) blows up in mysterious ways.

Is there another character that might imply parallelism? What about npm run test+? That at least works?

from scripty.

texastoland avatar texastoland commented on July 4, 2024

I didn't consider that 😣 I'm weary because of lack of precedent for any other symbol I considered. What about something literate like test.parallel?

from scripty.

searls avatar searls commented on July 4, 2024

Eh at that point I'd be more comfortable with the env var. using an actual word means there's a chance someone might accidentally stumble upon it and get real confused.

from scripty.

searls avatar searls commented on July 4, 2024

Also how about a word other than parallel? It's hard for most people to spell

from scripty.

texastoland avatar texastoland commented on July 4, 2024

I'd be more comfortable with the env var

Should it also be propagated to subtasks e.g. NODE_ENV=production?

how about a word other than parallel

async?

What about npm run test+

Reviewing valid characters that does look best!

from scripty.

searls avatar searls commented on July 4, 2024

Yes, one reason I like the env var (assuming it's namespaced to scripty to avoid collision like SCRIPTY_GO_FAST=true npm run test) is because downstream scripts you write could alter their behavior when running in parallel to avoid any locking problems / race conditions, etc.

from scripty.

searls avatar searls commented on July 4, 2024

Another reason I like the env var is that users wouldn't need to edit or duplicate an entry in their package.json just to switch between parallel and not (which I often want to do, for instance, when watching, so that I can get more sane stdout across two tabs)

from scripty.

boneskull avatar boneskull commented on July 4, 2024

this may be the best option

from scripty.

searls avatar searls commented on July 4, 2024

Yeah, based on the documentation, you'd think a config key would be the best bet, but I'm having a really hard time successfully overriding package config entries. I think the nut of it is the npm config docs are mostly about modifying core npm settings at runtime, whereas that's easy to conflate with package config settings, which get none of the same benefits (either the env var normalization or the --prop_name args). I just spent 20 minutes fighting it and gave up.

Some notes:

If my package contains:

"scripts": {
    "scripty": {
      "parallel": false
    }
}

Then as you would hope, process.env.npm_package_config_scripty_parallel is set to 'false'. But once it's set in the package json, there's no apparent way to override it dynamically, making it just as blunt an instrument as always using an arbitrary ENV var.

That is to say: npm_package_config_scripty_parallel=true npm run foo will still set the variable to 'false', and NPM_PACKAGE_CONFIG_SCRIPTY_PARALLEL npm run foo will set the var in upper case, without the case-insensitive translation suggested by the docs.

from scripty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.