This commit is contained in:
giancarlo
2024-03-24 02:23:22 +08:00
parent 648d77b430
commit bce3479368
589 changed files with 37067 additions and 9596 deletions

View File

@@ -1,5 +1,5 @@
import { execSync } from "node:child_process";
import type { PackageJson, PlopTypes } from "@turbo/gen";
import type { PlopTypes } from "@turbo/gen";
export default function generator(plop: PlopTypes.NodePlopAPI): void {
plop.setGenerator("init", {
@@ -9,7 +9,7 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
type: "input",
name: "name",
message:
"What is the name of the package? (You can skip the `@acme/` prefix)",
"What is the name of the package? (You can skip the `@kit/` prefix)",
},
{
type: "input",
@@ -21,8 +21,8 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
actions: [
(answers) => {
if ("name" in answers && typeof answers.name === "string") {
if (answers.name.startsWith("@acme/")) {
answers.name = answers.name.replace("@acme/", "");
if (answers.name.startsWith("@kit/")) {
answers.name = answers.name.replace("@kit/", "");
}
}
return "Config sanitized";
@@ -51,7 +51,8 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
type: "modify",
path: "packages/{{ name }}/package.json",
async transform(content, answers) {
const pkg = JSON.parse(content) as PackageJson;
const pkg = JSON.parse(content);
for (const dep of answers.deps.split(" ").filter(Boolean)) {
const version = await fetch(
`https://registry.npmjs.org/-/package/${dep}/dist-tags`,

View File

@@ -1,5 +1,5 @@
{
"name": "@acme/{{ name }}",
"name": "@kit/{{ name }}",
"private": true,
"version": "0.1.0",
"exports": {
@@ -22,17 +22,17 @@
"dependencies": {
},
"devDependencies": {
"@acme/eslint-config": "0.2.0",
"@acme/prettier-config": "^0.1.0",
"@acme/tsconfig": "^0.1.0",
"@kit/eslint-config": "0.2.0",
"@kit/prettier-config": "^0.1.0",
"@kit/tsconfig": "^0.1.0",
"eslint": "^8.56.0",
"prettier": "^3.1.1",
"typescript": "^5.3.3"
},
"eslintConfig": {
"extends": [
"@acme/eslint-config/base"
"@kit/eslint-config/base"
]
},
"prettier": "@acme/prettier-config"
"prettier": "@kit/prettier-config"
}

View File

@@ -1,5 +1,5 @@
{
"extends": "@acme/tsconfig/base.json",
"extends": "@kit/tsconfig/base.json",
"compilerOptions": {
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
},