Skip to content

Commit 195900c

Browse files
authored
Merge pull request #1004 from Dudrie/fix-things
Fix things
2 parents 4c72856 + abea226 commit 195900c

56 files changed

Lines changed: 11653 additions & 4341 deletions

Some content is hidden

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

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RUN pnpm install && pnpm build
2828
# Create the image which runs the server
2929
#
3030
# =============================================
31-
FROM alpine:3
31+
FROM alpine:3 as production
3232

3333
# Installs latest Chromium package, NodeJS and pnpm.
3434
RUN apk add --no-cache \

client/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SKIP_PREFLIGHT_CHECK=true
2+
BROWSER=none

client/.eslintrc.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
extends:
3+
- 'react-app'
4+
5+
rules:
6+
'react/display-name': 'off'
7+
'react/jsx-no-duplicate-props':
8+
- 'warn'
9+
- ignoreCase: false
10+
'react/prop-types': [ 0 ]

client/.gitignore

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
1-
.build
2-
build
3-
web_modules
4-
node_modules
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

client/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Getting Started with Create React App
2+
3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4+
5+
## Available Scripts
6+
7+
In the project directory, you can run:
8+
9+
### `npm start`
10+
11+
Runs the app in the development mode.\
12+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13+
14+
The page will reload if you make edits.\
15+
You will also see any lint errors in the console.
16+
17+
### `npm test`
18+
19+
Launches the test runner in the interactive watch mode.\
20+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more
21+
information.
22+
23+
### `npm run build`
24+
25+
Builds the app for production to the `build` folder.\
26+
It correctly bundles React in production mode and optimizes the build for the best performance.
27+
28+
The build is minified and the filenames include the hashes.\
29+
Your app is ready to be deployed!
30+
31+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
32+
33+
### `npm run eject`
34+
35+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
36+
37+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will
38+
remove the single build dependency from your project.
39+
40+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right
41+
into your project so you have full control over them. All of the commands except `eject` will still work, but they will
42+
point to the copied scripts so you can tweak them. At this point you’re on your own.
43+
44+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you
45+
shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t
46+
customize it when you are ready for it.
47+
48+
## Learn More
49+
50+
You can learn more in
51+
the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
52+
53+
To learn React, check out the [React documentation](https://reactjs.org/).

client/craco.config.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/* eslint-disable @typescript-eslint/no-var-requires */
2+
const CracoAlias = require('craco-alias');
3+
4+
const path = require('path');
5+
const fs = require('fs');
6+
7+
// Make sure any symlinks in the project folder are resolved:
8+
// https://github.com/facebook/create-react-app/issues/637
9+
const appDirectory = fs.realpathSync(process.cwd());
10+
const resolvePath = (relativePath) => path.resolve(appDirectory, relativePath);
11+
12+
module.exports = {
13+
webpack: {
14+
configure: (config, { env: webpackEnv }) => {
15+
const isEnvProduction = webpackEnv === 'production';
16+
const serverSharedLoader = {
17+
test: /\.(js|mjs|jsx|ts|tsx)$/,
18+
include: resolvePath('../server/src/shared'),
19+
loader: require.resolve('babel-loader'),
20+
options: {
21+
presets: ['react-app'],
22+
customize: require.resolve('babel-preset-react-app/webpack-overrides'),
23+
plugins: [
24+
[
25+
require.resolve('babel-plugin-named-asset-import'),
26+
{
27+
loaderMap: {
28+
svg: {
29+
ReactComponent: '@svgr/webpack?-svgo,+titleProp,+ref![path]',
30+
},
31+
},
32+
},
33+
],
34+
],
35+
cacheDirectory: true,
36+
cacheCompression: false,
37+
compact: isEnvProduction,
38+
},
39+
};
40+
41+
config.module.rules.forEach((rule) => {
42+
if (typeof rule.oneOf !== 'undefined') {
43+
rule.oneOf.splice(rule.oneOf.length - 2, 0, serverSharedLoader);
44+
}
45+
});
46+
47+
config.resolve.plugins = config.resolve.plugins.filter(
48+
(plugin) => plugin.constructor.name !== 'ModuleScopePlugin'
49+
);
50+
51+
config.output.publicPath = isEnvProduction ? '${ROUTE_PREFIX}' : '/';
52+
53+
return config;
54+
},
55+
},
56+
plugins: [
57+
{
58+
plugin: CracoAlias,
59+
options: {
60+
source: 'tsconfig',
61+
baseUrl: './src',
62+
tsConfigPath: './tsconfig.extends.json',
63+
},
64+
},
65+
],
66+
};

client/package.json

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
{
2-
"name": "client",
2+
"name": "client-cra",
33
"version": "0.1.0",
44
"private": true,
5+
"main": "src/index.tsx",
6+
"proxy": "http://localhost:8080",
57
"scripts": {
6-
"start": "snowpack dev",
7-
"start:reload": "snowpack dev --reload",
8-
"build": "snowpack build",
9-
"test": "web-test-runner \"src/**/*.test.tsx\"",
8+
"start": "craco start",
9+
"build": "craco build",
10+
"test": "craco test",
1011
"format": "eslint --fix \"src/**/*.ts?(x)\"",
1112
"eslint:check": "eslint \"src/**/*.ts?(x)\"",
1213
"prettier:check": "prettier --check \"src/**/*.ts?(x)\"",
1314
"ts:check": "tsc --project . --noEmit",
14-
"ts:check:watch": "tsc --project . --noEmit -w"
15+
"ts:check:watch": "tsc --project . --noEmit -w",
16+
"eject": "react-scripts eject"
1517
},
1618
"dependencies": {
1719
"@date-io/luxon": "1.3.13",
@@ -28,7 +30,7 @@
2830
"i18next": "^19.8.3",
2931
"i18next-sync-fs-backend": "^1.1.1",
3032
"i18next-xhr-backend": "^3.2.2",
31-
"mdi-material-ui": "^6.21.0",
33+
"mdi-material-ui": "^6.23.0",
3234
"notistack": "^1.0.3",
3335
"react": "^17.0.1",
3436
"react-dom": "^17.0.1",
@@ -41,36 +43,47 @@
4143
"yup": "^0.29.3"
4244
},
4345
"devDependencies": {
44-
"@material-ui/system": "^4.12.1",
46+
"@craco/craco": "^7.0.0-alpha.3",
4547
"@material-ui/utils": "^4.11.2",
46-
"@snowpack/plugin-dotenv": "^2.0.5",
47-
"@snowpack/plugin-react-refresh": "^2.3.9",
48-
"@snowpack/plugin-typescript": "^1.1.0",
49-
"@snowpack/plugin-webpack": "^2.3.0",
50-
"@snowpack/web-test-runner-plugin": "^0.1.5",
51-
"@testing-library/react": "^11.0.0",
48+
"@material-ui/system": "^4.12.1",
49+
"@testing-library/jest-dom": "^5.16.2",
50+
"@testing-library/react": "^12.1.3",
51+
"@testing-library/user-event": "^13.5.0",
5252
"@types/chai": "^4.2.13",
5353
"@types/file-saver": "^2.0.1",
54+
"@types/jest": "^27.4.0",
5455
"@types/papaparse": "^5.2.6",
5556
"@types/react": "^17.0.0",
5657
"@types/react-dom": "^17.0.0",
5758
"@types/react-router": "^5.1.11",
5859
"@types/react-router-dom": "^5.1.7",
5960
"@types/react-window": "^1.8.2",
60-
"@types/snowpack-env": "^2.3.3",
6161
"@types/yup": "^0.29.11",
62-
"@web/test-runner": "^0.11.7",
62+
"babel-loader": "^8.2.3",
63+
"babel-plugin-named-asset-import": "^0.3.8",
6364
"chai": "^4.2.0",
6465
"core-js": "^3.8.3",
66+
"craco-alias": "^3.0.1",
67+
"eslint-plugin-react-hooks": "^4.2.0",
68+
"html-loader": "^3.1.0",
69+
"html-webpack-plugin": "^5.5.0",
6570
"http-proxy": "^1.18.1",
71+
"react-dev-utils": "^12.0.0",
72+
"react-scripts": "5.0.0",
6673
"react-transition-group": "^4.4.2",
6774
"regenerator-runtime": "^0.13.7",
68-
"snowpack": "^3.8.3"
75+
"simple-pug-loader": "^0.2.1"
6976
},
70-
"browserslist": [
71-
">0.2%",
72-
"not dead",
73-
"not ie <= 11",
74-
"not op_mini all"
75-
]
77+
"browserslist": {
78+
"production": [
79+
">0.2%",
80+
"not dead",
81+
"not op_mini all"
82+
],
83+
"development": [
84+
"last 1 chrome version",
85+
"last 1 firefox version",
86+
"last 1 safari version"
87+
]
88+
}
7689
}

client/plugins/snowpack-prefix-support.js

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

client/plugins/snowpack-pug.js

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

client/public/index.html

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!DOCTYPE html>
2+
<html lang='en'>
3+
<head>
4+
<meta charset='utf-8' />
5+
<link rel='shortcut icon' href='%PUBLIC_URL%/static/favicon.ico' />
6+
<meta name='viewport' content='width=device-width, initial-scale=1 shrink-to-fit=no' />
7+
<meta name='theme-color' content='#000000' />
8+
<link rel='apple-touch-icon' href='%PUBLIC_URL%/static/logo192.png' />
9+
<link rel='manifest' href='%PUBLIC_URL%/static/manifest.json' />
10+
11+
<!--
12+
Global variables
13+
#{GLOBAL_VARS}
14+
-->
15+
16+
<link rel='preconnect' href='https://fonts.gstatic.com' />
17+
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto:300,400,500' />
18+
<link
19+
rel='stylesheet'
20+
href='https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300;400;500&display=swap'
21+
/>
22+
23+
<!--
24+
Notice the use of %PUBLIC_URL% in the tags above.
25+
It will be replaced with the URL of the `public` folder during the build.
26+
Only files inside the `public` folder can be referenced from the HTML.
27+
28+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
29+
work correctly both with client-side routing and a non-root public URL.
30+
Learn how to configure a non-root public URL by running `npm run build`.
31+
-->
32+
<title>Tutor Management System</title>
33+
</head>
34+
<body>
35+
<noscript>You need to enable JavaScript to run this app.</noscript>
36+
<div id='root'></div>
37+
<!--
38+
This HTML file is a template.
39+
If you open it directly in the browser, you will see an empty page.
40+
41+
You can add webfonts, meta tags, or analytics to this file.
42+
The build step will place the bundled scripts into the <body> tag.
43+
44+
To begin the development, run `npm start` or `yarn start`.
45+
To create a production bundle, use `npm run build` or `yarn build`.
46+
-->
47+
</body>
48+
</html>

0 commit comments

Comments
 (0)