21 lines
484 B
TypeScript
21 lines
484 B
TypeScript
#!/usr/bin/env bun
|
|
|
|
const ARTICLE_PATH = 'src/routes/articles';
|
|
|
|
const glob = new Bun.Glob("**/+page.svx");
|
|
|
|
const files = Array.from(glob.scanSync(ARTICLE_PATH));
|
|
|
|
const index = files.length;
|
|
|
|
const title = prompt('Title : ');
|
|
|
|
const slug = title!.replace(/\s+/g, '-').toLowerCase();
|
|
|
|
const filename = `${index.toString().padStart(4, '0')}-${slug}`;
|
|
|
|
await Bun.write(ARTICLE_PATH + '/' + `${filename}` + '/+page.svx', "");
|
|
|
|
console.log(`Created ${filename} +page.svx`);
|
|
|
|
export { };
|