wip: template
Some checks failed
/ check (20) (push) Failing after 3m33s
/ check (22) (push) Failing after 5s

Template will likely not be worked on for now

Signed-off-by: Alix von Schirp <github@avonschirp.bootmedia.de>
This commit is contained in:
2025-12-21 23:30:31 +01:00
parent 4b9c721ffd
commit 39e222fa55
3 changed files with 71 additions and 85 deletions

View File

@@ -1,9 +1,39 @@
// THIS IS FOR NOW UNLIKELY TO BE CONTINUED TO BE WORKED ON
import type { PlopTypes } from "@turbo/gen";
import * as fs from "node:fs";
import { simpleGit } from "simple-git";
export default function generator(plop: PlopTypes.NodePlopAPI): void {
const git = simpleGit();
const metaPackages = fs.readdirSync("meta").map((value) => {
const packageJson = JSON.parse(
fs.readFileSync(`meta/${value}/package.json`, "utf-8"),
);
return {
name: packageJson.name,
value: value,
};
});
// get git author info
const gitAuthor = {
name: git
.getConfig("user.name")
.then((res) => res.value)
.catch(() => ""),
email: git
.getConfig("user.email")
.then((res) => res.value)
.catch(() => ""),
};
// const gitAuthor = {
// name: (await git.getConfig("user.name")).value,
// email: (await git.getConfig("user.email")).value,
// };
// create a generator
plop.setGenerator("package", {
description: "Generator description",
description: "Create a new notify package",
// gather information from the user
prompts: [
{
@@ -19,17 +49,20 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
{
type: "input",
name: "author.name",
default: gitAuthor.name,
message: "Author name",
},
{
type: "input",
name: "author.email",
default: gitAuthor.email,
message: "Author email",
},
{
type: "input",
name: "author.url",
message: "Author URL",
type: "checkbox",
name: "import.meta",
message: "In which meta packages should this package be included?",
choices: metaPackages,
},
],
// perform actions based on the prompts