@dawudesign/node-hexa-cli 0.1.7 → 0.1.9
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 +1 -5
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -47
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
export { }
|
package/dist/index.js
CHANGED
|
@@ -1,58 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
#!/usr/bin/env node
|
|
3
2
|
|
|
4
3
|
// src/index.ts
|
|
5
4
|
import { Command } from "commander";
|
|
6
5
|
|
|
7
6
|
// src/license.ts
|
|
8
|
-
import { createHmac, timingSafeEqual } from "crypto";
|
|
9
|
-
import { writeFileSync, mkdirSync } from "fs";
|
|
10
|
-
import { homedir } from "os";
|
|
11
|
-
import { join } from "path";
|
|
12
|
-
var SIGNING_SECRET = process.env["NODEHEXA_LICENSE_SECRET"] ?? "";
|
|
13
|
-
var CONFIG_DIR = join(homedir(), ".config", "node-hexa");
|
|
14
|
-
var LICENSE_FILE = join(CONFIG_DIR, "license");
|
|
15
|
-
function parseLicenseKey(key) {
|
|
16
|
-
const parts = key.split("-");
|
|
17
|
-
if (parts.length < 3 || parts[0] !== "NODEHEXA") return null;
|
|
18
|
-
const sig = parts.at(-1);
|
|
19
|
-
if (!sig) return null;
|
|
20
|
-
const encoded = parts.slice(1, -1).join("-");
|
|
21
|
-
let payload;
|
|
22
|
-
try {
|
|
23
|
-
payload = Buffer.from(encoded, "base64url").toString("utf8");
|
|
24
|
-
} catch {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
const expectedSig = createHmac("sha256", SIGNING_SECRET).update(payload).digest("hex").slice(0, 16);
|
|
28
|
-
const sigOk = sig.length === expectedSig.length && timingSafeEqual(Buffer.from(sig), Buffer.from(expectedSig));
|
|
29
|
-
if (!sigOk) return null;
|
|
30
|
-
const colonIdx = payload.indexOf(":");
|
|
31
|
-
if (colonIdx === -1) return null;
|
|
32
|
-
return {
|
|
33
|
-
email: payload.slice(0, colonIdx),
|
|
34
|
-
expiresAt: payload.slice(colonIdx + 1)
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function activateLicense(key) {
|
|
38
|
-
const parsed = parseLicenseKey(key.trim());
|
|
39
|
-
if (!parsed) {
|
|
40
|
-
console.error("\u2717 Invalid license key.");
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
44
|
-
if (parsed.expiresAt !== "lifetime" && parsed.expiresAt < today) {
|
|
45
|
-
console.error(`\u2717 This license key expired on ${parsed.expiresAt}.`);
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
48
|
-
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
49
|
-
writeFileSync(LICENSE_FILE, key.trim(), "utf8");
|
|
50
|
-
console.log(
|
|
51
|
-
`\u2713 License activated for ${parsed.email} (valid until: ${parsed.expiresAt})`
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
7
|
function checkLicense() {
|
|
55
8
|
}
|
|
9
|
+
function activateLicense(_key) {
|
|
10
|
+
console.log("\u2713 This version is free \u2014 no license activation required.");
|
|
11
|
+
}
|
|
56
12
|
|
|
57
13
|
// ../../packages/parser/dist/index.js
|
|
58
14
|
import { Project } from "ts-morph";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dawudesign/node-hexa-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "CLI to scaffold and analyze NestJS Hexagonal DDD projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nestjs",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
|
-
"url": "https://github.com/Dawudesign/node-hexa.git",
|
|
26
|
+
"url": "git+https://github.com/Dawudesign/node-hexa.git",
|
|
27
27
|
"directory": "apps/cli"
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/Dawudesign/node-hexa#readme",
|