CLI ?
Semigradsky opened this issue · 4 comments
Semigradsky commented
Running using npm script would be very convenient
tolemac commented
It will be nice to have.
tolemac commented
I'm not sure how to implement it ...
I can think of two ways:
- To add code to
index.ts
inspectprocess.argv
searching parameters ... - To add new module, ie:
cli.ts
that import and usebundle
function fromindex.ts
...
@basarat can you tell me about?
I not sure how to determine if a module is running directly with nodejs or included from other ...
basarat commented
I not sure how to determine if a module is running directly with nodejs or included from other
With examples :
Developer (you)
- To allow running as a node script a module provides
bin
in package.json : https://github.com/alm-tools/alm/blob/master/package.json#L7 pointing to a js file which can then safely assume that it is being run as an executable. - Ideally the script should have shebang :
#! /usr/bin/env node
https://github.com/alm-tools/alm/blob/master/bin/alm
User
- To use such a file they can either do
npm install -g alm
. This gives them the executables from thepackage.json bin
on the user system command line - They can install it as a dev dependency and use
scripts
option in package.json to drive it e.g. :
"scripts": {
"build": "alm -p ./src"
},
🌹
tolemac commented
Done.