@component-hook/create-app 1.5.1 → 1.6.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.
- package/README.md +1 -0
- package/package.json +10 -10
- package/template-react/.vscode/extensions.json +9 -0
- package/template-react/.vscode/settings.json +18 -0
- package/template-react/README.md.art +85 -0
- package/template-react/e2e/home.spec.ts +40 -0
- package/template-react/eslint.config.js +18 -0
- package/template-react/index.html.art +13 -0
- package/template-react/lint-staged.config.js +6 -0
- package/template-react/package.json +70 -0
- package/template-react/public/vite.svg +1 -0
- package/template-react/src/App.tsx +6 -0
- package/template-react/src/assets/svg-icons/react.svg +1 -0
- package/template-react/src/components/common/index.ts +1 -0
- package/template-react/src/components/common/svg-icon/index.ts +1 -0
- package/template-react/src/components/common/svg-icon/src/index.tsx +23 -0
- package/template-react/src/main.tsx +26 -0
- package/template-react/src/mocks/browser.ts +4 -0
- package/template-react/src/mocks/handlers/index.ts +1 -0
- package/template-react/src/mocks/server.ts +4 -0
- package/template-react/src/pages/home/components/hello-world/index.test.tsx +45 -0
- package/template-react/src/pages/home/components/hello-world/index.tsx +49 -0
- package/template-react/src/pages/home/index.module.css +8 -0
- package/template-react/src/pages/home/index.test.tsx +19 -0
- package/template-react/src/pages/home/index.tsx +37 -0
- package/template-react/src/plugins/i18n/index.ts +19 -0
- package/template-react/src/plugins/i18n/locales/en-US.json +3 -0
- package/template-react/src/plugins/i18n/locales/zh-TW.json +3 -0
- package/template-react/src/router/index.tsx +22 -0
- package/template-react/src/stores/constants.ts +1 -0
- package/template-react/src/stores/index.ts +1 -0
- package/template-react/src/stores/middleware.ts +17 -0
- package/template-react/src/stores/modules/config.ts +27 -0
- package/template-react/src/styles/base.css +68 -0
- package/template-react/src/styles/common/all.css +1 -0
- package/template-react/src/styles/common/button.css +26 -0
- package/template-react/src/styles/index.css +3 -0
- package/template-react/src/styles/tailwind.css +14 -0
- package/template-react/src/test-utils/index.tsx +15 -0
- package/template-react/src/vite-env.d.ts +9 -0
- package/template-react/tsconfig.app.json +32 -0
- package/template-react/tsconfig.vitest.json +10 -0
- package/template-react/vite.config.ts +40 -0
- package/template-react/vitest.config.ts +18 -0
- package/template-react/vitest.setup.ts +13 -0
- package/template-shared/.browserslistrc +10 -0
- package/template-shared/.github/actions/setup-environment/action.yml +21 -0
- package/template-shared/.github/renovate.json +14 -0
- package/template-shared/.github/workflows/ci.yml +22 -0
- package/template-shared/.github/workflows/deploy.yml +27 -0
- package/template-shared/.github/workflows/preview.yml +17 -0
- package/template-shared/.gitlab/setup.yml +18 -0
- package/template-shared/.husky/commit-msg +1 -0
- package/template-shared/.husky/pre-commit +1 -0
- package/{LICENSE → template-shared/LICENSE} +1 -1
- package/template-shared/_gitignore +32 -0
- package/template-shared/_gitlab-ci.yml +22 -0
- package/template-shared/commitlint.config.js +3 -0
- package/template-shared/playwright.config.ts +49 -0
- package/template-shared/postcss.config.js +15 -0
- package/template-shared/prettier.config.js +13 -0
- package/template-shared/scripts/build-info/index.ts +21 -0
- package/template-shared/tsconfig.json +14 -0
- package/template-shared/tsconfig.node.json +12 -0
- package/template-vue/.vscode/extensions.json +10 -0
- package/template-vue/.vscode/settings.json +18 -0
- package/template-vue/README.md.art +81 -0
- package/template-vue/e2e/home.spec.ts +59 -0
- package/template-vue/eslint.config.js +18 -0
- package/template-vue/index.html.art +28 -0
- package/template-vue/lint-staged.config.js +6 -0
- package/template-vue/package.json +69 -0
- package/template-vue/public/vite.svg +1 -0
- package/template-vue/src/App.vue +7 -0
- package/template-vue/src/assets/svg-icons/vue.svg +1 -0
- package/template-vue/src/components/common/index.ts +1 -0
- package/template-vue/src/components/common/svg-icon/index.ts +1 -0
- package/template-vue/src/components/common/svg-icon/src/index.vue +29 -0
- package/template-vue/src/locales/en-US.json +3 -0
- package/template-vue/src/locales/zh-TW.json +3 -0
- package/template-vue/src/main.ts +21 -0
- package/template-vue/src/mocks/browser.ts +4 -0
- package/template-vue/src/mocks/handlers/index.ts +1 -0
- package/template-vue/src/mocks/server.ts +4 -0
- package/template-vue/src/pages/home/components/HelloWorld.test.ts +57 -0
- package/template-vue/src/pages/home/components/HelloWorld.vue +54 -0
- package/template-vue/src/pages/home/index.test.ts +17 -0
- package/template-vue/src/pages/home/index.vue +46 -0
- package/template-vue/src/plugins/i18n.ts +11 -0
- package/template-vue/src/router/index.ts +23 -0
- package/template-vue/src/stores/constants.ts.art +1 -0
- package/template-vue/src/stores/index.ts +15 -0
- package/template-vue/src/stores/modules/config.ts +20 -0
- package/template-vue/src/styles/base.css +59 -0
- package/template-vue/src/styles/common/all.css +1 -0
- package/template-vue/src/styles/common/button.css +15 -0
- package/template-vue/src/styles/index.css +3 -0
- package/template-vue/src/styles/tailwind.css +1 -0
- package/template-vue/src/test-utils/index.ts +33 -0
- package/template-vue/src/vite-env.d.ts +9 -0
- package/template-vue/tsconfig.app.json +12 -0
- package/template-vue/tsconfig.vitest.json +10 -0
- package/template-vue/vite.config.ts +46 -0
- package/template-vue/vitest.config.ts +18 -0
- package/template-vue/vitest.setup.ts +12 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
+
line-height: 1.5;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
|
|
6
|
+
color-scheme: light dark;
|
|
7
|
+
color: rgba(255, 255, 255, 0.87);
|
|
8
|
+
background-color: #242424;
|
|
9
|
+
|
|
10
|
+
overscroll-behavior: none none;
|
|
11
|
+
touch-action: manipulation;
|
|
12
|
+
user-select: none;
|
|
13
|
+
text-rendering: optimizeLegibility;
|
|
14
|
+
-moz-osx-font-smoothing: grayscale;
|
|
15
|
+
-moz-touch-callout: none;
|
|
16
|
+
-ms-touch-callout: none;
|
|
17
|
+
-webkit-font-smoothing: antialiased;
|
|
18
|
+
-webkit-touch-callout: none;
|
|
19
|
+
-webkit-overflow-scrolling: touch;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media (prefers-color-scheme: light) {
|
|
23
|
+
:root {
|
|
24
|
+
background-color: #ffffff;
|
|
25
|
+
color: #213547;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
body {
|
|
30
|
+
margin: 0;
|
|
31
|
+
display: flex;
|
|
32
|
+
place-items: center;
|
|
33
|
+
min-width: 320px;
|
|
34
|
+
min-height: 100vh;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
img {
|
|
38
|
+
-webkit-touch-callout: none;
|
|
39
|
+
-webkit-user-drag: none;
|
|
40
|
+
user-select: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#app {
|
|
44
|
+
max-width: 80rem;
|
|
45
|
+
margin: auto;
|
|
46
|
+
padding: 32px;
|
|
47
|
+
text-align: center;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
a {
|
|
51
|
+
font-weight: 500;
|
|
52
|
+
text-decoration-color: inherit;
|
|
53
|
+
color: #646cff;
|
|
54
|
+
transition: color 150ms;
|
|
55
|
+
|
|
56
|
+
&:hover {
|
|
57
|
+
color: #535bf2;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import './button.css';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
button {
|
|
2
|
+
border-radius: 8px;
|
|
3
|
+
padding: 8px;
|
|
4
|
+
border-width: 1px;
|
|
5
|
+
border-color: transparent;
|
|
6
|
+
transition-property: border-color;
|
|
7
|
+
transition-duration: 300ms;
|
|
8
|
+
&:hover {
|
|
9
|
+
border-color: #646cff;
|
|
10
|
+
}
|
|
11
|
+
&:focus {
|
|
12
|
+
outline-width: 4px;
|
|
13
|
+
outline-color: -webkit-focus-ring-color;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { render } from '@testing-library/vue';
|
|
2
|
+
import { createPinia, setActivePinia } from 'pinia';
|
|
3
|
+
import { createMemoryHistory, createRouter } from 'vue-router';
|
|
4
|
+
import i18n from '@/plugins/i18n';
|
|
5
|
+
import { routes } from '@/router';
|
|
6
|
+
import type { RenderOptions } from '@testing-library/vue/types';
|
|
7
|
+
import type { Component } from 'vue';
|
|
8
|
+
|
|
9
|
+
interface RenderComponentOptions extends RenderOptions<unknown> {
|
|
10
|
+
provide?: Record<PropertyKey, unknown>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const pinia = createTestPinia();
|
|
14
|
+
const router = createRouter({ history: createMemoryHistory(), routes });
|
|
15
|
+
|
|
16
|
+
function createTestPinia() {
|
|
17
|
+
const testPinia = createPinia();
|
|
18
|
+
|
|
19
|
+
setActivePinia(testPinia);
|
|
20
|
+
return testPinia;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function renderComponent(testComponent: Component, options?: RenderComponentOptions) {
|
|
24
|
+
const { provide, ...componentOptions } = options ?? {};
|
|
25
|
+
|
|
26
|
+
return render(testComponent, {
|
|
27
|
+
...componentOptions,
|
|
28
|
+
global: {
|
|
29
|
+
plugins: [pinia, i18n, router],
|
|
30
|
+
provide,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
declare module 'virtual:svg-icons-register';
|
|
4
|
+
|
|
5
|
+
interface ImportMetaEnv extends Readonly<Record<string, string>> {
|
|
6
|
+
readonly VITE_APP_VERSION: string;
|
|
7
|
+
readonly VITE_APP_BUILD_EPOCH?: string;
|
|
8
|
+
readonly VITE_APP_MOCK?: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
6
|
+
"paths": {
|
|
7
|
+
"@/*": ["./src/*"]
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
|
11
|
+
"exclude": ["src/**/*.test.*", "src/test-utils"]
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.app.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.vitest.tsbuildinfo",
|
|
6
|
+
"types": ["vitest/globals"]
|
|
7
|
+
},
|
|
8
|
+
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "vitest.setup.ts"],
|
|
9
|
+
"exclude": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { dirname, resolve } from 'node:path';
|
|
2
|
+
import { fileURLToPath, URL } from 'node:url';
|
|
3
|
+
import vueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
|
4
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
5
|
+
import vue from '@vitejs/plugin-vue';
|
|
6
|
+
import { visualizer } from 'rollup-plugin-visualizer';
|
|
7
|
+
import { defineConfig } from 'vite';
|
|
8
|
+
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
|
9
|
+
import './scripts/build-info';
|
|
10
|
+
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
base: './',
|
|
13
|
+
plugins: [
|
|
14
|
+
vue(),
|
|
15
|
+
tailwindcss(),
|
|
16
|
+
vueI18nPlugin({
|
|
17
|
+
include: resolve(dirname(fileURLToPath(import.meta.url)), 'src/locales/**'),
|
|
18
|
+
}),
|
|
19
|
+
createSvgIconsPlugin({
|
|
20
|
+
iconDirs: [resolve(process.cwd(), 'src/assets/svg-icons')],
|
|
21
|
+
}),
|
|
22
|
+
visualizer({ gzipSize: true }),
|
|
23
|
+
],
|
|
24
|
+
esbuild: {
|
|
25
|
+
pure: ['console.log'],
|
|
26
|
+
drop: ['debugger'],
|
|
27
|
+
},
|
|
28
|
+
resolve: {
|
|
29
|
+
alias: {
|
|
30
|
+
'@': fileURLToPath(new URL('src', import.meta.url)),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
build: {
|
|
34
|
+
rollupOptions: {
|
|
35
|
+
output: {
|
|
36
|
+
chunkFileNames: 'chunks/[name]-[hash].js',
|
|
37
|
+
assetFileNames: 'assets/[name].[hash].[ext]',
|
|
38
|
+
entryFileNames: 'entries/[name].[hash].js',
|
|
39
|
+
manualChunks: {
|
|
40
|
+
core: ['vue', 'vue-router', 'pinia', 'pinia-plugin-persistedstate', 'vue-i18n'],
|
|
41
|
+
vender: ['axios', '@intlify/unplugin-vue-i18n/messages'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineConfig, mergeConfig } from 'vitest/config';
|
|
2
|
+
import viteConfig from './vite.config';
|
|
3
|
+
|
|
4
|
+
export default mergeConfig(
|
|
5
|
+
viteConfig,
|
|
6
|
+
defineConfig({
|
|
7
|
+
test: {
|
|
8
|
+
globals: true,
|
|
9
|
+
environment: 'jsdom',
|
|
10
|
+
include: ['src/**/*.test.ts'],
|
|
11
|
+
setupFiles: ['./vitest.setup.ts'],
|
|
12
|
+
coverage: {
|
|
13
|
+
provider: 'v8',
|
|
14
|
+
include: ['!src/main.ts', 'src/**/*.ts', 'src/**/*.vue'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
}),
|
|
18
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { cleanup } from '@testing-library/vue';
|
|
2
|
+
import { mswServer } from '@/mocks/server';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
|
|
5
|
+
beforeAll(() => mswServer.listen());
|
|
6
|
+
|
|
7
|
+
afterEach(() => {
|
|
8
|
+
cleanup();
|
|
9
|
+
mswServer.resetHandlers();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
afterAll(() => mswServer.close());
|