First few blogs.
This commit is contained in:
parent
cbe09fc194
commit
702469464e
19 changed files with 719 additions and 28 deletions
21
scripts/new-article.ts
Normal file
21
scripts/new-article.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#!/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 { };
|
||||
Loading…
Add table
Add a link
Reference in a new issue