11# NodeJS Script – write cross-platform scripts with ease
22This package provides very similar functionality such as [ google/zx] ( https://github.com/google/zx ) .
3- Tke key difference is to provide unix shell commands in cross-platform commpatible way.
3+ The key difference is to provide unix shell commands in cross-platform compatible way.
44This is done by using [ shelljs/shelljs] ( https://github.com/shelljs/shelljs ) library.
55
66You can compare the final script code to ` zx ` example:
@@ -21,30 +21,23 @@ const name= "foo bar";
2121mkdir (tempdir ()+ " /" + name);
2222```
2323
24- ## Instalation
24+ ## Installation
2525** For now experiment!!!**
2626
27- 1 . you need nodejs >=v17.0.1 ⇒ folows [ nvm-sh/nvm: Node Version Manager] ( https://github.com/nvm-sh/nvm ) [ ^ node ]
27+ 1 . you need nodejs >=v17.0.1 ⇒ follow [ nvm-sh/nvm: Node Version Manager] ( https://github.com/nvm-sh/nvm ) [ ^ node ]
28281 . ` npm install https://github.com/jaandrle/nodejsscript --global `
2929
3030## Goods
31- · [ shelljs/shelljs: ] ( https://github.com/shelljs/shelljs )
31+ [ shelljs/shelljs] ( https://github.com/shelljs/shelljs ) :
3232[ cat] ( https://github.com/shelljs/shelljs#catoptions-file--file- ) · [ cd] ( https://github.com/shelljs/shelljs#cddir ) · [ chmod] ( https://github.com/shelljs/shelljs#chmodoptions-octal_mode--octal_string-file ) · [ cp] ( https://github.com/shelljs/shelljs#cpoptions-source--source--dest )
3333 · [ pushd] ( https://github.com/shelljs/shelljs#pushdoptions-dir---n--n ) · [ popd] ( https://github.com/shelljs/shelljs#popdoptions--n--n ) · [ dirs] ( https://github.com/shelljs/shelljs#dirsoptions--n---n ) · [ exec] ( https://github.com/shelljs/shelljs#execcommand--options--callback )
3434 · [ find] ( https://github.com/shelljs/shelljs#findpath--path- ) · [ grep] ( https://github.com/shelljs/shelljs#grepoptions-regex_filter-file--file- ) · [ head] ( https://github.com/shelljs/shelljs#head-n-num-file--file- ) · [ ln] ( https://github.com/shelljs/shelljs#lnoptions-source-dest )
3535 · [ ls] ( https://github.com/shelljs/shelljs#lsoptions-path- ) · [ mkdir] ( https://github.com/shelljs/shelljs#mkdiroptions-dir--dir- ) · [ mv] ( https://github.com/shelljs/shelljs#mvoptions--source--source--dest ) · [ pwd] ( https://github.com/shelljs/shelljs#pwd )
3636 · [ rm] ( https://github.com/shelljs/shelljs#rmoptions-file--file- ) · [ sed] ( https://github.com/shelljs/shelljs#sedoptions-search_regex-replacement-file--file- ) · [ set] ( https://github.com/shelljs/shelljs#setoptions ) · [ sort] ( https://github.com/shelljs/shelljs#sortoptions-file--file- )
3737 · [ tail] ( https://github.com/shelljs/shelljs#tail-n-num-file--file- ) · [ tempdir] ( https://github.com/shelljs/shelljs#tempdir ) · [ test] ( https://github.com/shelljs/shelljs#testexpression ) · [ touch] ( https://github.com/shelljs/shelljs#touchoptions-file--file- )
3838 · [ uniq] ( https://github.com/shelljs/shelljs#uniqoptions-input-output ) · [ which] ( https://github.com/shelljs/shelljs#whichcommand ) · [ exit] ( https://github.com/shelljs/shelljs#exitcode ) · [ error] ( https://github.com/shelljs/shelljs#error ) · [ errorCode] ( https://github.com/shelljs/shelljs#errorcode )
39- · [ cli()] ( #cli )
40- · [ xarg()] ( #xarg )
41- · [ pipe()] ( #pipe )
42- · [ fetch()] ( #fetch )
43- · [ question()] ( #question )
44- · [ echo()] ( #echo )
45- · [ exec$()] ( #exec$ )
46- · [ stdin()] ( #stdin )
47- · [ chalk] ( #chalk-package )
39+ | another libs: [ cli()] ( #cli ) · [ chalk] ( #chalk-package ) · [ fetch()] ( #fetch )
40+ | this lib: [ xarg()] ( #xarg ) · [ pipe()] ( #pipe ) · [ question()] ( #question ) · [ echo()] ( #echo ) · [ exec$()] ( #exec$ ) · [ stdin()] ( #stdin )
4841
4942
5043## Documentation
@@ -107,6 +100,8 @@ pipe(
107100### ` cli() `
108101A wrapper around the [ lukeed/sade: Smooth (CLI) Operator 🎶] ( https://github.com/lukeed/sade ) package.
109102In addition to the origin, ` cli() ` supports to fill script name from script file name.
103+ This should be good balance between [ commander - npm] ( https://www.npmjs.com/package/commander ) and parsing arguments and writing help texts by hand.
104+ For more complex scripts just create full npm package.
110105
111106``` js
112107cli (" " , true )
@@ -139,7 +134,7 @@ echo('Current branch is', branch);
139134```
140135
141136### ` echo() `
142- A ` console.log() ` alternative optimalized for scripting.
137+ A ` console.log() ` alternative optimized for scripting.
143138
144139``` js
145140const branch = exec$ (" git branch --show-current" );
0 commit comments