NPM publish prepare
This commit is contained in:
parent
913d9468f0
commit
3e5c1528a2
|
@ -9,21 +9,6 @@ pids
|
|||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
|
||||
node_modules
|
||||
|
|
23
README.md
23
README.md
|
@ -1,17 +1,17 @@
|
|||
# esm-cli
|
||||
|
||||
EcmaScript Module launcher
|
||||
ECMAScript modules launcher in Node 6+
|
||||
|
||||
Lunch ES modules using cli, accessing a specific export function or data, passing parameters.
|
||||
Lunch ES modules using command line interpreter, accessing a specific export function or data, and passing parameters.
|
||||
|
||||
## Install
|
||||
|
||||
Just install module as a global command with npm (not yet published)
|
||||
Just install module as a global command with npm
|
||||
`npm install -g esm-cli`
|
||||
|
||||
Until it published on npm you can install globaly after a git clone:
|
||||
Or you can install it globaly directly from a git clone:
|
||||
```
|
||||
git clone https://git.p2p.legal/dig/esm-cli.git
|
||||
git clone https://git.p2p.legal/dig/esm-cli
|
||||
cd esm-cli
|
||||
npm install -g .
|
||||
```
|
||||
|
@ -20,9 +20,16 @@ You should get acces to a global `esm` command.
|
|||
|
||||
## Usage
|
||||
|
||||
With esm-cli you can instanciate a full ES module file, executing it's content,
|
||||
and retreive an exported variable or execute an exported function.
|
||||
It understand returned promises or async functions.
|
||||
|
||||
`esm path/to/esm_file:export_name [params]`
|
||||
|
||||
With esm-cli you can instanciate a full ES module file, executing it's content, and retreive an exported variable or execute an exported function. It understand returned promises or async function.
|
||||
In this exemple, the file `./path/to/esm_file.js` is executed and the exported function is executed passing the [parsed params](#parameters-parsing):
|
||||
`await export_name( [params] )`
|
||||
|
||||
> Note: .js extension is not needed (nodejs resolver).
|
||||
|
||||
### Get exported variables
|
||||
|
||||
|
@ -41,7 +48,6 @@ And let's use it in cli:
|
|||
esm myModule
|
||||
> 42
|
||||
```
|
||||
Note: .js extension is not needed (nodejs resolver).
|
||||
|
||||
In a bash file you can invoke some text return using command subsitutions:
|
||||
```bash
|
||||
|
@ -49,7 +55,8 @@ In a bash file you can invoke some text return using command subsitutions:
|
|||
es_var=$(esm myModule)
|
||||
echo "EcmaScript said: $es_var"
|
||||
```
|
||||
If only a path to the file is provided, the default export is returned in any.
|
||||
If only a path to the file is provided, the default export is returned if any.
|
||||
|
||||
You can access any named exports:
|
||||
```bash
|
||||
esm myModule:user_config
|
||||
|
|
28
package.json
28
package.json
|
@ -1,7 +1,10 @@
|
|||
{
|
||||
"name": "esm-cli",
|
||||
"version": "1.0.0",
|
||||
"description": "EcmaScript Module launcher",
|
||||
"description": "ECMAScript modules launcher",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"main": "esm.js",
|
||||
"bin": {
|
||||
"esm": "./bin/esm-cli.js"
|
||||
|
@ -11,9 +14,30 @@
|
|||
"esm": "^3.2.18"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"bugs": {
|
||||
"url": "https://git.p2p.legal/dig/esm-cli/issues"
|
||||
},
|
||||
"homepage": "https://git.p2p.legal/dig/esm-cli",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://git.p2p.legal/dig/esm-cli.git"
|
||||
},
|
||||
"keywords": [
|
||||
"commonjs",
|
||||
"ecmascript",
|
||||
"export",
|
||||
"import",
|
||||
"modules",
|
||||
"node",
|
||||
"require",
|
||||
"commandline"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"author": {
|
||||
"name": "Thomas Di Grégorio",
|
||||
"email": "dig@p2p.legal"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue