Skip to content

Commit 39877a7

Browse files
committed
feat(cli): rename cli commad from wot-servient to node-wot
1 parent c5a7a51 commit 39877a7

File tree

9 files changed

+33
-33
lines changed

9 files changed

+33
-33
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ STOPSIGNAL SIGINT
3535
ENTRYPOINT [ "node", "dist/cli.js" ]
3636
CMD [ "-h" ]
3737

38-
## docker build -t wot-servient ./docker/Dockerfile
38+
## docker build -t node-wot ./docker/Dockerfile

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,16 @@ Go into the repository:
119119
cd node-wot
120120
```
121121

122-
Build the Docker image named `wot-servient` from the `Dockerfile`:
122+
Build the Docker image named `node-wot` from the `Dockerfile`:
123123

124124
```
125125
npm run build:docker
126126
```
127127

128-
Run the wot-servient as a container:
128+
Run the `node-wot` as a container:
129129

130130
```
131-
docker run --rm wot-servient -h
131+
docker run --rm node-wot -h
132132
```
133133

134134
## Examples
@@ -231,12 +231,12 @@ Can't find your preferred MediaType? More codecs can be easily added by implemen
231231
Run all the steps above including "Link Packages" and then run this:
232232

233233
```
234-
wot-servient -h
234+
node-wot -h
235235
cd examples/scripts
236-
wot-servient
236+
node-wot
237237
```
238238

239-
Without the "Link Packages" step, the `wot-servient` command is not available and `node` needs to be used (e.g., Windows CMD shell):
239+
Without the "Link Packages" step, the `node-wot` command is not available and `node` needs to be used (e.g., Windows CMD shell):
240240

241241
```
242242
# expose
@@ -256,9 +256,9 @@ First [build the docker image](#as-a-docker-image) and then run the counter exam
256256

257257
```
258258
# expose
259-
docker run -it --init -p 8080:8080/tcp -p 5683:5683/udp -v "$(pwd)"/examples:/srv/examples --rm wot-servient /srv/examples/scripts/counter.js
259+
docker run -it --init -p 8080:8080/tcp -p 5683:5683/udp -v "$(pwd)"/examples:/srv/examples --rm node-wot /srv/examples/scripts/counter.js
260260
# consume
261-
docker run -it --init -v "$(pwd)"/examples:/srv/examples --rm --net=host wot-servient /srv/examples/scripts/counter-client.js --client-only
261+
docker run -it --init -v "$(pwd)"/examples:/srv/examples --rm --net=host node-wot /srv/examples/scripts/counter-client.js --client-only
262262
```
263263

264264
- The counter exposes the HTTP endpoint at 8080/tcp and the CoAP endpoint at 5683/udp and they are bound to the host machine (with `-p 8080:8080/tcp -p 5683:5683/udp`).

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"prepare": "husky install",
3232
"publish": "npm publish --workspaces",
3333
"check:versions": "node utils/check_package_version_consistency.js",
34-
"build:docker": "docker build -t wot-servient .",
35-
"build:podman": "podman build -t wot-servient .",
34+
"build:docker": "docker build -t node-wot .",
35+
"build:podman": "podman build -t node-wot .",
3636
"clean:dist": "npm exec --workspaces -- npx rimraf tsconfig.tsbuildinfo dist",
3737
"update:wot-typescript-definitions": "npx npm-check-updates -u -f \"wot-typescript-definitions\" --deep",
3838
"link": "npm link -ws",

packages/binding-mqtt/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ Please setup node-wot as described at the [node-wot main page](https://github.co
200200

201201
```
202202

203-
Start the script by the command `wot-servient mqtt-publish.js` or `node ../../packages/cli/dist/cli.js mqtt-publish.js`.
203+
Start the script by the command `node-wot mqtt-publish.js` or `node ../../packages/cli/dist/cli.js mqtt-publish.js`.
204204

205205
- example-mqtt-subscription.js: Shows how node-wot consumes a Thing Description to do MQTT subscription on the provided event (=latest counter value) as well as initiate the action (reset counter).
206206

207-
Start the script by the command `wot-servient -c mqtt-subscribe.js` or `node ../../packages/cli/dist/cli.js -c mqtt-subscribe.js`.
207+
Start the script by the command `node-wotù -c mqtt-subscribe.js` or `node ../../packages/cli/dist/cli.js -c mqtt-subscribe.js`.
208208

209209
### More Details
210210

packages/cli/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,36 +27,36 @@ If you do so, anyway, you can specify the entry point as follows:
2727

2828
```JavaScript
2929
"scripts":{
30-
"start": "wot-servient main.js"
30+
"start": "node-wot main.js"
3131
}
3232
```
3333

3434
There are several ways to start the application:
3535

3636
a. Execute `npm start`.
37-
b. Execute `./node_modules/.bin/wot-servient main.js`.
37+
b. Execute `./node_modules/.bin/node-wot main.js`.
3838
c. Execute `node ./node_modules/@node-wot/cli/dist/cli.js main.js`.
3939
d. If you have installed `@node-wot/cli` globally you can even start the application right
40-
away using this command `wot-servient main.js`. However, in the current implementation, the
40+
away using this command `node-wot main.js`. However, in the current implementation, the
4141
import of local dependencies is not supported in this case.
4242

43-
wot-servient can execute multiple files at once, for example as follows:
43+
node-wot can execute multiple files at once, for example as follows:
4444

4545
```
46-
wot-servient script1.js ./src/script2.js
46+
node-wot script1.js ./src/script2.js
4747
```
4848

4949
### Configuration
5050

5151
The `-h` option explains the functionality and also how node-wot can be configured based on `wot-servient.conf.json`.
5252

53-
- `wot-servient -h` _or_
54-
- `node packages\cli\dist\cli.js`
53+
- `node-wot -h` _or_
54+
- `node packages\cli\dist\cli.js -h`
5555

5656
The `-h` help option shows the following output:
5757

5858
```
59-
Usage: wot-servient [options] [command] [files...]
59+
Usage: node-wot [options] [command] [files...]
6060
6161
6262
Run a WoT Servient in the current directory.
@@ -86,7 +86,7 @@ Settings can be applied through three methods, in order of precedence (highest t
8686
8787
For the complete list of available configuration fields and their data types, run:
8888
89-
wot-servient schema
89+
node-wot schema
9090
9191
In your configuration files you can the following to enable IDE config validation:
9292
@@ -113,7 +113,7 @@ ADDRESS=http://hello.com
113113

114114
To debug, use the option `--inspect` or `--inspect-brk` if you want to hang until your debug client is connected. Then start [Chrome Dev Tools](chrome://inspect) or [vscode debugger](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_attaching-to-nodejs) or your preferred v8 inspector to debug your code.
115115

116-
For further details check: `wot-servient --help`
116+
For further details check: `node-wot --help`
117117

118118
### Examples
119119

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"main": "bin/index.js",
1515
"types": "dist/cli.d.ts",
1616
"bin": {
17-
"wot-servient": "bin/index.js"
17+
"node-wot": "bin/index.js"
1818
},
1919
"optionalDependencies": {
2020
"ts-node": "10.9.1"

packages/cli/src/cli.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const baseDir = ".";
4141

4242
// General commands
4343
program
44-
.name("wot-servient")
44+
.name("node-wot")
4545
.description(
4646
`
4747
Run a WoT Servient in the current directory.
@@ -64,7 +64,7 @@ Settings can be applied through three methods, in order of precedence (highest t
6464
6565
For the complete list of available configuration fields and their data types, run:
6666
67-
wot-servient schema
67+
node-wot schema
6868
6969
In your configuration files you can the following to enable IDE config validation:
7070
@@ -136,11 +136,11 @@ program.action(async function (_, options, cmd) {
136136
servient = new DefaultServient(config);
137137
} catch (err) {
138138
if ((err as NodeJS.ErrnoException)?.code !== "ENOENT" || options.configFile != null) {
139-
error("WoT-Servient configuration file error:\n%O\nClose.", err);
139+
error("node-wot configuration file error:\n%O\nClose.", err);
140140
process.exit((err as NodeJS.ErrnoException).errno ?? 1);
141141
}
142142

143-
warn(`WoT-Servient using defaults as %s does not exist`, defaultFile);
143+
warn(`node-wot using defaults as %s does not exist`, defaultFile);
144144

145145
const config = await buildConfig(options, cloneDeep(defaultConfiguration), env, schemaValidator);
146146
config.servient.clientOnly = options.clientOnly ?? config.servient.clientOnly;
@@ -157,7 +157,7 @@ program.action(async function (_, options, cmd) {
157157
const files = await readdir(baseDir);
158158
const scripts = files.filter((file) => !file.startsWith(".") && file.slice(-3) === ".js");
159159

160-
info(`WoT-Servient using current directory with %d script${scripts.length > 1 ? "s" : ""}`, scripts.length);
160+
info(`node-wot using current directory with %d script${scripts.length > 1 ? "s" : ""}`, scripts.length);
161161

162162
return runScripts({ runtime, helpers }, scripts, options.inspect ?? options.inspectBrk);
163163
});

packages/cli/src/script-runner.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ export async function runScripts(context: WoTContext, scripts: string[], debug?:
2929
const executor = new Executor();
3030
const launchScripts = (scripts: Array<string>) => {
3131
scripts.forEach(async (fname: string) => {
32-
info(`WoT-Servient reading script ${fname}`);
32+
info(`node-wot reading script ${fname}`);
3333
try {
3434
const data = await readFile(fname, "utf-8");
3535
// limit printout to first line
3636
info(
37-
`WoT-Servient running script '${data.substr(0, data.indexOf("\n")).replace("\r", "")}'... (${
37+
`node-wot running script '${data.substr(0, data.indexOf("\n")).replace("\r", "")}'... (${
3838
data.split(/\r\n|\r|\n/).length
3939
} lines)`
4040
);
4141

4242
fname = path.resolve(fname);
4343
await executor.exec(fname, context);
4444
} catch (err) {
45-
error(`WoT-Servient experienced error while reading script. %O`, err);
45+
error(`node-wot experienced error while reading script. %O`, err);
4646
}
4747
});
4848
};

0 commit comments

Comments
 (0)