create-packer 1.13.2 → 1.13.3
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.
- package/LICENSE +21 -21
- package/README.md +18 -18
- package/package.json +1 -1
- package/template/docusaurus/.gitignore +20 -20
- package/template/docusaurus/.prettierignore +6 -6
- package/template/docusaurus/.prettierrc.js +20 -20
- package/template/docusaurus/README.md +33 -33
- package/template/docusaurus/babel.config.js +3 -3
- package/template/docusaurus/blog/2019-05-28-hola.md +11 -11
- package/template/docusaurus/blog/2019-05-29-hello-world.md +17 -17
- package/template/docusaurus/blog/2019-05-30-welcome.md +13 -13
- package/template/docusaurus/docs/doc1/doc1.mdx +201 -201
- package/template/docusaurus/docs/doc1/doc2.mdx +5 -5
- package/template/docusaurus/docs/doc1/doc3.mdx +13 -13
- package/template/docusaurus/docs/doc1/doc4.mdx +23 -23
- package/template/docusaurus/docs/doc2/doc1.mdx +200 -200
- package/template/docusaurus/docs/doc2/doc2.mdx +5 -5
- package/template/docusaurus/docs/doc2/doc3.mdx +13 -13
- package/template/docusaurus/docs/doc2/mdx4.mdx +23 -23
- package/template/docusaurus/docusaurus.config.js +134 -134
- package/template/docusaurus/package.json +54 -54
- package/template/docusaurus/sidebars.js +14 -14
- package/template/docusaurus/src/css/custom.css +33 -33
- package/template/docusaurus/src/pages/index.tsx +18 -18
- package/template/docusaurus/static/img/undraw_docusaurus_mountain.svg +170 -170
- package/template/docusaurus/static/img/undraw_docusaurus_react.svg +169 -169
- package/template/docusaurus/tsconfig.json +4 -4
- package/template/lib/.changeset/README.md +8 -8
- package/template/lib/.changeset/config.json +11 -11
- package/template/lib/.gitignore +35 -35
- package/template/lib/package.json +30 -30
- package/template/lib/packages/test/.gitignore +35 -35
- package/template/lib/packages/test/package.json +13 -13
- package/template/lib/packages/test/src/index.ts +5 -5
- package/template/lib/packages/test/tsconfig.json +17 -17
- package/template/lib/pnpm-lock.yaml +2386 -2386
- package/template/lib/pnpm-workspace.yaml +2 -2
- package/template/nest/.eslintrc.js +25 -25
- package/template/nest/.gitignore +34 -34
- package/template/nest/.husky/pre-commit +4 -4
- package/template/nest/.prettierrc +6 -6
- package/template/nest/README.md +73 -73
- package/template/nest/nest-cli.json +5 -5
- package/template/nest/src/app.controller.spec.ts +22 -22
- package/template/nest/src/app.controller.ts +12 -12
- package/template/nest/src/app.module.ts +10 -10
- package/template/nest/src/app.service.ts +8 -8
- package/template/nest/src/main.ts +10 -10
- package/template/nest/src/utils/transform.interceptor.ts +26 -26
- package/template/nest/test/app.e2e-spec.ts +24 -24
- package/template/nest/test/jest-e2e.json +9 -9
- package/template/nest/tsconfig.build.json +5 -5
- package/template/nest/tsconfig.json +21 -21
- package/template/react/.gitignore +25 -25
- package/template/react/.husky/commit-msg +4 -4
- package/template/react/.husky/pre-commit +4 -4
- package/template/react/.prettierignore +4 -4
- package/template/react/.prettierrc +18 -18
- package/template/react/commitlint.config.cjs +1 -1
- package/template/react/index.html +13 -13
- package/template/react/jest.config.cjs +55 -55
- package/template/react/jest.setup.ts +5 -5
- package/template/react/postcss.config.cjs +9 -9
- package/template/react/src/controllers/index.ts +1 -0
- package/template/react/src/{providers → controllers}/useVisible.ts +2 -1
- package/template/react/src/providers/index.ts +0 -1
- package/template/react/tailwind.config.cjs +8 -8
- package/template/react/tsconfig.json +25 -25
- package/template/react/tsconfig.node.json +9 -9
- package/template/vue/.husky/commit-msg +4 -4
- package/template/vue/.husky/pre-commit +4 -4
- package/template/vue/.prettierignore +4 -4
- package/template/vue/commitlint.config.cjs +1 -1
- package/template/vue/index.html +13 -13
- package/template/vue/postcss.config.cjs +9 -9
- package/template/vue/src/controllers/index.ts +2 -0
- package/template/vue/src/controllers/useList.ts +107 -0
- package/template/vue/src/providers/index.ts +0 -1
- package/template/vue/tailwind.config.cjs +8 -8
- package/template/vue/tsconfig.json +22 -22
- package/template/vue/tsconfig.node.json +9 -9
- package/template/nest/.husky/_/.gitignore +0 -1
- package/template/react/.husky/_/.gitignore +0 -1
- package/template/react/stats.html +0 -4044
- package/template/vue/.husky/_/.gitignore +0 -1
- /package/template/vue/src/{providers → controllers}/useVisible.ts +0 -0
|
@@ -1,25 +1,25 @@
|
|
|
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
|
-
|
|
15
|
-
# Editor directories and files
|
|
16
|
-
.vscode/*
|
|
17
|
-
!.vscode/extensions.json
|
|
18
|
-
.history
|
|
19
|
-
.idea
|
|
20
|
-
.DS_Store
|
|
21
|
-
*.suo
|
|
22
|
-
*.ntvs*
|
|
23
|
-
*.njsproj
|
|
24
|
-
*.sln
|
|
25
|
-
*.sw?
|
|
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
|
+
|
|
15
|
+
# Editor directories and files
|
|
16
|
+
.vscode/*
|
|
17
|
+
!.vscode/extensions.json
|
|
18
|
+
.history
|
|
19
|
+
.idea
|
|
20
|
+
.DS_Store
|
|
21
|
+
*.suo
|
|
22
|
+
*.ntvs*
|
|
23
|
+
*.njsproj
|
|
24
|
+
*.sln
|
|
25
|
+
*.sw?
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
-
|
|
4
|
-
npx --no -- commitlint --edit
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
+
|
|
4
|
+
npx --no -- commitlint --edit
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
-
|
|
4
|
-
npm run lint
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
+
|
|
4
|
+
npm run lint
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
**/*.md
|
|
2
|
-
**/*.svg
|
|
3
|
-
**/*.ejs
|
|
4
|
-
**/*.html
|
|
1
|
+
**/*.md
|
|
2
|
+
**/*.svg
|
|
3
|
+
**/*.ejs
|
|
4
|
+
**/*.html
|
|
@@ -1,18 +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
|
-
"jsxBracketSameLine": true,
|
|
16
|
-
"arrowParens": "avoid",
|
|
17
|
-
"rangeStart": 0
|
|
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
|
+
"jsxBracketSameLine": true,
|
|
16
|
+
"arrowParens": "avoid",
|
|
17
|
+
"rangeStart": 0
|
|
18
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = { extends: ['@commitlint/config-conventional'] }
|
|
1
|
+
module.exports = { extends: ['@commitlint/config-conventional'] }
|
|
@@ -1,13 +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>Vite + React + TS</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="root"></div>
|
|
11
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
|
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>Vite + React + TS</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
/** @type {import('@jest/types').Config.InitialOptions} */
|
|
2
|
-
module.exports = {
|
|
3
|
-
// The test environment that will be used for testing, jsdom for browser environment
|
|
4
|
-
// https://jestjs.io/docs/configuration#testenvironment-string
|
|
5
|
-
testEnvironment: 'jsdom',
|
|
6
|
-
|
|
7
|
-
// A list of paths to directories that Jest should use to search for files in
|
|
8
|
-
// https://jestjs.io/docs/configuration#roots-arraystring
|
|
9
|
-
roots: ['<rootDir>/src/'],
|
|
10
|
-
|
|
11
|
-
// The glob patterns Jest uses to detect test files.
|
|
12
|
-
// https://jestjs.io/docs/configuration#testmatch-arraystring
|
|
13
|
-
testMatch: ['**/*.spec.ts?(x)'],
|
|
14
|
-
|
|
15
|
-
// Jest transformations
|
|
16
|
-
// https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object
|
|
17
|
-
transform: {
|
|
18
|
-
'^.+\\.tsx?$': 'ts-jest' // Transform TypeScript files using ts-jest
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
// A list of paths to modules that run some code to configure or set up the testing framework before each test file in the suite is executed
|
|
22
|
-
// https://jestjs.io/docs/configuration#setupfilesafterenv-array
|
|
23
|
-
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
|
|
24
|
-
|
|
25
|
-
// Code coverage config
|
|
26
|
-
// https://jestjs.io/docs/configuration#collectcoveragefrom-array
|
|
27
|
-
coverageDirectory: '<rootDir>/coverage/',
|
|
28
|
-
collectCoverageFrom: [
|
|
29
|
-
'<rootDir>/src/**/*.{ts,tsx}',
|
|
30
|
-
'!**/__mocks__/**',
|
|
31
|
-
'!**/node_modules/**',
|
|
32
|
-
'!**/*.d.ts'
|
|
33
|
-
],
|
|
34
|
-
|
|
35
|
-
// Important: order matters, specific rules should be defined first
|
|
36
|
-
// https://jestjs.io/fr/docs/configuration#modulenamemapper-objectstring-string--arraystring
|
|
37
|
-
moduleNameMapper: {
|
|
38
|
-
// Handle CSS imports (with CSS modules)
|
|
39
|
-
// https://jestjs.io/docs/webpack#mocking-css-modules
|
|
40
|
-
'^.+\\.module\\.(css|sass|scss|less)$': 'identity-obj-proxy',
|
|
41
|
-
|
|
42
|
-
// Handle CSS imports (without CSS modules)
|
|
43
|
-
'^.+\\.(css|sass|scss|less)$': '<rootDir>/__mocks__/styleMock.js',
|
|
44
|
-
|
|
45
|
-
// Handle static assets
|
|
46
|
-
// https://jestjs.io/docs/webpack#handling-static-assets
|
|
47
|
-
'^.+\\.(jpg|jpeg|png|gif|webp|avif|svg|ttf|woff|woff2)$': `<rootDir>/__mocks__/fileMock.js`,
|
|
48
|
-
|
|
49
|
-
// Handle TypeScript path aliases
|
|
50
|
-
'^@/(.*)$': '<rootDir>/src/$1'
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
verbose: true,
|
|
54
|
-
testTimeout: 30000
|
|
55
|
-
}
|
|
1
|
+
/** @type {import('@jest/types').Config.InitialOptions} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
// The test environment that will be used for testing, jsdom for browser environment
|
|
4
|
+
// https://jestjs.io/docs/configuration#testenvironment-string
|
|
5
|
+
testEnvironment: 'jsdom',
|
|
6
|
+
|
|
7
|
+
// A list of paths to directories that Jest should use to search for files in
|
|
8
|
+
// https://jestjs.io/docs/configuration#roots-arraystring
|
|
9
|
+
roots: ['<rootDir>/src/'],
|
|
10
|
+
|
|
11
|
+
// The glob patterns Jest uses to detect test files.
|
|
12
|
+
// https://jestjs.io/docs/configuration#testmatch-arraystring
|
|
13
|
+
testMatch: ['**/*.spec.ts?(x)'],
|
|
14
|
+
|
|
15
|
+
// Jest transformations
|
|
16
|
+
// https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object
|
|
17
|
+
transform: {
|
|
18
|
+
'^.+\\.tsx?$': 'ts-jest' // Transform TypeScript files using ts-jest
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// A list of paths to modules that run some code to configure or set up the testing framework before each test file in the suite is executed
|
|
22
|
+
// https://jestjs.io/docs/configuration#setupfilesafterenv-array
|
|
23
|
+
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
|
|
24
|
+
|
|
25
|
+
// Code coverage config
|
|
26
|
+
// https://jestjs.io/docs/configuration#collectcoveragefrom-array
|
|
27
|
+
coverageDirectory: '<rootDir>/coverage/',
|
|
28
|
+
collectCoverageFrom: [
|
|
29
|
+
'<rootDir>/src/**/*.{ts,tsx}',
|
|
30
|
+
'!**/__mocks__/**',
|
|
31
|
+
'!**/node_modules/**',
|
|
32
|
+
'!**/*.d.ts'
|
|
33
|
+
],
|
|
34
|
+
|
|
35
|
+
// Important: order matters, specific rules should be defined first
|
|
36
|
+
// https://jestjs.io/fr/docs/configuration#modulenamemapper-objectstring-string--arraystring
|
|
37
|
+
moduleNameMapper: {
|
|
38
|
+
// Handle CSS imports (with CSS modules)
|
|
39
|
+
// https://jestjs.io/docs/webpack#mocking-css-modules
|
|
40
|
+
'^.+\\.module\\.(css|sass|scss|less)$': 'identity-obj-proxy',
|
|
41
|
+
|
|
42
|
+
// Handle CSS imports (without CSS modules)
|
|
43
|
+
'^.+\\.(css|sass|scss|less)$': '<rootDir>/__mocks__/styleMock.js',
|
|
44
|
+
|
|
45
|
+
// Handle static assets
|
|
46
|
+
// https://jestjs.io/docs/webpack#handling-static-assets
|
|
47
|
+
'^.+\\.(jpg|jpeg|png|gif|webp|avif|svg|ttf|woff|woff2)$': `<rootDir>/__mocks__/fileMock.js`,
|
|
48
|
+
|
|
49
|
+
// Handle TypeScript path aliases
|
|
50
|
+
'^@/(.*)$': '<rootDir>/src/$1'
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
verbose: true,
|
|
54
|
+
testTimeout: 30000
|
|
55
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
|
2
|
-
// allows you to do things like:
|
|
3
|
-
// expect(element).toHaveTextContent(/react/i)
|
|
4
|
-
// learn more: https://github.com/testing-library/jest-dom
|
|
5
|
-
import '@testing-library/jest-dom'
|
|
1
|
+
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
|
2
|
+
// allows you to do things like:
|
|
3
|
+
// expect(element).toHaveTextContent(/react/i)
|
|
4
|
+
// learn more: https://github.com/testing-library/jest-dom
|
|
5
|
+
import '@testing-library/jest-dom'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
plugins: {
|
|
3
|
-
'postcss-import': {},
|
|
4
|
-
'tailwindcss/nesting': 'postcss-nesting',
|
|
5
|
-
tailwindcss: {},
|
|
6
|
-
autoprefixer: {},
|
|
7
|
-
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {})
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: {
|
|
3
|
+
'postcss-import': {},
|
|
4
|
+
'tailwindcss/nesting': 'postcss-nesting',
|
|
5
|
+
tailwindcss: {},
|
|
6
|
+
autoprefixer: {},
|
|
7
|
+
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {})
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useVisible } from './useVisible'
|
|
@@ -2,11 +2,12 @@ import { useState } from 'react'
|
|
|
2
2
|
import { isFunction } from 'lodash-es'
|
|
3
3
|
|
|
4
4
|
export interface useVisibleConfigType {
|
|
5
|
+
defaultVisible?: boolean
|
|
5
6
|
onBeforeShow?: () => Promise<boolean | void>
|
|
6
7
|
onBeforeHide?: () => Promise<boolean | void>
|
|
7
8
|
}
|
|
8
9
|
export default function useVisible(config?: useVisibleConfigType) {
|
|
9
|
-
const [visible, setVisible] = useState(false)
|
|
10
|
+
const [visible, setVisible] = useState(config?.defaultVisible ?? false)
|
|
10
11
|
const onShow = async () => {
|
|
11
12
|
let isShow: boolean | void = true
|
|
12
13
|
if (isFunction(config?.onBeforeShow)) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/** @type {import('tailwindcss').Config} */
|
|
2
|
-
module.exports = {
|
|
3
|
-
content: ['./index.html', './src/**/*.{ts,tsx}'],
|
|
4
|
-
theme: {
|
|
5
|
-
extend: {}
|
|
6
|
-
},
|
|
7
|
-
plugins: []
|
|
8
|
-
}
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
content: ['./index.html', './src/**/*.{ts,tsx}'],
|
|
4
|
+
theme: {
|
|
5
|
+
extend: {}
|
|
6
|
+
},
|
|
7
|
+
plugins: []
|
|
8
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
4
|
-
"target": "ESNext",
|
|
5
|
-
"useDefineForClassFields": true,
|
|
6
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
7
|
-
"allowJs": false,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"esModuleInterop": false,
|
|
10
|
-
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"strict": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"module": "ESNext",
|
|
14
|
-
"moduleResolution": "Node",
|
|
15
|
-
"resolveJsonModule": true,
|
|
16
|
-
"isolatedModules": true,
|
|
17
|
-
"noEmit": true,
|
|
18
|
-
"jsx": "react-jsx",
|
|
19
|
-
"paths": {
|
|
20
|
-
"@/*": ["src/*"]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"include": ["src"],
|
|
24
|
-
"references": [{ "path": "./tsconfig.node.json" }]
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
7
|
+
"allowJs": false,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"esModuleInterop": false,
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"module": "ESNext",
|
|
14
|
+
"moduleResolution": "Node",
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"isolatedModules": true,
|
|
17
|
+
"noEmit": true,
|
|
18
|
+
"jsx": "react-jsx",
|
|
19
|
+
"paths": {
|
|
20
|
+
"@/*": ["src/*"]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"include": ["src"],
|
|
24
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
25
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"composite": true,
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "Node",
|
|
6
|
-
"allowSyntheticDefaultImports": true
|
|
7
|
-
},
|
|
8
|
-
"include": ["vite.config.ts"]
|
|
9
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"composite": true,
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"allowSyntheticDefaultImports": true
|
|
7
|
+
},
|
|
8
|
+
"include": ["vite.config.ts"]
|
|
9
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
-
|
|
4
|
-
npx --no -- commitlint --edit
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
+
|
|
4
|
+
npx --no -- commitlint --edit
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
-
|
|
4
|
-
npm run lint
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
+
|
|
4
|
+
npm run lint
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
**/*.md
|
|
2
|
-
**/*.svg
|
|
3
|
-
**/*.ejs
|
|
4
|
-
**/*.html
|
|
1
|
+
**/*.md
|
|
2
|
+
**/*.svg
|
|
3
|
+
**/*.ejs
|
|
4
|
+
**/*.html
|
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = { extends: ['@commitlint/config-conventional'] }
|
|
1
|
+
module.exports = { extends: ['@commitlint/config-conventional'] }
|
package/template/vue/index.html
CHANGED
|
@@ -1,13 +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>Vite + Vue + TS</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="app"></div>
|
|
11
|
-
<script type="module" src="/src/main.ts"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
|
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>Vite + Vue + TS</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
plugins: {
|
|
3
|
-
'postcss-import': {},
|
|
4
|
-
'tailwindcss/nesting': 'postcss-nesting',
|
|
5
|
-
tailwindcss: {},
|
|
6
|
-
autoprefixer: {},
|
|
7
|
-
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {})
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: {
|
|
3
|
+
'postcss-import': {},
|
|
4
|
+
'tailwindcss/nesting': 'postcss-nesting',
|
|
5
|
+
tailwindcss: {},
|
|
6
|
+
autoprefixer: {},
|
|
7
|
+
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {})
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { ref, reactive, computed, unref } from 'vue'
|
|
2
|
+
import { cloneDeep, concat, assign, pick, isNil, size, map } from 'lodash-es'
|
|
3
|
+
|
|
4
|
+
export interface stateType<ListItem, P> {
|
|
5
|
+
loading: boolean
|
|
6
|
+
total: number
|
|
7
|
+
params: P
|
|
8
|
+
list: ListItem[]
|
|
9
|
+
sum: Record<string, any>
|
|
10
|
+
selected: any[]
|
|
11
|
+
pagination: {
|
|
12
|
+
current: number
|
|
13
|
+
pageSize: number
|
|
14
|
+
total: number
|
|
15
|
+
}
|
|
16
|
+
selectedLen: number
|
|
17
|
+
}
|
|
18
|
+
export interface createListStorePropsType<ListItem, P> {
|
|
19
|
+
/**
|
|
20
|
+
* @description 默认请求参数
|
|
21
|
+
*/
|
|
22
|
+
defaultParams: P
|
|
23
|
+
/** 列表请求 */
|
|
24
|
+
fetch: (
|
|
25
|
+
state: Pick<stateType<ListItem, P>, 'pagination' | 'selected' | 'total' | 'params'>
|
|
26
|
+
) => Promise<{
|
|
27
|
+
list: any[]
|
|
28
|
+
page?: number
|
|
29
|
+
pageSize?: number
|
|
30
|
+
total?: number
|
|
31
|
+
sum?: Record<string, any>
|
|
32
|
+
}>
|
|
33
|
+
/** 初始化列表时的配置 */
|
|
34
|
+
initConfig?: {
|
|
35
|
+
/** 初始化的时候需要保留值的字段 */
|
|
36
|
+
keepParamsKeys?: Array<keyof P>
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default function createListStore<
|
|
41
|
+
ListItem extends Record<string, any>,
|
|
42
|
+
P extends { page?: number; pageSize?: number; [key: string]: any }
|
|
43
|
+
>(config: createListStorePropsType<ListItem, P>) {
|
|
44
|
+
const loading = ref<stateType<ListItem, P>['loading']>(true)
|
|
45
|
+
const total = ref<stateType<ListItem, P>['total']>(0)
|
|
46
|
+
const params = reactive<stateType<ListItem, P>['params']>(cloneDeep(config.defaultParams))
|
|
47
|
+
const list = ref<stateType<ListItem, P>['list']>([])
|
|
48
|
+
const sum = reactive<stateType<ListItem, P>['sum']>({})
|
|
49
|
+
const selected = ref<stateType<ListItem, P>['selected']>([])
|
|
50
|
+
const pagination = computed<stateType<ListItem, P>['pagination']>(() => ({
|
|
51
|
+
current: params.page || 0,
|
|
52
|
+
pageSize: params.pageSize || 0,
|
|
53
|
+
total: total.value
|
|
54
|
+
}))
|
|
55
|
+
const selectedLen = computed<stateType<ListItem, P>['selectedLen']>(() => size(selected.value))
|
|
56
|
+
function resetParams() {
|
|
57
|
+
assign(params, cloneDeep(config.defaultParams))
|
|
58
|
+
}
|
|
59
|
+
async function fetchList(arg?: { params?: Partial<P>; isConcat?: boolean; isInit?: boolean }) {
|
|
60
|
+
loading.value = true
|
|
61
|
+
try {
|
|
62
|
+
if (arg?.isInit) {
|
|
63
|
+
assign(
|
|
64
|
+
params,
|
|
65
|
+
cloneDeep(config.defaultParams),
|
|
66
|
+
pick(params, config?.initConfig?.keepParamsKeys || [])
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
assign(params, arg?.params)
|
|
70
|
+
const result = await config.fetch({
|
|
71
|
+
pagination: unref(pagination),
|
|
72
|
+
selected: unref(selected),
|
|
73
|
+
total: unref(total),
|
|
74
|
+
params
|
|
75
|
+
})
|
|
76
|
+
const newData = map(result.list, (item: any) => ({
|
|
77
|
+
...item,
|
|
78
|
+
__active__: {
|
|
79
|
+
campaign: false,
|
|
80
|
+
adGroup: false,
|
|
81
|
+
target: false,
|
|
82
|
+
searchTerm: false
|
|
83
|
+
}
|
|
84
|
+
}))
|
|
85
|
+
list.value = !isNil(result.page) && arg?.isConcat ? concat(list, newData) : newData
|
|
86
|
+
sum.value = result.sum || {}
|
|
87
|
+
total.value = result.total || total.value
|
|
88
|
+
params.page = result.page || params.page
|
|
89
|
+
params.pageSize = result.pageSize || params.pageSize
|
|
90
|
+
} finally {
|
|
91
|
+
loading.value = false
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
loading,
|
|
97
|
+
total,
|
|
98
|
+
params,
|
|
99
|
+
list,
|
|
100
|
+
sum,
|
|
101
|
+
selected,
|
|
102
|
+
pagination,
|
|
103
|
+
selectedLen,
|
|
104
|
+
resetParams,
|
|
105
|
+
fetchList
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/** @type {import('tailwindcss').Config} */
|
|
2
|
-
module.exports = {
|
|
3
|
-
content: ['./index.html', './src/**/*.{vue,ts,tsx}'],
|
|
4
|
-
theme: {
|
|
5
|
-
extend: {}
|
|
6
|
-
},
|
|
7
|
-
plugins: []
|
|
8
|
-
}
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
content: ['./index.html', './src/**/*.{vue,ts,tsx}'],
|
|
4
|
+
theme: {
|
|
5
|
+
extend: {}
|
|
6
|
+
},
|
|
7
|
+
plugins: []
|
|
8
|
+
}
|