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

Commit 1b6a1c7

Browse files
authored
Merge pull request #4 from topcoder-platform/feature/basic-work-periods
feat: Final Fixes for basic code with Work Periods
2 parents 51d1949 + 619afe5 commit 1b6a1c7

File tree

87 files changed

+953
-686
lines changed

Some content is hidden

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

87 files changed

+953
-686
lines changed

.eslintrc

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
{
2-
"extends": ["react-important-stuff", "plugin:prettier/recommended"],
3-
"parser": "babel-eslint"
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:react/recommended",
5+
"react-important-stuff",
6+
"plugin:prettier/recommended"
7+
],
8+
"parser": "babel-eslint",
9+
"rules": {
10+
"no-unused-vars": "warn"
11+
}
412
}

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This is a [single-spa](https://single-spa.js.org/) example React microapp.
2020

2121
## Config
2222

23-
For available variables config which depend on the running environment (`APPENV=dev` or `APPENV=prod`), please refer to `config/development.js` and `config/production.js`.
23+
For available variables config which depend on the running environment (`APPENV=dev` or `APPENV=prod`), please refer to `config/dev.js` and `config/prod.js`.
2424

2525
For application constants which don't depend on the running environment use `src/constants/index.js`.
2626

@@ -59,14 +59,14 @@ Make sure you have [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli
5959

6060
## How to run Locally for Development
6161

62-
TaaS App is done using Single SPA micro-frontend architecture https://single-spa.js.org/. So to start it, we would also have to run Frame App and Navbar App. Here I would show the steps to run locally everything we need.
62+
TaaS Admin App is done using Single SPA micro-frontend architecture https://single-spa.js.org/. So to start it, we would also have to run Frame App and Navbar App. Here I would show the steps to run locally everything we need.
6363

6464
### Local Authentication
6565

6666
First of all, to authenticate locally we have to run a local authentication service.
6767

6868
- Clone this repository into `taas-admin-app`.
69-
- Inside the folder `taas-admin-app/local/auth-local` run `npm start`.
69+
- Inside the folder `taas-admin-app/auth-local` run `npm start`.
7070
- You would need npm 5+ for it. This would start a local sever on port 5000 which could be used for local Authentication.
7171

7272
### Local Domain
@@ -115,7 +115,7 @@ Some config files are using domain `local.topcoder-dev.com`. You can change it t
115115
cd micro-frontends-navbar-app
116116
```
117117

118-
Update in file `micro-frontends-navbar-app/blob/dev/config/dev.js` values for `ACCOUNTS_APP_CONNECTOR` and `AUTH` to `http://localhost:5000` so Navbar app which handles authentication uses our local Authentication service.
118+
Update in file `micro-frontends-navbar-app/config/dev.js` values for `ACCOUNTS_APP_CONNECTOR` and `AUTH` to `http://localhost:5000` so Navbar app which handles authentication uses our local Authentication service.
119119

120120
```sh
121121
# inside folder "micro-frontends-navbar-app" run:
@@ -128,31 +128,31 @@ Some config files are using domain `local.topcoder-dev.com`. You can change it t
128128
# this host navbar app as http://localhost:3001/navbar/topcoder-micro-frontends-navbar-app.js
129129
```
130130

131-
3. Run **TaaS** micro-app:
131+
3. Run **TaaS Admin** micro-app:
132132

133133
```sh
134-
# inside folder "taas-app" run:
134+
# inside folder "taas-admin-app" run:
135135

136136
nvm use # or make sure to use Node 10
137137
npm i # to install dependencies
138138

139139
npm run dev
140140

141-
# this host TaaS App as http://localhost:8501/taas-app/topcoder-micro-frontends-teams.js
141+
# this hosts TaaS Admin App as http://localhost:8502/taas-admin-app/topcoder-micro-frontends-taas-admin-app.js
142142
```
143143

144-
4. Now we have to update the `micro-frontends-frame` app to show our local version of TaaS App, instead of remote one. Update file `micro-frontends-frame/config/micro-frontends-config-local.json`:
144+
4. Now we have to update the `micro-frontends-frame` app to show our local version of TaaS Admin App, instead of remote one. Update file `micro-frontends-frame/config/micro-frontends-config-local.json`:
145145

146146
```js
147147
// replace line
148-
"@topcoder/micro-frontends-teams": "https://platform.topcoder-dev.com/taas-app/topcoder-micro-frontends-teams.js",
148+
"@topcoder/micro-frontends-taas-admin-app": "https://platform.topcoder-dev.com/taas-admin-app/topcoder-micro-frontends-taas-admin-app.js",
149149

150150
// with line:
151-
"@topcoder/micro-frontends-teams": "http://localhost:8501/taas-app/topcoder-micro-frontends-teams.js",
151+
"@topcoder/micro-frontends-taas-admin-app": "http://localhost:8502/taas-admin-app/topcoder-micro-frontends-taas-admin-app.js",
152152
```
153153

154-
- Now open in the browser http://localhost:8080/taas/myteams.
154+
- Now open in the browser http://localhost:8080/taas-admin.
155155
- If you are not logged-in yet, you should be redirected to the login page.
156-
- If you cannot see the application and redirect doesn't happen, make sure that file "http://local.topcoder-dev.com:8501/taas-app/topcoder-micro-frontends-teams.js" is loaded successfully in the Network tab.
156+
- If you cannot see the application and redirect doesn't happen, make sure that file "http://local.topcoder-dev.com:8502/taas-admin-app/topcoder-micro-frontends-taas-admin-app.js" is loaded successfully in the Network tab.
157157

158158
Congratulations, you successfully run the project. If you had some issue, please, try to go through README of https://github.com/topcoder-platform/micro-frontends-frame and https://github.com/topcoder-platform/micro-frontends-navbar-app.

babel.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ module.exports = function (api) {
4646
// "module-resolver",
4747
// {
4848
// alias: {
49+
// assets: "./src/assets",
4950
// styles: "./src/styles",
5051
// components: "./src/components",
5152
// hooks: "./src/hooks",

config/dev.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
module.exports = {
2-
/**
3-
* URL of Topcoder Community Website
4-
*/
5-
TOPCODER_COMMUNITY_WEBSITE_URL: "https://topcoder-dev.com",
6-
7-
/**
8-
* URL of Topcoder Connect Website
9-
*/
10-
CONNECT_WEBSITE_URL: "https://connect.topcoder-dev.com",
11-
122
API: {
133
V5: "https://api.topcoder-dev.com/v5",
14-
V3: "https://api.topcoder-dev.com/v3",
154
},
5+
PLATFORM_WEBSITE_URL: "https://platform.topcoder-dev.com",
166
};

config/index.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
/* global process */
22

33
module.exports = (() => {
4-
const env = process.env.APPENV || "dev";
4+
const appEnv = process.env.APPENV === "prod" ? "prod" : "dev";
55

6-
console.log(`APPENV: "${env}"`);
6+
// eslint-disable-next-line no-console
7+
console.log(`APPENV: "${appEnv}"`);
78

8-
// for security reason don't let to require any arbitrary file defined in process.env
9-
if (["prod", "dev"].indexOf(env) < 0) {
10-
return require("./dev");
11-
}
12-
13-
return require("./" + env);
9+
return require(`./${appEnv}`);
1410
})();

config/prod.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
module.exports = {
2-
/**
3-
* URL of Topcoder Community Website
4-
*/
5-
TOPCODER_COMMUNITY_WEBSITE_URL: "https://topcoder.com",
6-
7-
/**
8-
* URL of Topcoder Connect Website
9-
*/
10-
CONNECT_WEBSITE_URL: "https://connect.topcoder.com",
11-
122
API: {
133
V5: "https://api.topcoder.com/v5",
14-
V3: "https://api.topcoder.com/v3",
154
},
5+
PLATFORM_WEBSITE_URL: "https://platform.topcoder.com",
166
};

package-lock.json

+140
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"eslint-config-prettier": "^6.7.0",
8080
"eslint-config-react-important-stuff": "^2.0.0",
8181
"eslint-plugin-prettier": "^3.1.1",
82+
"eslint-plugin-react": "^7.23.2",
8283
"file-loader": "^6.2.0",
8384
"identity-obj-proxy": "^3.0.0",
8485
"jest": "^25.2.7",
@@ -93,6 +94,7 @@
9394
"single-spa-react": "^2.14.0",
9495
"style-loader": "^2.0.0",
9596
"systemjs-webpack-interop": "^2.1.2",
97+
"url-loader": "^4.1.1",
9698
"webpack": "^4.41.2",
9799
"webpack-cli": "^3.3.10",
98100
"webpack-config-single-spa-react": "^1.0.3",

server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ app.get("/", (req, res) => {
2222
res.send("alive");
2323
});
2424

25-
const PORT = process.env.PORT || 8501;
25+
const PORT = process.env.PORT || 8502;
2626
app.listen(PORT, () => {
2727
console.log(`App is hosted on port ${PORT}.`); // eslint-disable-line no-console
2828
});
+17-5
Loading

0 commit comments

Comments
 (0)