create-packer 1.39.3 → 1.40.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 (75) hide show
  1. package/package.json +1 -1
  2. package/template/lib/workspace/packages/react/package.json +4 -0
  3. package/template/lib/workspace/packages/ts/package.json +1 -0
  4. package/template/web-app/react-rsbuild/index.html +0 -1
  5. package/template/web-app/react-rsbuild/rsbuild.config.ts +9 -8
  6. package/template/web-app/react-webpack/.editorconfig +0 -14
  7. package/template/web-app/react-webpack/.env +0 -2
  8. package/template/web-app/react-webpack/.env.dev +0 -2
  9. package/template/web-app/react-webpack/.gitignore +0 -27
  10. package/template/web-app/react-webpack/.husky/commit-msg +0 -4
  11. package/template/web-app/react-webpack/.husky/pre-commit +0 -4
  12. package/template/web-app/react-webpack/.prettierignore +0 -6
  13. package/template/web-app/react-webpack/.prettierrc +0 -18
  14. package/template/web-app/react-webpack/.stylelintignore +0 -4
  15. package/template/web-app/react-webpack/.stylelintrc +0 -24
  16. package/template/web-app/react-webpack/.vscode/extensions.json +0 -8
  17. package/template/web-app/react-webpack/.vscode/settings.json +0 -4
  18. package/template/web-app/react-webpack/README.md +0 -13
  19. package/template/web-app/react-webpack/commitlint.config.js +0 -1
  20. package/template/web-app/react-webpack/domain/app/app.model.ts +0 -7
  21. package/template/web-app/react-webpack/domain/app/app.styled.ts +0 -3
  22. package/template/web-app/react-webpack/domain/app/components/app-context.tsx +0 -17
  23. package/template/web-app/react-webpack/domain/app/components/app.tsx +0 -24
  24. package/template/web-app/react-webpack/domain/app/components/index.ts +0 -1
  25. package/template/web-app/react-webpack/domain/app/index.ts +0 -2
  26. package/template/web-app/react-webpack/domain/router/components/index.ts +0 -2
  27. package/template/web-app/react-webpack/domain/router/components/route-layout.tsx +0 -19
  28. package/template/web-app/react-webpack/domain/router/components/sub-route-outlet.tsx +0 -22
  29. package/template/web-app/react-webpack/domain/router/home/ids.ts +0 -3
  30. package/template/web-app/react-webpack/domain/router/home/index.ts +0 -2
  31. package/template/web-app/react-webpack/domain/router/home/routes.tsx +0 -13
  32. package/template/web-app/react-webpack/domain/router/ids.ts +0 -6
  33. package/template/web-app/react-webpack/domain/router/index.ts +0 -4
  34. package/template/web-app/react-webpack/domain/router/router.tsx +0 -28
  35. package/template/web-app/react-webpack/domain/router/router.types.ts +0 -3
  36. package/template/web-app/react-webpack/eslint.config.js +0 -104
  37. package/template/web-app/react-webpack/global.d.ts +0 -26
  38. package/template/web-app/react-webpack/index.css +0 -3
  39. package/template/web-app/react-webpack/index.html +0 -12
  40. package/template/web-app/react-webpack/main.tsx +0 -4
  41. package/template/web-app/react-webpack/package.json +0 -84
  42. package/template/web-app/react-webpack/pages/home/index.ts +0 -1
  43. package/template/web-app/react-webpack/pages/home/view.styled.ts +0 -7
  44. package/template/web-app/react-webpack/pages/home/view.tsx +0 -10
  45. package/template/web-app/react-webpack/pages/index.tsx +0 -18
  46. package/template/web-app/react-webpack/pages/not-found.tsx +0 -3
  47. package/template/web-app/react-webpack/postcss.config.js +0 -7
  48. package/template/web-app/react-webpack/public/react.svg +0 -1
  49. package/template/web-app/react-webpack/shared/assets/react.svg +0 -1
  50. package/template/web-app/react-webpack/shared/components/componentInstance.tsx +0 -78
  51. package/template/web-app/react-webpack/shared/components/index.ts +0 -1
  52. package/template/web-app/react-webpack/shared/constant/index.ts +0 -0
  53. package/template/web-app/react-webpack/shared/hooks/defineRouter/defineRouter.types.ts +0 -33
  54. package/template/web-app/react-webpack/shared/hooks/defineRouter/deineRouter.tsx +0 -160
  55. package/template/web-app/react-webpack/shared/hooks/defineRouter/index.ts +0 -2
  56. package/template/web-app/react-webpack/shared/hooks/index.ts +0 -6
  57. package/template/web-app/react-webpack/shared/hooks/useInterval.ts +0 -26
  58. package/template/web-app/react-webpack/shared/hooks/useLoadingAction.ts +0 -27
  59. package/template/web-app/react-webpack/shared/hooks/useLowPriorityState.ts +0 -26
  60. package/template/web-app/react-webpack/shared/hooks/useSyncState.ts +0 -15
  61. package/template/web-app/react-webpack/shared/hooks/useVisible.ts +0 -27
  62. package/template/web-app/react-webpack/shared/service/home.ts +0 -8
  63. package/template/web-app/react-webpack/shared/service/index.ts +0 -2
  64. package/template/web-app/react-webpack/shared/service/request.ts +0 -5
  65. package/template/web-app/react-webpack/shared/theme/index.ts +0 -1
  66. package/template/web-app/react-webpack/shared/theme/theme.styled.ts +0 -56
  67. package/template/web-app/react-webpack/shared/tools/index.ts +0 -0
  68. package/template/web-app/react-webpack/shared/types/index.ts +0 -1
  69. package/template/web-app/react-webpack/shared/types/utils.ts +0 -2
  70. package/template/web-app/react-webpack/tsconfig.json +0 -27
  71. package/template/web-app/react-webpack/tsconfig.node.json +0 -9
  72. package/template/web-app/react-webpack/webpack.config.mjs +0 -161
  73. package/template/web-app/react-webpack/webpack_config/constant.mjs +0 -5
  74. package/template/web-app/react-webpack/webpack_config/index.mjs +0 -2
  75. package/template/web-app/react-webpack/webpack_config/styles.mjs +0 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.39.3",
3
+ "version": "1.40.0",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -4,6 +4,10 @@
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "sideEffects": [
8
+ "*.css",
9
+ "*.scss"
10
+ ],
7
11
  "scripts": {
8
12
  "lint": "tsc --noEmit -p tsconfig.lint.json",
9
13
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -4,6 +4,7 @@
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "sideEffects": false,
7
8
  "scripts": {
8
9
  "lint": "tsc --noEmit -p tsconfig.lint.json",
9
10
  "build": "tsc",
@@ -4,7 +4,6 @@
4
4
  <meta charset="UTF-8" />
5
5
  <link rel="icon" type="image/svg+xml" href="/rsbuild-logo.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Rspack + React + TS</title>
8
7
  </head>
9
8
  <body>
10
9
  <div id="root"></div>
@@ -10,10 +10,10 @@ import { createChunks } from './scripts'
10
10
 
11
11
  export default defineConfig(({ envMode, command }) => {
12
12
  const { parsed: env } = loadEnv()
13
- const proxyBaseUrl = env.PUBLIC_API_HOST
14
13
  return {
15
14
  html: {
16
- template: './index.html'
15
+ template: './index.html',
16
+ title: 'Rspack + React + TS'
17
17
  },
18
18
  source: {
19
19
  entry: {
@@ -41,7 +41,11 @@ export default defineConfig(({ envMode, command }) => {
41
41
  },
42
42
  plugins: [
43
43
  pluginTypeCheck(),
44
- pluginEslint(),
44
+ pluginEslint({
45
+ eslintPluginOptions: {
46
+ configType: 'flat'
47
+ }
48
+ }),
45
49
  pluginStyledComponents({
46
50
  ssr: false,
47
51
  displayName: false,
@@ -68,11 +72,8 @@ export default defineConfig(({ envMode, command }) => {
68
72
  compress: false,
69
73
  proxy: [
70
74
  {
71
- context: [proxyBaseUrl],
72
- target: 'http://127.0.0.1:3000',
73
- pathRewrite: {
74
- [proxyBaseUrl]: ''
75
- }
75
+ context: [env.PUBLIC_API_HOST],
76
+ target: 'http://127.0.0.1:3000'
76
77
  }
77
78
  ]
78
79
  }
@@ -1,14 +0,0 @@
1
- # editorconfig.org
2
-
3
- root = true
4
-
5
- [*]
6
- charset = utf-8
7
- indent_size = 4
8
- indent_style = space
9
- insert_final_newline = true
10
- trim_trailing_whitespace = true
11
-
12
-
13
- [*.md]
14
- trim_trailing_whitespace = false
@@ -1,2 +0,0 @@
1
- ENV_BASE_URL=/
2
- ENV_API_HOST=
@@ -1,2 +0,0 @@
1
- ENV_BASE_URL=/dev
2
- ENV_API_HOST=/api
@@ -1,27 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
- yarn-debug.log*
6
- yarn-error.log*
7
- pnpm-debug.log*
8
- lerna-debug.log*
9
-
10
- node_modules
11
- dist
12
- dist-ssr
13
- *.local
14
- stats.html
15
-
16
- # Editor directories and files
17
- .vscode/*
18
- !.vscode/extensions.json
19
- !.vscode/settings.json
20
- .history
21
- .idea
22
- .DS_Store
23
- *.suo
24
- *.ntvs*
25
- *.njsproj
26
- *.sln
27
- *.sw?
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npx --no -- commitlint --edit
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npm run lint
@@ -1,6 +0,0 @@
1
- **/*.md
2
- **/*.svg
3
- **/*.ejs
4
- **/*.html
5
- .history
6
- dist
@@ -1,18 +0,0 @@
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
- }
@@ -1,4 +0,0 @@
1
- node_modules
2
- /dist
3
- /.vscode
4
- /.history
@@ -1,24 +0,0 @@
1
- {
2
- "extends": "stylelint-config-standard",
3
- "customSyntax": "postcss-styled-syntax",
4
- "rules": {
5
- "comment-empty-line-before": "never",
6
- "no-empty-source": null,
7
- "alpha-value-notation": null,
8
- "color-function-notation": null,
9
- "at-rule-no-unknown": [
10
- true,
11
- {
12
- "ignoreAtRules": ["use"]
13
- }
14
- ],
15
- "declaration-block-no-redundant-longhand-properties": null,
16
- "selector-pseudo-class-no-unknown": [
17
- true,
18
- {
19
- "ignorePseudoClasses": ["global"]
20
- }
21
- ],
22
- "selector-class-pattern": null
23
- }
24
- }
@@ -1,8 +0,0 @@
1
- {
2
- "recommendations": [
3
- "dbaeumer.vscode-eslint",
4
- "stylelint.vscode-stylelint",
5
- "esbenp.prettier-vscode",
6
- "styled-components.vscode-styled-components"
7
- ]
8
- }
@@ -1,4 +0,0 @@
1
- {
2
- "stylelint.validate": ["css", "less", "postcss", "scss", "typescript", "typescriptreact"],
3
- "stylelint.snippet": ["css", "less", "postcss", "scss", "typescript", "typescriptreact"]
4
- }
@@ -1,13 +0,0 @@
1
- # react-app-webpack
2
-
3
- - dev: pnpm run dev -> use ".env.dev"
4
- - build: pnpm run build -> use ".env"
5
-
6
- # svg
7
-
8
- - import IconReact from '@/assets/react.svg' -> ReactComponent
9
- - import iconReact from '@/assets/react.svg?url' -> svg url
10
-
11
- # style
12
-
13
- - index.module.css -> css module
@@ -1 +0,0 @@
1
- module.exports = { extends: ['@commitlint/config-conventional'] }
@@ -1,7 +0,0 @@
1
- import { defineStore } from 'define-zustand'
2
-
3
- export const useApp = defineStore({
4
- state: () => ({}),
5
- getter: {},
6
- actions: () => ({})
7
- })
@@ -1,3 +0,0 @@
1
- import { createGlobalStyle } from 'styled-components'
2
-
3
- export const GlobalStyle = createGlobalStyle``
@@ -1,17 +0,0 @@
1
- import { FunctionComponent } from 'react'
2
- import { ThemeProvider } from 'styled-components'
3
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
4
- import { theme } from '@/shared/theme'
5
-
6
- const queryClient = new QueryClient()
7
-
8
- export interface propsType {
9
- children: React.ReactNode
10
- }
11
- export const Root: FunctionComponent<propsType> = props => {
12
- return (
13
- <QueryClientProvider client={queryClient}>
14
- <ThemeProvider theme={theme}>{props.children}</ThemeProvider>
15
- </QueryClientProvider>
16
- )
17
- }
@@ -1,24 +0,0 @@
1
- import { useLayoutEffect } from 'react'
2
- import { RouterProvider } from 'react-router-dom'
3
- import { request } from '@/shared/service'
4
- import { routerInstance } from '@/domain/router'
5
- import { GlobalStyle } from '../app.styled'
6
- import * as AppContext from './app-context'
7
-
8
- export const Root = () => {
9
- useLayoutEffect(() => {
10
- request.interceptors.response.use(
11
- res => res,
12
- error => {
13
- console.log(error)
14
- }
15
- )
16
- }, [])
17
-
18
- return (
19
- <AppContext.Root>
20
- <GlobalStyle />
21
- <RouterProvider router={routerInstance} fallbackElement={<>loading...</>} />
22
- </AppContext.Root>
23
- )
24
- }
@@ -1 +0,0 @@
1
- export * as App from './app'
@@ -1,2 +0,0 @@
1
- export * from './app.model'
2
- export * from './components'
@@ -1,2 +0,0 @@
1
- export * as SubRouteOutlet from './sub-route-outlet'
2
- export * as RouteLayout from './route-layout'
@@ -1,19 +0,0 @@
1
- import { FunctionComponent } from 'react'
2
- import { Outlet } from 'react-router-dom'
3
- import { last } from 'lodash-es'
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 +0,0 @@
1
- import { FunctionComponent } from 'react'
2
- import { Outlet } from 'react-router-dom'
3
- import { useMount } from 'react-use'
4
- import { last } from 'lodash-es'
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,3 +0,0 @@
1
- export default {
2
- home: 'home'
3
- }
@@ -1,2 +0,0 @@
1
- export { default as routes } from './routes'
2
- export { default as ids } from './ids'
@@ -1,13 +0,0 @@
1
- import { lazy } from 'react'
2
- import ids from './ids'
3
- import type { routeType } from '../router.types'
4
-
5
- const routes: routeType[] = [
6
- {
7
- path: 'home',
8
- id: ids.home,
9
- Component: lazy(() => import('@/pages/home'))
10
- }
11
- ]
12
-
13
- export default routes
@@ -1,6 +0,0 @@
1
- import * as home from './home'
2
- export default {
3
- root: 'root',
4
- notFound: 'notFound',
5
- ...home.ids
6
- }
@@ -1,4 +0,0 @@
1
- export { default as routerIds } from './ids'
2
- export * from './router'
3
- export * from './router.types'
4
- export * from './components'
@@ -1,28 +0,0 @@
1
- import { lazy } from 'react'
2
- import { createBrowserRouter } from 'react-router-dom'
3
- import { defineRouter, routeType } from '@/shared/hooks'
4
- import ids from './ids'
5
- import * as home from './home'
6
-
7
- const routes: routeType[] = [
8
- {
9
- path: '/',
10
- id: ids.root,
11
- Component: lazy(() => import('@/pages')),
12
- children: [
13
- ...home.routes,
14
- {
15
- path: '*',
16
- id: ids.notFound,
17
- Component: lazy(() => import('@/pages/not-found'))
18
- }
19
- ]
20
- }
21
- ]
22
-
23
- export const routerInstance = createBrowserRouter(routes as never, {
24
- basename: ENV_BASE_URL
25
- })
26
-
27
- export const { useMatchRoutes, useQuery, useRouter, useRoutePermission } =
28
- defineRouter(routerInstance)
@@ -1,3 +0,0 @@
1
- import { routeType as $routeType } from '@/shared/hooks'
2
-
3
- export type routeType = $routeType
@@ -1,104 +0,0 @@
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
-
8
- const scriptExtensions = ['js', 'jsx', 'mjs', 'cjs', 'ts', 'tsx']
9
- const files = scriptExtensions.map(ext => `**/*.${ext}`)
10
-
11
- export default tseslint.config([
12
- {
13
- ignores: ['**/node_modules/', '**/dist/', '**/.history/', '**/.vscode/', 'vite.config.ts.*']
14
- },
15
- eslint.configs.recommended,
16
- importPlugin.flatConfigs.recommended,
17
- tseslint.configs.recommended,
18
- {
19
- plugins: { reactPlugin, reactHooksPlugin },
20
- files,
21
- languageOptions: {
22
- ecmaVersion: 2018,
23
- sourceType: 'module',
24
- parserOptions: {
25
- ecmaFeatures: {
26
- jsx: true
27
- },
28
- useJSXTextNode: true
29
- },
30
- globals: {
31
- ...globals.browser,
32
- ...globals.node
33
- }
34
- },
35
- settings: {
36
- 'import/resolver': {
37
- typescript: true,
38
- node: true
39
- },
40
- react: {
41
- version: '18'
42
- }
43
- },
44
- rules: {
45
- 'import/export': 'off',
46
- 'import/namespace': 'off',
47
- 'import/default': 'off',
48
- 'import/no-named-as-default-member': 'off',
49
- 'import/no-named-as-default': 'off',
50
- 'import/order': [
51
- 'error',
52
- {
53
- groups: [
54
- 'builtin',
55
- 'external',
56
- 'internal',
57
- 'parent',
58
- 'sibling',
59
- 'index',
60
- 'object',
61
- 'type'
62
- ],
63
- pathGroups: [
64
- { pattern: 'react', group: 'external', position: 'before' },
65
- { pattern: 'react-dom/*', group: 'external', position: 'before' },
66
- { pattern: 'react-router', group: 'external', position: 'before' },
67
- { pattern: 'react-router-dom', group: 'external', position: 'before' }
68
- ],
69
- pathGroupsExcludedImportTypes: ['react', 'react-router', 'react-router-dom']
70
- }
71
- ],
72
- 'no-case-declarations': 'off',
73
- '@typescript-eslint/no-unused-expressions': 'off',
74
- '@typescript-eslint/no-empty-object-type': 'off',
75
- '@typescript-eslint/no-var-requires': 0,
76
- '@typescript-eslint/explicit-function-return-type': 'off',
77
- '@typescript-eslint/no-explicit-any': 0,
78
- '@typescript-eslint/no-non-null-assertion': 'off',
79
- '@typescript-eslint/no-inferrable-types': [
80
- 'warn',
81
- {
82
- ignoreParameters: true
83
- }
84
- ],
85
- '@typescript-eslint/no-unused-vars': [
86
- 'warn',
87
- {
88
- argsIgnorePattern: '^_'
89
- }
90
- ],
91
- '@typescript-eslint/member-delimiter-style': 0,
92
- '@typescript-eslint/class-name-casing': 0,
93
- '@typescript-eslint/explicit-module-boundary-types': 'off',
94
- '@typescript-eslint/ban-ts-comment': 'off',
95
- '@typescript-eslint/no-empty-interface': 'off',
96
- 'react/prop-types': 'off',
97
- 'react/no-find-dom-node': 'off',
98
- 'react-hooks/exhaustive-deps': 'off',
99
- 'react/display-name': 'off',
100
- 'react/react-in-jsx-scope': 'off',
101
- 'no-constant-condition': 'off'
102
- }
103
- }
104
- ])
@@ -1,26 +0,0 @@
1
- import 'styled-components'
2
- import { themeType } from './shared/theme'
3
-
4
- declare global {
5
- const ENV_BASE_URL: string
6
- const ENV_API_HOST: string
7
- }
8
-
9
- declare module '*.css'
10
- declare module '*.less'
11
- declare module '*.scss'
12
- declare module '*.png'
13
- declare module '*.webp'
14
- declare module '*.svg?url' {
15
- const url: string
16
- export default url
17
- }
18
- declare module '*.svg' {
19
- import * as React from 'react'
20
- function ReactComponent(props: React.SVGProps<SVGSVGElement>): React.ReactElement
21
- export default ReactComponent
22
- }
23
-
24
- declare module 'styled-components' {
25
- export interface DefaultTheme extends themeType {}
26
- }
@@ -1,3 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
@@ -1,12 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/react.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>webpack5 + React + TS</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- </body>
12
- </html>
@@ -1,4 +0,0 @@
1
- import { createRoot } from 'react-dom/client'
2
- import { App } from '@/domain/app'
3
-
4
- createRoot(document.getElementById('root') as HTMLElement).render(<App.Root />)