@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.
- package/{template-shared/LICENSE → LICENSE} +1 -1
- package/README.md +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +110 -101
- package/package.json +3 -3
- package/template-react/.vscode/extensions.json +0 -9
- package/template-react/.vscode/settings.json +0 -18
- package/template-react/README.md.art +0 -84
- package/template-react/eslint.config.js +0 -18
- package/template-react/index.html.art +0 -13
- package/template-react/lint-staged.config.js +0 -6
- package/template-react/package.json +0 -69
- package/template-react/public/vite.svg +0 -1
- package/template-react/src/App.tsx +0 -6
- package/template-react/src/__tests__/e2e/home.spec.ts +0 -40
- package/template-react/src/__tests__/unit/pages/home/components/HelloWorld.test.tsx +0 -45
- package/template-react/src/__tests__/unit/pages/home/index.test.tsx +0 -19
- package/template-react/src/__tests__/unit/render/index.tsx +0 -15
- package/template-react/src/assets/svg-icons/react.svg +0 -1
- package/template-react/src/components/common/index.ts +0 -1
- package/template-react/src/components/common/svg-icon/index.ts +0 -1
- package/template-react/src/components/common/svg-icon/src/index.tsx +0 -23
- package/template-react/src/main.tsx +0 -26
- package/template-react/src/mocks/browser.ts +0 -4
- package/template-react/src/mocks/handlers/index.ts +0 -1
- package/template-react/src/mocks/server.ts +0 -4
- package/template-react/src/pages/home/components/hello-world/index.tsx +0 -49
- package/template-react/src/pages/home/index.module.css +0 -8
- package/template-react/src/pages/home/index.tsx +0 -37
- package/template-react/src/plugins/i18n/index.ts +0 -15
- package/template-react/src/plugins/i18n/locales/en-US.json +0 -3
- package/template-react/src/plugins/i18n/locales/zh-TW.json +0 -3
- package/template-react/src/router/index.tsx +0 -22
- package/template-react/src/stores/constants.ts +0 -1
- package/template-react/src/stores/index.ts +0 -1
- package/template-react/src/stores/middleware.ts +0 -17
- package/template-react/src/stores/modules/config.ts +0 -27
- package/template-react/src/styles/base.css +0 -68
- package/template-react/src/styles/common/all.css +0 -1
- package/template-react/src/styles/common/button.css +0 -26
- package/template-react/src/styles/index.css +0 -3
- package/template-react/src/styles/tailwind.css +0 -14
- package/template-react/src/vite-env.d.ts +0 -9
- package/template-react/tsconfig.app.json +0 -32
- package/template-react/tsconfig.vitest.json +0 -10
- package/template-react/vite.config.ts +0 -40
- package/template-react/vitest.config.ts +0 -18
- package/template-react/vitest.setup.ts +0 -13
- package/template-shared/.browserslistrc +0 -10
- package/template-shared/.github/actions/setup-environment/action.yml +0 -21
- package/template-shared/.github/renovate.json +0 -14
- package/template-shared/.github/workflows/ci.yml +0 -22
- package/template-shared/.github/workflows/deploy.yml +0 -27
- package/template-shared/.github/workflows/preview.yml +0 -17
- package/template-shared/.gitlab/setup.yml +0 -18
- package/template-shared/.husky/commit-msg +0 -1
- package/template-shared/.husky/pre-commit +0 -1
- package/template-shared/_gitignore +0 -32
- package/template-shared/_gitlab-ci.yml +0 -22
- package/template-shared/commitlint.config.js +0 -3
- package/template-shared/playwright.config.ts +0 -49
- package/template-shared/postcss.config.js +0 -15
- package/template-shared/prettier.config.js +0 -13
- package/template-shared/scripts/build-info/index.ts +0 -21
- package/template-shared/tsconfig.json +0 -14
- package/template-shared/tsconfig.node.json +0 -12
- package/template-vue/.vscode/extensions.json +0 -10
- package/template-vue/.vscode/settings.json +0 -18
- package/template-vue/README.md.art +0 -80
- package/template-vue/eslint.config.js +0 -18
- package/template-vue/index.html.art +0 -28
- package/template-vue/lint-staged.config.js +0 -6
- package/template-vue/package.json +0 -68
- package/template-vue/public/vite.svg +0 -1
- package/template-vue/src/App.vue +0 -7
- package/template-vue/src/__tests__/e2e/home.spec.ts +0 -61
- package/template-vue/src/__tests__/unit/pages/home/components/HelloWorld.test.ts +0 -57
- package/template-vue/src/__tests__/unit/pages/home/index.test.ts +0 -17
- package/template-vue/src/__tests__/unit/render/index.ts +0 -28
- package/template-vue/src/assets/svg-icons/vue.svg +0 -1
- package/template-vue/src/components/common/index.ts +0 -1
- package/template-vue/src/components/common/svg-icon/index.ts +0 -1
- package/template-vue/src/components/common/svg-icon/src/index.vue +0 -29
- package/template-vue/src/locales/en-US.json +0 -3
- package/template-vue/src/locales/zh-TW.json +0 -3
- package/template-vue/src/main.ts +0 -21
- package/template-vue/src/mocks/browser.ts +0 -4
- package/template-vue/src/mocks/handlers/index.ts +0 -1
- package/template-vue/src/mocks/server.ts +0 -4
- package/template-vue/src/pages/home/components/HelloWorld.vue +0 -54
- package/template-vue/src/pages/home/index.vue +0 -46
- package/template-vue/src/plugins/i18n.ts +0 -11
- package/template-vue/src/router/index.ts +0 -23
- package/template-vue/src/stores/constants.ts.art +0 -1
- package/template-vue/src/stores/index.ts +0 -15
- package/template-vue/src/stores/modules/config.ts +0 -20
- package/template-vue/src/styles/base.css +0 -59
- package/template-vue/src/styles/common/all.css +0 -1
- package/template-vue/src/styles/common/button.css +0 -15
- package/template-vue/src/styles/index.css +0 -3
- package/template-vue/src/styles/tailwind.css +0 -1
- package/template-vue/src/vite-env.d.ts +0 -9
- package/template-vue/tsconfig.app.json +0 -12
- package/template-vue/tsconfig.vitest.json +0 -10
- package/template-vue/vite.config.ts +0 -46
- package/template-vue/vitest.config.ts +0 -18
- package/template-vue/vitest.setup.ts +0 -12
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { screen } from '@testing-library/react';
|
|
2
|
-
import { renderComponent } from '@/__tests__/unit/render';
|
|
3
|
-
import { Home } from '@/pages/home';
|
|
4
|
-
|
|
5
|
-
describe('home page', () => {
|
|
6
|
-
it('renders the correct content', () => {
|
|
7
|
-
renderComponent(<Home />);
|
|
8
|
-
const viteLink = screen.getByRole('link', { name: /vite logo/i });
|
|
9
|
-
const reactLink = screen.getByLabelText(/react link/i);
|
|
10
|
-
|
|
11
|
-
expect(viteLink).toHaveAttribute('href', 'https://vite.dev');
|
|
12
|
-
expect(viteLink).toHaveAttribute('rel', 'noreferrer');
|
|
13
|
-
expect(viteLink).toHaveAttribute('target', '_blank');
|
|
14
|
-
|
|
15
|
-
expect(reactLink).toHaveAttribute('href', 'https://react.dev');
|
|
16
|
-
expect(reactLink).toHaveAttribute('rel', 'noreferrer');
|
|
17
|
-
expect(reactLink).toHaveAttribute('target', '_blank');
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react';
|
|
2
|
-
import { MemoryRouter } from 'react-router-dom';
|
|
3
|
-
import type { RenderOptions } from '@testing-library/react/types';
|
|
4
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
5
|
-
|
|
6
|
-
function ProvidersWrapper({ children }: { children: ReactNode }) {
|
|
7
|
-
return <MemoryRouter>{children}</MemoryRouter>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function renderComponent(
|
|
11
|
-
component: ReactElement,
|
|
12
|
-
options?: Omit<RenderOptions, 'wrapper'>,
|
|
13
|
-
): ReturnType<typeof render> {
|
|
14
|
-
return render(component, { wrapper: ProvidersWrapper, ...options });
|
|
15
|
-
}
|
|
@@ -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="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './svg-icon';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SvgIcon } from './src/index';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react';
|
|
2
|
-
|
|
3
|
-
type Props = HTMLAttributes<SVGElement> & {
|
|
4
|
-
name: string;
|
|
5
|
-
prefix?: string;
|
|
6
|
-
color?: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export function SvgIcon({ name, prefix = 'icon', color = '#333', ...props }: Props) {
|
|
10
|
-
const symbolId = `#${prefix}-${name}`;
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<svg
|
|
14
|
-
{...props}
|
|
15
|
-
aria-hidden="true"
|
|
16
|
-
>
|
|
17
|
-
<use
|
|
18
|
-
href={symbolId}
|
|
19
|
-
fill={color}
|
|
20
|
-
/>
|
|
21
|
-
</svg>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { StrictMode } from 'react';
|
|
2
|
-
import { createRoot } from 'react-dom/client';
|
|
3
|
-
import { App } from './App.tsx';
|
|
4
|
-
|
|
5
|
-
import 'virtual:svg-icons-register';
|
|
6
|
-
import '@/plugins/i18n';
|
|
7
|
-
import '@/styles/index.css';
|
|
8
|
-
|
|
9
|
-
const root = createRoot(document.querySelector('#root') as HTMLElement);
|
|
10
|
-
const isDev = import.meta.env.DEV;
|
|
11
|
-
|
|
12
|
-
if (import.meta.env.VITE_APP_MOCK === 'service-worker') {
|
|
13
|
-
const { worker } = await import('@/mocks/browser');
|
|
14
|
-
|
|
15
|
-
worker.start();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (isDev) {
|
|
19
|
-
root.render(<App />);
|
|
20
|
-
} else {
|
|
21
|
-
root.render(
|
|
22
|
-
<StrictMode>
|
|
23
|
-
<App />
|
|
24
|
-
</StrictMode>,
|
|
25
|
-
);
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const handlers = [];
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { useConfigStore } from '@/stores';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
title?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function HelloWorld({ title = '' }: Props) {
|
|
10
|
-
const [count, setCount] = useState(0);
|
|
11
|
-
const { t, i18n } = useTranslation();
|
|
12
|
-
const { appMeta } = useConfigStore();
|
|
13
|
-
|
|
14
|
-
function changeLanguage() {
|
|
15
|
-
const language = i18n.language === 'zh-TW' ? 'en-US' : 'zh-TW';
|
|
16
|
-
|
|
17
|
-
i18n.changeLanguage(language);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<>
|
|
22
|
-
<h1>{title}</h1>
|
|
23
|
-
|
|
24
|
-
<div className="p-8">
|
|
25
|
-
<button
|
|
26
|
-
className="mb-4"
|
|
27
|
-
onClick={() => setCount(originCount => originCount + 1)}
|
|
28
|
-
>
|
|
29
|
-
count is {count}
|
|
30
|
-
</button>
|
|
31
|
-
<p>
|
|
32
|
-
Edit <code>src/App.tsx</code> and save to test HMR
|
|
33
|
-
</p>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<p className="text-[#888]">Click on the Vite and React logos to learn more</p>
|
|
37
|
-
<p className="mt-1 text-[#888]">
|
|
38
|
-
{appMeta.version} - Built at: {appMeta.builtAt.toLocaleString()}
|
|
39
|
-
</p>
|
|
40
|
-
|
|
41
|
-
<button
|
|
42
|
-
className="my-4"
|
|
43
|
-
onClick={() => changeLanguage()}
|
|
44
|
-
>
|
|
45
|
-
{t('language')}
|
|
46
|
-
</button>
|
|
47
|
-
</>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { SvgIcon } from '@/components/common';
|
|
2
|
-
import { HelloWorld } from './components/hello-world';
|
|
3
|
-
import styles from './index.module.css';
|
|
4
|
-
import viteLogo from '/vite.svg';
|
|
5
|
-
|
|
6
|
-
export function Home() {
|
|
7
|
-
return (
|
|
8
|
-
<>
|
|
9
|
-
<div>
|
|
10
|
-
<a
|
|
11
|
-
href="https://vite.dev"
|
|
12
|
-
target="_blank"
|
|
13
|
-
rel="noreferrer"
|
|
14
|
-
>
|
|
15
|
-
<img
|
|
16
|
-
src={viteLogo}
|
|
17
|
-
className={`${styles.logo} hover:filter-[drop-shadow(0_0_2em_#646cffaa)]`}
|
|
18
|
-
alt="Vite logo"
|
|
19
|
-
/>
|
|
20
|
-
</a>
|
|
21
|
-
<a
|
|
22
|
-
href="https://react.dev"
|
|
23
|
-
target="_blank"
|
|
24
|
-
rel="noreferrer"
|
|
25
|
-
aria-label="React link"
|
|
26
|
-
>
|
|
27
|
-
<SvgIcon
|
|
28
|
-
name="react"
|
|
29
|
-
className={`${styles.logo} motion-safe:animate-logo-spin hover:filter-[drop-shadow(0_0_2em_#61dafbaa)]`}
|
|
30
|
-
/>
|
|
31
|
-
</a>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<HelloWorld title="Vite + React" />
|
|
35
|
-
</>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import i18n from 'i18next';
|
|
2
|
-
import { initReactI18next } from 'react-i18next';
|
|
3
|
-
import enUS from './locales/en-US.json' with { type: 'json' };
|
|
4
|
-
import zhTW from './locales/zh-TW.json' with { type: 'json' };
|
|
5
|
-
|
|
6
|
-
i18n.use(initReactI18next).init({
|
|
7
|
-
lng: navigator.language,
|
|
8
|
-
fallbackLng: 'en-US',
|
|
9
|
-
resources: {
|
|
10
|
-
'zh-TW': { translation: zhTW },
|
|
11
|
-
'en-US': { translation: enUS },
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export default i18n;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { createBrowserRouter, Navigate } from 'react-router-dom';
|
|
2
|
-
import { Home } from '@/pages/home';
|
|
3
|
-
|
|
4
|
-
export const routes = [
|
|
5
|
-
{
|
|
6
|
-
path: '*',
|
|
7
|
-
element: (
|
|
8
|
-
<Navigate
|
|
9
|
-
to="/"
|
|
10
|
-
replace
|
|
11
|
-
/>
|
|
12
|
-
),
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
path: '/',
|
|
16
|
-
element: <Home />,
|
|
17
|
-
},
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
const router = createBrowserRouter(routes);
|
|
21
|
-
|
|
22
|
-
export default router;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const STORAGE_PREFIX = 'react-starter';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useConfigStore } from './modules/config';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { create, type StateCreator } from 'zustand';
|
|
2
|
-
import { createJSONStorage, persist, type PersistOptions } from 'zustand/middleware';
|
|
3
|
-
import { STORAGE_PREFIX } from './constants';
|
|
4
|
-
|
|
5
|
-
export function createPersistedStore<T, S = Partial<T>>(
|
|
6
|
-
id: string,
|
|
7
|
-
initializer: StateCreator<T>,
|
|
8
|
-
persistOptions?: Partial<PersistOptions<T, S>>,
|
|
9
|
-
) {
|
|
10
|
-
return create(
|
|
11
|
-
persist<T, [], [], S>(initializer, {
|
|
12
|
-
name: `${STORAGE_PREFIX}-${id}`,
|
|
13
|
-
storage: createJSONStorage(() => localStorage),
|
|
14
|
-
...persistOptions,
|
|
15
|
-
}),
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { createPersistedStore } from '../middleware';
|
|
2
|
-
|
|
3
|
-
interface ConfigState {
|
|
4
|
-
appMeta: {
|
|
5
|
-
version: string;
|
|
6
|
-
builtAt: Date;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const versionString = `${import.meta.env.VITE_APP_VERSION}-${import.meta.env.VITE_APP_LAST_COMMIT_HASH}`;
|
|
11
|
-
|
|
12
|
-
const defaultState = {
|
|
13
|
-
appMeta: {
|
|
14
|
-
version: import.meta.env.MODE === 'development' ? `${versionString}-dev` : versionString,
|
|
15
|
-
builtAt: new Date(Number(import.meta.env.VITE_APP_BUILD_EPOCH)),
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const useConfigStore = createPersistedStore<ConfigState>(
|
|
20
|
-
'config',
|
|
21
|
-
() => ({
|
|
22
|
-
...defaultState,
|
|
23
|
-
}),
|
|
24
|
-
{
|
|
25
|
-
partialize: () => ({}),
|
|
26
|
-
},
|
|
27
|
-
);
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
font-family: 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
|
-
a {
|
|
23
|
-
font-weight: 500;
|
|
24
|
-
color: #646cff;
|
|
25
|
-
text-decoration: inherit;
|
|
26
|
-
|
|
27
|
-
&:hover {
|
|
28
|
-
color: #535bf2;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
body {
|
|
33
|
-
margin: 0;
|
|
34
|
-
display: flex;
|
|
35
|
-
place-items: center;
|
|
36
|
-
min-width: 320px;
|
|
37
|
-
min-height: 100vh;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
img {
|
|
41
|
-
-webkit-touch-callout: none;
|
|
42
|
-
-webkit-user-drag: none;
|
|
43
|
-
user-select: none;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
h1 {
|
|
47
|
-
font-size: 3.2em;
|
|
48
|
-
line-height: 1.1;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
#root {
|
|
52
|
-
max-width: 1280px;
|
|
53
|
-
width: 100%;
|
|
54
|
-
margin: 0 auto;
|
|
55
|
-
padding: 2rem;
|
|
56
|
-
text-align: center;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@media (prefers-color-scheme: light) {
|
|
60
|
-
:root {
|
|
61
|
-
color: #213547;
|
|
62
|
-
background-color: #ffffff;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
a:hover {
|
|
66
|
-
color: #747bff;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import './button.css';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
button {
|
|
2
|
-
border-radius: 8px;
|
|
3
|
-
border: 1px solid transparent;
|
|
4
|
-
padding: 0.6em 1.2em;
|
|
5
|
-
font-size: 1em;
|
|
6
|
-
font-weight: 500;
|
|
7
|
-
font-family: inherit;
|
|
8
|
-
background-color: #1a1a1a;
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
transition: border-color 0.25s;
|
|
11
|
-
|
|
12
|
-
&:hover {
|
|
13
|
-
border-color: #646cff;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
&:focus,
|
|
17
|
-
&:focus-visible {
|
|
18
|
-
outline: 4px auto -webkit-focus-ring-color;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@media (prefers-color-scheme: light) {
|
|
23
|
-
button {
|
|
24
|
-
background-color: #f9f9f9;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -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_MOCK?: 'service-worker';
|
|
8
|
-
readonly VITE_APP_BUILD_EPOCH?: string;
|
|
9
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"composite": true,
|
|
4
|
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
5
|
-
"target": "ES2020",
|
|
6
|
-
"jsx": "react-jsx",
|
|
7
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
8
|
-
"moduleDetection": "force",
|
|
9
|
-
"useDefineForClassFields": true,
|
|
10
|
-
"module": "ESNext",
|
|
11
|
-
|
|
12
|
-
/* Bundler mode */
|
|
13
|
-
"moduleResolution": "bundler",
|
|
14
|
-
"paths": {
|
|
15
|
-
"@/*": ["./src/*"]
|
|
16
|
-
},
|
|
17
|
-
"allowImportingTsExtensions": true,
|
|
18
|
-
|
|
19
|
-
/* Linting */
|
|
20
|
-
"strict": true,
|
|
21
|
-
"noFallthroughCasesInSwitch": true,
|
|
22
|
-
"noUnusedLocals": true,
|
|
23
|
-
"noUnusedParameters": true,
|
|
24
|
-
"noEmit": true,
|
|
25
|
-
"verbatimModuleSyntax": true,
|
|
26
|
-
"erasableSyntaxOnly": true,
|
|
27
|
-
"skipLibCheck": true,
|
|
28
|
-
"noUncheckedSideEffectImports": true
|
|
29
|
-
},
|
|
30
|
-
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx"],
|
|
31
|
-
"exclude": ["src/**/__tests__/*"]
|
|
32
|
-
}
|
|
@@ -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", "vitest.setup.ts"],
|
|
9
|
-
"exclude": []
|
|
10
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'node:path';
|
|
2
|
-
import { fileURLToPath, URL } from 'node:url';
|
|
3
|
-
import tailwindcss from '@tailwindcss/vite';
|
|
4
|
-
import react from '@vitejs/plugin-react-swc';
|
|
5
|
-
import { defineConfig } from 'vite';
|
|
6
|
-
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
|
7
|
-
import './scripts/build-info';
|
|
8
|
-
|
|
9
|
-
export default defineConfig({
|
|
10
|
-
base: './',
|
|
11
|
-
plugins: [
|
|
12
|
-
react(),
|
|
13
|
-
tailwindcss(),
|
|
14
|
-
createSvgIconsPlugin({
|
|
15
|
-
iconDirs: [resolve(process.cwd(), 'src/assets/svg-icons')],
|
|
16
|
-
}),
|
|
17
|
-
],
|
|
18
|
-
esbuild: {
|
|
19
|
-
pure: ['console.log'],
|
|
20
|
-
drop: ['debugger'],
|
|
21
|
-
},
|
|
22
|
-
resolve: {
|
|
23
|
-
alias: {
|
|
24
|
-
'@': fileURLToPath(new URL('src', import.meta.url)),
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
build: {
|
|
28
|
-
rollupOptions: {
|
|
29
|
-
output: {
|
|
30
|
-
chunkFileNames: 'chunks/[name]-[hash].js',
|
|
31
|
-
assetFileNames: 'assets/[name].[hash].[ext]',
|
|
32
|
-
entryFileNames: 'entries/[name].[hash].js',
|
|
33
|
-
manualChunks: {
|
|
34
|
-
core: ['react', 'react-dom', 'react-i18next', 'react-router-dom', 'zustand', 'i18next'],
|
|
35
|
-
vender: ['axios'],
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
});
|
|
@@ -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.tsx'],
|
|
11
|
-
setupFiles: ['./vitest.setup.ts'],
|
|
12
|
-
coverage: {
|
|
13
|
-
provider: 'v8',
|
|
14
|
-
include: ['!src/main.tsx', 'src/**/*.tsx', 'src/**/*.ts'],
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
}),
|
|
18
|
-
);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { cleanup } from '@testing-library/react';
|
|
2
|
-
import { mswServer } from '@/mocks/server';
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
4
|
-
import '@/plugins/i18n';
|
|
5
|
-
|
|
6
|
-
beforeAll(() => mswServer.listen());
|
|
7
|
-
|
|
8
|
-
afterEach(() => {
|
|
9
|
-
cleanup();
|
|
10
|
-
mswServer.resetHandlers();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
afterAll(() => mswServer.close());
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Click this link to view browser coverage https://browsersl.ist/#q=%3E+1.5%25%0Aios+%3E%3D+13%0Achrome+%3E%3D+60%0Anot+ie+%3C%3D+11%0Alast+2+versions%0Anot+dead
|
|
2
|
-
|
|
3
|
-
# Browsers that support
|
|
4
|
-
|
|
5
|
-
> 1.5%
|
|
6
|
-
ios >= 13
|
|
7
|
-
chrome >= 60
|
|
8
|
-
not ie <= 11
|
|
9
|
-
last 2 versions
|
|
10
|
-
not dead
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
name: Setup environment
|
|
2
|
-
|
|
3
|
-
description: Install dependencies
|
|
4
|
-
|
|
5
|
-
runs:
|
|
6
|
-
using: composite
|
|
7
|
-
steps:
|
|
8
|
-
- name: install pnpm
|
|
9
|
-
uses: pnpm/action-setup@v4
|
|
10
|
-
with:
|
|
11
|
-
run_install: false
|
|
12
|
-
|
|
13
|
-
- name: install Node.js
|
|
14
|
-
uses: actions/setup-node@v6
|
|
15
|
-
with:
|
|
16
|
-
node-version: 24.12.0
|
|
17
|
-
cache: pnpm
|
|
18
|
-
|
|
19
|
-
- name: install dependencies
|
|
20
|
-
shell: bash
|
|
21
|
-
run: pnpm install
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
-
"extends": ["config:recommended", "schedule:weekly", "group:allNonMajor"],
|
|
4
|
-
"labels": ["dependencies"],
|
|
5
|
-
"rangeStrategy": "bump",
|
|
6
|
-
"ignoreDeps": ["node"],
|
|
7
|
-
"packageRules": [
|
|
8
|
-
{
|
|
9
|
-
"matchDepTypes": ["peerDependencies"],
|
|
10
|
-
"enabled": false
|
|
11
|
-
}
|
|
12
|
-
],
|
|
13
|
-
"postUpdateOptions": ["pnpmDedupe"]
|
|
14
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: CI Pipeline
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_call:
|
|
5
|
-
workflow_dispatch:
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
CI:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v6
|
|
12
|
-
- name: setup environment
|
|
13
|
-
uses: ./.github/actions/setup-environment
|
|
14
|
-
|
|
15
|
-
- name: install Playwright browsers
|
|
16
|
-
run: npx playwright install --with-deps
|
|
17
|
-
|
|
18
|
-
- name: run unit test
|
|
19
|
-
run: pnpm test:unit
|
|
20
|
-
|
|
21
|
-
- name: run e2e test
|
|
22
|
-
run: pnpm test:ci-e2e
|