@ocpplab/cli 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/bin/ocpplab-cli.js +25 -0
- package/package.json +21 -4
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ocpplab/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Command-line client for the OCPPLab API: one command per API operation.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm i -g @ocpplab/cli
|
|
7
|
+
ocpplab-cli auth login # sign in with your browser and pick an organization
|
|
8
|
+
ocpplab-cli --help
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
In CI or scripts, set `OCPPLAB_TOKEN` to an SDK token instead of signing in.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Entry point of the @ocpplab/cli npm package: runs the ocpplab-cli binary from
|
|
3
|
+
// the platform package npm installed for this machine (an optionalDependency).
|
|
4
|
+
const { spawnSync } = require("node:child_process");
|
|
5
|
+
|
|
6
|
+
const pkg = `@ocpplab/cli-${process.platform}-${process.arch}`;
|
|
7
|
+
const exe = process.platform === "win32" ? "ocpplab-cli.exe" : "ocpplab-cli";
|
|
8
|
+
|
|
9
|
+
let binary;
|
|
10
|
+
try {
|
|
11
|
+
binary = require.resolve(`${pkg}/bin/${exe}`);
|
|
12
|
+
} catch {
|
|
13
|
+
console.error(
|
|
14
|
+
`ocpplab-cli: no prebuilt binary for ${process.platform}-${process.arch} ` +
|
|
15
|
+
`(${pkg} is not installed). Reinstall without --omit=optional, or build from source.`,
|
|
16
|
+
);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
21
|
+
if (result.error) {
|
|
22
|
+
console.error(`ocpplab-cli: ${result.error.message}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
process.exit(result.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocpplab/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"homepage": "https://ocpplab.io",
|
|
6
|
+
"description": "Command-line client for the OCPPLab API",
|
|
7
|
+
"bin": {
|
|
8
|
+
"ocpplab-cli": "bin/ocpplab-cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin"
|
|
12
|
+
],
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=18"
|
|
15
|
+
},
|
|
16
|
+
"optionalDependencies": {
|
|
17
|
+
"@ocpplab/cli-darwin-arm64": "0.1.0",
|
|
18
|
+
"@ocpplab/cli-darwin-x64": "0.1.0",
|
|
19
|
+
"@ocpplab/cli-linux-x64": "0.1.0",
|
|
20
|
+
"@ocpplab/cli-linux-arm64": "0.1.0",
|
|
21
|
+
"@ocpplab/cli-win32-x64": "0.1.0"
|
|
22
|
+
}
|
|
23
|
+
}
|