create-packer 1.37.1 → 1.38.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 (237) hide show
  1. package/package.json +3 -2
  2. package/template/cli/.prettierignore +6 -0
  3. package/template/cli/.prettierrc +18 -0
  4. package/template/cli/bin/createTemp.d.ts +1 -0
  5. package/template/cli/bin/createTemp.js +54 -0
  6. package/template/cli/bin/index.d.ts +2 -0
  7. package/template/cli/bin/index.js +4 -0
  8. package/template/cli/bin/utils/index.d.ts +10 -0
  9. package/template/cli/bin/utils/index.js +44 -0
  10. package/template/cli/package.json +54 -47
  11. package/template/docusaurus/.prettierignore +2 -0
  12. package/template/docusaurus/src/components/HomepageFeatures/index.tsx +70 -70
  13. package/template/docusaurus/src/components/HomepageFeatures/styles.module.css +11 -11
  14. package/template/docusaurus/src/css/custom.css +30 -30
  15. package/template/docusaurus/src/pages/index.module.css +23 -23
  16. package/template/docusaurus/src/pages/index.tsx +40 -40
  17. package/template/lib/workspace/.prettierignore +6 -0
  18. package/template/lib/workspace/.prettierrc +18 -0
  19. package/template/lib/workspace/package.json +73 -72
  20. package/template/lib/workspace/packages/react/package.json +41 -40
  21. package/template/lib/workspace/packages/ts/package.json +29 -28
  22. package/template/nest/package.json +84 -84
  23. package/template/nest/src/app.controller.spec.ts +22 -22
  24. package/template/nest/src/app.controller.ts +12 -12
  25. package/template/nest/src/app.module.ts +10 -10
  26. package/template/nest/src/app.service.ts +8 -8
  27. package/template/nest/src/main.ts +10 -10
  28. package/template/nest/src/utils/transform.interceptor.ts +26 -26
  29. package/template/nest/test/app.e2e-spec.ts +24 -24
  30. package/template/web-app/next/app/globals.css +22 -22
  31. package/template/web-app/next/app/layout.tsx +18 -18
  32. package/template/web-app/next/app/page.tsx +113 -113
  33. package/template/web-app/next/package.json +47 -47
  34. package/template/web-app/react-rsbuild/.prettierignore +6 -0
  35. package/template/web-app/react-rsbuild/.prettierrc +18 -0
  36. package/template/web-app/react-rsbuild/.vscode/extensions.json +8 -8
  37. package/template/web-app/react-rsbuild/.vscode/settings.json +4 -18
  38. package/template/web-app/react-rsbuild/domain/app/app.model.ts +7 -7
  39. package/template/web-app/react-rsbuild/domain/app/app.styled.ts +3 -3
  40. package/template/web-app/react-rsbuild/domain/app/components/app-context.tsx +17 -17
  41. package/template/web-app/react-rsbuild/domain/app/components/app.tsx +24 -24
  42. package/template/web-app/react-rsbuild/domain/app/components/index.ts +1 -1
  43. package/template/web-app/react-rsbuild/domain/app/index.ts +2 -2
  44. package/template/web-app/react-rsbuild/domain/router/home/ids.ts +3 -3
  45. package/template/web-app/react-rsbuild/domain/router/home/index.ts +2 -2
  46. package/template/web-app/react-rsbuild/domain/router/home/routes.tsx +13 -13
  47. package/template/web-app/react-rsbuild/domain/router/ids.ts +6 -6
  48. package/template/web-app/react-rsbuild/domain/router/index.ts +3 -3
  49. package/template/web-app/react-rsbuild/domain/router/router.tsx +28 -28
  50. package/template/web-app/react-rsbuild/domain/router/router.types.ts +3 -3
  51. package/template/web-app/react-rsbuild/env.d.ts +28 -28
  52. package/template/web-app/react-rsbuild/main.tsx +4 -4
  53. package/template/web-app/react-rsbuild/package.json +10 -11
  54. package/template/web-app/react-rsbuild/pages/home/home.styled.ts +7 -7
  55. package/template/web-app/react-rsbuild/pages/home/home.tsx +10 -10
  56. package/template/web-app/react-rsbuild/pages/home/index.ts +1 -1
  57. package/template/web-app/react-rsbuild/pages/index.tsx +18 -18
  58. package/template/web-app/react-rsbuild/pages/not-found.tsx +3 -3
  59. package/template/web-app/react-rsbuild/rsbuild.config.ts +78 -85
  60. package/template/web-app/react-rsbuild/scripts/createChunks.ts +26 -26
  61. package/template/web-app/react-rsbuild/scripts/index.ts +1 -1
  62. package/template/web-app/react-rsbuild/shared/hooks/defineRouter/defineRouter.types.ts +33 -33
  63. package/template/web-app/react-rsbuild/shared/hooks/defineRouter/index.ts +2 -2
  64. package/template/web-app/react-rsbuild/shared/hooks/index.ts +6 -6
  65. package/template/web-app/react-rsbuild/shared/hooks/useInterval.ts +26 -26
  66. package/template/web-app/react-rsbuild/shared/hooks/useLoadingAction.ts +27 -27
  67. package/template/web-app/react-rsbuild/shared/hooks/useLowPriorityState.ts +26 -26
  68. package/template/web-app/react-rsbuild/shared/hooks/useSyncState.ts +15 -15
  69. package/template/web-app/react-rsbuild/shared/hooks/useVisible.ts +27 -27
  70. package/template/web-app/react-rsbuild/shared/service/api.ts +1 -1
  71. package/template/web-app/react-rsbuild/shared/service/home.ts +8 -8
  72. package/template/web-app/react-rsbuild/shared/service/index.ts +3 -3
  73. package/template/web-app/react-rsbuild/shared/service/request.ts +5 -5
  74. package/template/web-app/react-rsbuild/shared/theme/index.ts +1 -1
  75. package/template/web-app/react-rsbuild/shared/theme/theme.styled.ts +56 -56
  76. package/template/web-app/react-rsbuild/shared/tools/componentInstance.tsx +80 -80
  77. package/template/web-app/react-rsbuild/shared/tools/index.ts +1 -1
  78. package/template/web-app/react-rsbuild/shared/types/index.ts +1 -1
  79. package/template/web-app/react-rsbuild/shared/types/utils.ts +2 -2
  80. package/template/web-app/react-rsbuild/tsconfig.json +32 -44
  81. package/template/web-app/react-rsbuild/tsconfig.node.json +10 -14
  82. package/template/web-app/react-vite/.prettierignore +6 -0
  83. package/template/web-app/react-vite/.prettierrc +18 -0
  84. package/template/web-app/react-vite/.vscode/extensions.json +1 -1
  85. package/template/web-app/react-vite/package.json +4 -4
  86. package/template/web-app/react-webpack/.prettierignore +6 -0
  87. package/template/web-app/react-webpack/.prettierrc +18 -0
  88. package/template/web-app/react-webpack/.vscode/extensions.json +8 -8
  89. package/template/web-app/react-webpack/.vscode/settings.json +4 -18
  90. package/template/web-app/react-webpack/commitlint.config.js +1 -1
  91. package/template/web-app/react-webpack/domain/app/app.model.ts +7 -7
  92. package/template/web-app/react-webpack/domain/app/app.styled.ts +3 -3
  93. package/template/web-app/react-webpack/domain/app/components/app-context.tsx +17 -17
  94. package/template/web-app/react-webpack/domain/app/components/app.tsx +24 -24
  95. package/template/web-app/react-webpack/domain/app/components/index.ts +1 -1
  96. package/template/web-app/react-webpack/domain/app/index.ts +2 -2
  97. package/template/web-app/react-webpack/domain/router/home/ids.ts +3 -3
  98. package/template/web-app/react-webpack/domain/router/home/index.ts +2 -2
  99. package/template/web-app/react-webpack/domain/router/home/routes.tsx +13 -13
  100. package/template/web-app/react-webpack/domain/router/ids.ts +6 -6
  101. package/template/web-app/react-webpack/domain/router/index.ts +3 -3
  102. package/template/web-app/react-webpack/domain/router/router.tsx +28 -28
  103. package/template/web-app/react-webpack/domain/router/router.types.ts +3 -3
  104. package/template/web-app/react-webpack/global.d.ts +26 -26
  105. package/template/web-app/react-webpack/index.css +3 -3
  106. package/template/web-app/react-webpack/main.tsx +4 -4
  107. package/template/web-app/react-webpack/package.json +87 -87
  108. package/template/web-app/react-webpack/pages/home/home.styled.ts +7 -7
  109. package/template/web-app/react-webpack/pages/home/home.tsx +10 -10
  110. package/template/web-app/react-webpack/pages/home/index.ts +1 -1
  111. package/template/web-app/react-webpack/pages/index.tsx +18 -18
  112. package/template/web-app/react-webpack/pages/not-found.tsx +3 -3
  113. package/template/web-app/react-webpack/postcss.config.js +7 -7
  114. package/template/web-app/react-webpack/shared/hooks/defineRouter/defineRouter.types.ts +33 -33
  115. package/template/web-app/react-webpack/shared/hooks/defineRouter/index.ts +2 -2
  116. package/template/web-app/react-webpack/shared/hooks/index.ts +6 -6
  117. package/template/web-app/react-webpack/shared/hooks/useInterval.ts +26 -26
  118. package/template/web-app/react-webpack/shared/hooks/useLoadingAction.ts +27 -27
  119. package/template/web-app/react-webpack/shared/hooks/useLowPriorityState.ts +26 -26
  120. package/template/web-app/react-webpack/shared/hooks/useSyncState.ts +15 -15
  121. package/template/web-app/react-webpack/shared/hooks/useVisible.ts +27 -27
  122. package/template/web-app/react-webpack/shared/service/home.ts +8 -8
  123. package/template/web-app/react-webpack/shared/service/index.ts +2 -2
  124. package/template/web-app/react-webpack/shared/service/request.ts +5 -5
  125. package/template/web-app/react-webpack/shared/theme/index.ts +1 -1
  126. package/template/web-app/react-webpack/shared/theme/theme.styled.ts +56 -56
  127. package/template/web-app/react-webpack/shared/tools/componentInstance.tsx +78 -78
  128. package/template/web-app/react-webpack/shared/tools/index.ts +1 -1
  129. package/template/web-app/react-webpack/shared/types/index.ts +1 -1
  130. package/template/web-app/react-webpack/shared/types/utils.ts +2 -2
  131. package/template/web-app/react-webpack/tsconfig.json +27 -38
  132. package/template/web-app/react-webpack/tsconfig.node.json +9 -9
  133. package/template/web-app/solid/package.json +51 -51
  134. package/template/web-app/solid/src/app.container.tsx +12 -12
  135. package/template/web-app/solid/src/index.css +15 -15
  136. package/template/web-app/solid/src/index.tsx +15 -15
  137. package/template/web-app/solid/src/layout/index.ts +1 -1
  138. package/template/web-app/solid/src/layout/layout.container.tsx +5 -5
  139. package/template/web-app/solid/src/pages/home/home.container.tsx +5 -5
  140. package/template/web-app/solid/src/pages/home/index.ts +1 -1
  141. package/template/web-app/solid/src/pages/notFound/index.ts +1 -1
  142. package/template/web-app/solid/src/pages/notFound/notFound.container.tsx +3 -3
  143. package/template/web-app/solid/src/router/home/index.ts +2 -2
  144. package/template/web-app/solid/src/router/home/paths.ts +3 -3
  145. package/template/web-app/solid/src/router/home/routes.tsx +12 -12
  146. package/template/web-app/solid/src/router/index.ts +2 -2
  147. package/template/web-app/solid/src/router/paths.ts +5 -5
  148. package/template/web-app/solid/src/router/routes.ts +16 -16
  149. package/template/web-app/svelte/.prettierignore +2 -0
  150. package/template/web-app/svelte/.prettierrc +14 -14
  151. package/template/web-app/svelte/.svelte-kit/ambient.d.ts +177 -153
  152. package/template/web-app/svelte/.svelte-kit/generated/client/app.js +23 -19
  153. package/template/web-app/svelte/.svelte-kit/generated/client/matchers.js +1 -1
  154. package/template/web-app/svelte/.svelte-kit/generated/client/nodes/0.js +1 -1
  155. package/template/web-app/svelte/.svelte-kit/generated/client/nodes/1.js +1 -1
  156. package/template/web-app/svelte/.svelte-kit/generated/client/nodes/2.js +1 -1
  157. package/template/web-app/svelte/.svelte-kit/generated/root.svelte +62 -56
  158. package/template/web-app/svelte/.svelte-kit/generated/server/internal.js +61 -30
  159. package/template/web-app/svelte/.svelte-kit/non-ambient.d.ts +23 -0
  160. package/template/web-app/svelte/.svelte-kit/tsconfig.json +32 -39
  161. package/template/web-app/svelte/.svelte-kit/types/route_meta_data.json +3 -3
  162. package/template/web-app/svelte/.svelte-kit/types/src/routes/$types.d.ts +35 -20
  163. package/template/web-app/svelte/.vscode/extensions.json +8 -8
  164. package/template/web-app/svelte/commitlint.config.cjs +1 -1
  165. package/template/web-app/svelte/package.json +55 -55
  166. package/template/web-app/svelte/scripts/createChunks.ts +26 -26
  167. package/template/web-app/svelte/scripts/index.ts +1 -1
  168. package/template/web-app/svelte/src/app.d.ts +12 -12
  169. package/template/web-app/svelte/src/routes/+page.svelte +2 -2
  170. package/template/web-app/svelte/svelte.config.js +17 -17
  171. package/template/web-app/svelte/tsconfig.json +21 -21
  172. package/template/web-app/svelte/vite-env.d.ts +11 -11
  173. package/template/web-app/svelte/vite.config.ts +55 -55
  174. package/template/web-app/vue/.prettierignore +6 -0
  175. package/template/web-app/vue/.prettierrc +18 -0
  176. package/template/web-app/vue/.vscode/extensions.json +1 -1
  177. package/template/web-app/vue/domain/app/components/app.vue +18 -18
  178. package/template/web-app/vue/package.json +4 -4
  179. package/template/web-app/vue/pages/home/home.vue +16 -16
  180. package/template/web-app/vue/pages/index.vue +3 -3
  181. package/template/web-app/vue/pages/not-found.vue +3 -3
  182. package/template/web-extension/.prettierignore +6 -0
  183. package/template/web-extension/.prettierrc +18 -0
  184. package/template/web-extension/.vscode/extensions.json +8 -8
  185. package/template/web-extension/.vscode/settings.json +4 -18
  186. package/template/web-extension/.wxt/eslintrc-auto-import.json +19 -19
  187. package/template/web-extension/.wxt/tsconfig.json +24 -27
  188. package/template/web-extension/.wxt/types/globals.d.ts +10 -10
  189. package/template/web-extension/.wxt/types/i18n.d.ts +80 -74
  190. package/template/web-extension/.wxt/types/imports.d.ts +17 -17
  191. package/template/web-extension/.wxt/types/paths.d.ts +12 -12
  192. package/template/web-extension/entrypoints/background/index.ts +1 -1
  193. package/template/web-extension/entrypoints/content/constants/base.ts +1 -1
  194. package/template/web-extension/entrypoints/content/constants/index.ts +1 -1
  195. package/template/web-extension/entrypoints/content/domain/app/index.ts +1 -1
  196. package/template/web-extension/entrypoints/content/domain/app/tools/index.ts +1 -1
  197. package/template/web-extension/entrypoints/content/domain/app/tools/insertApp.tsx +59 -55
  198. package/template/web-extension/entrypoints/content/index.tsx +12 -12
  199. package/template/web-extension/entrypoints/content/modules/common/common.tsx +10 -10
  200. package/template/web-extension/entrypoints/content/modules/common/index.ts +2 -2
  201. package/template/web-extension/entrypoints/content/modules/common/insert.tsx +9 -9
  202. package/template/web-extension/entrypoints/content/modules/index.ts +1 -1
  203. package/template/web-extension/entrypoints/popup/index.html +0 -1
  204. package/template/web-extension/entrypoints/popup/main.tsx +14 -14
  205. package/template/web-extension/entrypoints/popup/popup.container.tsx +3 -3
  206. package/template/web-extension/package.json +86 -87
  207. package/template/web-extension/shared/background/index.ts +1 -1
  208. package/template/web-extension/shared/background/message.ts +11 -11
  209. package/template/web-extension/shared/components/app-context.tsx +14 -14
  210. package/template/web-extension/shared/components/index.ts +1 -1
  211. package/template/web-extension/shared/content/index.ts +1 -1
  212. package/template/web-extension/shared/content/message.ts +15 -15
  213. package/template/web-extension/shared/hooks/index.ts +2 -2
  214. package/template/web-extension/shared/hooks/useSyncState.ts +15 -15
  215. package/template/web-extension/shared/hooks/useVisible.ts +27 -27
  216. package/template/web-extension/shared/popup/index.ts +1 -1
  217. package/template/web-extension/shared/popup/message.ts +12 -12
  218. package/template/web-extension/shared/service/index.ts +1 -1
  219. package/template/web-extension/shared/service/request.ts +5 -5
  220. package/template/web-extension/shared/styles/global.styled.ts +8 -8
  221. package/template/web-extension/shared/styles/index.ts +2 -2
  222. package/template/web-extension/shared/styles/theme.styled.ts +56 -56
  223. package/template/web-extension/shared/tools/index.ts +1 -1
  224. package/template/web-extension/shared/tools/message.ts +80 -80
  225. package/template/web-extension/shared/types/index.ts +1 -1
  226. package/template/web-extension/shared/types/utils.ts +3 -3
  227. package/template/web-extension/tsconfig.json +32 -32
  228. package/template/web-extension/tsconfig.node.json +10 -10
  229. package/template/web-extension/vite-env.d.ts +19 -19
  230. package/template/web-extension/wxt.config.ts +50 -46
  231. package/template/cli/biome.json +0 -40
  232. package/template/lib/workspace/biome.json +0 -40
  233. package/template/web-app/react-rsbuild/biome.json +0 -40
  234. package/template/web-app/react-vite/biome.json +0 -40
  235. package/template/web-app/react-webpack/biome.json +0 -40
  236. package/template/web-app/vue/biome.json +0 -40
  237. package/template/web-extension/biome.json +0 -40
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.37.1",
3
+ "version": "1.38.0",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -26,7 +26,6 @@
26
26
  "ora": "8.1.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@biomejs/biome": "1.9.2",
30
29
  "@commitlint/config-conventional": "^17.7.0",
31
30
  "@commitlint/cz-commitlint": "17.4.2",
32
31
  "@types/fs-extra": "9.0.12",
@@ -36,6 +35,7 @@
36
35
  "@typescript-eslint/parser": "7.0.2",
37
36
  "commitizen": "4.3.0",
38
37
  "eslint": "8.56.0",
38
+ "prettier": "3.2.5",
39
39
  "rimraf": "3.0.2",
40
40
  "typescript": "5.5.2"
41
41
  },
@@ -49,6 +49,7 @@
49
49
  "pub": "pnpm run build && pnpm run push && node ./scripts/pub.js",
50
50
  "test": "pnpm run build && rimraf ./__test__ && node ./bin __test__",
51
51
  "build": "rimraf ./bin && tsc",
52
+ "format": "pnpm -r run format",
52
53
  "clean:pkg": "pnpm -r exec rimraf node_modules",
53
54
  "commit": "git add . && cz",
54
55
  "push": "pnpm run commit && git push"
@@ -0,0 +1,6 @@
1
+ **/*.md
2
+ **/*.svg
3
+ **/*.ejs
4
+ **/*.html
5
+ .history
6
+ dist
@@ -0,0 +1,18 @@
1
+ {
2
+ "overrides": [
3
+ {
4
+ "files": ".prettierrc",
5
+ "options": { "parser": "json" }
6
+ }
7
+ ],
8
+ "printWidth": 100,
9
+ "tabWidth": 4,
10
+ "useTabs": false,
11
+ "semi": false,
12
+ "singleQuote": true,
13
+ "trailingComma": "none",
14
+ "bracketSpacing": true,
15
+ "bracketSameLine": false,
16
+ "arrowParens": "avoid",
17
+ "rangeStart": 0
18
+ }
@@ -0,0 +1 @@
1
+ export declare function createTemp(dirname: string): Promise<void>;
@@ -0,0 +1,54 @@
1
+ import chalk from 'chalk';
2
+ import * as inquirer from '@inquirer/prompts';
3
+ import * as fsExtra from 'fs-extra';
4
+ import path from 'path';
5
+ import { fileURLToPath } from 'url';
6
+ import ora from 'ora';
7
+ import { spawnSync } from 'child_process';
8
+ import { genTemplateInfoList, onGenCommand } from './utils/index.js';
9
+ import { existsSync } from 'fs';
10
+ const cwd = process.cwd();
11
+ const command = onGenCommand();
12
+ const dirname = path.dirname(fileURLToPath(import.meta.url));
13
+ const excludes = ['node_modules', 'yarn-error.log', 'dist'];
14
+ const tempRoot = path.join(dirname, '../template');
15
+ const tempInfoList = genTemplateInfoList(tempRoot);
16
+ function copyTempFile(tempPath, output) {
17
+ fsExtra.readdirSync(tempPath).map(name => {
18
+ if (!excludes.includes(name)) {
19
+ fsExtra.copySync(path.join(tempPath, name), path.join(output, name));
20
+ }
21
+ });
22
+ }
23
+ function createTempEnd(output) {
24
+ spawnSync(command, ['install'], {
25
+ cwd: output,
26
+ stdio: 'inherit'
27
+ });
28
+ }
29
+ export async function createTemp(dirname) {
30
+ const isCurrent = dirname === '.';
31
+ let answer = await inquirer.select({
32
+ message: 'Select temp.',
33
+ choices: tempInfoList.map(o => o.name)
34
+ });
35
+ let tempInfo = tempInfoList.find(o => o.name === answer);
36
+ if (tempInfo?.children && tempInfo.children.length > 0) {
37
+ answer = await inquirer.select({
38
+ message: 'Select temp type.',
39
+ choices: tempInfo.children.map(o => o.name)
40
+ });
41
+ tempInfo = tempInfo.children.find(o => o.name === answer);
42
+ }
43
+ const creating = ora(chalk.yellow('Creating...\n')).start();
44
+ const output = path.join(cwd, isCurrent ? '' : dirname);
45
+ if (!isCurrent && existsSync(output)) {
46
+ return console.log(chalk.red(`${dirname} already exists!`));
47
+ }
48
+ if (!isCurrent) {
49
+ fsExtra.mkdirSync(output);
50
+ }
51
+ copyTempFile(tempInfo.src, output);
52
+ createTempEnd(output);
53
+ creating.succeed();
54
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { createTemp } from './createTemp.js';
3
+ import { program } from 'commander';
4
+ program.argument('<dirname>', 'Create project.', dirname => createTemp(dirname)).parse(process.argv);
@@ -0,0 +1,10 @@
1
+ export declare function hasPnpm(): boolean;
2
+ export declare function hasYarn(): boolean;
3
+ export declare function onGenCommand(): "pnpm" | "yarn" | "npm";
4
+ interface tempInfoType {
5
+ name: string;
6
+ src: string;
7
+ children?: tempInfoType[];
8
+ }
9
+ export declare function genTemplateInfoList(root: string): tempInfoType[];
10
+ export {};
@@ -0,0 +1,44 @@
1
+ import * as path from 'path';
2
+ import { execSync } from 'child_process';
3
+ import { readdirSync, existsSync } from 'fs';
4
+ export function hasPnpm() {
5
+ try {
6
+ execSync('pnpm --version');
7
+ return true;
8
+ }
9
+ catch {
10
+ return false;
11
+ }
12
+ }
13
+ export function hasYarn() {
14
+ try {
15
+ execSync('yarnpkg --version');
16
+ return true;
17
+ }
18
+ catch {
19
+ return false;
20
+ }
21
+ }
22
+ export function onGenCommand() {
23
+ if (hasPnpm()) {
24
+ return 'pnpm';
25
+ }
26
+ if (hasYarn()) {
27
+ return 'yarn';
28
+ }
29
+ return 'npm';
30
+ }
31
+ export function genTemplateInfoList(root) {
32
+ const temps = [];
33
+ readdirSync(root, { withFileTypes: true }).forEach(o => {
34
+ const src = path.join(root, o.name);
35
+ if (o.isDirectory()) {
36
+ temps.push({
37
+ name: o.name,
38
+ src,
39
+ children: existsSync(path.join(src, 'package.json')) ? [] : genTemplateInfoList(src)
40
+ });
41
+ }
42
+ });
43
+ return temps;
44
+ }
@@ -1,47 +1,54 @@
1
- {
2
- "name": "template-cli",
3
- "version": "0.0.1",
4
- "main": "index.js",
5
- "repository": "https://github.com/kevily/create-packer",
6
- "author": "1k <bug_zero@163.com>",
7
- "license": "MIT",
8
- "private": false,
9
- "bin": "./bin/index.js",
10
- "type": "module",
11
- "scripts": {
12
- "login": "npm login --registry https://registry.npmjs.org",
13
- "pub": "pnpm run build && pnpm run push && node ./scripts/pub.js",
14
- "test": "pnpm run build && rimraf ./__test__ && node ./bin __test__",
15
- "build": "rimraf ./bin && tsc",
16
- "commit": "git add . && cz",
17
- "push": "pnpm run commit && git push"
18
- },
19
- "files": ["bin", "template", "template/**/.gitignore", ".gitignore"],
20
- "dependencies": {
21
- "@inquirer/prompts": "7.0.0",
22
- "chalk": "5.3.0",
23
- "commander": "8.1.0",
24
- "fs-extra": "10.0.0",
25
- "lodash": "4.17.21",
26
- "ora": "8.1.0"
27
- },
28
- "devDependencies": {
29
- "@biomejs/biome": "1.9.3",
30
- "@commitlint/config-conventional": "^17.6.3",
31
- "@commitlint/cz-commitlint": "17.4.2",
32
- "@types/fs-extra": "9.0.12",
33
- "@types/inquirer": "7.3.3",
34
- "@types/node": "16.4.7",
35
- "@typescript-eslint/eslint-plugin": "4.29.2",
36
- "@typescript-eslint/parser": "4.29.2",
37
- "commitizen": "4.3.0",
38
- "eslint": "7.32.0",
39
- "rimraf": "3.0.2",
40
- "typescript": "4.3.5"
41
- },
42
- "config": {
43
- "commitizen": {
44
- "path": "@commitlint/cz-commitlint"
45
- }
46
- }
47
- }
1
+ {
2
+ "name": "template-cli",
3
+ "version": "0.0.1",
4
+ "main": "index.js",
5
+ "repository": "https://github.com/kevily/create-packer",
6
+ "author": "1k <bug_zero@163.com>",
7
+ "license": "MIT",
8
+ "private": false,
9
+ "bin": "./bin/index.js",
10
+ "type": "module",
11
+ "scripts": {
12
+ "login": "npm login --registry https://registry.npmjs.org",
13
+ "pub": "pnpm run build && pnpm run push && node ./scripts/pub.js",
14
+ "test": "pnpm run build && rimraf ./__test__ && node ./bin __test__",
15
+ "build": "rimraf ./bin && tsc",
16
+ "commit": "git add . && cz",
17
+ "push": "pnpm run commit && git push",
18
+ "format": "prettier --write \"**/*.{ts,js,tsx,jsx,json,css,scss,less}\""
19
+ },
20
+ "files": [
21
+ "bin",
22
+ "template",
23
+ "template/**/.gitignore",
24
+ ".gitignore"
25
+ ],
26
+ "dependencies": {
27
+ "@inquirer/prompts": "7.0.0",
28
+ "chalk": "5.3.0",
29
+ "commander": "8.1.0",
30
+ "fs-extra": "10.0.0",
31
+ "lodash": "4.17.21",
32
+ "ora": "8.1.0"
33
+ },
34
+ "devDependencies": {
35
+ "@biomejs/biome": "1.9.3",
36
+ "@commitlint/config-conventional": "^17.6.3",
37
+ "@commitlint/cz-commitlint": "17.4.2",
38
+ "@types/fs-extra": "9.0.12",
39
+ "@types/inquirer": "7.3.3",
40
+ "@types/node": "16.4.7",
41
+ "@typescript-eslint/eslint-plugin": "4.29.2",
42
+ "@typescript-eslint/parser": "4.29.2",
43
+ "commitizen": "4.3.0",
44
+ "eslint": "7.32.0",
45
+ "prettier": "3.3.3",
46
+ "rimraf": "3.0.2",
47
+ "typescript": "4.3.5"
48
+ },
49
+ "config": {
50
+ "commitizen": {
51
+ "path": "@commitlint/cz-commitlint"
52
+ }
53
+ }
54
+ }
@@ -2,3 +2,5 @@
2
2
  **/*.svg
3
3
  **/*.ejs
4
4
  **/*.html
5
+ .history
6
+ dist
@@ -1,70 +1,70 @@
1
- import React from 'react'
2
- import clsx from 'clsx'
3
- import styles from './styles.module.css'
4
-
5
- type FeatureItem = {
6
- title: string
7
- Svg: React.ComponentType<React.ComponentProps<'svg'>>
8
- description: JSX.Element
9
- }
10
-
11
- const FeatureList: FeatureItem[] = [
12
- {
13
- title: 'Easy to Use',
14
- Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default,
15
- description: (
16
- <>
17
- Docusaurus was designed from the ground up to be easily installed and used to get
18
- your website up and running quickly.
19
- </>
20
- )
21
- },
22
- {
23
- title: 'Focus on What Matters',
24
- Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default,
25
- description: (
26
- <>
27
- Docusaurus lets you focus on your docs, and we&apos;ll do the chores. Go ahead and
28
- move your docs into the <code>docs</code> directory.
29
- </>
30
- )
31
- },
32
- {
33
- title: 'Powered by React',
34
- Svg: require('@site/static/img/undraw_docusaurus_react.svg').default,
35
- description: (
36
- <>
37
- Extend or customize your website layout by reusing React. Docusaurus can be extended
38
- while reusing the same header and footer.
39
- </>
40
- )
41
- }
42
- ]
43
-
44
- function Feature({ title, Svg, description }: FeatureItem) {
45
- return (
46
- <div className={clsx('col col--4')}>
47
- <div className="text--center">
48
- <Svg className={styles.featureSvg} role="img" />
49
- </div>
50
- <div className="text--center padding-horiz--md">
51
- <h3>{title}</h3>
52
- <p>{description}</p>
53
- </div>
54
- </div>
55
- )
56
- }
57
-
58
- export default function HomepageFeatures(): JSX.Element {
59
- return (
60
- <section className={styles.features}>
61
- <div className="container">
62
- <div className="row">
63
- {FeatureList.map((props, idx) => (
64
- <Feature key={idx} {...props} />
65
- ))}
66
- </div>
67
- </div>
68
- </section>
69
- )
70
- }
1
+ import React from 'react'
2
+ import clsx from 'clsx'
3
+ import styles from './styles.module.css'
4
+
5
+ type FeatureItem = {
6
+ title: string
7
+ Svg: React.ComponentType<React.ComponentProps<'svg'>>
8
+ description: JSX.Element
9
+ }
10
+
11
+ const FeatureList: FeatureItem[] = [
12
+ {
13
+ title: 'Easy to Use',
14
+ Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default,
15
+ description: (
16
+ <>
17
+ Docusaurus was designed from the ground up to be easily installed and used to get
18
+ your website up and running quickly.
19
+ </>
20
+ )
21
+ },
22
+ {
23
+ title: 'Focus on What Matters',
24
+ Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default,
25
+ description: (
26
+ <>
27
+ Docusaurus lets you focus on your docs, and we&apos;ll do the chores. Go ahead and
28
+ move your docs into the <code>docs</code> directory.
29
+ </>
30
+ )
31
+ },
32
+ {
33
+ title: 'Powered by React',
34
+ Svg: require('@site/static/img/undraw_docusaurus_react.svg').default,
35
+ description: (
36
+ <>
37
+ Extend or customize your website layout by reusing React. Docusaurus can be extended
38
+ while reusing the same header and footer.
39
+ </>
40
+ )
41
+ }
42
+ ]
43
+
44
+ function Feature({ title, Svg, description }: FeatureItem) {
45
+ return (
46
+ <div className={clsx('col col--4')}>
47
+ <div className="text--center">
48
+ <Svg className={styles.featureSvg} role="img" />
49
+ </div>
50
+ <div className="text--center padding-horiz--md">
51
+ <h3>{title}</h3>
52
+ <p>{description}</p>
53
+ </div>
54
+ </div>
55
+ )
56
+ }
57
+
58
+ export default function HomepageFeatures(): JSX.Element {
59
+ return (
60
+ <section className={styles.features}>
61
+ <div className="container">
62
+ <div className="row">
63
+ {FeatureList.map((props, idx) => (
64
+ <Feature key={idx} {...props} />
65
+ ))}
66
+ </div>
67
+ </div>
68
+ </section>
69
+ )
70
+ }
@@ -1,11 +1,11 @@
1
- .features {
2
- display: flex;
3
- align-items: center;
4
- padding: 2rem 0;
5
- width: 100%;
6
- }
7
-
8
- .featureSvg {
9
- height: 200px;
10
- width: 200px;
11
- }
1
+ .features {
2
+ display: flex;
3
+ align-items: center;
4
+ padding: 2rem 0;
5
+ width: 100%;
6
+ }
7
+
8
+ .featureSvg {
9
+ height: 200px;
10
+ width: 200px;
11
+ }
@@ -1,30 +1,30 @@
1
- /**
2
- * Any CSS included here will be global. The classic template
3
- * bundles Infima by default. Infima is a CSS framework designed to
4
- * work well for content-centric websites.
5
- */
6
-
7
- /* You can override the default Infima variables here. */
8
- :root {
9
- --ifm-color-primary: #2e8555;
10
- --ifm-color-primary-dark: #29784c;
11
- --ifm-color-primary-darker: #277148;
12
- --ifm-color-primary-darkest: #205d3b;
13
- --ifm-color-primary-light: #33925d;
14
- --ifm-color-primary-lighter: #359962;
15
- --ifm-color-primary-lightest: #3cad6e;
16
- --ifm-code-font-size: 95%;
17
- --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
18
- }
19
-
20
- /* For readability concerns, you should choose a lighter palette in dark mode. */
21
- [data-theme='dark'] {
22
- --ifm-color-primary: #25c2a0;
23
- --ifm-color-primary-dark: #21af90;
24
- --ifm-color-primary-darker: #1fa588;
25
- --ifm-color-primary-darkest: #1a8870;
26
- --ifm-color-primary-light: #29d5b0;
27
- --ifm-color-primary-lighter: #32d8b4;
28
- --ifm-color-primary-lightest: #4fddbf;
29
- --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
30
- }
1
+ /**
2
+ * Any CSS included here will be global. The classic template
3
+ * bundles Infima by default. Infima is a CSS framework designed to
4
+ * work well for content-centric websites.
5
+ */
6
+
7
+ /* You can override the default Infima variables here. */
8
+ :root {
9
+ --ifm-color-primary: #2e8555;
10
+ --ifm-color-primary-dark: #29784c;
11
+ --ifm-color-primary-darker: #277148;
12
+ --ifm-color-primary-darkest: #205d3b;
13
+ --ifm-color-primary-light: #33925d;
14
+ --ifm-color-primary-lighter: #359962;
15
+ --ifm-color-primary-lightest: #3cad6e;
16
+ --ifm-code-font-size: 95%;
17
+ --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
18
+ }
19
+
20
+ /* For readability concerns, you should choose a lighter palette in dark mode. */
21
+ [data-theme='dark'] {
22
+ --ifm-color-primary: #25c2a0;
23
+ --ifm-color-primary-dark: #21af90;
24
+ --ifm-color-primary-darker: #1fa588;
25
+ --ifm-color-primary-darkest: #1a8870;
26
+ --ifm-color-primary-light: #29d5b0;
27
+ --ifm-color-primary-lighter: #32d8b4;
28
+ --ifm-color-primary-lightest: #4fddbf;
29
+ --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
30
+ }
@@ -1,23 +1,23 @@
1
- /**
2
- * CSS files with the .module.css suffix will be treated as CSS modules
3
- * and scoped locally.
4
- */
5
-
6
- .heroBanner {
7
- padding: 4rem 0;
8
- text-align: center;
9
- position: relative;
10
- overflow: hidden;
11
- }
12
-
13
- @media screen and (max-width: 996px) {
14
- .heroBanner {
15
- padding: 2rem;
16
- }
17
- }
18
-
19
- .buttons {
20
- display: flex;
21
- align-items: center;
22
- justify-content: center;
23
- }
1
+ /**
2
+ * CSS files with the .module.css suffix will be treated as CSS modules
3
+ * and scoped locally.
4
+ */
5
+
6
+ .heroBanner {
7
+ padding: 4rem 0;
8
+ text-align: center;
9
+ position: relative;
10
+ overflow: hidden;
11
+ }
12
+
13
+ @media screen and (max-width: 996px) {
14
+ .heroBanner {
15
+ padding: 2rem;
16
+ }
17
+ }
18
+
19
+ .buttons {
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ }
@@ -1,40 +1,40 @@
1
- import React from 'react'
2
- import clsx from 'clsx'
3
- import Link from '@docusaurus/Link'
4
- import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
5
- import Layout from '@theme/Layout'
6
- import HomepageFeatures from '@site/src/components/HomepageFeatures'
7
-
8
- import styles from './index.module.css'
9
-
10
- function HomepageHeader() {
11
- const { siteConfig } = useDocusaurusContext()
12
- return (
13
- <header className={clsx('hero hero--primary', styles.heroBanner)}>
14
- <div className="container">
15
- <h1 className="hero__title">{siteConfig.title}</h1>
16
- <p className="hero__subtitle">{siteConfig.tagline}</p>
17
- <div className={styles.buttons}>
18
- <Link className="button button--secondary button--lg" to="/docs/intro">
19
- Docusaurus Tutorial - 5min ⏱️
20
- </Link>
21
- </div>
22
- </div>
23
- </header>
24
- )
25
- }
26
-
27
- export default function Home(): JSX.Element {
28
- const { siteConfig } = useDocusaurusContext()
29
- return (
30
- <Layout
31
- title={`Hello from ${siteConfig.title}`}
32
- description="Description will go into a meta tag in <head />"
33
- >
34
- <HomepageHeader />
35
- <main>
36
- <HomepageFeatures />
37
- </main>
38
- </Layout>
39
- )
40
- }
1
+ import React from 'react'
2
+ import clsx from 'clsx'
3
+ import Link from '@docusaurus/Link'
4
+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
5
+ import Layout from '@theme/Layout'
6
+ import HomepageFeatures from '@site/src/components/HomepageFeatures'
7
+
8
+ import styles from './index.module.css'
9
+
10
+ function HomepageHeader() {
11
+ const { siteConfig } = useDocusaurusContext()
12
+ return (
13
+ <header className={clsx('hero hero--primary', styles.heroBanner)}>
14
+ <div className="container">
15
+ <h1 className="hero__title">{siteConfig.title}</h1>
16
+ <p className="hero__subtitle">{siteConfig.tagline}</p>
17
+ <div className={styles.buttons}>
18
+ <Link className="button button--secondary button--lg" to="/docs/intro">
19
+ Docusaurus Tutorial - 5min ⏱️
20
+ </Link>
21
+ </div>
22
+ </div>
23
+ </header>
24
+ )
25
+ }
26
+
27
+ export default function Home(): JSX.Element {
28
+ const { siteConfig } = useDocusaurusContext()
29
+ return (
30
+ <Layout
31
+ title={`Hello from ${siteConfig.title}`}
32
+ description="Description will go into a meta tag in <head />"
33
+ >
34
+ <HomepageHeader />
35
+ <main>
36
+ <HomepageFeatures />
37
+ </main>
38
+ </Layout>
39
+ )
40
+ }
@@ -0,0 +1,6 @@
1
+ **/*.md
2
+ **/*.svg
3
+ **/*.ejs
4
+ **/*.html
5
+ .history
6
+ dist