feat(lore): add lorem command

This commit is contained in:
Nan72 2025-02-19 08:46:13 +07:00
parent 1d806b30b6
commit 4953a0083e
No known key found for this signature in database
4 changed files with 36 additions and 0 deletions

View File

@ -15,6 +15,7 @@ const entrypoints = [
"./src/trim-end.ts", "./src/trim-end.ts",
"./src/trim-start.ts", "./src/trim-start.ts",
"./src/random-case.ts", "./src/random-case.ts",
"./src/lorem.ts",
"./src/uis/truncate.ts", "./src/uis/truncate.ts",
"./src/uis/pad.ts", "./src/uis/pad.ts",
]; ];

View File

@ -87,6 +87,11 @@
"main": "dist/pad.js", "main": "dist/pad.js",
"name": "Pad a string to a maximum length", "name": "Pad a string to a maximum length",
"cmds": [] "cmds": []
},
{
"main": "dist/lorem.js",
"name": "Generate a Lorem Ipsum sentence into your clipboard",
"cmds": []
} }
] ]
}, },
@ -98,6 +103,7 @@
"@kksh/api": "0.1.3", "@kksh/api": "0.1.3",
"i18next": "^23.15.1", "i18next": "^23.15.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"lorem-ipsum": "^2.0.8",
"uuid": "^11.0.3" "uuid": "^11.0.3"
}, },
"devDependencies": { "devDependencies": {

12
pnpm-lock.yaml generated
View File

@ -17,6 +17,9 @@ importers:
lodash: lodash:
specifier: ^4.17.21 specifier: ^4.17.21
version: 4.17.21 version: 4.17.21
lorem-ipsum:
specifier: ^2.0.8
version: 2.0.8
typescript: typescript:
specifier: ^5.0.0 specifier: ^5.0.0
version: 5.7.3 version: 5.7.3
@ -725,6 +728,11 @@ packages:
lodash@4.17.21: lodash@4.17.21:
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
lorem-ipsum@2.0.8:
resolution: {integrity: sha512-5RIwHuCb979RASgCJH0VKERn9cQo/+NcAi2BMe9ddj+gp7hujl6BI+qdOG4nVsLDpwWEJwTVYXNKP6BGgbcoGA==}
engines: {node: '>= 8.x', npm: '>= 5.x'}
hasBin: true
lru-cache@11.0.2: lru-cache@11.0.2:
resolution: {integrity: sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==} resolution: {integrity: sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==}
engines: {node: 20 || >=22} engines: {node: 20 || >=22}
@ -1872,6 +1880,10 @@ snapshots:
lodash@4.17.21: {} lodash@4.17.21: {}
lorem-ipsum@2.0.8:
dependencies:
commander: 9.5.0
lru-cache@11.0.2: {} lru-cache@11.0.2: {}
lru-cache@5.1.1: lru-cache@5.1.1:

17
src/lorem.ts Normal file
View File

@ -0,0 +1,17 @@
import {clipboard, expose} from "@kksh/api/headless";
import camelCase from "lodash/camelCase";
import {BaseExt} from "./base";
import { LoremIpsum } from "lorem-ipsum";
class CamelCaseExt extends BaseExt {
constructor() {
super(()=>{
const lorem = new LoremIpsum();
const generated = lorem.generateSentences(1);
clipboard.writeText(generated);
return generated;
});
}
}
expose(new CamelCaseExt())