@zalify/cli 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 +21 -0
- package/bin/cli.js +36 -0
- package/package.json +23 -0
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @zalify/cli
|
|
2
|
+
|
|
3
|
+
Zalify CLI – command-line interface for Zalify.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i -g @zalify/cli@latest
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
zalify version # Print version and check for updates
|
|
15
|
+
zalify -v # Same as --version (built-in)
|
|
16
|
+
zalify --version # Output current version only
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Commands
|
|
20
|
+
|
|
21
|
+
- **version** – Prints `Zalify CLI version: x.x.x` and, if a newer version exists on npm, suggests running `npm i -g @zalify/cli@latest` to update.
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import updateNotifier from 'update-notifier';
|
|
5
|
+
import { createRequire } from 'node:module';
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const pkg = require('../package.json');
|
|
9
|
+
|
|
10
|
+
const program = new Command();
|
|
11
|
+
|
|
12
|
+
program
|
|
13
|
+
.name('zalify')
|
|
14
|
+
.description('Zalify CLI - command-line interface for Zalify')
|
|
15
|
+
.version(pkg.version, '-v, --version', 'output the current version');
|
|
16
|
+
|
|
17
|
+
program
|
|
18
|
+
.command('version')
|
|
19
|
+
.description('Print Zalify CLI version and check for updates')
|
|
20
|
+
.action(async () => {
|
|
21
|
+
console.log(`Zalify CLI version: ${pkg.version}`);
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const notifier = updateNotifier({ pkg });
|
|
25
|
+
const update = await notifier.fetchInfo();
|
|
26
|
+
if (update && update.type !== 'latest' && update.latest !== update.current) {
|
|
27
|
+
console.log(
|
|
28
|
+
`\nA new version (${update.latest}) is available. Run "npm i -g @zalify/cli@latest" to update.`
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
} catch {
|
|
32
|
+
// Package not published yet or registry unreachable – ignore
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
program.parse();
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zalify/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Zalify CLI - command-line interface for Zalify",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "bin/cli.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"zalify": "./bin/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=18"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"zalify",
|
|
15
|
+
"cli"
|
|
16
|
+
],
|
|
17
|
+
"author": "",
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"commander": "^12.0.0",
|
|
21
|
+
"update-notifier": "^7.0.0"
|
|
22
|
+
}
|
|
23
|
+
}
|