nps icon indicating copy to clipboard operation
nps copied to clipboard

point `default` to named script

Open pvinis opened this issue 4 years ago • 3 comments

This is not really a problem, more of a question.

Can I have something like

module.exports = {
  build: 'yarn some-build-cmd',
  dev: 'yarn some-other-cmd',
  default: // <-- here goes a way to point to `dev`
}

Basically I would like to have a named script, and to point to it as the default.

This would mostly be useful in cases like

{
  ios: {
    alpha: {
      x: 'bla alpha',
      nonX: 'blu alpha',
    },
    beta: {
      x: 'bla beta',
      nonX: 'blu beta',
    },
  },
  default: // some way to point to ios.alpha.nonX
}

pvinis avatar Oct 23 '19 10:10 pvinis

I don't see any problems with this request. Looks good to me.

sezna avatar Nov 02 '19 20:11 sezna

Perhaps I'm missing something, but couldn't this be achieved by directly calling the desired script from default?

e.g.

module.exports = {
  build: 'yarn some-build-cmd',
  dev: 'yarn some-other-cmd',
  default: 'nps build'
}

This will result in nps logging two separate script executions to the console, but I can't imagine that an additional configuration would be more succinct.

I suppose that this wouldn't work very well in a case where you wanted to pass dynamic arguments from the command line to the 2nd named script.

evdhiggins avatar Dec 19 '19 19:12 evdhiggins

🤔 I guess that makes sense, but it would be nice to have support for args. hmm

pvinis avatar Dec 20 '19 13:12 pvinis