create-antd-layout 1.0.8 → 1.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.
Files changed (72) hide show
  1. package/bin/index.js +28 -71
  2. package/package.json +1 -1
  3. package/templates/antd-layout-vite-max/LICENSE +21 -0
  4. package/templates/antd-layout-vite-max/README.md +73 -0
  5. package/templates/antd-layout-vite-max/eslint.config.js +23 -0
  6. package/templates/antd-layout-vite-max/index.html +13 -0
  7. package/templates/antd-layout-vite-max/package-lock.json +3269 -0
  8. package/templates/antd-layout-vite-max/package.json +41 -0
  9. package/templates/antd-layout-vite-max/public/favicon.svg +10 -0
  10. package/templates/antd-layout-vite-max/public/images/visitiors.webp +0 -0
  11. package/templates/antd-layout-vite-max/public/svg/project/p1.svg +1 -0
  12. package/templates/antd-layout-vite-max/public/svg/project/p2.svg +1 -0
  13. package/templates/antd-layout-vite-max/public/svg/project/p3.svg +1 -0
  14. package/templates/antd-layout-vite-max/public/svg/project/p4.svg +1 -0
  15. package/templates/antd-layout-vite-max/public/svg/project/p5.svg +1 -0
  16. package/templates/antd-layout-vite-max/public/svg/project/p6.svg +1 -0
  17. package/templates/antd-layout-vite-max/public/svg/project/p7.svg +1 -0
  18. package/templates/antd-layout-vite-max/public/svg/project/p8.svg +1 -0
  19. package/templates/antd-layout-vite-max/public/vite.svg +1 -0
  20. package/templates/antd-layout-vite-max/src/App.css +3 -0
  21. package/templates/antd-layout-vite-max/src/App.tsx +18 -0
  22. package/templates/antd-layout-vite-max/src/assets/react.svg +1 -0
  23. package/templates/antd-layout-vite-max/src/components/AppChart.tsx +121 -0
  24. package/templates/antd-layout-vite-max/src/components/LanguageButton.tsx +57 -0
  25. package/templates/antd-layout-vite-max/src/components/PopoverPanel.tsx +182 -0
  26. package/templates/antd-layout-vite-max/src/components/ThemeButton.tsx +69 -0
  27. package/templates/antd-layout-vite-max/src/components/WardenLogo.tsx +35 -0
  28. package/templates/antd-layout-vite-max/src/components/typings.ts +5 -0
  29. package/templates/antd-layout-vite-max/src/index.css +17 -0
  30. package/templates/antd-layout-vite-max/src/layouts/index.tsx +72 -0
  31. package/templates/antd-layout-vite-max/src/layouts/menuData.tsx +45 -0
  32. package/templates/antd-layout-vite-max/src/locales/en-US/components.ts +42 -0
  33. package/templates/antd-layout-vite-max/src/locales/en-US/menus.ts +26 -0
  34. package/templates/antd-layout-vite-max/src/locales/en-US/pages.ts +158 -0
  35. package/templates/antd-layout-vite-max/src/locales/en-US.ts +53 -0
  36. package/templates/antd-layout-vite-max/src/locales/zh-CN/components.ts +42 -0
  37. package/templates/antd-layout-vite-max/src/locales/zh-CN/menus.ts +26 -0
  38. package/templates/antd-layout-vite-max/src/locales/zh-CN/pages.ts +158 -0
  39. package/templates/antd-layout-vite-max/src/locales/zh-CN.ts +53 -0
  40. package/templates/antd-layout-vite-max/src/main.tsx +10 -0
  41. package/templates/antd-layout-vite-max/src/pages/404.tsx +14 -0
  42. package/templates/antd-layout-vite-max/src/pages/login.tsx +86 -0
  43. package/templates/antd-layout-vite-max/src/pages/system/organizations/components.tsx +160 -0
  44. package/templates/antd-layout-vite-max/src/pages/system/organizations/dept.tsx +284 -0
  45. package/templates/antd-layout-vite-max/src/pages/system/organizations/user.tsx +223 -0
  46. package/templates/antd-layout-vite-max/src/pages/system/security/components.tsx +239 -0
  47. package/templates/antd-layout-vite-max/src/pages/system/security/firewall.tsx +211 -0
  48. package/templates/antd-layout-vite-max/src/pages/system/security/permission.tsx +295 -0
  49. package/templates/antd-layout-vite-max/src/pages/system/security/role.tsx +212 -0
  50. package/templates/antd-layout-vite-max/src/pages/system/settings.tsx +133 -0
  51. package/templates/antd-layout-vite-max/src/pages/transaction/components.tsx +408 -0
  52. package/templates/antd-layout-vite-max/src/pages/transaction/order.tsx +261 -0
  53. package/templates/antd-layout-vite-max/src/pages/transaction/product.tsx +244 -0
  54. package/templates/antd-layout-vite-max/src/pages/typings.ts +166 -0
  55. package/templates/antd-layout-vite-max/src/pages/workbench/monitoring/components.tsx +483 -0
  56. package/templates/antd-layout-vite-max/src/pages/workbench/monitoring/index.module.css +11 -0
  57. package/templates/antd-layout-vite-max/src/pages/workbench/monitoring/index.tsx +35 -0
  58. package/templates/antd-layout-vite-max/src/pages/workbench/notifications.tsx +178 -0
  59. package/templates/antd-layout-vite-max/src/pages/workbench/report/components.tsx +312 -0
  60. package/templates/antd-layout-vite-max/src/pages/workbench/report/sales.module.css +36 -0
  61. package/templates/antd-layout-vite-max/src/pages/workbench/report/sales.tsx +37 -0
  62. package/templates/antd-layout-vite-max/src/pages/workbench/report/visit.tsx +228 -0
  63. package/templates/antd-layout-vite-max/src/pages/workbench/welcome/components.tsx +535 -0
  64. package/templates/antd-layout-vite-max/src/pages/workbench/welcome/index.module.css +92 -0
  65. package/templates/antd-layout-vite-max/src/pages/workbench/welcome/index.tsx +39 -0
  66. package/templates/antd-layout-vite-max/src/routes.ts +75 -0
  67. package/templates/antd-layout-vite-max/src/utils/printUtil.ts +71 -0
  68. package/templates/antd-layout-vite-max/src/utils/stringUtil.ts +46 -0
  69. package/templates/antd-layout-vite-max/tsconfig.app.json +33 -0
  70. package/templates/antd-layout-vite-max/tsconfig.json +7 -0
  71. package/templates/antd-layout-vite-max/tsconfig.node.json +26 -0
  72. package/templates/antd-layout-vite-max/vite.config.ts +13 -0
package/bin/index.js CHANGED
@@ -13,9 +13,23 @@ const execa_1 = require("execa");
13
13
  const inquirer_1 = __importDefault(require("inquirer"));
14
14
  const degit_1 = __importDefault(require("degit"));
15
15
  const TEMPLATES = [
16
- { name: "SPA + Vite (Simple)", value: "antd-layout-vite-simple", type: "local" },
17
- { name: "SPA + Vite (Max)", value: "antd-layout-vite-max", type: "private", repo: "zhouwenqi/adminui-demo-antd-layout-max" },
18
- { name: "SSR + Next (Pro)", value: "antd-layout-pro", type: "public", repo: "zhouwenqi/adminui-demo-antd-layout-pro" },
16
+ {
17
+ name: "SPA + Vite (Simple)",
18
+ value: "antd-layout-vite-simple",
19
+ type: "local",
20
+ },
21
+ {
22
+ name: "SPA + Vite (Max)",
23
+ value: "antd-layout-vite-max",
24
+ type: "remote",
25
+ repo: "https://github.com/zhouwenqi/adminui-demo-antd-layout-max.git",
26
+ },
27
+ {
28
+ name: "SSR + Next (Pro)",
29
+ value: "antd-layout-pro",
30
+ type: "remote",
31
+ repo: "https://github.com/zhouwenqi/adminui-demo-antd-layout-pro.git",
32
+ },
19
33
  ];
20
34
  const PACKAGE_MANAGERS = [
21
35
  { name: 'npm', value: 'npm' },
@@ -61,7 +75,7 @@ ${packageManager} install`));
61
75
  const program = new commander_1.Command();
62
76
  program
63
77
  .name('create-antd-layout')
64
- .description("Create a new antd-layout project from local, private (via Deploy Key), or public templates")
78
+ .description("Create a new antd-layout project from local or remote templates")
65
79
  .version("1.0.0")
66
80
  .argument("<project-directory>", 'Project directory name')
67
81
  .action(async (projectDir) => {
@@ -82,14 +96,14 @@ program
82
96
  ]);
83
97
  const selectedValue = answers.template;
84
98
  const template = TEMPLATES.find(t => t.value === selectedValue);
85
- let copySpinner = (0, ora_1.default)();
86
- if (template.type === "local") {
99
+ let copySpinner;
100
+ if (template.type === 'local') {
87
101
  const templatePath = path_1.default.join(__dirname, `../templates/${template.value}`);
88
102
  if (!fs_extra_1.default.existsSync(templatePath)) {
89
103
  console.error(chalk_1.default.red(`❌ Local template '${template.value}' does not exist in templates/ directory.`));
90
104
  process.exit(1);
91
105
  }
92
- copySpinner.start(`Copying local template "${template.value}"...`);
106
+ copySpinner = (0, ora_1.default)(`Copying local template "${template.value}"...`).start();
93
107
  try {
94
108
  await fs_extra_1.default.copy(templatePath, targetDir);
95
109
  copySpinner.succeed(`Local template "${template.value}" copied!`);
@@ -100,70 +114,12 @@ program
100
114
  process.exit(1);
101
115
  }
102
116
  }
103
- else if (template.type === "private") {
104
- // 提示用户输入 Deploy Key(私钥内容)
105
- const keyAnswer = await inquirer_1.default.prompt([
106
- {
107
- type: 'editor',
108
- name: 'sshKey',
109
- message: 'Paste your SSH Deploy Key (private key content):',
110
- validate: (input) => {
111
- const trimmed = input.trim();
112
- if (!trimmed)
113
- return 'Private key is required.';
114
- if (!trimmed.startsWith('-----BEGIN'))
115
- return 'Invalid SSH private key format.';
116
- return true;
117
- },
118
- },
119
- ]);
120
- const sshKey = keyAnswer.sshKey.trim();
121
- const tempSshDir = path_1.default.join(targetDir, '.temp-ssh');
122
- const keyPath = path_1.default.join(tempSshDir, 'id_ed25519');
123
- const configPath = path_1.default.join(tempSshDir, 'ssh_config');
124
- // 创建临时 SSH 目录
125
- await fs_extra_1.default.mkdir(tempSshDir, { recursive: true });
126
- await fs_extra_1.default.writeFile(keyPath, sshKey, { mode: 0o600 });
127
- await fs_extra_1.default.writeFile(configPath, `
128
- Host github-deploy
129
- HostName github.com
130
- User git
131
- IdentityFile ${keyPath}
132
- IdentitiesOnly yes
133
- StrictHostKeyChecking no
134
- `.trim());
135
- const repoUrl = `git@github-deploy:${template.repo}.git`;
136
- copySpinner.start(`Cloning private template from ${template.repo} via Deploy Key...`);
137
- try {
138
- await (0, execa_1.execa)('git', ['clone', repoUrl, targetDir], {
139
- stdio: 'ignore',
140
- env: {
141
- ...process.env,
142
- GIT_SSH_COMMAND: `ssh -F ${configPath}`,
143
- },
144
- });
145
- await fs_extra_1.default.remove(path_1.default.join(targetDir, '.git'));
146
- await fs_extra_1.default.remove(tempSshDir);
147
- copySpinner.succeed(`Private template cloned successfully!`);
148
- }
149
- catch (err) {
150
- copySpinner.fail("Failed to clone private template.");
151
- if (err.stderr?.includes('Permission denied') || err.message?.includes('Authentication failed')) {
152
- console.error(chalk_1.default.red('❌ Invalid Deploy Key or repository not found.'));
153
- console.error(chalk_1.default.yellow('Make sure:'));
154
- console.error(chalk_1.default.yellow(' - The Deploy Key is added to the GitHub repo (Settings → Deploy keys)'));
155
- console.error(chalk_1.default.yellow(' - The key has read-only access (no need for "write" permission)'));
156
- }
157
- else {
158
- console.error(err);
159
- }
160
- if (fs_extra_1.default.existsSync(tempSshDir))
161
- await fs_extra_1.default.remove(tempSshDir);
117
+ else if (template.type === 'remote') {
118
+ if (!template.repo) {
119
+ console.error(chalk_1.default.red(`❌ Remote template '${template.value}' missing repo field.`));
162
120
  process.exit(1);
163
121
  }
164
- }
165
- else if (template.type === "public") {
166
- copySpinner.start(`Downloading public template from ${template.repo}...`);
122
+ copySpinner = (0, ora_1.default)(`Downloading remote template from ${template.repo}...`).start();
167
123
  try {
168
124
  const emitter = (0, degit_1.default)(template.repo, {
169
125
  cache: false,
@@ -171,10 +127,10 @@ Host github-deploy
171
127
  verbose: false,
172
128
  });
173
129
  await emitter.clone(targetDir);
174
- copySpinner.succeed(`Public template from ${template.repo} downloaded!`);
130
+ copySpinner.succeed(`Remote template from ${template.repo} downloaded!`);
175
131
  }
176
132
  catch (err) {
177
- copySpinner.fail("Failed to download public template.");
133
+ copySpinner.fail("Failed to download remote template.");
178
134
  console.error(err);
179
135
  process.exit(1);
180
136
  }
@@ -205,6 +161,7 @@ Host github-deploy
205
161
  🚀 To start:`);
206
162
  console.log(` cd ${projectDir}`);
207
163
  console.log(` ${packageManager === 'yarn' ? 'yarn dev' : `${packageManager} run dev`}`);
164
+ // 可选:自动启动 dev(可注释掉)
208
165
  try {
209
166
  if (packageManager === 'yarn') {
210
167
  await (0, execa_1.execa)('yarn', ['dev'], { cwd: targetDir, stdio: 'inherit' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-antd-layout",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "this is create project for @adminui-dev/antd-layout's template proejct",
5
5
  "keywords": [
6
6
  "create-antd-layout",
@@ -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="/favicon.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>