Skip to content

Commit c7c5fab

Browse files
committed
📝
1 parent fde8aea commit c7c5fab

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@ This is done by using [shelljs/shelljs](https://github.com/shelljs/shelljs) libr
66
You can compare the final script code to `zx` example:
77
```javascript
88
#!/usr/bin/env nodejsscript
9-
import { exec, grep, echo, mkdir, tempdir } from "nodejsscript";
10-
9+
import { exec, exec$, grep, echo } from "nodejsscript";
1110
echo(grep("name", "../package.json").trim());
1211

13-
const branch= exec("git branch --show-current").trim();
12+
const branch= exec$("git branch --show-current");
1413
exec(`dep deploy --branch=${branch}`);
1514

1615
exec("sleep 1; echo 1");
1716
exec("sleep 2; echo 2");
1817
exec("sleep 3; echo 3");
1918

19+
import { mkdir, tempdir } from "nodejsscript";
20+
import { join } from "node:path";
2021
const name= "foo bar";
21-
mkdir(tempdir()+"/"+name);
22+
mkdir(join(tempdir(), name));
2223
```
2324

2425
## Installation

test/run.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* jshint esversion: 8,-W097, -W040, node: true, expr: true, undef: true */
33
import * as s from "/home/jaandrle/.nvm/versions/node/v17.0.1/lib/node_modules/nodejsscript/index.js";
44
// from "nodejsscript";
5+
import { join } from "node:path";
56

67
s.cli("", true)
78
.version("0.1.0")
@@ -16,7 +17,7 @@ s.cli("", true)
1617
s.exec("sleep 2; echo 2");
1718
s.exec("sleep 3; echo 3");
1819

19-
const name= s.tempdir()+"/foo bar";
20+
const name= join(s.tempdir(), "foo bar");
2021
s.pipe(s.mkdir, s.echo)(name);
2122
s.echo(s.test("-d", name));
2223
if(clear)

0 commit comments

Comments
 (0)