Skip to content

Commit 1783939

Browse files
author
Daniil Yankouski
authored
Merge pull request #10 from qDanik/setup/vite
Replace webpack with vitejs
2 parents f9279c9 + 246636e commit 1783939

File tree

172 files changed

+7721
-9997
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+7721
-9997
lines changed

.babelrc

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,8 @@
11
{
22
"presets": [
33
["@babel/preset-env", { "targets": { "node": "current" } }],
4-
"@babel/preset-react",
54
"@babel/preset-typescript"
65
],
7-
"plugins": [
8-
"@loadable/babel-plugin",
9-
[
10-
"@babel/plugin-transform-arrow-functions",
11-
{
12-
"spec": false
13-
}
14-
],
15-
"@babel/plugin-proposal-object-rest-spread",
16-
"@babel/plugin-syntax-dynamic-import",
17-
["@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": true }],
18-
"@babel/plugin-proposal-class-properties",
19-
[
20-
"@babel/plugin-transform-runtime",
21-
{
22-
"helpers": false,
23-
"regenerator": true,
24-
"useESModules": true
25-
}
26-
]
27-
],
286
"env": {
297
"test": {
308
"plugins": [

.env.example

Lines changed: 0 additions & 5 deletions
This file was deleted.

.env.production

Lines changed: 0 additions & 5 deletions
This file was deleted.

.env.staging

Lines changed: 0 additions & 5 deletions
This file was deleted.

.eslintrc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"eslint:recommended",
66
"plugin:react/recommended",
77
"plugin:@typescript-eslint/recommended",
8+
"plugin:import/typescript",
89
"plugin:prettier/recommended"
910
],
1011
"env": {
@@ -25,6 +26,12 @@
2526
"settings": {
2627
"react": {
2728
"version": "detect"
29+
},
30+
"import/resolver": {
31+
"node": {
32+
"extensions": [".js", ".jsx", ".ts", ".tsx"],
33+
"moduleDirectory": ["node_modules", "src/", "./"]
34+
}
2835
}
2936
},
3037
"rules": {
@@ -41,7 +48,7 @@
4148
],
4249
"import/extensions": "off",
4350
"import/no-extraneous-dependencies": "off",
44-
"import/no-unresolved": "off",
51+
"import/no-unresolved": "error",
4552
"import/no-useless-path-segments": "off",
4653
"import/prefer-default-export": "off",
4754
"linebreak-style": "off",
@@ -73,6 +80,7 @@
7380
"object-curly-newline": "off",
7481
"object-property-newline": "off",
7582
"prefer-const": "error",
83+
"quote-props": ["error", "as-needed"],
7684
"react/destructuring-assignment": "off",
7785
"react/forbid-prop-types": "off",
7886
"react/no-unused-prop-types": "warn",
@@ -84,6 +92,8 @@
8492
"react-hooks/rules-of-hooks": "error",
8593
"react-hooks/exhaustive-deps": "warn",
8694
"prettier/prettier": "error",
87-
"@typescript-eslint/no-explicit-any": "off"
95+
"@typescript-eslint/no-explicit-any": "off",
96+
"@typescript-eslint/no-namespace": "off",
97+
"@typescript-eslint/member-delimiter-style": ["error"]
8898
}
8999
}
Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,46 @@
1-
name: CI
2-
on: [push, pull_request]
3-
jobs:
4-
checks:
5-
name: Linters
6-
runs-on: ubuntu-latest
7-
steps:
8-
- uses: actions/checkout@v1
9-
- uses: actions/setup-node@v1
10-
- run: yarn install --frozen-lockfile
11-
- run: yarn lint
12-
tests:
13-
name: Tests
14-
runs-on: ubuntu-latest
15-
strategy:
16-
matrix:
17-
node-version: ['12.x', '14.x']
18-
fail-fast: false
19-
steps:
20-
- uses: actions/checkout@v1
21-
- name: Setting up Node.js (v${{ matrix.node-version }}.x)
22-
uses: actions/setup-node@v1
23-
with:
24-
node-version: ${{ matrix.node-version }}
25-
- run: yarn install --frozen-lockfile
26-
- run: yarn test:ci
27-
build:
28-
name: Build
29-
runs-on: ubuntu-latest
30-
steps:
31-
- uses: actions/checkout@v1
32-
- uses: actions/setup-node@v1
33-
- run: yarn install --frozen-lockfile
1+
name: CI
2+
on: [push, pull_request]
3+
jobs:
4+
checks:
5+
name: Linters
6+
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
node-version: ['14.x']
10+
steps:
11+
- uses: actions/checkout@v1
12+
- name: Setting up Node.js (v${{ matrix.node-version }}.x)
13+
uses: actions/setup-node@v1
14+
with:
15+
node-version: ${{ matrix.node-version }}
16+
- run: yarn install --frozen-lockfile
17+
- run: yarn lint
18+
tests:
19+
name: Tests
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
node-version: ['14.x']
24+
fail-fast: false
25+
steps:
26+
- uses: actions/checkout@v1
27+
- name: Setting up Node.js (v${{ matrix.node-version }}.x)
28+
uses: actions/setup-node@v1
29+
with:
30+
node-version: ${{ matrix.node-version }}
31+
- run: yarn install --frozen-lockfile
32+
- run: yarn test:ci
33+
build:
34+
name: Build
35+
runs-on: ubuntu-latest
36+
strategy:
37+
matrix:
38+
node-version: ['14.x']
39+
steps:
40+
- uses: actions/checkout@v1
41+
- name: Setting up Node.js (v${{ matrix.node-version }}.x)
42+
uses: actions/setup-node@v1
43+
with:
44+
node-version: ${{ matrix.node-version }}
45+
- run: yarn install --frozen-lockfile
3446
- run: yarn build

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# misc
32
.DS_Store
43
.vscode

.jest/config.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
import { defaults as defaultConfig } from 'jest-config';
21
import type { Config } from '@jest/types';
2+
import globalOptions from '../.vite/define';
33

44
type JestConfig = Partial<
55
Omit<Config.ProjectConfig, 'moduleNameMapper' | 'transform'> & Config.GlobalConfig
66
> & {
77
preset: string;
8-
moduleNameMapper: Record<string, string | Array<string>>;
8+
moduleNameMapper: Record<string, string>;
99
transform: Record<string, string>;
1010
};
1111

1212
const config: JestConfig = {
1313
preset: 'ts-jest',
14-
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/index.tsx'],
15-
testEnvironment: 'node',
14+
collectCoverageFrom: [
15+
'<rootDir>/src/{domain,data-access,core}/**/*.ts',
16+
],
17+
coveragePathIgnorePatterns: [
18+
'<rootDir>/node_modules',
19+
'<rootDir>/src/index.ts',
20+
'<rootDir>/src/ui/app.component.ts',
21+
'.d.ts',
22+
'.mock.ts',
23+
],
1624
coverageDirectory: 'coverage',
1725
coverageThreshold: {
1826
global: {
@@ -26,20 +34,16 @@ const config: JestConfig = {
2634
'ts-jest': {
2735
tsconfig: '<rootDir>/tsconfig.json',
2836
},
29-
DEVELOPMENT: false,
30-
ENV_CONFIG: {
31-
TOKEN: 'mockToken',
32-
},
37+
...globalOptions,
3338
},
39+
testRegex: ['.test.ts$', '.spec.ts$'],
3440
moduleDirectories: ['<rootDir>/node_modules', '<rootDir>/node_modules/@types', '<rootDir>/src'],
35-
moduleFileExtensions: defaultConfig.moduleFileExtensions,
3641
setupFiles: ['<rootDir>/.jest/setup.ts'],
3742
rootDir: '../',
3843
roots: ['<rootDir>/src'],
3944
moduleNameMapper: {
4045
'file-loader?.*': 'GlobalImageStub',
4146
},
42-
testMatch: ['**/*.(test|spec).(ts|tsx)'],
4347
transform: {
4448
'^.+\\.(tsx|ts)?$': 'ts-jest',
4549
},

.vite/build.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { BuildOptions } from 'vite';
2+
3+
const buildConfig: BuildOptions = {
4+
brotliSize: false,
5+
chunkSizeWarningLimit: 1000,
6+
rollupOptions: {
7+
output: {
8+
manualChunks: (id: string | string[]): string => {
9+
if (id.includes('node_modules')) {
10+
return 'vendor';
11+
}
12+
},
13+
},
14+
},
15+
};
16+
17+
export default buildConfig;

.vite/css.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
preprocessorOptions: {
3+
less: {
4+
javascriptEnabled: true,
5+
},
6+
},
7+
};

0 commit comments

Comments
 (0)