feat(tools): scaffold reset-password CLI
Add src/tools/cli with a CliFlow helper (boxed headers, labeled log lines) and a reset-password command stub wired to the prompt package. Runnable via 'bun run u:reset-password'; interactive flow to follow.
This commit is contained in:
parent
41b9d62e15
commit
fff9e82d62
3 changed files with 53 additions and 1 deletions
|
|
@ -24,7 +24,8 @@
|
|||
"test:int": "cross-env NODE_OPTIONS=--no-deprecation vitest run --config ./vitest.config.mts",
|
||||
"deploy": "bun pm version patch --message \"chore: update to %s\"",
|
||||
"preversion": "bun run build",
|
||||
"postversion": "bun run generate:version-info && bash ./build/deploy.sh"
|
||||
"postversion": "bun run generate:version-info && bash ./build/deploy.sh",
|
||||
"u:reset-password": "bun run src/tools/cli/reset-password.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-stack/payloadcms": "^3.2.30",
|
||||
|
|
@ -69,6 +70,7 @@
|
|||
"nodemailer": "^9.0.5",
|
||||
"payload": "3.88.0",
|
||||
"postcss": "8.5.18",
|
||||
"prompt": "^1.3.0",
|
||||
"radix-ui": "^1.6.7",
|
||||
"react": "19.2.3",
|
||||
"react-dom": "19.2.3",
|
||||
|
|
|
|||
43
src/tools/cli/_library.ts
Normal file
43
src/tools/cli/_library.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
export class CliFlow {
|
||||
protected moduleName: string;
|
||||
|
||||
constructor(moduleName: string) {
|
||||
this.moduleName = moduleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* showHeader
|
||||
*/
|
||||
public showHeader(title: string, subtitle?: string) {
|
||||
const LENGTH = Math.max(title.length, subtitle?.length ?? 0) + 5;
|
||||
|
||||
// Chars: ╔═╗║╚═╝╬
|
||||
|
||||
// Draw the top border
|
||||
let topStr = "╔";
|
||||
for (let i = 0; i < LENGTH; i++) {
|
||||
topStr += "═";
|
||||
}
|
||||
topStr += "╗";
|
||||
console.log(topStr);
|
||||
|
||||
// Draw the title
|
||||
console.log(`║ \x1B[33;1m${title}\x1B[0m ${"║".padStart(LENGTH - title.length - 1, " ")}`);
|
||||
|
||||
// Draw the subtitle
|
||||
subtitle &&
|
||||
console.log(`║ \x1B[2m${subtitle}\x1B[0m ${"║".padStart(LENGTH - subtitle.length - 1, " ")}`);
|
||||
|
||||
// Draw the bottom border
|
||||
let btmStr = "╚";
|
||||
for (let i = 0; i < LENGTH; i++) {
|
||||
btmStr += "═";
|
||||
}
|
||||
btmStr += "╝";
|
||||
console.log(btmStr + "\n");
|
||||
}
|
||||
|
||||
log(...msg: string[]) {
|
||||
console.log(`\t\x1B[33m[LOG]\x1B[0m ${msg.join(" ")}`);
|
||||
}
|
||||
}
|
||||
7
src/tools/cli/reset-password.ts
Normal file
7
src/tools/cli/reset-password.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { CliFlow } from "./_library";
|
||||
|
||||
const prompt = require("prompt");
|
||||
|
||||
const flow = new CliFlow("reset-password");
|
||||
|
||||
flow.showHeader("Test", "Long subtitle test");
|
||||
Loading…
Reference in a new issue