@wavy/fn 0.0.10 → 0.0.11
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/dist/main.cjs +2 -1
- package/dist/main.d.cts +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.js +2 -1
- package/package.json +1 -29
- package/publish.js +31 -0
package/dist/main.cjs
CHANGED
|
@@ -402,7 +402,8 @@ var TimeManager = class _TimeManager {
|
|
|
402
402
|
return fmtDate;
|
|
403
403
|
}
|
|
404
404
|
getDuration(from, to, options) {
|
|
405
|
-
const
|
|
405
|
+
const getDate = (date) => ["string", "number"].includes(typeof date) ? new Date(date === "now" ? Date.now() : date) : date;
|
|
406
|
+
const difference = getDate(to).getTime() - getDate(from).getTime();
|
|
406
407
|
const metrics = _TimeManager.metrics;
|
|
407
408
|
const getFmtDuration = (duration2, unit) => `${duration2} ${options?.abvUnits ? unit.abv : unit.fmt}${duration2 > 1 ? "s" : ""}`;
|
|
408
409
|
const getDuration = (plugins) => plugins.reduce((prev, curr) => prev / curr);
|
package/dist/main.d.cts
CHANGED
|
@@ -32,7 +32,7 @@ declare class StringFormatter {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
declare const dateFormat: (time: number | Date | "now", format?: DateFormat) => string;
|
|
35
|
-
declare const timeDuration: (from: number, to: number, options?: {
|
|
35
|
+
declare const timeDuration: (from: number | "now" | Date, to: number | "now" | Date, options?: {
|
|
36
36
|
disableRemainder?: boolean;
|
|
37
37
|
abvUnits?: boolean;
|
|
38
38
|
}) => string;
|
package/dist/main.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ declare class StringFormatter {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
declare const dateFormat: (time: number | Date | "now", format?: DateFormat) => string;
|
|
35
|
-
declare const timeDuration: (from: number, to: number, options?: {
|
|
35
|
+
declare const timeDuration: (from: number | "now" | Date, to: number | "now" | Date, options?: {
|
|
36
36
|
disableRemainder?: boolean;
|
|
37
37
|
abvUnits?: boolean;
|
|
38
38
|
}) => string;
|
package/dist/main.js
CHANGED
|
@@ -305,7 +305,8 @@ var TimeManager = class _TimeManager {
|
|
|
305
305
|
return fmtDate;
|
|
306
306
|
}
|
|
307
307
|
getDuration(from, to, options) {
|
|
308
|
-
const
|
|
308
|
+
const getDate = (date) => ["string", "number"].includes(typeof date) ? new Date(date === "now" ? Date.now() : date) : date;
|
|
309
|
+
const difference = getDate(to).getTime() - getDate(from).getTime();
|
|
309
310
|
const metrics = _TimeManager.metrics;
|
|
310
311
|
const getFmtDuration = (duration2, unit) => `${duration2} ${options?.abvUnits ? unit.abv : unit.fmt}${duration2 > 1 ? "s" : ""}`;
|
|
311
312
|
const getDuration = (plugins) => plugins.reduce((prev, curr) => prev / curr);
|
package/package.json
CHANGED
|
@@ -1,29 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@wavy/fn",
|
|
3
|
-
"version": "0.0.10",
|
|
4
|
-
"main": "./dist/main.js",
|
|
5
|
-
"module": "./dist/main.cjs",
|
|
6
|
-
"types": "./dist/main.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsup && node prepend"
|
|
9
|
-
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/justVibes/literate-succotash.git"
|
|
13
|
-
},
|
|
14
|
-
"keywords": [],
|
|
15
|
-
"author": "",
|
|
16
|
-
"license": "MIT",
|
|
17
|
-
"type": "module",
|
|
18
|
-
"bugs": {
|
|
19
|
-
"url": "https://github.com/justVibes/literate-succotash/issues"
|
|
20
|
-
},
|
|
21
|
-
"homepage": "https://github.com/justVibes/literate-succotash#readme",
|
|
22
|
-
"description": "",
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@types/node": "^24.5.2",
|
|
25
|
-
"@wavy/types": "^0.0.32",
|
|
26
|
-
"tsup": "^8.5.0",
|
|
27
|
-
"typescript": "^5.9.2"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
{"name":"@wavy/fn","version":"0.0.11","main":"./dist/main.js","module":"./dist/main.cjs","types":"./dist/main.d.ts","scripts":{"build":"tsup && node prepend"},"repository":{"type":"git","url":"git+https://github.com/justVibes/literate-succotash.git"},"keywords":[],"author":"","license":"MIT","type":"module","bugs":{"url":"https://github.com/justVibes/literate-succotash/issues"},"homepage":"https://github.com/justVibes/literate-succotash#readme","description":"","devDependencies":{"@types/node":"^24.5.2","@wavy/types":"^0.0.32","tsup":"^8.5.0","typescript":"^5.9.2"}}
|
package/publish.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import("child_process").then(async ({ exec }) => {
|
|
2
|
+
const fs = await import("fs");
|
|
3
|
+
const console = await import("console");
|
|
4
|
+
const jsonPackage = JSON.parse(
|
|
5
|
+
fs.readFileSync("./package.json").toString("utf-8")
|
|
6
|
+
);
|
|
7
|
+
const version = jsonPackage.version;
|
|
8
|
+
const updateVersion = () => {
|
|
9
|
+
jsonPackage.version = version
|
|
10
|
+
.split(".")
|
|
11
|
+
.map((v, i, arr) => parseInt(v) + (i === arr.length - 1 ? 1 : 0))
|
|
12
|
+
.join(".");
|
|
13
|
+
fs.writeFileSync("./package.json", JSON.stringify(jsonPackage));
|
|
14
|
+
};
|
|
15
|
+
exec("npm run build && npm publish", async (err) => {
|
|
16
|
+
const overwriteVersionError = `Cannot implicitly apply the "latest" tag because published version ${version} is higher than the new version ${version}.`;
|
|
17
|
+
const successMessage = "✨ Successfully published package 😁! ✨";
|
|
18
|
+
|
|
19
|
+
if (err && err.message.includes(overwriteVersionError)) {
|
|
20
|
+
updateVersion();
|
|
21
|
+
exec("npm publish", (err) => {
|
|
22
|
+
if (err) console.error(err);
|
|
23
|
+
else console.log(successMessage);
|
|
24
|
+
});
|
|
25
|
+
} else if (err) {
|
|
26
|
+
console.log(err);
|
|
27
|
+
} else {
|
|
28
|
+
console.log(successMessage);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|