create-tea-architecture 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2
+
3
+ ## Getting Started
4
+
5
+ First, run the development server:
6
+
7
+ ```bash
8
+ npm run dev
9
+ # or
10
+ yarn dev
11
+ # or
12
+ pnpm dev
13
+ # or
14
+ bun dev
15
+ ```
16
+
17
+ Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
+
19
+ You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20
+
21
+ This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22
+
23
+ ## Learn More
24
+
25
+ To learn more about Next.js, take a look at the following resources:
26
+
27
+ - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28
+ - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29
+
30
+ You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31
+
32
+ ## Deploy on Vercel
33
+
34
+ The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35
+
36
+ Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/index.ts
4
+ import path from "path";
5
+ import process from "process";
6
+ import prompts from "prompts";
7
+ import { execa } from "execa";
8
+ import fs from "fs-extra";
9
+ var lockFiles = [
10
+ "package-lock.json",
11
+ "pnpm-lock.yaml",
12
+ "yarn.lock",
13
+ "bun.lockb"
14
+ ];
15
+ function detectPkgManager() {
16
+ const ua = process.env.npm_config_user_agent ?? "";
17
+ if (ua.includes("pnpm")) return "pnpm";
18
+ if (ua.includes("yarn")) return "yarn";
19
+ if (ua.includes("bun")) return "bun";
20
+ return "npm";
21
+ }
22
+ function runCmd(pm, args, cwd) {
23
+ return execa(pm, args, { stdio: "inherit", cwd });
24
+ }
25
+ function createTemplateFilter(templateDir) {
26
+ return (src) => {
27
+ const base = path.basename(src);
28
+ if (["node_modules", ".git", ".next"].includes(base)) return false;
29
+ if (lockFiles.includes(base)) return false;
30
+ const rel = path.relative(templateDir, src);
31
+ return !rel.startsWith("..");
32
+ };
33
+ }
34
+ async function main() {
35
+ const pm = detectPkgManager();
36
+ const argName = process.argv[2];
37
+ const { projectName } = await prompts(
38
+ {
39
+ type: argName ? null : "text",
40
+ name: "projectName",
41
+ message: "Project name:",
42
+ initial: "my-next-app",
43
+ validate: (v) => v?.trim() ? true : "Enter a name"
44
+ },
45
+ { onCancel: () => process.exit(1) }
46
+ );
47
+ const name = (argName ?? projectName).trim();
48
+ const targetDir = path.resolve(process.cwd(), name);
49
+ if (await fs.pathExists(targetDir)) {
50
+ const existing = await fs.readdir(targetDir);
51
+ if (existing.length > 0) {
52
+ console.error(`\u274C Directory not empty: ${targetDir}`);
53
+ process.exit(1);
54
+ }
55
+ } else {
56
+ await fs.mkdirp(targetDir);
57
+ }
58
+ const pmFlag = pm === "pnpm" ? "--use-pnpm" : pm === "yarn" ? "--use-yarn" : pm === "bun" ? "--use-bun" : "--use-npm";
59
+ const cnaArgs = [
60
+ "create-next-app@latest",
61
+ targetDir,
62
+ "--ts",
63
+ "--eslint",
64
+ "--app",
65
+ "--src-dir",
66
+ "--tailwind",
67
+ "--import-alias",
68
+ "@/*",
69
+ pmFlag
70
+ ];
71
+ if (pm === "npm") {
72
+ await runCmd("npm", ["exec", "--yes", ...cnaArgs]);
73
+ } else if (pm === "bun") {
74
+ await execa("bunx", cnaArgs, { stdio: "inherit" });
75
+ } else {
76
+ await runCmd(pm, ["dlx", ...cnaArgs]);
77
+ }
78
+ const templateDir = path.resolve(
79
+ new URL(".", import.meta.url).pathname,
80
+ "..",
81
+ "templates",
82
+ "default"
83
+ );
84
+ await fs.copy(templateDir, targetDir, {
85
+ overwrite: true,
86
+ filter: createTemplateFilter(templateDir)
87
+ });
88
+ const pkgPath = path.join(targetDir, "package.json");
89
+ const pkg = await fs.readJson(pkgPath);
90
+ pkg.name = name;
91
+ await fs.writeJson(pkgPath, pkg, { spaces: 2 });
92
+ for (const lf of lockFiles) {
93
+ await fs.remove(path.join(targetDir, lf));
94
+ }
95
+ await runCmd(pm, ["install"], targetDir);
96
+ console.log(`
97
+ \u2705 Done!
98
+ `);
99
+ console.log(`cd ${name}`);
100
+ console.log(`${pm} run dev
101
+ `);
102
+ }
103
+ main().catch((err) => {
104
+ console.error("\u274C Failed:", err);
105
+ process.exit(1);
106
+ });
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "create-tea-architecture",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "bin": {
7
+ "create-tea-architecture": "./dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "templates"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsup",
15
+ "dev": "node --loader ts-node/esm src/index.ts",
16
+ "prepublishOnly": "npm run build"
17
+ },
18
+ "dependencies": {
19
+ "execa": "^9.0.0",
20
+ "fs-extra": "^11.2.0",
21
+ "prompts": "^2.4.2"
22
+ },
23
+ "devDependencies": {
24
+ "@types/fs-extra": "^11.0.4",
25
+ "@types/node": "^20.0.0",
26
+ "@types/prompts": "^2.4.9",
27
+ "ts-node": "^10.9.2",
28
+ "tsup": "^8.0.0",
29
+ "typescript": "^5.0.0"
30
+ }
31
+ }
@@ -0,0 +1,36 @@
1
+ This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2
+
3
+ ## Getting Started
4
+
5
+ First, run the development server:
6
+
7
+ ```bash
8
+ npm run dev
9
+ # or
10
+ yarn dev
11
+ # or
12
+ pnpm dev
13
+ # or
14
+ bun dev
15
+ ```
16
+
17
+ Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
+
19
+ You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20
+
21
+ This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22
+
23
+ ## Learn More
24
+
25
+ To learn more about Next.js, take a look at the following resources:
26
+
27
+ - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28
+ - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29
+
30
+ You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31
+
32
+ ## Deploy on Vercel
33
+
34
+ The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35
+
36
+ Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
Binary file
@@ -0,0 +1,18 @@
1
+ import { defineConfig, globalIgnores } from "eslint/config";
2
+ import nextVitals from "eslint-config-next/core-web-vitals";
3
+ import nextTs from "eslint-config-next/typescript";
4
+
5
+ const eslintConfig = defineConfig([
6
+ ...nextVitals,
7
+ ...nextTs,
8
+ // Override default ignores of eslint-config-next.
9
+ globalIgnores([
10
+ // Default ignores of eslint-config-next:
11
+ ".next/**",
12
+ "out/**",
13
+ "build/**",
14
+ "next-env.d.ts",
15
+ ]),
16
+ ]);
17
+
18
+ export default eslintConfig;
@@ -0,0 +1,7 @@
1
+ import type { NextConfig } from "next";
2
+
3
+ const nextConfig: NextConfig = {
4
+ /* config options here */
5
+ };
6
+
7
+ export default nextConfig;