Esy: Running package.json scripts with esy

Created on 18 Jan 2018  路  7Comments  路  Source: esy/esy

I would expect esy test to run a command in package.json, either in scripts or in the esy section.
As is, I have to run npm test, which feels super weird

discussion enhancement good first issue help wanted

Most helpful comment

I'm renaming this issue into "Running package.json scripts with esy". After discussion at ReasonConf it is became clear that there are strong reasons for this to exist:

  • Familiar UI for people who already know npm scripts
  • Need for a cross platform task runner

All 7 comments

Curious what's in your npm test command. You can run esy build anyCommand to run any command in your build environment (good for running unit tests). Right now, that means you can make a script ./test so that I can run esy build ./test. Maybe in the future, test would make its way into blessed command list.

We discussed this a while ago and supporting scripts same way js does it turned out to be more challenging and prone to user errors. Since there is not just one environment, people would likely trip up over empty sandboxes.

I'm temporarily getting by on make test and my current setup for testing looks like

esy b refmterr jbuilder runtest --dev

Notice the b which is the equivalent of esy build %cmd% (i.e runs it in _build environment_).

I do think that we can learn something from Cargo though, and provide a few important predefined commands out of the box beyond build/install/init.

We don't need to make esy into a general purpose script runner because in general esy any-cmd will work to run arbitrary things like publishing/release scripts.

esy install         # Done
esy build           # Done
esy add             # Done
esy anyCmd --arg1   # Done
esy init            # Done (in master)
esy test
esy clean

The reason why I think that install/build/test/clean are somewhat "special" is that it means anyone who checks our your repo, immediately knows how to install deps, build the project, run tests, and clean - regardless of how they are implemented - and those are the select few important commands necessary to contribute to a project.

yeahh jumping out to a makefile is also something I want to avoid :D
and I don't want to have to type esy b refmterr jbuilder runtest --dev every time 馃槄

I'm renaming this issue into "Running package.json scripts with esy". After discussion at ReasonConf it is became clear that there are strong reasons for this to exist:

  • Familiar UI for people who already know npm scripts
  • Need for a cross platform task runner

cc @bsansouci

Thank you @rauanmayemir !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bryphe picture bryphe  路  6Comments

zartstrom picture zartstrom  路  3Comments

dejanr picture dejanr  路  6Comments

lessp picture lessp  路  7Comments

ManasJayanth picture ManasJayanth  路  5Comments