File tree Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,10 @@ $ npm i vorpal-rc
1414
1515## Usage
1616``` javascript
17- var vorpal = require (' vorpal' )();
18- var rc = require (' vorpal-rc' );
17+ import Vorpal from ' vorpal' ;
18+ import rc from ' vorpal-rc' ;
19+
20+ const vorpal = new Vorpal ();
1921
2022// first declare your commands
2123vorpal
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ Object . defineProperty ( exports , "__esModule" , {
4+ value : true
5+ } ) ;
6+
7+ exports . default = function ( vorpal , rcfile ) {
8+ if ( typeof rcfile !== 'string' ) {
9+ throw new Error ( 'Missing .rc filename' ) ;
10+ }
11+
12+ try {
13+ ( 0 , _fs . readFileSync ) ( rcfile , 'utf-8' ) . split ( _os . EOL ) . filter ( function ( cmd ) {
14+ return ( 0 , _trim2 . default ) ( cmd ) . length ;
15+ } ) . forEach ( function ( cmd ) {
16+ return vorpal . exec ( cmd ) ;
17+ } ) ;
18+ } catch ( err ) {
19+ console . warn ( err . message ) ;
20+ }
21+ } ;
22+
23+ var _fs = require ( 'fs' ) ;
24+
25+ var _os = require ( 'os' ) ;
26+
27+ var _trim = require ( 'trim' ) ;
28+
29+ var _trim2 = _interopRequireDefault ( _trim ) ;
30+
31+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
Original file line number Diff line number Diff line change 33 "description" : " .rc file support for Vorpal.js" ,
44 "main" : " ./dist/rc.js" ,
55 "scripts" : {
6- "prebuild" : " rm -rf dist" ,
6+ "prebuild" : " rimraf dist" ,
77 "build" : " babel src -d dist" ,
88 "example" : " babel-node examples/shell.js" ,
99 "check-coverage" : " istanbul check-coverage --statements 100 --functions 100 --lines 100" ,
2626 "bugs" : {
2727 "url" : " https://github.com/subk/vorpal-rc/issues"
2828 },
29+ "files" : [
30+ " dist" ,
31+ " README.md"
32+ ],
2933 "homepage" : " https://github.com/subk/vorpal-rc#readme" ,
3034 "devDependencies" : {
3135 "babel-cli" : " ^6.6.5" ,
3640 "cz-conventional-changelog" : " ^1.1.5" ,
3741 "istanbul" : " ^1.0.0-alpha.2" ,
3842 "mocha" : " ^2.4.5" ,
43+ "rimraf" : " ^2.5.2" ,
3944 "semantic-release" : " ^4.3.5" ,
4045 "test-console" : " ^1.0.0" ,
4146 "vorpal" : " ^1.10.10"
You can’t perform that action at this time.
0 commit comments