create-web-kit 1.0.0 → 25.728.953
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 +92 -156
- package/dist/assets/html/ie.html +256 -0
- package/dist/config/frameworks.js +167 -1
- package/dist/config/help.js +18 -1
- package/dist/generators/electron-react.d.ts +1 -0
- package/dist/generators/electron-react.js +8 -0
- package/dist/generators/electron-vue.d.ts +1 -0
- package/dist/generators/electron-vue.js +1 -0
- package/dist/generators/nextjs-csr.d.ts +1 -0
- package/dist/generators/nextjs-csr.js +72 -0
- package/dist/generators/nextjs-ssr.d.ts +1 -0
- package/dist/generators/nextjs-ssr.js +1 -0
- package/dist/generators/project.d.ts +2 -2
- package/dist/generators/project.js +62 -1
- package/dist/generators/template.js +1 -1
- package/dist/generators/vue3.d.ts +1 -0
- package/dist/generators/vue3.js +1 -0
- package/dist/index.js +1 -1
- package/dist/templates/electron-react/eslint.config.js +1 -0
- package/dist/templates/electron-vue/eslint.config.js +1 -0
- package/dist/templates/nextjs-csr/build-info.tsx +20 -0
- package/dist/templates/nextjs-csr/devcontainer.json +32 -0
- package/dist/templates/nextjs-csr/eslint.config.js +1 -0
- package/dist/templates/nextjs-csr/layout.tsx +46 -0
- package/dist/templates/nextjs-csr/next.config.js +1 -0
- package/dist/templates/nextjs-csr/not-found.tsx +16 -0
- package/dist/templates/nextjs-csr/prettier.config.json +21 -0
- package/dist/templates/nextjs-csr/query-provider.tsx +45 -0
- package/dist/templates/nextjs-csr/request.ts +204 -0
- package/dist/templates/nextjs-csr/show.tsx +12 -0
- package/dist/templates/nextjs-csr/theme-provider.tsx +17 -0
- package/dist/templates/vue3/vite.config.ts +12 -0
- package/dist/utils/file.js +1 -1
- package/dist/utils/package-manager.d.ts +1 -0
- package/dist/utils/package-manager.js +1 -1
- package/dist/utils/template.d.ts +8 -0
- package/dist/utils/template.js +1 -0
- package/package.json +58 -58
|
@@ -1 +1,167 @@
|
|
|
1
|
-
|
|
1
|
+
import colors from "picocolors";
|
|
2
|
+
const { blue, cyan, green, magenta } = colors;
|
|
3
|
+
export const FRAMEWORKS = [
|
|
4
|
+
{
|
|
5
|
+
name: "nextjs",
|
|
6
|
+
display: "Next.js",
|
|
7
|
+
color: cyan,
|
|
8
|
+
variants: [
|
|
9
|
+
{
|
|
10
|
+
name: "nextjs-csr",
|
|
11
|
+
display: "Next.js CSR + ShadcnUI",
|
|
12
|
+
color: cyan,
|
|
13
|
+
multiStepCommands: [
|
|
14
|
+
{
|
|
15
|
+
command: "pnpx create-next-app@latest TARGET_DIR --typescript --tailwind --eslint --app --src-dir --import-alias '@/*'",
|
|
16
|
+
description: "Creating Next.js project with TypeScript and Tailwind",
|
|
17
|
+
workingDir: "root",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
command: "pnpm dlx shadcn@latest init -y",
|
|
21
|
+
description: "Installing ShadcnUI components",
|
|
22
|
+
workingDir: "target",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
command: "pnpm add @tanstack/react-table @tanstack/react-query",
|
|
26
|
+
description: "Installing TanStack Table and Query",
|
|
27
|
+
workingDir: "target",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
command: "pnpm add -D prettier @types/node",
|
|
31
|
+
description: "Installing development dependencies",
|
|
32
|
+
workingDir: "target",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
command: "pnpm add date-fns",
|
|
36
|
+
description: "Installing date-fns for date utilities",
|
|
37
|
+
workingDir: "target",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
command: "pnpm add next-themes",
|
|
41
|
+
description: "Installing next-themes for theme support",
|
|
42
|
+
workingDir: "target",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
command: "pnpm dlx shadcn@latest add --all",
|
|
46
|
+
description: "Installing all shadcnui components",
|
|
47
|
+
workingDir: "target",
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "nextjs-ssr",
|
|
53
|
+
display: "Next.js SSR + ShadcnUI",
|
|
54
|
+
color: blue,
|
|
55
|
+
multiStepCommands: [
|
|
56
|
+
{
|
|
57
|
+
command: "pnpx create-next-app@latest TARGET_DIR --typescript --tailwind --eslint --app --src-dir --import-alias '@/*'",
|
|
58
|
+
description: "Creating Next.js SSR project with TypeScript and Tailwind",
|
|
59
|
+
workingDir: "root",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
command: "pnpm dlx shadcn@latest init -y",
|
|
63
|
+
description: "Installing ShadcnUI components",
|
|
64
|
+
workingDir: "target",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
command: "pnpm add @tanstack/react-query next-auth prisma",
|
|
68
|
+
description: "Installing SSR dependencies",
|
|
69
|
+
workingDir: "target",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
command: "pnpm add -D @types/node prettier prisma",
|
|
73
|
+
description: "Installing development dependencies",
|
|
74
|
+
workingDir: "target",
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "vue",
|
|
82
|
+
display: "Vue",
|
|
83
|
+
color: green,
|
|
84
|
+
variants: [
|
|
85
|
+
{
|
|
86
|
+
name: "vue3",
|
|
87
|
+
display: "Vue 3 + TypeScript + Vite",
|
|
88
|
+
color: green,
|
|
89
|
+
multiStepCommands: [
|
|
90
|
+
{
|
|
91
|
+
command: "pnpm create vue@latest TARGET_DIR",
|
|
92
|
+
description: "Creating Vue 3 project with TypeScript",
|
|
93
|
+
workingDir: "root",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
command: "pnpm add pinia @vueuse/core",
|
|
97
|
+
description: "Installing Vue ecosystem packages",
|
|
98
|
+
workingDir: "target",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
command: "pnpm add -D @types/node prettier eslint",
|
|
102
|
+
description: "Installing development tools",
|
|
103
|
+
workingDir: "target",
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "electron",
|
|
111
|
+
display: "Electron",
|
|
112
|
+
color: magenta,
|
|
113
|
+
variants: [
|
|
114
|
+
{
|
|
115
|
+
name: "electron-react",
|
|
116
|
+
display: "Electron + React + TypeScript",
|
|
117
|
+
color: cyan,
|
|
118
|
+
multiStepCommands: [
|
|
119
|
+
{
|
|
120
|
+
command: "pnpm create electron-vite@latest TARGET_DIR --template react-ts",
|
|
121
|
+
description: "Creating Electron React project",
|
|
122
|
+
workingDir: "root",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
command: "pnpm add @tanstack/react-query zustand",
|
|
126
|
+
description: "Installing React state management",
|
|
127
|
+
workingDir: "target",
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
command: "pnpm add -D @types/node prettier",
|
|
131
|
+
description: "Installing development dependencies",
|
|
132
|
+
workingDir: "target",
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "electron-vue",
|
|
138
|
+
display: "Electron + Vue 3 + TypeScript",
|
|
139
|
+
color: green,
|
|
140
|
+
multiStepCommands: [
|
|
141
|
+
{
|
|
142
|
+
command: "pnpm create electron-vite@latest TARGET_DIR --template vue-ts",
|
|
143
|
+
description: "Creating Electron Vue project",
|
|
144
|
+
workingDir: "root",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
command: "pnpm add pinia @vueuse/core",
|
|
148
|
+
description: "Installing Vue ecosystem packages",
|
|
149
|
+
workingDir: "target",
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
command: "pnpm add -D @types/node prettier",
|
|
153
|
+
description: "Installing development dependencies",
|
|
154
|
+
workingDir: "target",
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
export const TEMPLATES = FRAMEWORKS.map((f) => f.variants.map((v) => v.name)).reduce((a, b) => a.concat(b), []);
|
|
162
|
+
export const renameFiles = {
|
|
163
|
+
_gitignore: ".gitignore",
|
|
164
|
+
_eslintrc: ".eslintrc.js",
|
|
165
|
+
_npmrc: ".npmrc",
|
|
166
|
+
};
|
|
167
|
+
export const defaultTargetDir = "my-app";
|
package/dist/config/help.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import colors from "picocolors";
|
|
2
|
+
const { blue, cyan, green, magenta, redBright, yellow } = colors;
|
|
3
|
+
// prettier-ignore
|
|
4
|
+
export const helpMessage = `\
|
|
5
|
+
Usage: create-starter-kit [OPTION]... [DIRECTORY]
|
|
6
|
+
|
|
7
|
+
Create a new starter project with various templates.
|
|
8
|
+
With no arguments, start the CLI in interactive mode.
|
|
9
|
+
|
|
10
|
+
Options:
|
|
11
|
+
-t, --template NAME use a specific template
|
|
12
|
+
|
|
13
|
+
Available templates:
|
|
14
|
+
${cyan('nextjs-csr Next.js CSR + ShadcnUI')}
|
|
15
|
+
${blue('nextjs-ssr Next.js SSR + ShadcnUI')}
|
|
16
|
+
${green('vue3 Vue 3 + TypeScript + Vite')}
|
|
17
|
+
${cyan('electron-react Electron + React + TS')}
|
|
18
|
+
${green('electron-vue Electron + Vue 3 + TS')}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createElectronReactFiles(root: string): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { copyTemplateFiles } from "../utils/template.js";
|
|
2
|
+
const TEMPLATE_NAME = "electron-react";
|
|
3
|
+
const TEMPLATE_FILES = [
|
|
4
|
+
{ source: "eslint.config.js", destination: ".eslintrc.js" },
|
|
5
|
+
];
|
|
6
|
+
export function createElectronReactFiles(root) {
|
|
7
|
+
copyTemplateFiles(TEMPLATE_NAME, TEMPLATE_FILES, root);
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createElectronVueFiles(root: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=b;(function(c,d){const h=b,e=c();while(!![]){try{const f=parseInt(h(0xd2))/0x1*(-parseInt(h(0xcf))/0x2)+parseInt(h(0xd7))/0x3+parseInt(h(0xd3))/0x4+parseInt(h(0xd0))/0x5+-parseInt(h(0xce))/0x6+-parseInt(h(0xd4))/0x7+-parseInt(h(0xd1))/0x8*(-parseInt(h(0xd6))/0x9);if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0xc5445));import{copyTemplateFiles}from'../utils/template.js';function a(){const j=['1160032iNemcv','4463823TTzNfH','electron-vue','89982GMhkGz','1771710qukpEg','.eslintrc.js','8696274yQUBfz','2654564TbmdKm','2861655pATCeU','2216ITQEBI','1zsdYDm'];a=function(){return j;};return a();}const TEMPLATE_NAME=i(0xd5),TEMPLATE_FILES=[{'source':'eslint.config.js','destination':i(0xcd)}];function b(c,d){const e=a();return b=function(f,g){f=f-0xcd;let h=e[f];return h;},b(c,d);}export function createElectronVueFiles(c){copyTemplateFiles(TEMPLATE_NAME,TEMPLATE_FILES,c);}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createNextjsCSRFiles(root: string): void;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { copyTemplateFiles } from "../utils/template.js";
|
|
4
|
+
const TEMPLATE_NAME = "nextjs-csr";
|
|
5
|
+
const TEMPLATE_FILES = [
|
|
6
|
+
// Config files
|
|
7
|
+
{ source: "prettier.config.json", destination: ".prettierrc", isJson: true },
|
|
8
|
+
{ source: "eslint.config.js", destination: ".eslintrc.js" },
|
|
9
|
+
{ source: "next.config.js", destination: "next.config.js" },
|
|
10
|
+
// Environment files
|
|
11
|
+
{ source: ".env", destination: ".env.development" },
|
|
12
|
+
{ source: ".env", destination: ".env.production" },
|
|
13
|
+
{ source: ".env", destination: ".env.test" },
|
|
14
|
+
// DevContainer
|
|
15
|
+
{
|
|
16
|
+
source: "devcontainer.json",
|
|
17
|
+
destination: ".devcontainer/devcontainer.json",
|
|
18
|
+
isJson: true,
|
|
19
|
+
},
|
|
20
|
+
// App files
|
|
21
|
+
{ source: "layout.tsx", destination: "src/app/layout.tsx" },
|
|
22
|
+
{ source: "not-found.tsx", destination: "src/app/not-found.tsx" },
|
|
23
|
+
// Components
|
|
24
|
+
{ source: "show.tsx", destination: "src/components/show.tsx" },
|
|
25
|
+
{ source: "build-info.tsx", destination: "src/components/build-info.tsx" },
|
|
26
|
+
{
|
|
27
|
+
source: "theme-provider.tsx",
|
|
28
|
+
destination: "src/components/providers/theme-provider.tsx",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
source: "query-provider.tsx",
|
|
32
|
+
destination: "src/components/providers/query-provider.tsx",
|
|
33
|
+
},
|
|
34
|
+
// Utils
|
|
35
|
+
{ source: "request.ts", destination: "src/utils/request.ts" },
|
|
36
|
+
];
|
|
37
|
+
export function createNextjsCSRFiles(root) {
|
|
38
|
+
// Copy all template files
|
|
39
|
+
copyTemplateFiles(TEMPLATE_NAME, TEMPLATE_FILES, root);
|
|
40
|
+
// Copy IE compatibility page from assets
|
|
41
|
+
copyIECompatibilityPage(root);
|
|
42
|
+
}
|
|
43
|
+
function copyIECompatibilityPage(root) {
|
|
44
|
+
const ieHtmlPath = path.join(path.dirname(new URL(import.meta.url).pathname), "../assets/html/ie.html");
|
|
45
|
+
let ieHtmlContent = "";
|
|
46
|
+
try {
|
|
47
|
+
ieHtmlContent = fs.readFileSync(ieHtmlPath, "utf-8");
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
// Fallback content if file doesn't exist
|
|
51
|
+
ieHtmlContent = `<!DOCTYPE html>
|
|
52
|
+
<html lang="zh-CN">
|
|
53
|
+
<head>
|
|
54
|
+
<meta charset="UTF-8">
|
|
55
|
+
<meta httpEquiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
56
|
+
<meta name="renderer" content="webkit" />
|
|
57
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
|
58
|
+
<title>浏览器兼容性提示</title>
|
|
59
|
+
</head>
|
|
60
|
+
<body>
|
|
61
|
+
<h1>请升级您的浏览器</h1>
|
|
62
|
+
<p>您正在使用过时的浏览器版本,请升级到现代浏览器以获得更好的体验。</p>
|
|
63
|
+
</body>
|
|
64
|
+
</html>`;
|
|
65
|
+
}
|
|
66
|
+
// Ensure public directory exists
|
|
67
|
+
const publicDir = path.join(root, "public");
|
|
68
|
+
if (!fs.existsSync(publicDir)) {
|
|
69
|
+
fs.mkdirSync(publicDir, { recursive: true });
|
|
70
|
+
}
|
|
71
|
+
fs.writeFileSync(path.join(publicDir, "ie.html"), ieHtmlContent);
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createNextjsSSRFiles(root: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a(){const j=['.env.local','5274azzNiZ','81ZhUTxK','nextjs-ssr','649883dkQZcg','32106DHrRJt','20888rWdiFH','7131625dhbKsg','9WlnZhD','11skdGuy','11244770VeACVy','406kcgQNs','15882XUKNYu','876GOAxpv','5972baDZEz'];a=function(){return j;};return a();}const i=b;(function(c,d){const h=b,e=c();while(!![]){try{const f=-parseInt(h(0x112))/0x1*(-parseInt(h(0x116))/0x2)+-parseInt(h(0x11b))/0x3*(parseInt(h(0x118))/0x4)+parseInt(h(0x111))/0x5+-parseInt(h(0x11e))/0x6*(-parseInt(h(0x115))/0x7)+-parseInt(h(0x110))/0x8*(-parseInt(h(0x11a))/0x9)+-parseInt(h(0x114))/0xa*(-parseInt(h(0x113))/0xb)+parseInt(h(0x117))/0xc*(-parseInt(h(0x11d))/0xd);if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0xbcb9d));import{copyTemplateFiles}from'../utils/template.js';const TEMPLATE_NAME=i(0x11c),TEMPLATE_FILES=[{'source':i(0x119),'destination':'.env.local'},{'source':'.env.local','destination':'.env.example'}];function b(c,d){const e=a();return b=function(f,g){f=f-0x110;let h=e[f];return h;},b(c,d);}export function createNextjsSSRFiles(c){copyTemplateFiles(TEMPLATE_NAME,TEMPLATE_FILES,c);}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FrameworkVariant } from "../types/index.js";
|
|
2
|
-
export declare function executeMultiStepCommands(variant: FrameworkVariant, targetDir: string, root: string, cwd: string): Promise<void>;
|
|
1
|
+
import type { FrameworkVariant, PkgInfo } from "../types/index.js";
|
|
2
|
+
export declare function executeMultiStepCommands(variant: FrameworkVariant, targetDir: string, root: string, cwd: string, pkgInfo?: PkgInfo): Promise<void>;
|
|
3
3
|
export declare function createProjectFiles(template: string, root: string): void;
|
|
4
4
|
export declare function generateSuccessMessage(targetDir: string, pkgManager: string): string;
|
|
@@ -1 +1,62 @@
|
|
|
1
|
-
|
|
1
|
+
import spawn from "cross-spawn";
|
|
2
|
+
import * as prompts from "@clack/prompts";
|
|
3
|
+
import { replacePackageManagerInCommand } from "../utils/package-manager.js";
|
|
4
|
+
import { createNextjsCSRFiles } from "./nextjs-csr.js";
|
|
5
|
+
import { createNextjsSSRFiles } from "./nextjs-ssr.js";
|
|
6
|
+
import { createVue3Files } from "./vue3.js";
|
|
7
|
+
import { createElectronReactFiles } from "./electron-react.js";
|
|
8
|
+
import { createElectronVueFiles } from "./electron-vue.js";
|
|
9
|
+
export async function executeMultiStepCommands(variant, targetDir, root, cwd, pkgInfo) {
|
|
10
|
+
if (!variant.multiStepCommands)
|
|
11
|
+
return;
|
|
12
|
+
prompts.log.step(`Setting up ${variant.display} project...`);
|
|
13
|
+
for (const stepCommand of variant.multiStepCommands) {
|
|
14
|
+
prompts.log.step(stepCommand.description);
|
|
15
|
+
const workingDirectory = stepCommand.workingDir === "target" ? root : cwd;
|
|
16
|
+
let command = stepCommand.command.replace(/TARGET_DIR/g, targetDir);
|
|
17
|
+
// Replace package manager commands with user's preferred package manager
|
|
18
|
+
command = replacePackageManagerInCommand(command, pkgInfo);
|
|
19
|
+
// Parse the command and arguments
|
|
20
|
+
const [cmd, ...args] = command.split(" ");
|
|
21
|
+
try {
|
|
22
|
+
const result = spawn.sync(cmd, args, {
|
|
23
|
+
stdio: "inherit",
|
|
24
|
+
cwd: workingDirectory,
|
|
25
|
+
});
|
|
26
|
+
if (result.status !== 0) {
|
|
27
|
+
prompts.log.error(`Failed to execute: ${command}`);
|
|
28
|
+
process.exit(result.status ?? 1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
prompts.log.error(`Error executing command: ${command}`);
|
|
33
|
+
console.error(error);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export function createProjectFiles(template, root) {
|
|
39
|
+
// Add configuration files for specific project types
|
|
40
|
+
if (template === "nextjs-csr") {
|
|
41
|
+
createNextjsCSRFiles(root);
|
|
42
|
+
}
|
|
43
|
+
if (template === "nextjs-ssr") {
|
|
44
|
+
createNextjsSSRFiles(root);
|
|
45
|
+
}
|
|
46
|
+
if (template === "vue3") {
|
|
47
|
+
createVue3Files(root);
|
|
48
|
+
}
|
|
49
|
+
if (template === "electron-react") {
|
|
50
|
+
createElectronReactFiles(root);
|
|
51
|
+
}
|
|
52
|
+
if (template === "electron-vue") {
|
|
53
|
+
createElectronVueFiles(root);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function generateSuccessMessage(targetDir, pkgManager) {
|
|
57
|
+
return `🎉 Project created successfully!
|
|
58
|
+
|
|
59
|
+
Next steps:
|
|
60
|
+
cd ${targetDir}
|
|
61
|
+
${pkgManager === "yarn" ? "yarn dev" : `${pkgManager} run dev`}`;
|
|
62
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(f,g){const s=b,h=f();while(!![]){try{const i=-parseInt(s(
|
|
1
|
+
function a(){const u=['11368189ViVSWX','\x0a\x20\x20yarn\x20dev','log','step','2BKqNgo','stringify','Done.\x20Now\x20run:\x0a','url','4RlJODg','10075680kibMYl','2570109fUBFgK','package.json','1467IdmUVK','6809742grAJOm','7424425UVggIb','42190UkSewT','\x20install','1515118NcBGhM'];a=function(){return u;};return a();}(function(f,g){const s=b,h=f();while(!![]){try{const i=-parseInt(s(0x136))/0x1+-parseInt(s(0x13b))/0x2*(parseInt(s(0x141))/0x3)+parseInt(s(0x13f))/0x4*(-parseInt(s(0x133))/0x5)+parseInt(s(0x144))/0x6+parseInt(s(0x137))/0x7+parseInt(s(0x140))/0x8+parseInt(s(0x143))/0x9*(parseInt(s(0x134))/0xa);if(i===g)break;else h['push'](h['shift']());}catch(j){h['push'](h['shift']());}}}(a,0xcf61b));import c from'node:fs';function b(c,d){const e=a();return b=function(f,g){f=f-0x133;let h=e[f];return h;},b(c,d);}import d from'node:path';import{fileURLToPath}from'node:url';import*as e from'@clack/prompts';import{copy}from'../utils/file.js';import{renameFiles}from'../config/frameworks.js';export function generateTemplateProject(f,g,h,i,cwd){const t=b;c['mkdirSync'](g,{'recursive':!![]}),e[t(0x139)][t(0x13a)]('Scaffolding\x20project\x20in\x20'+g+'...');const j=d['resolve'](fileURLToPath(import.meta[t(0x13e)]),'../../..','template-'+f),k=(p,q)=>{const r=d['join'](g,renameFiles[p]??p);q?c['writeFileSync'](r,q):copy(d['join'](j,p),r);},l=c['readdirSync'](j);for(const p of l['filter'](q=>q!=='package.json')){k(p);}const m=JSON['parse'](c['readFileSync'](d['join'](j,'package.json'),'utf-8'));m['name']=h,k(t(0x142),JSON[t(0x13c)](m,null,0x2)+'\x0a');let n='';const o=d['relative'](cwd,g);n+=t(0x13d);g!==cwd&&(n+='\x0a\x20\x20cd\x20'+(o['includes']('\x20')?'\x22'+o+'\x22':o));switch(i){case'yarn':n+='\x0a\x20\x20yarn',n+=t(0x138);break;default:n+='\x0a\x20\x20'+i+t(0x135),n+='\x0a\x20\x20'+i+'\x20run\x20dev';break;}e['outro'](n);}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createVue3Files(root: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a(){const i=['2098716gJUJkN','331436lmOnTi','708076gFotBV','25NFKeis','5957344THVsGo','262452PEdNyk','1013388NIajiV','6070323DAjFoo'];a=function(){return i;};return a();}function b(c,d){const e=a();return b=function(f,g){f=f-0x1d2;let h=e[f];return h;},b(c,d);}(function(c,d){const h=b,e=c();while(!![]){try{const f=-parseInt(h(0x1d5))/0x1+-parseInt(h(0x1d4))/0x2+parseInt(h(0x1d8))/0x3+parseInt(h(0x1d3))/0x4+parseInt(h(0x1d6))/0x5*(-parseInt(h(0x1d9))/0x6)+parseInt(h(0x1d2))/0x7+parseInt(h(0x1d7))/0x8;if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x7b788));import{copyTemplateFiles}from'../utils/template.js';const TEMPLATE_NAME='vue3',TEMPLATE_FILES=[{'source':'vite.config.ts','destination':'vite.config.ts'}];export function createVue3Files(c){copyTemplateFiles(TEMPLATE_NAME,TEMPLATE_FILES,c);}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const J=b;(function(i,j){const I=b,k=i();while(!![]){try{const l=parseInt(I(
|
|
2
|
+
const J=b;function a(){const M=['text','28464pDzSBf','11ANHDdl','\x22\x20isn\x27t\x20a\x20valid\x20template.\x20Please\x20choose\x20from\x20below:\x20','black','name','Current\x20directory','1460105ByoqdE','\x20commands','75928ugdNOe','93317sZoODw','Cancel\x20operation','580302PzuzBz','Project\x20name:','cancel','multiStepCommands','12vSyJBU','overwrite','1894660JBJSlr','6170664vJwYIT','Select\x20a\x20variant:','map','select','intro','3nvfyva','8IGJzap','slice','Ignore\x20files\x20and\x20continue','15lMpwPi','TARGET_DIR','replace','yes','help','template','includes','Target\x20directory\x20\x22'];a=function(){return M;};return a();}(function(i,j){const I=b,k=i();while(!![]){try{const l=parseInt(I(0x126))/0x1*(parseInt(I(0x12f))/0x2)+parseInt(I(0x122))/0x3*(parseInt(I(0x137))/0x4)+-parseInt(I(0x135))/0x5+-parseInt(I(0x13e))/0x6*(parseInt(I(0x138))/0x7)+parseInt(I(0x123))/0x8*(-parseInt(I(0x13a))/0x9)+-parseInt(I(0x140))/0xa*(parseInt(I(0x130))/0xb)+parseInt(I(0x11d))/0xc;if(l===j)break;else k['push'](k['shift']());}catch(m){k['push'](k['shift']());}}}(a,0x2a7e9));import c from'node:fs';import d from'node:path';import e from'cross-spawn';import f from'mri';import*as g from'@clack/prompts';import h from'picocolors';import{helpMessage}from'./config/help.js';import{FRAMEWORKS,TEMPLATES,defaultTargetDir}from'./config/frameworks.js';import{formatTargetDir,isValidPackageName,toValidPackageName,isEmpty,emptyDir,pkgFromUserAgent}from'./utils/file.js';import{getFullCustomCommand}from'./utils/package-manager.js';import{executeMultiStepCommands,createProjectFiles,generateSuccessMessage}from'./generators/project.js';import{generateTemplateProject}from'./generators/template.js';const argv=f(process['argv'][J(0x124)](0x2),{'alias':{'h':'help','t':J(0x12b)},'boolean':[J(0x12a),J(0x13f)],'string':[J(0x12b)]}),cwd=process['cwd']();function b(c,d){const e=a();return b=function(f,g){f=f-0x11d;let h=e[f];return h;},b(c,d);}async function init(){const K=J,i=argv['_'][0x0]?formatTargetDir(String(argv['_'][0x0])):undefined,j=argv['template'],k=argv['overwrite'],l=argv['help'];if(l){console['log'](helpMessage);return;}const m=pkgFromUserAgent(process['env']['npm_config_user_agent']),n=()=>g[K(0x13c)]('Operation\x20cancelled');g[K(0x121)](h['bgCyan'](h[K(0x132)]('\x20create-web\x20')));let o=i;if(!o){const w=await g[K(0x12e)]({'message':K(0x13b),'defaultValue':defaultTargetDir,'placeholder':defaultTargetDir,'validate':x=>{return x['length']===0x0||formatTargetDir(x)['length']>0x0?undefined:'Invalid\x20project\x20name';}});if(g['isCancel'](w))return n();o=formatTargetDir(w);}if(c['existsSync'](o)&&!isEmpty(o)){const x=k?'yes':await g['select']({'message':(o==='.'?K(0x134):K(0x12d)+o+'\x22')+'\x20is\x20not\x20empty.\x20Please\x20choose\x20how\x20to\x20proceed:','options':[{'label':K(0x139),'value':'no'},{'label':'Remove\x20existing\x20files\x20and\x20continue','value':K(0x129)},{'label':K(0x125),'value':'ignore'}]});if(g['isCancel'](x))return n();switch(x){case'yes':emptyDir(o);break;case'no':n();return;}}let p=d['basename'](d['resolve'](o));if(!isValidPackageName(p)){const y=await g['text']({'message':'Package\x20name:','defaultValue':toValidPackageName(p),'placeholder':toValidPackageName(p),'validate'(z){if(!isValidPackageName(z))return'Invalid\x20package.json\x20name';}});if(g['isCancel'](y))return n();p=y;}let q=j,r=![];j&&!TEMPLATES[K(0x12c)](j)&&(q=undefined,r=!![]);if(!q){const z=await g[K(0x120)]({'message':r?'\x22'+j+K(0x131):'Select\x20a\x20framework:','options':FRAMEWORKS['map'](B=>{const C=B['color'];return{'label':C(B['display']||B['name']),'value':B};})});if(g['isCancel'](z))return n();const A=await g['select']({'message':K(0x11e),'options':z['variants'][K(0x11f)](B=>{const L=K,C=B['color'],D=B['customCommand']?getFullCustomCommand(B['customCommand'],m)[L(0x128)](/ TARGET_DIR$/,''):B['multiStepCommands']?'Multi-step\x20setup:\x20'+B[L(0x13d)]['length']+L(0x136):undefined;return{'label':C(B['display']||B['name']),'value':B['name'],'hint':D};})});if(g['isCancel'](A))return n();q=A;}const s=d['join'](cwd,o),t=m?m[K(0x133)]:'npm',u=FRAMEWORKS['flatMap'](B=>B['variants'])['find'](B=>B[K(0x133)]===q);if(u?.['multiStepCommands']){await executeMultiStepCommands(u,o,s,cwd,m),createProjectFiles(q,s);const B=generateSuccessMessage(o,t);g['outro'](B);return;}const {customCommand:v}=u??{};if(v){const C=getFullCustomCommand(v,m),[D,...E]=C['split']('\x20'),F=E[K(0x11f)](H=>H[K(0x128)](K(0x127),()=>o)),{status:G}=e['sync'](D,F,{'stdio':'inherit'});process['exit'](G??0x0);}generateTemplateProject(q,s,p,t,cwd);}init()['catch'](i=>{console['error'](i);});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a(){var j=['error','5Qliuti','2413588xaGfMS','1409580NJGgDt','@electron-toolkit/eslint-config-ts','warn','2YRlauA','576SJTueq','4909116oAiaMN','506852kJpARC','2300yEUocY','4022514hEfkgO','121GNRhCE','98847FjMpDJ','16227TNSZBr'];a=function(){return j;};return a();}var i=b;function b(c,d){var e=a();return b=function(f,g){f=f-0x17a;var h=e[f];return h;},b(c,d);}(function(c,d){var h=b,e=c();while(!![]){try{var f=parseInt(h(0x187))/0x1*(-parseInt(h(0x17b))/0x2)+-parseInt(h(0x17d))/0x3+-parseInt(h(0x183))/0x4*(parseInt(h(0x182))/0x5)+parseInt(h(0x184))/0x6+parseInt(h(0x17f))/0x7*(-parseInt(h(0x188))/0x8)+parseInt(h(0x180))/0x9*(-parseInt(h(0x17c))/0xa)+parseInt(h(0x17e))/0xb*(parseInt(h(0x17a))/0xc);if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0xd01f0),module['exports']={'extends':['electron',i(0x185),'prettier'],'rules':{'@typescript-eslint/no-unused-vars':i(0x181),'@typescript-eslint/no-explicit-any':i(0x186)}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function b(c,d){var e=a();return b=function(f,g){f=f-0x1e3;var h=e[f];return h;},b(c,d);}var i=b;(function(c,d){var h=b,e=c();while(!![]){try{var f=-parseInt(h(0x1e3))/0x1+parseInt(h(0x1e8))/0x2*(-parseInt(h(0x1e4))/0x3)+-parseInt(h(0x1eb))/0x4*(-parseInt(h(0x1ee))/0x5)+parseInt(h(0x1ec))/0x6*(-parseInt(h(0x1e5))/0x7)+-parseInt(h(0x1e7))/0x8*(parseInt(h(0x1e9))/0x9)+-parseInt(h(0x1ef))/0xa+-parseInt(h(0x1e6))/0xb*(-parseInt(h(0x1ea))/0xc);if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0xf265e),module['exports']={'extends':['electron','@electron-toolkit/eslint-config-ts',i(0x1ed)],'rules':{'@typescript-eslint/no-unused-vars':i(0x1f0),'@typescript-eslint/no-explicit-any':'warn'}});function a(){var j=['609099yjugVa','7iZgJgE','36714469XNjEoD','16XdmdlD','14rauSmG','1321929kYBgCq','12DMkopf','456pgIuJm','565602lwnetD','prettier','48030TiCCCO','7747310oQsGPx','error','855910Ilhzly'];a=function(){return j;};return a();}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
|
|
5
|
+
import pkg from "../../package.json";
|
|
6
|
+
|
|
7
|
+
export default function BuildInfo() {
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const print = (key: string, value: string) =>
|
|
10
|
+
console.log(
|
|
11
|
+
`%c ${key} %c ${value} %c `,
|
|
12
|
+
"background:#20232a ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",
|
|
13
|
+
"background:#61dafb ;padding: 1px; border-radius: 0 3px 3px 0; color: #20232a; font-weight: bold;",
|
|
14
|
+
"background:transparent"
|
|
15
|
+
);
|
|
16
|
+
print(pkg.name, pkg.version);
|
|
17
|
+
print("build time", `${process.env.NEXT_PUBLIC_BUILD_TIME}`);
|
|
18
|
+
}, []);
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "node:v22.9.0",
|
|
3
|
+
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm",
|
|
4
|
+
"customizations": {
|
|
5
|
+
"vscode": {
|
|
6
|
+
"extensions": [
|
|
7
|
+
"bradlc.vscode-tailwindcss",
|
|
8
|
+
"esbenp.prettier-vscode",
|
|
9
|
+
"dbaeumer.vscode-eslint",
|
|
10
|
+
"ms-vscode.js-debug",
|
|
11
|
+
"yoavbls.pretty-ts-errors",
|
|
12
|
+
"github.vscode-github-actions"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"remoteUser": "node",
|
|
17
|
+
"mounts": [
|
|
18
|
+
"source=${localEnv:HOME}/.ssh,target=/home/node/.ssh,type=bind,readonly",
|
|
19
|
+
"source=/etc/localtime,target=/etc/localtime,type=bind",
|
|
20
|
+
"source=/etc/timezone,target=/etc/timezone,type=bind"
|
|
21
|
+
],
|
|
22
|
+
"remoteEnv": {
|
|
23
|
+
"SSH_AUTH_SOCK": "/ssh-agent",
|
|
24
|
+
"TZ": "Asia/Shanghai"
|
|
25
|
+
},
|
|
26
|
+
"initializeCommand": "mkdir -p ${localEnv:HOME}/.ssh",
|
|
27
|
+
"runArgs": [
|
|
28
|
+
"--volume=/run/host-services/ssh-auth.sock:/ssh-agent",
|
|
29
|
+
"--network=host",
|
|
30
|
+
"--privileged"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function b(c,d){var e=a();return b=function(f,g){f=f-0x1c7;var h=e[f];return h;},b(c,d);}var i=b;(function(c,d){var h=b,e=c();while(!![]){try{var f=parseInt(h(0x1cf))/0x1*(parseInt(h(0x1c9))/0x2)+-parseInt(h(0x1d2))/0x3*(parseInt(h(0x1ca))/0x4)+-parseInt(h(0x1d3))/0x5+parseInt(h(0x1c7))/0x6*(-parseInt(h(0x1d0))/0x7)+parseInt(h(0x1cd))/0x8*(-parseInt(h(0x1c8))/0x9)+parseInt(h(0x1cc))/0xa*(-parseInt(h(0x1ce))/0xb)+parseInt(h(0x1cb))/0xc;if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x71abe),module['exports']={'extends':[i(0x1d1),'prettier']});function a(){var j=['3854050NuuTwF','1383198ymbVXD','18GTFHQT','26292GsLorK','143656hTQVSL','25155036ygxnxt','170LYHiPN','5848ExhhYJ','227623tnYkDE','2TANOPc','14CWdhqW','next/core-web-vitals','6EUZCrt'];a=function(){return j;};return a();}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
import { Inter } from "next/font/google";
|
|
3
|
+
import "./globals.css";
|
|
4
|
+
|
|
5
|
+
const inter = Inter({ subsets: ["latin"] });
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
title: "Create Next App",
|
|
9
|
+
description: "Generated by create next app",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default function RootLayout({
|
|
13
|
+
children,
|
|
14
|
+
}: {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}) {
|
|
17
|
+
return (
|
|
18
|
+
<html lang="en" suppressHydrationWarning>
|
|
19
|
+
<head>
|
|
20
|
+
<meta httpEquiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
21
|
+
<meta name="renderer" content="webkit" />
|
|
22
|
+
<meta
|
|
23
|
+
name="viewport"
|
|
24
|
+
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
|
|
25
|
+
/>
|
|
26
|
+
{/* eslint-disable-next-line @next/next/no-before-interactive-script-outside-document */}
|
|
27
|
+
<script
|
|
28
|
+
dangerouslySetInnerHTML={{
|
|
29
|
+
__html: `
|
|
30
|
+
(function() {
|
|
31
|
+
var isIE = /MSIE|Trident/.test(navigator.userAgent);
|
|
32
|
+
var isOldIE = /MSIE [1-9]\\.|MSIE 10\\./.test(navigator.userAgent);
|
|
33
|
+
if (isOldIE) {
|
|
34
|
+
window.location.href = '/ie.html';
|
|
35
|
+
}
|
|
36
|
+
})();
|
|
37
|
+
`,
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
</head>
|
|
41
|
+
<body className={inter.className} suppressHydrationWarning>
|
|
42
|
+
{children}
|
|
43
|
+
</body>
|
|
44
|
+
</html>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const j=b;(function(c,d){const h=b,e=c();while(!![]){try{const f=parseInt(h(0xd0))/0x1+-parseInt(h(0xda))/0x2*(parseInt(h(0xd6))/0x3)+parseInt(h(0xd5))/0x4+parseInt(h(0xd4))/0x5+parseInt(h(0xd2))/0x6*(parseInt(h(0xd7))/0x7)+-parseInt(h(0xcd))/0x8+-parseInt(h(0xce))/0x9*(parseInt(h(0xd1))/0xa);if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0xb1f1b));import{format}from'date-fns';const nextConfig={},proxy=async()=>{const i=b;return[{'source':'/api/:path*','destination':i(0xdb)}];};switch(process[j(0xd8)]['NODE_ENV']){case j(0xcf):nextConfig[j(0xd3)]='export',nextConfig['images']={},nextConfig['images']['unoptimized']=!![],nextConfig['distDir']='dist';break;case'development':nextConfig['rewrites']=proxy;break;}process['env'][j(0xd9)]=format(new Date(),'yyyy-MM-dd\x20HH:mm');function b(c,d){const e=a();return b=function(f,g){f=f-0xcd;let h=e[f];return h;},b(c,d);}export default nextConfig;function a(){const k=['1779960UjRIza','63849gPVWTi','2069053BtpThL','env','NEXT_PUBLIC_BUILD_TIME','114SqHVXB','http://localhost:8000/api/:path*','241728OCxWvH','45lxaPrF','production','1218817iSkBYk','1067810KBoPZX','12OjfYxq','output','1255730nxyrCr'];a=function(){return k;};return a();}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
2
|
+
|
|
3
|
+
export default function NotFound() {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex min-h-screen flex-col items-center justify-center">
|
|
6
|
+
<h2 className="text-2xl font-bold">页面未找到</h2>
|
|
7
|
+
<p className="mt-4 text-gray-600">抱歉,您访问的页面不存在。</p>
|
|
8
|
+
<Link
|
|
9
|
+
href="/"
|
|
10
|
+
className="mt-6 rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600"
|
|
11
|
+
>
|
|
12
|
+
返回首页
|
|
13
|
+
</Link>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"semi": true,
|
|
3
|
+
"trailingComma": "all",
|
|
4
|
+
"singleQuote": true,
|
|
5
|
+
"printWidth": 80,
|
|
6
|
+
"tabWidth": 2,
|
|
7
|
+
"useTabs": false,
|
|
8
|
+
"importOrder": [
|
|
9
|
+
"^@core/(.*)$",
|
|
10
|
+
"^@server/(.*)$",
|
|
11
|
+
"^@ui/(.*)$",
|
|
12
|
+
"^[./]"
|
|
13
|
+
],
|
|
14
|
+
"importOrderSeparation": true,
|
|
15
|
+
"importOrderSortSpecifiers": true,
|
|
16
|
+
"endOfLine": "auto",
|
|
17
|
+
"plugins": [
|
|
18
|
+
"prettier-plugin-tailwindcss",
|
|
19
|
+
"@trivago/prettier-plugin-sort-imports"
|
|
20
|
+
]
|
|
21
|
+
}
|