create-packer 1.45.2 → 1.45.4

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 (32) hide show
  1. package/package.json +2 -2
  2. package/template/cli/eslint.config.js +35 -0
  3. package/template/cli/package.json +9 -8
  4. package/template/cli/scripts/pub.js +39 -39
  5. package/template/cli/src/createTemp.ts +1 -1
  6. package/template/lib/workspace/eslint.config.mjs +118 -116
  7. package/template/web-app/react-rsbuild/domain/router/components/index.ts +2 -2
  8. package/template/web-app/react-rsbuild/domain/router/components/route-layout.tsx +19 -19
  9. package/template/web-app/react-rsbuild/domain/router/components/sub-route-outlet.tsx +22 -22
  10. package/template/web-app/react-rsbuild/domain/router/home/routes.tsx +1 -1
  11. package/template/web-app/react-rsbuild/domain/router/index.ts +4 -4
  12. package/template/web-app/react-rsbuild/eslint.config.js +106 -104
  13. package/template/web-app/react-rsbuild/main.css +2 -2
  14. package/template/web-app/react-rsbuild/pages/home/index.ts +1 -1
  15. package/template/web-app/react-rsbuild/shared/components/componentInstance.tsx +80 -80
  16. package/template/web-app/react-rsbuild/shared/components/index.ts +1 -1
  17. package/template/web-app/react-rsbuild/shared/types/utils.ts +1 -1
  18. package/template/web-app/react-vite/domain/router/home/routes.tsx +1 -1
  19. package/template/web-app/react-vite/eslint.config.js +3 -1
  20. package/template/web-app/react-vite/shared/types/utils.ts +1 -1
  21. package/template/web-app/svelte/.env +1 -1
  22. package/template/web-app/svelte/.svelte-kit/ambient.d.ts +12 -14
  23. package/template/web-app/svelte/eslint.config.js +2 -0
  24. package/template/web-app/vue/eslint.config.js +3 -1
  25. package/template/web-app/vue/shared/hooks/useList.ts +1 -1
  26. package/template/web-app/vue/vite-env.d.ts +1 -1
  27. package/template/web-app/vue-rsbuild/env.d.ts +1 -1
  28. package/template/web-app/vue-rsbuild/eslint.config.js +113 -111
  29. package/template/web-app/vue-rsbuild/shared/hooks/useList.ts +1 -1
  30. package/template/web-extension/eslint.config.js +107 -105
  31. package/template/web-extension/shared/types/utils.ts +1 -1
  32. package/template/cli/.eslintrc +0 -35
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.45.2",
3
+ "version": "1.45.4",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -30,7 +30,7 @@
30
30
  "@commitlint/cz-commitlint": "17.4.2",
31
31
  "@types/fs-extra": "9.0.12",
32
32
  "@types/inquirer": "7.3.3",
33
- "@types/node": "16.4.7",
33
+ "@types/node": "18",
34
34
  "commitizen": "4.3.0",
35
35
  "eslint": "9.17.0",
36
36
  "globals": "15.12.0",
@@ -0,0 +1,35 @@
1
+ import eslint from '@eslint/js'
2
+ import globals from 'globals'
3
+ import tseslint from 'typescript-eslint'
4
+
5
+ export default tseslint.config({
6
+ extends: [eslint.configs.recommended, tseslint.configs.recommended],
7
+ files: ['**/*.{tsx,ts}'],
8
+ ignores: ['**/node_modules/', 'dist/', '.history/', '.vscode'],
9
+ languageOptions: {
10
+ ecmaVersion: 2018,
11
+ sourceType: 'module',
12
+ globals: {
13
+ ...globals.browser,
14
+ ...globals.node
15
+ }
16
+ },
17
+ rules: {
18
+ '@typescript-eslint/no-var-requires': 0,
19
+ '@typescript-eslint/explicit-function-return-type': 'off',
20
+ '@typescript-eslint/no-explicit-any': 1,
21
+ '@typescript-eslint/no-inferrable-types': [
22
+ 'warn',
23
+ {
24
+ ignoreParameters: true
25
+ }
26
+ ],
27
+ '@typescript-eslint/no-unused-vars': 'warn',
28
+ '@typescript-eslint/member-delimiter-style': 0,
29
+ '@typescript-eslint/class-name-casing': 0,
30
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
31
+ '@typescript-eslint/ban-ts-comment': 'off',
32
+ semi: ['error', 'never'],
33
+ quotes: 'off'
34
+ }
35
+ })
@@ -27,22 +27,23 @@
27
27
  "@inquirer/prompts": "7.0.0",
28
28
  "chalk": "5.3.0",
29
29
  "commander": "8.1.0",
30
- "fs-extra": "10.0.0",
30
+ "fs-extra": "11.3.0",
31
+ "lodash": "4.17.21",
31
32
  "ora": "8.1.0"
32
33
  },
33
34
  "devDependencies": {
34
- "@commitlint/config-conventional": "^17.6.3",
35
+ "@commitlint/config-conventional": "^17.7.0",
35
36
  "@commitlint/cz-commitlint": "17.4.2",
36
37
  "@types/fs-extra": "9.0.12",
37
38
  "@types/inquirer": "7.3.3",
38
- "@types/node": "16.4.7",
39
- "@typescript-eslint/eslint-plugin": "4.29.2",
40
- "@typescript-eslint/parser": "4.29.2",
39
+ "@types/node": "18",
41
40
  "commitizen": "4.3.0",
42
- "eslint": "7.32.0",
43
- "prettier": "3.3.3",
41
+ "eslint": "9.17.0",
42
+ "globals": "15.12.0",
43
+ "prettier": "3.2.5",
44
44
  "rimraf": "3.0.2",
45
- "typescript": "4.3.5"
45
+ "typescript": "5.8.2",
46
+ "typescript-eslint": "8.15.0"
46
47
  },
47
48
  "config": {
48
49
  "commitizen": {
@@ -1,39 +1,39 @@
1
- import * as inquirer from '@inquirer/prompts'
2
- import pkg from '../package.json' assert { type: 'json' }
3
- import { execSync } from 'child_process'
4
- import chalk from 'chalk'
5
-
6
- function genPrompt(nextVersion) {
7
- const version = {
8
- major: 0,
9
- minor: 1,
10
- patch: 2
11
- }
12
- const nextVersionIndex = version[nextVersion]
13
- const newVersion = pkg.version.split('.').map(Number)
14
- newVersion[nextVersionIndex] += 1
15
- // 把后续的版本号归零
16
- // ------------------------------------------------------------------------
17
- for (let i = nextVersionIndex + 1; i < 3; i++) {
18
- newVersion[i] = 0
19
- }
20
- return `${nextVersion}(${newVersion.join('.')})`
21
- }
22
-
23
- const versions = {
24
- [genPrompt('patch')]: 'patch',
25
- [genPrompt('minor')]: 'minor',
26
- [genPrompt('major')]: 'major'
27
- }
28
-
29
- inquirer
30
- .select({
31
- message: 'version:',
32
- choices: Object.keys(versions)
33
- })
34
- .then(version => {
35
- execSync(
36
- `npm version ${versions[version]} && pnpm publish --registry https://registry.npmjs.org && git push`
37
- )
38
- console.log(chalk.blue('Published(*^3^)'))
39
- })
1
+ import * as inquirer from '@inquirer/prompts'
2
+ import pkg from '../package.json' with { type: 'json' }
3
+ import { execSync } from 'child_process'
4
+ import chalk from 'chalk'
5
+
6
+ function genPrompt(nextVersion) {
7
+ const version = {
8
+ major: 0,
9
+ minor: 1,
10
+ patch: 2
11
+ }
12
+ const nextVersionIndex = version[nextVersion]
13
+ const newVersion = pkg.version.split('.').map(Number)
14
+ newVersion[nextVersionIndex] += 1
15
+ // 把后续的版本号归零
16
+ // ------------------------------------------------------------------------
17
+ for (let i = nextVersionIndex + 1; i < 3; i++) {
18
+ newVersion[i] = 0
19
+ }
20
+ return `${nextVersion}(${newVersion.join('.')})`
21
+ }
22
+
23
+ const versions = {
24
+ [genPrompt('patch')]: 'patch',
25
+ [genPrompt('minor')]: 'minor',
26
+ [genPrompt('major')]: 'major'
27
+ }
28
+
29
+ inquirer
30
+ .select({
31
+ message: 'version:',
32
+ choices: Object.keys(versions)
33
+ })
34
+ .then(version => {
35
+ execSync(
36
+ `npm version ${versions[version]} && pnpm publish --registry https://registry.npmjs.org && git push`
37
+ )
38
+ console.log(chalk.blue('Published(*^3^)'))
39
+ })
@@ -1,6 +1,6 @@
1
1
  import chalk from 'chalk'
2
2
  import * as inquirer from '@inquirer/prompts'
3
- import * as fsExtra from 'fs-extra'
3
+ import fsExtra from 'fs-extra'
4
4
  import path from 'path'
5
5
  import { fileURLToPath } from 'url'
6
6
  import ora from 'ora'
@@ -1,116 +1,118 @@
1
- import eslint from '@eslint/js'
2
- import globals from 'globals'
3
- import tseslint from 'typescript-eslint'
4
- import importPlugin from 'eslint-plugin-import'
5
- import reactPlugin from 'eslint-plugin-react'
6
- import reactHooksPlugin from 'eslint-plugin-react-hooks'
7
- import storybook from 'eslint-plugin-storybook'
8
-
9
- const scriptExtensions = ['js', 'jsx', 'mjs', 'cjs', 'ts', 'tsx']
10
- const storybookFiles = scriptExtensions.map(ext => `**/*.stories.${ext}`)
11
- const files = scriptExtensions.map(ext => `**/*.${ext}`)
12
- const ignores = [
13
- '**/node_modules/',
14
- '**/dist/',
15
- '**/cjs/',
16
- '**/.history/',
17
- '**/storybook-static/',
18
- '**/.vscode/'
19
- ]
20
-
21
- export default tseslint.config([
22
- { ignores },
23
- eslint.configs.recommended,
24
- importPlugin.flatConfigs.recommended,
25
- tseslint.configs.recommended,
26
- {
27
- plugins: {
28
- reactPlugin,
29
- reactHooksPlugin
30
- },
31
- files,
32
- languageOptions: {
33
- ecmaVersion: 2018,
34
- sourceType: 'module',
35
- parserOptions: {
36
- ecmaFeatures: {
37
- jsx: true
38
- },
39
- useJSXTextNode: true
40
- },
41
- globals: {
42
- ...globals.browser,
43
- ...globals.node
44
- }
45
- },
46
- settings: {
47
- 'import/resolver': {
48
- typescript: true,
49
- node: true
50
- },
51
- react: {
52
- version: '18'
53
- }
54
- },
55
- rules: {
56
- 'import/export': 'off',
57
- 'import/namespace': 'off',
58
- 'import/default': 'off',
59
- 'import/no-named-as-default-member': 'off',
60
- 'import/no-named-as-default': 'off',
61
- 'import/order': [
62
- 'error',
63
- {
64
- groups: [
65
- 'builtin',
66
- 'external',
67
- 'internal',
68
- 'parent',
69
- 'sibling',
70
- 'index',
71
- 'object',
72
- 'type'
73
- ],
74
- pathGroups: [
75
- { pattern: 'react', group: 'external', position: 'before' },
76
- { pattern: 'react-dom/*', group: 'external', position: 'before' },
77
- { pattern: 'react-router', group: 'external', position: 'before' },
78
- { pattern: 'react-router-dom', group: 'external', position: 'before' }
79
- ],
80
- pathGroupsExcludedImportTypes: ['react', 'react-router', 'react-router-dom']
81
- }
82
- ],
83
- 'no-case-declarations': 'off',
84
- '@typescript-eslint/no-unused-expressions': 'off',
85
- '@typescript-eslint/no-empty-object-type': 'off',
86
- '@typescript-eslint/no-var-requires': 0,
87
- '@typescript-eslint/explicit-function-return-type': 'off',
88
- '@typescript-eslint/no-explicit-any': 0,
89
- '@typescript-eslint/no-non-null-assertion': 'off',
90
- '@typescript-eslint/no-inferrable-types': [
91
- 'warn',
92
- {
93
- ignoreParameters: true
94
- }
95
- ],
96
- '@typescript-eslint/no-unused-vars': [
97
- 'warn',
98
- {
99
- argsIgnorePattern: '^_'
100
- }
101
- ],
102
- '@typescript-eslint/member-delimiter-style': 0,
103
- '@typescript-eslint/class-name-casing': 0,
104
- '@typescript-eslint/explicit-module-boundary-types': 'off',
105
- '@typescript-eslint/ban-ts-comment': 'off',
106
- '@typescript-eslint/no-empty-interface': 'off',
107
- 'react/prop-types': 'off',
108
- 'react/no-find-dom-node': 'off',
109
- 'react-hooks/exhaustive-deps': 'off',
110
- 'react/display-name': 'off',
111
- 'react/react-in-jsx-scope': 'off',
112
- 'no-constant-condition': 'off'
113
- }
114
- },
115
- { extends: [storybook.configs['flat/recommended']], files: storybookFiles }
116
- ])
1
+ import eslint from '@eslint/js'
2
+ import globals from 'globals'
3
+ import tseslint from 'typescript-eslint'
4
+ import importPlugin from 'eslint-plugin-import'
5
+ import reactPlugin from 'eslint-plugin-react'
6
+ import reactHooksPlugin from 'eslint-plugin-react-hooks'
7
+ import storybook from 'eslint-plugin-storybook'
8
+
9
+ const scriptExtensions = ['js', 'jsx', 'mjs', 'cjs', 'ts', 'tsx']
10
+ const storybookFiles = scriptExtensions.map(ext => `**/*.stories.${ext}`)
11
+ const files = scriptExtensions.map(ext => `**/*.${ext}`)
12
+ const ignores = [
13
+ '**/node_modules/',
14
+ '**/dist/',
15
+ '**/cjs/',
16
+ '**/.history/',
17
+ '**/storybook-static/',
18
+ '**/.vscode/'
19
+ ]
20
+
21
+ export default tseslint.config([
22
+ { ignores },
23
+ eslint.configs.recommended,
24
+ importPlugin.flatConfigs.recommended,
25
+ tseslint.configs.recommended,
26
+ {
27
+ plugins: {
28
+ reactPlugin,
29
+ reactHooksPlugin
30
+ },
31
+ files,
32
+ languageOptions: {
33
+ ecmaVersion: 2018,
34
+ sourceType: 'module',
35
+ parserOptions: {
36
+ ecmaFeatures: {
37
+ jsx: true
38
+ },
39
+ useJSXTextNode: true
40
+ },
41
+ globals: {
42
+ ...globals.browser,
43
+ ...globals.node
44
+ }
45
+ },
46
+ settings: {
47
+ 'import/resolver': {
48
+ typescript: true,
49
+ node: true
50
+ },
51
+ react: {
52
+ version: '18'
53
+ }
54
+ },
55
+ rules: {
56
+ 'import/export': 'off',
57
+ 'import/namespace': 'off',
58
+ 'import/default': 'off',
59
+ 'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
60
+ 'import/no-duplicates': ['error', { 'prefer-inline': true }],
61
+ 'import/no-named-as-default-member': 'off',
62
+ 'import/no-named-as-default': 'off',
63
+ 'import/order': [
64
+ 'error',
65
+ {
66
+ groups: [
67
+ 'builtin',
68
+ 'external',
69
+ 'internal',
70
+ 'parent',
71
+ 'sibling',
72
+ 'index',
73
+ 'object',
74
+ 'type'
75
+ ],
76
+ pathGroups: [
77
+ { pattern: 'react', group: 'external', position: 'before' },
78
+ { pattern: 'react-dom/*', group: 'external', position: 'before' },
79
+ { pattern: 'react-router', group: 'external', position: 'before' },
80
+ { pattern: 'react-router-dom', group: 'external', position: 'before' }
81
+ ],
82
+ pathGroupsExcludedImportTypes: ['builtin']
83
+ }
84
+ ],
85
+ 'no-case-declarations': 'off',
86
+ '@typescript-eslint/no-unused-expressions': 'off',
87
+ '@typescript-eslint/no-empty-object-type': 'off',
88
+ '@typescript-eslint/no-var-requires': 0,
89
+ '@typescript-eslint/explicit-function-return-type': 'off',
90
+ '@typescript-eslint/no-explicit-any': 0,
91
+ '@typescript-eslint/no-non-null-assertion': 'off',
92
+ '@typescript-eslint/no-inferrable-types': [
93
+ 'warn',
94
+ {
95
+ ignoreParameters: true
96
+ }
97
+ ],
98
+ '@typescript-eslint/no-unused-vars': [
99
+ 'warn',
100
+ {
101
+ argsIgnorePattern: '^_'
102
+ }
103
+ ],
104
+ '@typescript-eslint/member-delimiter-style': 0,
105
+ '@typescript-eslint/class-name-casing': 0,
106
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
107
+ '@typescript-eslint/ban-ts-comment': 'off',
108
+ '@typescript-eslint/no-empty-interface': 'off',
109
+ 'react/prop-types': 'off',
110
+ 'react/no-find-dom-node': 'off',
111
+ 'react-hooks/exhaustive-deps': 'off',
112
+ 'react/display-name': 'off',
113
+ 'react/react-in-jsx-scope': 'off',
114
+ 'no-constant-condition': 'off'
115
+ }
116
+ },
117
+ { extends: [storybook.configs['flat/recommended']], files: storybookFiles }
118
+ ])
@@ -1,2 +1,2 @@
1
- export * as SubRouteOutlet from './sub-route-outlet'
2
- export * as RouteLayout from './route-layout'
1
+ export * as SubRouteOutlet from './sub-route-outlet'
2
+ export * as RouteLayout from './route-layout'
@@ -1,19 +1,19 @@
1
- import { FunctionComponent } from 'react'
2
- import { Outlet } from 'react-router'
3
- import { last } from 'es-toolkit'
4
- import { routeType, useMatchRoutes } from '@/domain/router'
5
-
6
- export interface propsType {
7
- Index: FunctionComponent
8
- rootId: routeType['id']
9
- }
10
-
11
- export const Root: FunctionComponent<propsType> = ({ Index, rootId }) => {
12
- const matchRoutes = useMatchRoutes()
13
-
14
- if (last(matchRoutes)?.id === rootId) {
15
- return <Index />
16
- }
17
-
18
- return <Outlet />
19
- }
1
+ import { FunctionComponent } from 'react'
2
+ import { Outlet } from 'react-router'
3
+ import { last } from 'es-toolkit'
4
+ import { routeType, useMatchRoutes } from '@/domain/router'
5
+
6
+ export interface propsType {
7
+ Index: FunctionComponent
8
+ rootId: routeType['id']
9
+ }
10
+
11
+ export const Root: FunctionComponent<propsType> = ({ Index, rootId }) => {
12
+ const matchRoutes = useMatchRoutes()
13
+
14
+ if (last(matchRoutes)?.id === rootId) {
15
+ return <Index />
16
+ }
17
+
18
+ return <Outlet />
19
+ }
@@ -1,22 +1,22 @@
1
- import { FunctionComponent } from 'react'
2
- import { Outlet } from 'react-router'
3
- import { useMount } from 'react-use'
4
- import { last } from 'es-toolkit'
5
- import { useMatchRoutes, useRouter, routeType } from '@/domain/router'
6
-
7
- export interface propsType {
8
- rootId: routeType['id']
9
- homeId: routeType['id']
10
- }
11
- export const Root: FunctionComponent<propsType> = props => {
12
- const matchRoutes = useMatchRoutes()
13
- const navigate = useRouter(state => state.navigate)
14
-
15
- useMount(() => {
16
- if (last(matchRoutes)?.id === props.rootId) {
17
- navigate({ id: props.homeId })
18
- }
19
- })
20
-
21
- return <Outlet />
22
- }
1
+ import { FunctionComponent } from 'react'
2
+ import { Outlet } from 'react-router'
3
+ import { useMount } from 'react-use'
4
+ import { last } from 'es-toolkit'
5
+ import { useMatchRoutes, useRouter, routeType } from '@/domain/router'
6
+
7
+ export interface propsType {
8
+ rootId: routeType['id']
9
+ homeId: routeType['id']
10
+ }
11
+ export const Root: FunctionComponent<propsType> = props => {
12
+ const matchRoutes = useMatchRoutes()
13
+ const navigate = useRouter(state => state.navigate)
14
+
15
+ useMount(() => {
16
+ if (last(matchRoutes)?.id === props.rootId) {
17
+ navigate({ id: props.homeId })
18
+ }
19
+ })
20
+
21
+ return <Outlet />
22
+ }
@@ -1,6 +1,6 @@
1
1
  import { lazy } from 'react'
2
+ import { type routeType } from '../router.types'
2
3
  import ids from './ids'
3
- import type { routeType } from '../router.types'
4
4
 
5
5
  const routes: routeType[] = [
6
6
  {
@@ -1,4 +1,4 @@
1
- export { default as routerIds } from './ids'
2
- export * from './router'
3
- export * from './router.types'
4
- export * from './components'
1
+ export { default as routerIds } from './ids'
2
+ export * from './router'
3
+ export * from './router.types'
4
+ export * from './components'