@dephub/slug 1.0.0 → 1.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 +0 -1
- package/dist/cli.js +22 -22
- package/dist/index.d.ts +0 -1
- package/dist/index.js +4 -5
- package/dist/package.json.js +1 -1
- package/package.json +16 -6
package/README.md
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://npmjs.org/package/@dephub/slug)
|
|
6
6
|
[](https://nodejs.org/)
|
|
7
|
-
[](https://nodejs.org/)
|
|
8
7
|
|
|
9
8
|
---
|
|
10
9
|
|
package/dist/cli.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { cli as a } from "@dephub/cli";
|
|
3
|
-
import {
|
|
4
|
-
import { compare as
|
|
5
|
-
import { slug as
|
|
6
|
-
import { isSlug as
|
|
7
|
-
import { name as
|
|
8
|
-
a.name(
|
|
9
|
-
a.command("generate", "Convert string to URL-friendly slug").argument("<input>", "Input string to convert").option("--separator", 'Separator character (default: "-")').flag("--no-lowercase", "Keep original case").option("--fallback", "Fallback text if result is empty").action(({ args:
|
|
10
|
-
const [
|
|
3
|
+
import { logger as e } from "@dephub/logger";
|
|
4
|
+
import { compare as c } from "./core/compare.js";
|
|
5
|
+
import { slug as l } from "./core/slug.js";
|
|
6
|
+
import { isSlug as p } from "./core/valid.js";
|
|
7
|
+
import { name as g, version as m, description as u } from "./utils/pkg.js";
|
|
8
|
+
a.name(g.split("/")[1] ?? "slug").version(m).description(u);
|
|
9
|
+
a.command("generate", "Convert string to URL-friendly slug").argument("<input>", "Input string to convert").option("--separator", 'Separator character (default: "-")').flag("--no-lowercase", "Keep original case").option("--fallback", "Fallback text if result is empty").action(({ args: o, options: r, flags: s }) => {
|
|
10
|
+
const [i] = o;
|
|
11
11
|
try {
|
|
12
12
|
const t = {
|
|
13
|
-
fallback:
|
|
14
|
-
lowercase:
|
|
15
|
-
separator:
|
|
16
|
-
},
|
|
17
|
-
|
|
13
|
+
fallback: r.fallback,
|
|
14
|
+
lowercase: s.lowercase,
|
|
15
|
+
separator: r.separator
|
|
16
|
+
}, n = l(i, t);
|
|
17
|
+
e.log(n);
|
|
18
18
|
} catch (t) {
|
|
19
|
-
|
|
19
|
+
e.error(t.message), process.exit(1);
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
a.command("validate", "Check if string is valid slug format").argument("<input>", "String to validate").action(({ args:
|
|
23
|
-
const [
|
|
24
|
-
|
|
22
|
+
a.command("validate", "Check if string is valid slug format").argument("<input>", "String to validate").action(({ args: o }) => {
|
|
23
|
+
const [r] = o;
|
|
24
|
+
p(r) ? e.success("Valid slug format") : (e.error("Invalid slug format"), process.exit(1));
|
|
25
25
|
});
|
|
26
|
-
a.command("compare", "Compare two strings by slugified versions").argument("<first>", "First string to compare").argument("<second>", "Second string to compare").option("--separator", "Separator character").flag("--no-lowercase", "Keep original case").action(({ args:
|
|
27
|
-
const [
|
|
28
|
-
lowercase:
|
|
29
|
-
separator:
|
|
26
|
+
a.command("compare", "Compare two strings by slugified versions").argument("<first>", "First string to compare").argument("<second>", "Second string to compare").option("--separator", "Separator character").flag("--no-lowercase", "Keep original case").action(({ args: o, options: r, flags: s }) => {
|
|
27
|
+
const [i, t] = o, n = {
|
|
28
|
+
lowercase: s.lowercase,
|
|
29
|
+
separator: r.separator
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
c(i, t, n) ? e.success("Strings are equivalent when slugified") : (e.error("Strings are different when slugified"), process.exit(1));
|
|
32
32
|
});
|
|
33
33
|
await a.run();
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { compare as e } from "./core/compare.js";
|
|
2
|
-
import { slug as
|
|
3
|
-
import { isSlug as
|
|
2
|
+
import { slug as p } from "./core/slug.js";
|
|
3
|
+
import { isSlug as t } from "./core/valid.js";
|
|
4
4
|
export {
|
|
5
5
|
e as compare,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
m as slug
|
|
6
|
+
t as isSlug,
|
|
7
|
+
p as slug
|
|
9
8
|
};
|
package/dist/package.json.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const n = "@dephub/slug", o = "1.0.
|
|
1
|
+
const n = "@dephub/slug", o = "1.0.1", s = "URL-friendly slug generator with semantic comparison and validation", t = {
|
|
2
2
|
name: n,
|
|
3
3
|
version: o,
|
|
4
4
|
description: s
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dephub/slug",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"description": "URL-friendly slug generator with semantic comparison and validation",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -34,21 +34,31 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"license": "MIT",
|
|
37
|
-
"homepage": "https://github.com/
|
|
37
|
+
"homepage": "https://github.com/estarlincito/dephub-slug#readme",
|
|
38
38
|
"repository": {
|
|
39
39
|
"type": "git",
|
|
40
|
-
"url": "https://github.com/
|
|
41
|
-
"directory": "packages/slug"
|
|
40
|
+
"url": "https://github.com/estarlincito/dephub-slug.git"
|
|
42
41
|
},
|
|
43
42
|
"bugs": {
|
|
44
|
-
"url": "https://github.com/
|
|
43
|
+
"url": "https://github.com/estarlincito/dephub-slug/issues"
|
|
45
44
|
},
|
|
46
45
|
"publishConfig": {
|
|
47
46
|
"access": "public"
|
|
48
47
|
},
|
|
49
48
|
"dependencies": {
|
|
50
49
|
"@dephub/cli": "^1.0.0",
|
|
51
|
-
"@dephub/
|
|
50
|
+
"@dephub/logger": "^1.1.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@dephub/glob": "^1.0.0",
|
|
54
|
+
"@dephub/lint": "^1.0.0",
|
|
55
|
+
"@dephub/lint-ts": "^1.0.0",
|
|
56
|
+
"@dephub/path": "^1.0.0",
|
|
57
|
+
"@types/node": "^24.3.1",
|
|
58
|
+
"eslint": "^9.37.0",
|
|
59
|
+
"typescript": "^5.9.2",
|
|
60
|
+
"vite": "^7.1.4",
|
|
61
|
+
"vite-plugin-dts": "^4.5.4"
|
|
52
62
|
},
|
|
53
63
|
"scripts": {
|
|
54
64
|
"release": "pnpm publish",
|