create-antd-layout 1.0.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.
Files changed (28) hide show
  1. package/bin/index.js +130 -0
  2. package/package.json +49 -0
  3. package/templates/antd-layout-vite-simple/LICENSE +21 -0
  4. package/templates/antd-layout-vite-simple/README.md +73 -0
  5. package/templates/antd-layout-vite-simple/eslint.config.js +23 -0
  6. package/templates/antd-layout-vite-simple/index.html +13 -0
  7. package/templates/antd-layout-vite-simple/package-lock.json +3269 -0
  8. package/templates/antd-layout-vite-simple/package.json +39 -0
  9. package/templates/antd-layout-vite-simple/public/vite.svg +1 -0
  10. package/templates/antd-layout-vite-simple/src/App.css +3 -0
  11. package/templates/antd-layout-vite-simple/src/App.tsx +21 -0
  12. package/templates/antd-layout-vite-simple/src/assets/react.svg +1 -0
  13. package/templates/antd-layout-vite-simple/src/components/PopoverPanel.tsx +178 -0
  14. package/templates/antd-layout-vite-simple/src/components/ThemeButton.tsx +35 -0
  15. package/templates/antd-layout-vite-simple/src/index.css +17 -0
  16. package/templates/antd-layout-vite-simple/src/layouts/index.tsx +68 -0
  17. package/templates/antd-layout-vite-simple/src/main.tsx +10 -0
  18. package/templates/antd-layout-vite-simple/src/pages/login.tsx +7 -0
  19. package/templates/antd-layout-vite-simple/src/pages/system/config.tsx +72 -0
  20. package/templates/antd-layout-vite-simple/src/pages/system/logs.tsx +41 -0
  21. package/templates/antd-layout-vite-simple/src/pages/welcome.tsx +27 -0
  22. package/templates/antd-layout-vite-simple/src/pages/workend/order.tsx +24 -0
  23. package/templates/antd-layout-vite-simple/src/pages/workend/product.tsx +117 -0
  24. package/templates/antd-layout-vite-simple/src/routes.ts +39 -0
  25. package/templates/antd-layout-vite-simple/tsconfig.app.json +33 -0
  26. package/templates/antd-layout-vite-simple/tsconfig.json +7 -0
  27. package/templates/antd-layout-vite-simple/tsconfig.node.json +26 -0
  28. package/templates/antd-layout-vite-simple/vite.config.ts +13 -0
package/bin/index.js ADDED
@@ -0,0 +1,130 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const fs_extra_1 = __importDefault(require("fs-extra"));
10
+ const path_1 = __importDefault(require("path"));
11
+ const ora_1 = __importDefault(require("ora"));
12
+ const execa_1 = require("execa");
13
+ const inquirer_1 = __importDefault(require("inquirer"));
14
+ const TEMPLATES = [
15
+ { name: "SPA + Vite (Simple)", value: "antd-layout-vite-simple" },
16
+ { name: "SPA + Vite (Pro)", value: "antd-layout-vite-pro" },
17
+ { name: "SSR + Next (Minimal)", value: "antd-layout-next-minimal" },
18
+ ];
19
+ async function detectPackageManager() {
20
+ try {
21
+ await (0, execa_1.execa)('pnpm', ['--version'], { stdio: 'ignore' });
22
+ return 'pnpm';
23
+ }
24
+ catch {
25
+ try {
26
+ await (0, execa_1.execa)('yarn', ['--version'], { stdio: 'ignore' });
27
+ return 'yarn';
28
+ }
29
+ catch {
30
+ return 'npm';
31
+ }
32
+ }
33
+ }
34
+ const PACKAGE_MANAGERS = [
35
+ { name: 'npm', value: 'npm' },
36
+ { name: 'yarn', value: 'yarn' },
37
+ { name: 'pnpm', value: 'pnpm' },
38
+ ];
39
+ async function runInstall(packageManager, cwd) {
40
+ const installSpinner = (0, ora_1.default)(`Installing dependencies with ${packageManager}...`).start();
41
+ const commands = {
42
+ npm: ['install'],
43
+ yarn: [],
44
+ pnpm: ['install'],
45
+ };
46
+ try {
47
+ await (0, execa_1.execa)(packageManager, commands[packageManager], {
48
+ cwd,
49
+ stdio: 'ignore',
50
+ });
51
+ installSpinner.succeed(`Dependencies installed with ${packageManager}!`);
52
+ }
53
+ catch (error) {
54
+ installSpinner.fail(`Failed to install with ${packageManager}.`);
55
+ console.warn(chalk_1.default.yellow(`💡 Please run:\n cd ${path_1.default.basename(cwd)}\n ${packageManager} install`));
56
+ }
57
+ }
58
+ const program = new commander_1.Command();
59
+ program
60
+ .name('create-antd-layout')
61
+ .description("Create a new antd-layout project form local tempaltes")
62
+ .version("1.0.0")
63
+ .argument("<project-directory>", 'Project directory name')
64
+ .action(async (projectDir) => {
65
+ const targetDir = path_1.default.resolve(process.cwd(), projectDir);
66
+ if (fs_extra_1.default.existsSync(targetDir)) {
67
+ console.error(chalk_1.default.red(`❌ Directory '${projectDir}' already exists.`));
68
+ process.exit(1);
69
+ }
70
+ const answers = await inquirer_1.default.prompt([
71
+ {
72
+ type: "list",
73
+ name: "template",
74
+ message: 'Please choose a template',
75
+ choices: TEMPLATES,
76
+ default: TEMPLATES[0].value
77
+ },
78
+ ]);
79
+ const selectedTemplate = answers.template;
80
+ const templatePath = path_1.default.join(__dirname, `../templates/${selectedTemplate}`);
81
+ if (!fs_extra_1.default.existsSync(templatePath)) {
82
+ console.error(chalk_1.default.red(`❌ The template ${selectedTemplate}' does not exist. Please check the templates/directory.`));
83
+ process.exit(1);
84
+ }
85
+ const copySpinner = (0, ora_1.default)(`Copying template "${selectedTemplate}"...`).start();
86
+ try {
87
+ await fs_extra_1.default.copy(templatePath, targetDir);
88
+ copySpinner.succeed(`Template "${selectedTemplate}" copied!`);
89
+ }
90
+ catch (err) {
91
+ copySpinner.fail("Failed to cpy template.");
92
+ console.error(err);
93
+ process.exit(1);
94
+ }
95
+ const detected = await detectPackageManager();
96
+ const pmAnswer = await inquirer_1.default.prompt([
97
+ {
98
+ type: 'list',
99
+ name: 'packageManager',
100
+ message: 'Please choose package manager:',
101
+ choices: PACKAGE_MANAGERS,
102
+ default: detected,
103
+ },
104
+ ]);
105
+ const packageManager = pmAnswer.packageManager;
106
+ await runInstall(packageManager, targetDir);
107
+ console.log(chalk_1.default.green(`\n✅ Project created successfully!`));
108
+ console.log(`\n📁 Location: ${targetDir}`);
109
+ console.log(`\n🚀 To start:`);
110
+ console.log(` cd ${projectDir}`);
111
+ console.log(` npm run dev\n`);
112
+ try {
113
+ if (packageManager === 'yarn') {
114
+ await (0, execa_1.execa)('yarn', ['dev'], {
115
+ cwd: targetDir,
116
+ stdio: 'inherit',
117
+ });
118
+ }
119
+ else {
120
+ await (0, execa_1.execa)(packageManager, ['run', 'dev'], {
121
+ cwd: targetDir,
122
+ stdio: 'inherit',
123
+ });
124
+ }
125
+ }
126
+ catch (error) {
127
+ process.exit(0);
128
+ }
129
+ });
130
+ program.parse();
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "create-antd-layout",
3
+ "version": "1.0.0",
4
+ "description": "this is create project for @adminui-dev/antd-layout's template proejct",
5
+ "keywords": [
6
+ "create-antd-layout",
7
+ "antd-layout"
8
+ ],
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "license": "MIT",
13
+ "author": "zhouwenqi",
14
+ "bin": {
15
+ "create-antd-layout": "./bin/index.js"
16
+ },
17
+ "files": [
18
+ "bin",
19
+ "templates"
20
+ ],
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/zhouwenqi/create-antd-layout.git"
24
+ },
25
+ "homepage": "https://demo.adminui.dev",
26
+ "scripts": {
27
+ "build": "tsc",
28
+ "dev": "ts-node src/index.ts",
29
+ "test": "echo \"Error: no test specified\" && exit 1"
30
+ },
31
+ "dependencies": {
32
+ "chalk": "^4.1.2",
33
+ "commander": "^12.1.0",
34
+ "execa": "^9.5.1",
35
+ "fs-extra": "^11.0.0",
36
+ "inquirer": "^9.2.15",
37
+ "ora": "^8.1.0"
38
+ },
39
+ "devDependencies": {
40
+ "@types/fs-extra": "^11.0.4",
41
+ "@types/inquirer": "^9.0.7",
42
+ "@types/node": "^20.14.0",
43
+ "ts-node": "^10.9.2",
44
+ "typescript": "^5.5.0"
45
+ },
46
+ "engines": {
47
+ "node": ">=18"
48
+ }
49
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 zhouwenqi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,73 @@
1
+ # React + TypeScript + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## React Compiler
11
+
12
+ The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13
+
14
+ ## Expanding the ESLint configuration
15
+
16
+ If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
17
+
18
+ ```js
19
+ export default defineConfig([
20
+ globalIgnores(['dist']),
21
+ {
22
+ files: ['**/*.{ts,tsx}'],
23
+ extends: [
24
+ // Other configs...
25
+
26
+ // Remove tseslint.configs.recommended and replace with this
27
+ tseslint.configs.recommendedTypeChecked,
28
+ // Alternatively, use this for stricter rules
29
+ tseslint.configs.strictTypeChecked,
30
+ // Optionally, add this for stylistic rules
31
+ tseslint.configs.stylisticTypeChecked,
32
+
33
+ // Other configs...
34
+ ],
35
+ languageOptions: {
36
+ parserOptions: {
37
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
+ tsconfigRootDir: import.meta.dirname,
39
+ },
40
+ // other options...
41
+ },
42
+ },
43
+ ])
44
+ ```
45
+
46
+ You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
+
48
+ ```js
49
+ // eslint.config.js
50
+ import reactX from 'eslint-plugin-react-x'
51
+ import reactDom from 'eslint-plugin-react-dom'
52
+
53
+ export default defineConfig([
54
+ globalIgnores(['dist']),
55
+ {
56
+ files: ['**/*.{ts,tsx}'],
57
+ extends: [
58
+ // Other configs...
59
+ // Enable lint rules for React
60
+ reactX.configs['recommended-typescript'],
61
+ // Enable lint rules for React DOM
62
+ reactDom.configs.recommended,
63
+ ],
64
+ languageOptions: {
65
+ parserOptions: {
66
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
+ tsconfigRootDir: import.meta.dirname,
68
+ },
69
+ // other options...
70
+ },
71
+ },
72
+ ])
73
+ ```
@@ -0,0 +1,23 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import reactHooks from 'eslint-plugin-react-hooks'
4
+ import reactRefresh from 'eslint-plugin-react-refresh'
5
+ import tseslint from 'typescript-eslint'
6
+ import { defineConfig, globalIgnores } from 'eslint/config'
7
+
8
+ export default defineConfig([
9
+ globalIgnores(['dist']),
10
+ {
11
+ files: ['**/*.{ts,tsx}'],
12
+ extends: [
13
+ js.configs.recommended,
14
+ tseslint.configs.recommended,
15
+ reactHooks.configs.flat.recommended,
16
+ reactRefresh.configs.vite,
17
+ ],
18
+ languageOptions: {
19
+ ecmaVersion: 2020,
20
+ globals: globals.browser,
21
+ },
22
+ },
23
+ ])
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>adminui-demo-antd-layout-simple</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>