Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 2ff1860

Browse files
output from challenge: 30203699
1 parent e7b1f8c commit 2ff1860

File tree

230 files changed

+304
-15838
lines changed

Some content is hidden

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

230 files changed

+304
-15838
lines changed

README.md

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,30 @@ This is a [single-spa](https://single-spa.js.org/) example React microapp.
1616
| Command | Description |
1717
| --------------------- | ----------------------------------------------------------------- |
1818
| `npm start` | Run server which serves production ready build from `dist` folder |
19-
| `npm run dev` | Run app in the development mode |
20-
| `npm run dev-https` | Run app in the development mode using HTTPS protocol |
21-
| `npm run build` | Build app for production and puts files to the `dist` folder |
19+
| `npm run dev` | Run app in the `development` mode and `dev` config |
20+
| `npm run dev-https` | Run app in the `development` mode and `dev` config using HTTPS protocol |
21+
| `npm run local` | Run app in the `development` mode and `local-dev` config |
22+
| `npm run prod` | Run app in the `development` mode and `prod` config |
23+
| `npm run build` | Build app for production and puts files to the `dist` folder, default to `development` mode and `local-dev` config |
2224
| `npm run analyze` | Analyze dependencies sizes and opens report in the browser |
2325
| `npm run lint` | Check code for lint errors |
2426
| `npm run format` | Format code using prettier |
2527
| `npm run test` | Run unit tests |
2628
| `npm run watch-tests` | Watch for file changes and run unit tests on changes |
2729
| `npm run coverage` | Generate test code coverage report |
28-
| `npm run mock-api` | Start the mock api which mocks Recruit api |
2930

3031
## Local Deployment
3132

3233
Inside the project folder run:
33-
34-
- `export APPMODE="development"; export APPENV="local";` - to load APPMODE & APPENV
3534
- `nvm use 10.22.1;` - to use npm version: 10.22.1
3635
- `npm i` - install dependencies
37-
- `npm run dev` - run app in development mode
38-
- As this app can be loaded only inside a frame single-spa, you have to run a `micro-frontends-frame` frame app and configure it to use the URL `http://localhost:8008/topcoder-micro-frontends-earn-app.js`.
36+
- `npm run local` - run app in `development` mode and `local-dev` config
37+
- As this app can be loaded only inside a frame single-spa, you have to run a `micro-frontends-frame` frame app and configure it to use the URL `http://localhost:8008/earn-app/topcoder-micro-frontends-earn-app.js`.
3938

4039
## Deployment to Production
4140

4241
- `npm i` - install dependencies
43-
- `npm build` - build code to `dist/` folder
42+
- `APPMODE=production APPENV=prod npm run build` - build code to `dist/` folder
4443
- Now you can host `dist/` folder using any static server. For example, you may run a simple `Express` server by running `npm start`.
4544

4645
### Deploying to Heroku
@@ -58,21 +57,3 @@ Make sure you have [Heroky CLI](https://devcenter.heroku.com/articles/heroku-cli
5857
- `git push heroku master` - push changes to Heroku and trigger deploying
5958

6059
- Now you have to configure frame app to use the URL provided by Heroku like `https://<APP-NAME>.herokuapp.com/earn-app/topcoder-micro-frontends-earn-app.js` to load this microapp.
61-
62-
### Aggregator API
63-
64-
Please refer to [Swagger Doc](./src/api/docs/swagger.yaml) for Aggregator API endpoints
65-
66-
#### Aggregator API Configuration
67-
68-
In the `micro-frontends-earn-app` root directory create `.env` file with the next environment variables.
69-
70-
```bash
71-
# Auth0 config
72-
AUTH_SECRET=
73-
AUTH0_URL=
74-
AUTH0_AUDIENCE=
75-
AUTH0_CLIENT_ID=
76-
AUTH0_CLIENT_SECRET=
77-
```
78-
Once the earn app is started, the aggregator api will work as well

babel.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
let cssLocalIdent;
2-
if (process.env.APPMODE == 'development') {
3-
cssLocalIdent = 'earn_[path][name]___[local]___[hash:base64:6]';
4-
} else {
2+
if (process.env.APPMODE === 'production') {
53
cssLocalIdent = '[hash:base64:6]';
4+
} else {
5+
cssLocalIdent = 'earn_[path][name]___[local]___[hash:base64:6]';
66
}
77

88
const config = {

config/default.js

Lines changed: 5 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,8 @@
11
require("dotenv").config();
2+
23
module.exports = {
3-
GUIKIT: {
4-
DEBOUNCE_ON_CHANGE_TIME: 150,
5-
},
6-
API: {
7-
V5: "https://api.topcoder-dev.com/v5",
8-
V3: "https://api.topcoder-dev.com/v3",
9-
},
10-
URL: {
11-
BASE: "https://www.topcoder-dev.com",
12-
COMMUNITY_APP: "https://community-app.topcoder-dev.com",
13-
PLATFORM_WEBSITE_URL: "https://platform.topcoder-dev.com",
14-
},
15-
RECRUIT_API: "https://www.topcoder-dev.com",
16-
// the server api base path
17-
API_BASE_PATH: process.env.API_BASE_PATH || "/earn-app/api/my-gigs",
18-
// the log level, default is 'debug'
19-
LOG_LEVEL: process.env.LOG_LEVEL || "debug",
20-
// The authorization secret used during token verification.
21-
AUTH_SECRET:
22-
process.env.AUTH_SECRET,
23-
// The valid issuer of tokens, a json array contains valid issuer.
24-
VALID_ISSUERS:
25-
process.env.VALID_ISSUERS,
26-
// Auth0 URL, used to get TC M2M token
27-
AUTH0_URL:
28-
process.env.AUTH0_URL,
29-
// Auth0 audience, used to get TC M2M token
30-
AUTH0_AUDIENCE: process.env.AUTH0_AUDIENCE,
31-
// Auth0 client id, used to get TC M2M token
32-
AUTH0_CLIENT_ID:
33-
process.env.AUTH0_CLIENT_ID,
34-
// Auth0 client secret, used to get TC M2M token
35-
AUTH0_CLIENT_SECRET:
36-
process.env.AUTH0_CLIENT_SECRET,
37-
// Proxy Auth0 URL, used to get TC M2M token
38-
AUTH0_PROXY_SERVER_URL: process.env.AUTH0_PROXY_SERVER_URL,
39-
m2m: {
40-
M2M_AUDIT_USER_ID:
41-
process.env.M2M_AUDIT_USER_ID ,
42-
M2M_AUDIT_HANDLE: process.env.M2M_AUDIT_HANDLE,
43-
},
44-
MOCK_API_PORT: process.env.MOCK_API_PORT || 4000,
45-
ALLOWED_FILE_TYPES: process.env.ALLOWED_FILE_TYPES || [
46-
"pdf",
47-
"doc",
48-
"docx",
49-
"txt",
50-
],
51-
MAX_ALLOWED_FILE_SIZE_MB: process.env.MAX_ALLOWED_FILE_SIZE_MB || 10,
4+
MFE_CONFIG: {
5+
'@topcoder/micro-frontends-challenges-app': 'https://platform.topcoder-dev.com/challenges-app/topcoder-micro-frontends-challenges-app.js',
6+
'@topcoder/micro-frontends-gigs-app': 'https://platform.topcoder-dev.com/gigs-app/topcoder-micro-frontends-gigs-app.js',
7+
}
528
};

config/dev.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module.exports = {
2+
};

config/development.js

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

config/local-dev.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
MFE_CONFIG: {
3+
'@topcoder/micro-frontends-challenges-app': 'http://localhost:8009/challenges-app/topcoder-micro-frontends-challenges-app.js',
4+
'@topcoder/micro-frontends-gigs-app': 'http://localhost:8010/gigs-app/topcoder-micro-frontends-gigs-app.js',
5+
}
6+
};

config/prod.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
MFE_CONFIG: {
3+
'@topcoder/micro-frontends-challenges-app': 'http://platform.topcoder.com/challenges-app/topcoder-micro-frontends-challenges-app.js',
4+
'@topcoder/micro-frontends-gigs-app': 'http://platform.topcoder.com/gigs-app/topcoder-micro-frontends-gigs-app.js',
5+
}
6+
};

config/production.js

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

docker/Dockerfile

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,9 @@ FROM node:10.22.1
33

44
ARG APPMODE
55
ARG APPENV
6-
ARG RECRUIT_API
7-
ARG AUTH_SECRET
8-
ARG VALID_ISSUERS
9-
ARG AUTH0_URL
10-
ARG AUTH0_AUDIENCE
11-
ARG AUTH0_CLIENT_ID
12-
ARG AUTH0_CLIENT_SECRET
13-
ARG AUTH0_PROXY_SERVER_URL
14-
ARG M2M_AUDIT_USER_ID
15-
ARG M2M_AUDIT_HANDLE
166

177
ENV APPMODE=$APPMODE
188
ENV APPENV=$APPENV
19-
ENV RECRUIT_API=$RECRUIT_API
20-
ENV AUTH_SECRET=$AUTH_SECRET
21-
ENV VALID_ISSUERS=$VALID_ISSUERS
22-
ENV AUTH0_URL=$AUTH0_URL
23-
ENV AUTH0_AUDIENCE=$AUTH0_AUDIENCE
24-
ENV AUTH0_CLIENT_ID=$AUTH0_CLIENT_ID
25-
ENV AUTH0_CLIENT_SECRET=$AUTH0_CLIENT_SECRET
26-
ENV AUTH0_PROXY_SERVER_URL=$AUTH0_PROXY_SERVER_URL
27-
ENV M2M_AUDIT_USER_ID=$M2M_AUDIT_USER_ID
28-
ENV M2M_AUDIT_HANDLE=$M2M_AUDIT_HANDLE
299

3010
# Copy the current directory into the Docker image
3111
COPY . /micro-frontends-earn-app

package.json

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
"name": "@topcoder/micro-frontends-earn-app",
33
"scripts": {
44
"start": "node server.js",
5-
"dev": "cross-env APPMODE=development webpack-dev-server --port 8008",
6-
"dev-https": "cross-env APPMODE=development webpack-dev-server --https --port 8008",
7-
"build": "webpack --mode=${APPMODE:-development} --env.config=${APPENV:-dev}",
8-
"analyze": "webpack --mode=production --env.analyze=true",
5+
"dev": "cross-env APPENV=dev webpack-dev-server",
6+
"dev-https": "cross-env APPENV=dev webpack-dev-server --https",
7+
"local": "cross-env APPMODE=local-dev webpack-dev-server --mode=development",
8+
"build": "cross-env APPENV=${APPENV:-local} APPMODE=${APPMODE:-development} webpack --mode=${APPMODE:-development}",
9+
"analyze": "cross-env APPMODE=production webpack --mode=production --env.analyze=true",
910
"lint": "eslint src --ext js,jsx --fix",
1011
"format": "prettier --write \"./**\"",
1112
"test": "cross-env BABEL_ENV=test jest",
1213
"watch-tests": "cross-env BABEL_ENV=test jest --watch",
13-
"coverage": "cross-env BABEL_ENV=test jest --coverage",
14-
"mock-api": "node ./src/api/mock-api/mock-api.js"
14+
"coverage": "cross-env BABEL_ENV=test jest --coverage"
1515
},
1616
"devDependencies": {
1717
"@babel/core": "^7.7.5",
@@ -61,37 +61,15 @@
6161
"dependencies": {
6262
"@babel/runtime": "^7.13.10",
6363
"@reach/router": "^1.3.4",
64-
"autoprefixer": "^8.6.5",
65-
"cors": "^2.8.5",
66-
"country-calling-code": "0.0.3",
6764
"dotenv": "^10.0.0",
6865
"express": "^4.17.1",
69-
"express-fileupload": "^1.2.1",
70-
"express-interceptor": "^1.2.0",
71-
"get-parameter-names": "^0.3.0",
72-
"http-status": "^1.5.0",
73-
"i18n-iso-countries": "^6.7.0",
74-
"joi": "^17.4.0",
7566
"lodash": "^4.17.21",
76-
"moment": "^2.29.1",
77-
"moment-duration-format": "^2.3.2",
78-
"qs": "^6.10.1",
79-
"rc-tooltip": "^4.2.3",
8067
"react": "^16.12.0",
81-
"react-date-range": "^1.1.3",
8268
"react-dom": "^16.12.0",
83-
"react-dropzone": "^11.3.2",
84-
"react-loading": "^2.0.3",
8569
"react-redux": "^7.2.3",
86-
"react-responsive-modal": "^6.1.0",
87-
"react-select": "^1.3.0",
88-
"react-use": "^15.3.4",
8970
"redux": "^4.0.5",
9071
"redux-actions": "^2.6.5",
9172
"redux-logger": "^3.0.6",
92-
"redux-promise-middleware": "^6.1.2",
93-
"superagent": "^6.1.0",
94-
"tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6",
95-
"winston": "^3.3.3"
73+
"redux-promise-middleware": "^6.1.2"
9674
}
9775
}

0 commit comments

Comments
 (0)