tetrons 2.3.37 → 2.3.39
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.
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/server/licenseUtils.ts
|
|
31
|
+
var licenseUtils_exports = {};
|
|
32
|
+
__export(licenseUtils_exports, {
|
|
33
|
+
getOrCreateInstallDate: () => getOrCreateInstallDate,
|
|
34
|
+
getRemainingDays: () => getRemainingDays
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(licenseUtils_exports);
|
|
37
|
+
var import_fs = __toESM(require("fs"));
|
|
38
|
+
var import_path = __toESM(require("path"));
|
|
39
|
+
var USAGE_FILE_PATH = import_path.default.join(process.cwd(), ".tetrons-usage.json");
|
|
40
|
+
function getOrCreateInstallDate() {
|
|
41
|
+
if (import_fs.default.existsSync(USAGE_FILE_PATH)) {
|
|
42
|
+
const data = JSON.parse(import_fs.default.readFileSync(USAGE_FILE_PATH, "utf-8"));
|
|
43
|
+
return new Date(data.installedAt);
|
|
44
|
+
}
|
|
45
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
46
|
+
import_fs.default.writeFileSync(USAGE_FILE_PATH, JSON.stringify({ installedAt: now }));
|
|
47
|
+
return new Date(now);
|
|
48
|
+
}
|
|
49
|
+
function getRemainingDays(installedAt, validityDays) {
|
|
50
|
+
const now = /* @__PURE__ */ new Date();
|
|
51
|
+
const diff = Math.floor(
|
|
52
|
+
(now.getTime() - installedAt.getTime()) / (1e3 * 60 * 60 * 24)
|
|
53
|
+
);
|
|
54
|
+
return validityDays - diff;
|
|
55
|
+
}
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
getOrCreateInstallDate,
|
|
59
|
+
getRemainingDays
|
|
60
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
const USAGE_FILE_PATH = path.join(process.cwd(), ".tetrons-usage.json");
|
|
5
|
+
|
|
6
|
+
export function getOrCreateInstallDate(): Date {
|
|
7
|
+
if (fs.existsSync(USAGE_FILE_PATH)) {
|
|
8
|
+
const data = JSON.parse(fs.readFileSync(USAGE_FILE_PATH, "utf-8"));
|
|
9
|
+
return new Date(data.installedAt);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const now = new Date().toISOString();
|
|
13
|
+
fs.writeFileSync(USAGE_FILE_PATH, JSON.stringify({ installedAt: now }));
|
|
14
|
+
return new Date(now);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getRemainingDays(
|
|
18
|
+
installedAt: Date,
|
|
19
|
+
validityDays: number
|
|
20
|
+
): number {
|
|
21
|
+
const now = new Date();
|
|
22
|
+
const diff = Math.floor(
|
|
23
|
+
(now.getTime() - installedAt.getTime()) / (1000 * 60 * 60 * 24)
|
|
24
|
+
);
|
|
25
|
+
return validityDays - diff;
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/server/licenseUtils.ts
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
var USAGE_FILE_PATH = path.join(process.cwd(), ".tetrons-usage.json");
|
|
5
|
+
function getOrCreateInstallDate() {
|
|
6
|
+
if (fs.existsSync(USAGE_FILE_PATH)) {
|
|
7
|
+
const data = JSON.parse(fs.readFileSync(USAGE_FILE_PATH, "utf-8"));
|
|
8
|
+
return new Date(data.installedAt);
|
|
9
|
+
}
|
|
10
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
11
|
+
fs.writeFileSync(USAGE_FILE_PATH, JSON.stringify({ installedAt: now }));
|
|
12
|
+
return new Date(now);
|
|
13
|
+
}
|
|
14
|
+
function getRemainingDays(installedAt, validityDays) {
|
|
15
|
+
const now = /* @__PURE__ */ new Date();
|
|
16
|
+
const diff = Math.floor(
|
|
17
|
+
(now.getTime() - installedAt.getTime()) / (1e3 * 60 * 60 * 24)
|
|
18
|
+
);
|
|
19
|
+
return validityDays - diff;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
getOrCreateInstallDate,
|
|
23
|
+
getRemainingDays
|
|
24
|
+
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tetrons",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.39",
|
|
4
4
|
"description": "A Next.js project written in TypeScript",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"dev": "next dev --turbo",
|
|
10
|
-
"build": "tsup && copyfiles -u 2 src/styles/*.css dist/styles && copyfiles -u 2 src/components/**/*.tsx dist/components",
|
|
10
|
+
"build": "tsup && cp src/server/licenseUtils.ts dist/server/licenseUtils.js && copyfiles -u 2 src/styles/*.css dist/styles && copyfiles -u 2 src/components/**/*.tsx dist/components",
|
|
11
11
|
"start": "next start",
|
|
12
12
|
"lint": "next lint"
|
|
13
13
|
},
|