@component-hook/create-app 1.4.4 → 1.5.1

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 (107) hide show
  1. package/{template-shared/LICENSE → LICENSE} +1 -1
  2. package/README.md +1 -1
  3. package/dist/index.d.mts +1 -1
  4. package/dist/index.mjs +110 -101
  5. package/package.json +3 -3
  6. package/template-react/.vscode/extensions.json +0 -9
  7. package/template-react/.vscode/settings.json +0 -18
  8. package/template-react/README.md.art +0 -84
  9. package/template-react/eslint.config.js +0 -18
  10. package/template-react/index.html.art +0 -13
  11. package/template-react/lint-staged.config.js +0 -6
  12. package/template-react/package.json +0 -69
  13. package/template-react/public/vite.svg +0 -1
  14. package/template-react/src/App.tsx +0 -6
  15. package/template-react/src/__tests__/e2e/home.spec.ts +0 -40
  16. package/template-react/src/__tests__/unit/pages/home/components/HelloWorld.test.tsx +0 -45
  17. package/template-react/src/__tests__/unit/pages/home/index.test.tsx +0 -19
  18. package/template-react/src/__tests__/unit/render/index.tsx +0 -15
  19. package/template-react/src/assets/svg-icons/react.svg +0 -1
  20. package/template-react/src/components/common/index.ts +0 -1
  21. package/template-react/src/components/common/svg-icon/index.ts +0 -1
  22. package/template-react/src/components/common/svg-icon/src/index.tsx +0 -23
  23. package/template-react/src/main.tsx +0 -26
  24. package/template-react/src/mocks/browser.ts +0 -4
  25. package/template-react/src/mocks/handlers/index.ts +0 -1
  26. package/template-react/src/mocks/server.ts +0 -4
  27. package/template-react/src/pages/home/components/hello-world/index.tsx +0 -49
  28. package/template-react/src/pages/home/index.module.css +0 -8
  29. package/template-react/src/pages/home/index.tsx +0 -37
  30. package/template-react/src/plugins/i18n/index.ts +0 -15
  31. package/template-react/src/plugins/i18n/locales/en-US.json +0 -3
  32. package/template-react/src/plugins/i18n/locales/zh-TW.json +0 -3
  33. package/template-react/src/router/index.tsx +0 -22
  34. package/template-react/src/stores/constants.ts +0 -1
  35. package/template-react/src/stores/index.ts +0 -1
  36. package/template-react/src/stores/middleware.ts +0 -17
  37. package/template-react/src/stores/modules/config.ts +0 -27
  38. package/template-react/src/styles/base.css +0 -68
  39. package/template-react/src/styles/common/all.css +0 -1
  40. package/template-react/src/styles/common/button.css +0 -26
  41. package/template-react/src/styles/index.css +0 -3
  42. package/template-react/src/styles/tailwind.css +0 -14
  43. package/template-react/src/vite-env.d.ts +0 -9
  44. package/template-react/tsconfig.app.json +0 -32
  45. package/template-react/tsconfig.vitest.json +0 -10
  46. package/template-react/vite.config.ts +0 -40
  47. package/template-react/vitest.config.ts +0 -18
  48. package/template-react/vitest.setup.ts +0 -13
  49. package/template-shared/.browserslistrc +0 -10
  50. package/template-shared/.github/actions/setup-environment/action.yml +0 -21
  51. package/template-shared/.github/renovate.json +0 -14
  52. package/template-shared/.github/workflows/ci.yml +0 -22
  53. package/template-shared/.github/workflows/deploy.yml +0 -27
  54. package/template-shared/.github/workflows/preview.yml +0 -17
  55. package/template-shared/.gitlab/setup.yml +0 -18
  56. package/template-shared/.husky/commit-msg +0 -1
  57. package/template-shared/.husky/pre-commit +0 -1
  58. package/template-shared/_gitignore +0 -32
  59. package/template-shared/_gitlab-ci.yml +0 -22
  60. package/template-shared/commitlint.config.js +0 -3
  61. package/template-shared/playwright.config.ts +0 -49
  62. package/template-shared/postcss.config.js +0 -15
  63. package/template-shared/prettier.config.js +0 -13
  64. package/template-shared/scripts/build-info/index.ts +0 -21
  65. package/template-shared/tsconfig.json +0 -14
  66. package/template-shared/tsconfig.node.json +0 -12
  67. package/template-vue/.vscode/extensions.json +0 -10
  68. package/template-vue/.vscode/settings.json +0 -18
  69. package/template-vue/README.md.art +0 -80
  70. package/template-vue/eslint.config.js +0 -18
  71. package/template-vue/index.html.art +0 -28
  72. package/template-vue/lint-staged.config.js +0 -6
  73. package/template-vue/package.json +0 -68
  74. package/template-vue/public/vite.svg +0 -1
  75. package/template-vue/src/App.vue +0 -7
  76. package/template-vue/src/__tests__/e2e/home.spec.ts +0 -61
  77. package/template-vue/src/__tests__/unit/pages/home/components/HelloWorld.test.ts +0 -57
  78. package/template-vue/src/__tests__/unit/pages/home/index.test.ts +0 -17
  79. package/template-vue/src/__tests__/unit/render/index.ts +0 -28
  80. package/template-vue/src/assets/svg-icons/vue.svg +0 -1
  81. package/template-vue/src/components/common/index.ts +0 -1
  82. package/template-vue/src/components/common/svg-icon/index.ts +0 -1
  83. package/template-vue/src/components/common/svg-icon/src/index.vue +0 -29
  84. package/template-vue/src/locales/en-US.json +0 -3
  85. package/template-vue/src/locales/zh-TW.json +0 -3
  86. package/template-vue/src/main.ts +0 -21
  87. package/template-vue/src/mocks/browser.ts +0 -4
  88. package/template-vue/src/mocks/handlers/index.ts +0 -1
  89. package/template-vue/src/mocks/server.ts +0 -4
  90. package/template-vue/src/pages/home/components/HelloWorld.vue +0 -54
  91. package/template-vue/src/pages/home/index.vue +0 -46
  92. package/template-vue/src/plugins/i18n.ts +0 -11
  93. package/template-vue/src/router/index.ts +0 -23
  94. package/template-vue/src/stores/constants.ts.art +0 -1
  95. package/template-vue/src/stores/index.ts +0 -15
  96. package/template-vue/src/stores/modules/config.ts +0 -20
  97. package/template-vue/src/styles/base.css +0 -59
  98. package/template-vue/src/styles/common/all.css +0 -1
  99. package/template-vue/src/styles/common/button.css +0 -15
  100. package/template-vue/src/styles/index.css +0 -3
  101. package/template-vue/src/styles/tailwind.css +0 -1
  102. package/template-vue/src/vite-env.d.ts +0 -9
  103. package/template-vue/tsconfig.app.json +0 -12
  104. package/template-vue/tsconfig.vitest.json +0 -10
  105. package/template-vue/vite.config.ts +0 -46
  106. package/template-vue/vitest.config.ts +0 -18
  107. package/template-vue/vitest.setup.ts +0 -12
@@ -1,28 +0,0 @@
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 = createPinia();
14
- const router = createRouter({ history: createMemoryHistory(), routes });
15
-
16
- setActivePinia(pinia);
17
-
18
- export function renderComponent(testComponent: Component, options?: RenderComponentOptions) {
19
- const { provide, ...componentOptions } = options ?? {};
20
-
21
- return render(testComponent, {
22
- ...componentOptions,
23
- global: {
24
- plugins: [pinia, i18n, router],
25
- provide,
26
- },
27
- });
28
- }
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
@@ -1 +0,0 @@
1
- export * from './svg-icon';
@@ -1 +0,0 @@
1
- export { default as SvgIcon } from './src/index.vue';
@@ -1,29 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue';
3
-
4
- interface Props {
5
- name: string;
6
- prefix?: string;
7
- color?: string;
8
- }
9
-
10
- defineOptions({ name: 'SvgIcon' });
11
- const props = withDefaults(defineProps<Props>(), {
12
- prefix: 'icon',
13
- color: '#333',
14
- });
15
-
16
- const symbolId = computed(() => `#${props.prefix}-${props.name}`);
17
- </script>
18
-
19
- <template>
20
- <svg
21
- aria-hidden="true"
22
- :title="symbolId"
23
- >
24
- <use
25
- :href="symbolId"
26
- :fill="color"
27
- />
28
- </svg>
29
- </template>
@@ -1,3 +0,0 @@
1
- {
2
- "language": "English"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "language": "中文"
3
- }
@@ -1,21 +0,0 @@
1
- import { createApp } from 'vue';
2
- import i18NPlugin from '@/plugins/i18n';
3
- import router from '@/router';
4
- import App from './App.vue';
5
- import { createPinia } from './stores';
6
- import 'virtual:svg-icons-register';
7
- import '@/styles/index.css';
8
-
9
- if (import.meta.env.VITE_APP_MOCK === 'service-worker') {
10
- const { worker } = await import('@/mocks/browser');
11
-
12
- worker.start();
13
- }
14
-
15
- const app = createApp(App);
16
- const pinia = createPinia();
17
-
18
- app.use(pinia);
19
- app.use(router);
20
- app.use(i18NPlugin);
21
- app.mount('#app');
@@ -1,4 +0,0 @@
1
- import { setupWorker } from 'msw/browser';
2
- import { handlers } from '@/mocks/handlers';
3
-
4
- export const worker = setupWorker(...handlers);
@@ -1 +0,0 @@
1
- export const handlers = [];
@@ -1,4 +0,0 @@
1
- import { setupServer } from 'msw/node';
2
- import { handlers } from '@/mocks/handlers';
3
-
4
- export const mswServer = setupServer(...handlers);
@@ -1,54 +0,0 @@
1
- <script setup lang="ts">
2
- import { ref } from 'vue';
3
- import { useI18n } from 'vue-i18n';
4
- import { useConfigStore } from '@/stores';
5
-
6
- defineProps<{ msg: string }>();
7
-
8
- const { locale } = useI18n();
9
- const { version } = useConfigStore();
10
- const count = ref(0);
11
-
12
- function changeLocale() {
13
- locale.value = locale.value === 'en-US' ? 'zh-TW' : 'en-US';
14
- }
15
- </script>
16
-
17
- <template>
18
- <h1>{{ msg }}</h1>
19
-
20
- <div class="p-8">
21
- <button @click="count++">count is {{ count }}</button>
22
- </div>
23
-
24
- <p>
25
- Check out
26
- <a
27
- href="https://vuejs.org/guide/quick-start.html#local"
28
- target="_blank"
29
- >create-vue</a
30
- >, the official Vue + Vite starter
31
- </p>
32
- <p>
33
- Install
34
- <a
35
- href="https://github.com/vuejs/language-tools"
36
- target="_blank"
37
- >Volar</a
38
- >
39
- in your IDE for a better DX
40
- </p>
41
- <p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
42
- <p class="read-the-docs">
43
- {{ version }}
44
- </p>
45
- <button @click="changeLocale">
46
- {{ $t('language') }}
47
- </button>
48
- </template>
49
-
50
- <style lang="css" scoped>
51
- .read-the-docs {
52
- color: #888;
53
- }
54
- </style>
@@ -1,46 +0,0 @@
1
- <script setup lang="ts">
2
- import { SvgIcon } from '@/components/common';
3
- import HelloWorld from './components/HelloWorld.vue';
4
- </script>
5
-
6
- <template>
7
- <div>
8
- <a
9
- href="https://vitejs.dev"
10
- target="_blank"
11
- >
12
- <img
13
- src="/vite.svg"
14
- class="logo"
15
- alt="Vite logo"
16
- />
17
- </a>
18
- <a
19
- href="https://vuejs.org/"
20
- target="_blank"
21
- aria-label="Vue link"
22
- >
23
- <svg-icon
24
- name="vue"
25
- class="logo hover:drop-shadow-[0_0_2em_#42b883aa]"
26
- />
27
- </a>
28
- </div>
29
-
30
- <hello-world msg="Vite + Vue" />
31
- </template>
32
-
33
- <style lang="css" scoped>
34
- .logo {
35
- width: 96px;
36
- height: 96px;
37
- margin: 0 auto;
38
- padding: 24px;
39
- will-change: filter;
40
- transition: filter 300ms;
41
-
42
- &:hover {
43
- filter: drop-shadow(0 0 2em #646cffaa);
44
- }
45
- }
46
- </style>
@@ -1,11 +0,0 @@
1
- import messages from '@intlify/unplugin-vue-i18n/messages';
2
- import { createI18n } from 'vue-i18n';
3
-
4
- const i18n = createI18n({
5
- legacy: import.meta.env.MODE === 'test',
6
- locale: navigator.language,
7
- fallbackLocale: 'en-US',
8
- messages,
9
- });
10
-
11
- export default i18n;
@@ -1,23 +0,0 @@
1
- import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router';
2
- import HomePage from '@/pages/home/index.vue';
3
-
4
- export const routes: Array<RouteRecordRaw> = [
5
- {
6
- path: '/:catchAll(.*)',
7
- redirect: '/',
8
- },
9
- {
10
- path: '/',
11
- component: HomePage,
12
- meta: {
13
- title: 'Vue3 Coding Standards',
14
- },
15
- },
16
- ];
17
-
18
- const router = createRouter({
19
- history: createWebHistory(),
20
- routes,
21
- });
22
-
23
- export default router;
@@ -1 +0,0 @@
1
- export const STORAGE_PREFIX = '{{projectName}}';
@@ -1,15 +0,0 @@
1
- import { createPinia as create } from 'pinia';
2
- import { createPersistedState } from 'pinia-plugin-persistedstate';
3
- import { STORAGE_PREFIX } from './constants';
4
- export { useConfigStore } from './modules/config';
5
-
6
- export function createPinia() {
7
- const pinia = create();
8
- const persistedState = createPersistedState({
9
- key: storeKey => `${STORAGE_PREFIX}-${storeKey}`,
10
- });
11
-
12
- pinia.use(persistedState);
13
-
14
- return pinia;
15
- }
@@ -1,20 +0,0 @@
1
- import { defineStore } from 'pinia';
2
-
3
- const versionString = import.meta.env.DEV
4
- ? `${import.meta.env.VITE_APP_VERSION}-dev`
5
- : import.meta.env.VITE_APP_VERSION;
6
-
7
- const defaultState = {
8
- isDev: import.meta.env.DEV,
9
- version: versionString,
10
- };
11
-
12
- export const useConfigStore = defineStore('config', {
13
- state: () => defaultState,
14
- getters: {},
15
- actions: {},
16
- persist: {
17
- storage: localStorage,
18
- pick: [],
19
- },
20
- });
@@ -1,59 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- @import './button.css';
@@ -1,15 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- @import './tailwind.css';
2
- @import './base.css';
3
- @import './common/all.css';
@@ -1 +0,0 @@
1
- @import 'tailwindcss';
@@ -1,9 +0,0 @@
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
- }
@@ -1,12 +0,0 @@
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/**/__tests__/*"]
12
- }
@@ -1,10 +0,0 @@
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
- }
@@ -1,46 +0,0 @@
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
- });
@@ -1,18 +0,0 @@
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/__tests__/unit/**/*.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
- );
@@ -1,12 +0,0 @@
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());