@evopos/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/LICENSE +21 -0
- package/README.md +76 -2
- package/dist/bin.js +8 -0
- package/dist/bin.js.map +1 -0
- package/dist/chunk-ZQ6F743F.js +1196 -0
- package/dist/chunk-ZQ6F743F.js.map +1 -0
- package/dist/index.d.ts +342 -0
- package/dist/index.js +83 -0
- package/dist/index.js.map +1 -0
- package/package.json +37 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EvoPOS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,77 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @evopos/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Command-line tool for EvoPOS plugin developers: sign in, validate, pack, deploy to your sandbox and submit for review.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install -g @evopos/cli # or: npx @evopos/cli <command>
|
|
7
|
+
evopos login
|
|
8
|
+
cd my-plugin
|
|
9
|
+
evopos deploy --submit
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Node.js 20 or newer. No runtime dependencies besides `@evopos/contracts`.
|
|
13
|
+
|
|
14
|
+
## Commands
|
|
15
|
+
|
|
16
|
+
| Command | What it does |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `evopos login [--no-browser] [--with-token \| --token <t>]` | Device-code sign-in: prints a code, opens the browser, waits for approval and saves the token |
|
|
19
|
+
| `evopos logout` | Revokes the token on the server and removes it from this machine |
|
|
20
|
+
| `evopos whoami` | Account, token (name, expiry), sandbox slug and kassa URL, API address |
|
|
21
|
+
| `evopos validate [dir]` | Checks `manifest.json` against the contract and that every referenced file exists |
|
|
22
|
+
| `evopos pack [dir] [--out <file>]` | Builds a reproducible `.zip` (default `.evopos/<id>-<version>.zip`) |
|
|
23
|
+
| `evopos deploy [dir] [--submit] [--no-build]` | `npm run build` (if `package.json` has it), pack, upload a draft to the sandbox, optionally submit |
|
|
24
|
+
| `evopos submit [dir] [--id <id>] [--version <v>]` | Sends a draft version for review (id and version default to the manifest) |
|
|
25
|
+
| `evopos open [--print]` | Opens the sandbox kassa in the browser, or only prints the URL |
|
|
26
|
+
|
|
27
|
+
`dir` defaults to the current directory. If `dir/dist/manifest.json` exists, `dist/` is the package root; otherwise `dir/manifest.json` is used and the files of `dir` are packed (without `node_modules`, `package.json`, `README.md`, `dist`, and names starting with `.`).
|
|
28
|
+
|
|
29
|
+
Common flags: `--api <url>`, `--json`, `-h`/`--help`, `-v`/`--version`.
|
|
30
|
+
|
|
31
|
+
## Environment
|
|
32
|
+
|
|
33
|
+
| Variable | Meaning |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `EVOPOS_TOKEN` | CLI token (`evo_cli_...`). Takes priority over the saved login; use it in CI |
|
|
36
|
+
| `EVOPOS_API_BASE` | API address. Order: `--api`, this variable, `https://developers.evopos.az` |
|
|
37
|
+
| `EVOPOS_CONFIG_DIR` | Where `credentials.json` lives |
|
|
38
|
+
| `NO_COLOR` | Disables colour (colour is also off when output is not a terminal) |
|
|
39
|
+
|
|
40
|
+
The API address must be `https`. Plain `http` is accepted only for `localhost`, `127.0.0.1`, `[::1]`, `*.localhost` and `*.test`.
|
|
41
|
+
|
|
42
|
+
## Where the token is stored
|
|
43
|
+
|
|
44
|
+
`credentials.json` in `$EVOPOS_CONFIG_DIR`, else `%APPDATA%\evopos` (Windows), else `$XDG_CONFIG_HOME/evopos`, else `~/.config/evopos`. The folder is `0700`, the file `0600`; the CLI warns if the file is readable by others. Tokens are kept per API address. The token is never printed, not even with `--json`.
|
|
45
|
+
|
|
46
|
+
In CI prefer `EVOPOS_TOKEN` or `evopos login --with-token < token-file`. `--token <t>` works but stays in shell history.
|
|
47
|
+
|
|
48
|
+
## Scripting
|
|
49
|
+
|
|
50
|
+
With `--json` stdout is exactly one JSON object; progress and warnings go to stderr. On failure the object is `{"error": "<code>", "message": "...", "errors": [...]}` (`errors` only when there are details).
|
|
51
|
+
|
|
52
|
+
Exit codes: `0` success, `1` error (network, server, invalid package, not logged in), `2` wrong usage (unknown command or flag, bad API address).
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
evopos deploy --submit --json | jq -r '.status'
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Programmatic API
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { packPlugin, validateManifestFile, EvoposClient, resolveApiBase } from '@evopos/cli';
|
|
62
|
+
|
|
63
|
+
const { file, sha256, manifest } = packPlugin({ dir: './my-plugin' });
|
|
64
|
+
const { base } = resolveApiBase(undefined, process.env);
|
|
65
|
+
const client = new EvoposClient({ base, token: process.env.EVOPOS_TOKEN });
|
|
66
|
+
await client.uploadPackage(await readFile(file));
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`packPlugin({ dir, out?, extraFiles? })` returns `{ file, bytes, files, sha256, manifest }`. The same archive is produced for the same input (fixed entry order and timestamps).
|
|
70
|
+
|
|
71
|
+
## Development
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
npm run typecheck -w packages/cli
|
|
75
|
+
npm test -w packages/cli
|
|
76
|
+
npm run build -w packages/cli
|
|
77
|
+
```
|
package/dist/bin.js
ADDED
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { main } from './cli/main';\n\nprocess.exitCode = await main(process.argv.slice(2));\n"],"mappings":";;;;;;AAGA,QAAQ,WAAW,MAAM,KAAK,QAAQ,KAAK,MAAM,CAAC,CAAC;","names":[]}
|