fluxmail 0.0.1

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 ADDED
@@ -0,0 +1,29 @@
1
+ # fluxmail
2
+
3
+ CLI stub for `fluxmail`.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g fluxmail
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ fluxmail help
15
+ fluxmail version
16
+ ```
17
+
18
+ ## Local development
19
+
20
+ ```bash
21
+ node bin/fluxmail.js help
22
+ npm link # exposes the `fluxmail` command locally
23
+ ```
24
+
25
+ ## Publishing
26
+
27
+ ```bash
28
+ npm publish --access public
29
+ ```
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { run } from "../src/cli.js";
3
+
4
+ run(process.argv.slice(2));
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "fluxmail",
3
+ "version": "0.0.1",
4
+ "description": "Fluxmail CLI",
5
+ "type": "module",
6
+ "bin": {
7
+ "fluxmail": "bin/fluxmail.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "src"
12
+ ],
13
+ "engines": {
14
+ "node": ">=18"
15
+ },
16
+ "scripts": {
17
+ "start": "node bin/fluxmail.js"
18
+ },
19
+ "keywords": [
20
+ "cli",
21
+ "fluxmail",
22
+ "email"
23
+ ],
24
+ "license": "MIT"
25
+ }
package/src/cli.js ADDED
@@ -0,0 +1,36 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ const require = createRequire(import.meta.url);
4
+ const { version } = require("../package.json");
5
+
6
+ const HELP = `fluxmail — CLI
7
+
8
+ Usage:
9
+ fluxmail <command> [options]
10
+
11
+ Commands:
12
+ help Show this help
13
+ version Print the version
14
+
15
+ Options:
16
+ -h, --help Show this help
17
+ -v, --version Print the version
18
+ `;
19
+
20
+ export function run(argv = []) {
21
+ const [command] = argv;
22
+
23
+ if (argv.includes("-v") || argv.includes("--version") || command === "version") {
24
+ console.log(version);
25
+ return;
26
+ }
27
+
28
+ if (!command || argv.includes("-h") || argv.includes("--help") || command === "help") {
29
+ console.log(HELP);
30
+ return;
31
+ }
32
+
33
+ console.error(`fluxmail: unknown command '${command}'`);
34
+ console.error("Run 'fluxmail help' for usage.");
35
+ process.exitCode = 1;
36
+ }