Skip to content

Commit 3a1b9ac

Browse files
migrate vite app to webpack-based CRA app and add types for scss modules
1 parent a069f8d commit 3a1b9ac

File tree

214 files changed

+18675
-177
lines changed

Some content is hidden

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

214 files changed

+18675
-177
lines changed

.prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"arrowParens": "avoid",
3+
"singleQuote": true,
4+
"printWidth": 100
5+
}

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "node_modules/typescript/lib"
3+
}

README.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# JS Slot Machine
2+
3+
JS Slot Machine is a Progressive web app with a regular slot machine game that has the logos of main JS-related tools as symbols.
4+
5+
## Available Scripts
6+
7+
In the project directory, you can run:
8+
9+
### `yarn install`
10+
11+
Installs all the dependencies required to run and develop this application.
12+
13+
### `yarn dev`
14+
15+
Runs the app in the development mode.\
16+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
17+
18+
### `yarn build`
19+
20+
Build a production-ready application.
21+
22+
### `yarn lint`
23+
24+
Run linter command.
25+
26+
### `yarn gen-scss-types`
27+
28+
Runs typed-scss-modules and generates types for scss modules, keeping the namespace using BEM css methodology
29+
30+
### `yarn gen-scss-types`
31+
32+
Runs typed-scss-modules and generates types for scss modules, keeping the namespace using BEM css methodology
33+
34+
### `yarn test:unit`
35+
36+
Launches the unit test runner in the interactive watch mode.
37+
### `yarn test:unit-coverage`
38+
39+
Launches the unit test runner in the interactive watch mode and shows tets coverage report.

craco.config.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const path = require(`path`);
2+
3+
module.exports = {
4+
webpack: {
5+
alias: {
6+
'@': path.resolve(__dirname, 'src'),
7+
},
8+
},
9+
style: {
10+
sass: {
11+
loaderOptions: {
12+
additionalData: `
13+
@import "@/assets/styles/_index.scss";
14+
`,
15+
},
16+
},
17+
},
18+
jest: {
19+
preset: 'ts-jest',
20+
collectCoverageFrom: ['src/**/*.ts', 'src/**/*.tsx', '!src/index.tsx'],
21+
coverageReporters: ['text'],
22+
moduleNameMapper: {
23+
'^@/(.+)': '<rootDir>/src/$1',
24+
'\\.(css|scss)$': '<rootDir>/__mocks__/style-mock.ts',
25+
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
26+
'<rootDir>/__mocks__/file-mock.ts',
27+
i18next: '<rootDir>/__mocks__/i18next-mock.ts',
28+
'react-i18next': '<rootDir>/__mocks__/react-i18next-mock.ts',
29+
nanoid: '<rootDir>/__mocks__/nanoid-mock.ts',
30+
},
31+
transform: {
32+
'^.+\\.ts?$': 'ts-jest',
33+
},
34+
configure: {
35+
roots: ['<rootDir>/src'],
36+
testMatch: ['<rootDir>/spec/**/*.{spec,test}.{js,jsx,ts,tsx}'],
37+
},
38+
}
39+
};

package.json

+42-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
2-
"name": "js-slots-webpack",
2+
"name": "js-slot-machine",
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@testing-library/jest-dom": "^5.16.4",
7-
"@testing-library/react": "^13.3.0",
8-
"@testing-library/user-event": "^13.5.0",
9-
"@types/jest": "^27.5.2",
10-
"@types/node": "^17.0.40",
11-
"@types/react": "^18.0.12",
12-
"@types/react-dom": "^18.0.5",
6+
"craco": "^0.0.3",
7+
"gsap": "^3.10.4",
8+
"i18next": "^21.8.8",
9+
"nanoid": "^3.3.4",
1310
"react": "^18.1.0",
1411
"react-dom": "^18.1.0",
12+
"react-i18next": "^11.17.0",
13+
"react-redux": "^8.0.2",
1514
"react-scripts": "5.0.1",
15+
"react-transition-group": "^4.4.2",
16+
"redux": "^4.2.0",
1617
"typescript": "^4.7.3",
17-
"web-vitals": "^2.1.4",
1818
"workbox-background-sync": "^6.5.3",
1919
"workbox-broadcast-update": "^6.5.3",
2020
"workbox-cacheable-response": "^6.5.3",
@@ -29,9 +29,12 @@
2929
"workbox-streams": "^6.5.3"
3030
},
3131
"scripts": {
32-
"start": "react-scripts start",
33-
"build": "react-scripts build",
34-
"test": "react-scripts test",
32+
"start": "craco start",
33+
"build": "craco build",
34+
"lint": "eslint --max-warnings=0 src",
35+
"test:unit": "craco test",
36+
"test:unit-coverage": "yarn test:unit -- --env=jsdom --coverage",
37+
"gen-scss-types": "typed-scss-modules src --additionalData \"@import './assets/styles/_index.scss';\" --nameFormat none --exportType default",
3538
"eject": "react-scripts eject"
3639
},
3740
"eslintConfig": {
@@ -51,5 +54,32 @@
5154
"last 1 firefox version",
5255
"last 1 safari version"
5356
]
57+
},
58+
"devDependencies": {
59+
"@testing-library/jest-dom": "^5.16.4",
60+
"@testing-library/react": "^13.3.0",
61+
"@testing-library/user-event": "^13.5.0",
62+
"@types/jest": "^27.5.2",
63+
"@types/node": "^17.0.40",
64+
"@types/react": "^18.0.12",
65+
"@types/react-dom": "^18.0.5",
66+
"@types/react-transition-group": "^4.4.4",
67+
"sass": "^1.52.2",
68+
"ts-jest": "^28.0.4",
69+
"typed-scss-modules": "^6.5.0"
70+
},
71+
"cracoConfig": "craco.config.js",
72+
"jest": {
73+
"collectCoverageFrom": [
74+
"src/**/*.ts",
75+
"src/**/*.tsx",
76+
"!src/index.tsx"
77+
],
78+
"coverageReporters": [
79+
"text"
80+
],
81+
"moduleNameMapper": {
82+
"^@/(.+)": "<rootDir>/src/$1"
83+
}
5484
}
5585
}

public/favicon.ico

-3.78 KB
Binary file not shown.

0 commit comments

Comments
 (0)