Skip to content

Commit dadc65f

Browse files
committed
fix build, add "demo" script in package.json
1 parent eeb3882 commit dadc65f

File tree

7 files changed

+206
-29
lines changed

7 files changed

+206
-29
lines changed

.babelrc.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"sourceType": "unambiguous",
3+
"presets": ["@babel/preset-env", "@babel/preset-typescript", [
4+
"@babel/preset-react", {"runtime": "automatic"}
5+
]],
6+
"plugins": ["@babel/plugin-transform-runtime"]
7+
}

README.md

+15-22
Original file line numberDiff line numberDiff line change
@@ -196,28 +196,21 @@ Each [Tool](#tools) can have its own setup requirements. Please see each tool's
196196

197197
## yarn Commands
198198

199-
| Command | Description |
200-
| --------------------- | ------------------------------------------------------------------------------------- |
201-
| `yarn start` | Serve dev mode build with the default config |
202-
| `yarn start:<dev>` | Serve dev mode build with dev's personal config |
203-
| `yarn build` | Build dev mode build with the default config and outputs static files in /builds |
204-
| `yarn build:prod` | Build prod mode build with the prod config and outputs static files in /builds |
205-
| `yarn lint:ts` | Run eslint against ts/x files and outputs report |
206-
| `yarn lint:ts:fix` | Run eslint against ts/x files, fixes auto-fixable issues, and outputs report |
207-
| `yarn lint:js` | Run eslint against js/x files and outputs report |
208-
| `yarn lint:js:fix` | Run eslint against js/x files, fixes auto-fixable issues, and outputs report |
209-
| `yarn lint` | Run eslint against js/x and ts/x files and outputs report |
210-
| `yarn lint:fix` | Run eslint against js/x and ts/x files, fixes auto-fixable issues, and outputs report |
211-
| `yarn test` | Run unit tests, watching for changes and re-running per your specifications |
212-
| `yarn test:no-watch` | Run unit tests once, without watching for changes or re-running |
213-
| `yarn cy:run` | Run e2e tests once in local command with the site is running |
214-
| `yarn cy:ci` | Run e2e tests once by circle ci |
215-
| `yarn report:coverage`| Generate e2e coverage report in html format |
216-
| `yarn report:coverage:text` | Generate e2e coverage report in text format |
217-
218-
219-
220-
199+
| Command | Description |
200+
| --------------------- | ------------------------------------------------------------------------------------- |
201+
| `yarn start` | Serve dev mode build with the default config |
202+
| `yarn start:<dev>` | Serve dev mode build with dev's personal config |
203+
| `yarn build` | Build dev mode build with the default config and outputs static files in /build |
204+
| `yarn build:prod` | Build prod mode build with the prod config and outputs static files in /build |
205+
| `yarn demo` | Serves the built files (by running yarn:build) for local testing |
206+
| `yarn lint` | Run eslint against js/x and ts/x files and outputs report |
207+
| `yarn lint:fix` | Run eslint against js/x and ts/x files, fixes auto-fixable issues, and outputs report |
208+
| `yarn test` | Run unit tests, watching for changes and re-running per your specifications |
209+
| `yarn test:no-watch` | Run unit tests once, without watching for changes or re-running |
210+
| `yarn cy:run` | Run e2e tests once in local command with the site is running |
211+
| `yarn cy:ci` | Run e2e tests once by circle ci |
212+
| `yarn report:coverage` | Generate e2e coverage report in html format |
213+
| `yarn report:coverage:text` | Generate e2e coverage report in text format |
221214

222215
# Application Structure
223216

craco.config.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const path = require('path');
22
const CracoCSSModules = require('craco-css-modules');
3+
const BabelRcPlugin = require('@jackwilsdon/craco-use-babelrc');
34

45
const isProd = process.env.APPMODE === "production";
56

@@ -17,6 +18,7 @@ module.exports = {
1718
},
1819

1920
plugins: [
21+
{ plugin: BabelRcPlugin },
2022
{ plugin: CracoCSSModules },
2123
],
2224

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"dev": "yarn craco start",
88
"start": "sh start.sh",
99
"build": "yarn craco build",
10+
"demo": "npx http-server --port 443 -a 0.0.0.0 -S -C ./ssl/rootCA.crt -K ./ssl/rootCA.key -P https://local.topcoder-dev.com? --proxy-options.secure false ./build",
1011
"lint": "eslint -c ./src/.eslintrc.js 'src/**/*.{ts,tsx}'",
1112
"lint:fix": "eslint -c ./src/.eslintrc.js 'src/**/*.{ts,tsx}' --fix",
1213
"test": "craco test --watchAll",
@@ -104,6 +105,7 @@
104105
"@babel/runtime": "^7.19.4",
105106
"@craco/craco": "^7.1.0",
106107
"@cypress/code-coverage": "^3.10.0",
108+
"@jackwilsdon/craco-use-babelrc": "1.0.0",
107109
"@testing-library/jest-dom": "^5.16.5",
108110
"@testing-library/react": "^13.4.0",
109111
"@testing-library/user-event": "^14.4.3",
@@ -154,6 +156,7 @@
154156
"eslint-plugin-ordered-imports": "^0.6.0",
155157
"eslint-plugin-react": "^7.28.0",
156158
"eslint-plugin-react-hooks": "^4.3.0",
159+
"eslint-plugin-unicorn": "^46.0.0",
157160
"file-loader": "^6.2.0",
158161
"husky": "^8.0.1",
159162
"identity-obj-proxy": "^3.0.0",

src/apps/learn/.eslintrc.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
},
2121
plugins: [
2222
'@typescript-eslint',
23-
'no-null',
23+
'unicorn',
2424
'ordered-imports',
2525
'react',
2626
'react-hooks'
@@ -104,9 +104,10 @@ module.exports = {
104104
'error',
105105
120,
106106
],
107+
'no-empty': ["error", { "allowEmptyCatch": true }],
107108
'no-extra-boolean-cast': 'off',
108109
'no-nested-ternary': 'off',
109-
'no-null/no-null': 'error',
110+
'unicorn/no-null': 'error',
110111
'no-param-reassign': [
111112
'error',
112113
{

src/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { StrictMode } from "react";
1+
import { StrictMode } from "react";
22
import { createRoot } from 'react-dom/client'
33
import { BrowserRouter } from "react-router-dom";
44

0 commit comments

Comments
 (0)