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

Commit 63dfa02

Browse files
committed
feat: teams and team details
1 parent 46bb86a commit 63dfa02

File tree

96 files changed

+22793
-20
lines changed

Some content is hidden

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

96 files changed

+22793
-20
lines changed

.circleci/config.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
version: 2
2+
defaults: &defaults
3+
docker:
4+
- image: circleci/python:2.7-stretch-browsers
5+
install_dependency: &install_dependency
6+
name: Installation of build and deployment dependencies.
7+
command: |
8+
sudo apt install jq
9+
sudo pip install awscli --upgrade
10+
sudo pip install docker-compose
11+
install_deploysuite: &install_deploysuite
12+
name: Installation of install_deploysuite.
13+
command: |
14+
git clone --branch v1.4.2 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
15+
cp ./../buildscript/master_deploy.sh .
16+
cp ./../buildscript/buildenv.sh .
17+
cp ./../buildscript/awsconfiguration.sh .
18+
restore_cache_settings_for_build: &restore_cache_settings_for_build
19+
key: docker-node-modules-{{ checksum "package-lock.json" }}
20+
21+
save_cache_settings: &save_cache_settings
22+
key: docker-node-modules-{{ checksum "package-lock.json" }}
23+
paths:
24+
- node_modules
25+
26+
builddeploy_steps: &builddeploy_steps
27+
- checkout
28+
- setup_remote_docker
29+
- run: *install_dependency
30+
- run: *install_deploysuite
31+
- restore_cache: *restore_cache_settings_for_build
32+
- run: ./build.sh ${APPNAME}
33+
- save_cache: *save_cache_settings
34+
- deploy:
35+
name: Running MasterScript.
36+
command: |
37+
./awsconfiguration.sh $DEPLOY_ENV
38+
source awsenvconf
39+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
40+
source buildenvvar
41+
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
42+
43+
jobs:
44+
# Build & Deploy against development backend
45+
"build-dev":
46+
<<: *defaults
47+
environment:
48+
DEPLOY_ENV: "DEV"
49+
LOGICAL_ENV: "dev"
50+
APPNAME: "micro-frontends-teams"
51+
steps: *builddeploy_steps
52+
53+
"build-prod":
54+
<<: *defaults
55+
environment:
56+
DEPLOY_ENV: "PROD"
57+
LOGICAL_ENV: "prod"
58+
APPNAME: "micro-frontends-teams"
59+
steps: *builddeploy_steps
60+
61+
workflows:
62+
version: 2
63+
build:
64+
jobs:
65+
# Development builds are executed on "develop" branch only.
66+
- "build-dev":
67+
context: org-global
68+
filters:
69+
branches:
70+
only:
71+
- dev
72+
73+
# Production builds are exectuted only on tagged commits to the
74+
# master branch.
75+
- "build-prod":
76+
context: org-global
77+
filters:
78+
branches:
79+
only: master

.eslintrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": ["react-important-stuff", "plugin:prettier/recommended"],
3+
"parser": "babel-eslint"
4+
}

.gitignore

+104-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,104 @@
1-
# Build and Release Folders
2-
bin-debug/
3-
bin-release/
4-
[Oo]bj/
5-
[Bb]in/
6-
7-
# Other files and folders
8-
.settings/
9-
10-
# Executables
11-
*.swf
12-
*.air
13-
*.ipa
14-
*.apk
15-
16-
# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
17-
# should NOT be excluded as they contain compiler settings and other important
18-
# information for Eclipse / Flash Builder.
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Next.js build output
79+
.next
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
85+
# Gatsby files
86+
.cache/
87+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# public
90+
91+
# vuepress build output
92+
.vuepress/dist
93+
94+
# Serverless directories
95+
.serverless/
96+
97+
# FuseBox cache
98+
.fusebox/
99+
100+
# DynamoDB Local files
101+
.dynamodb/
102+
103+
# TernJS port file
104+
.tern-port

.prettierignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.gitignore
2+
.prettierignore
3+
yarn.lock
4+
yarn-error.log
5+
package-lock.json
6+
dist
7+
coverage

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": false
3+
}

README.md

+62-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,62 @@
1-
# taasapp
2-
TaaS App Front End
1+
# Topcoder Teams Microapp
2+
3+
This is a [single-spa](https://single-spa.js.org/) example React microapp.
4+
5+
> NOTE. This application have been configured to be run as child app of a single-spa application. So while this app can be deployed and run independently, we would need some frame [single-spa](https://single-spa.js.org/) which would load it. While technically we can achieve running this app as standalone app it's strongly not recommended by the author of the `single-spa` approch, see this [GitHub Issue](https://github.com/single-spa/single-spa/issues/640) for details.
6+
7+
## Requirements
8+
9+
- node - v10.22.1
10+
- npm - v6.14.6
11+
12+
## Technology Stack
13+
14+
- React 16.12
15+
- Router via [Reach Router](https://reach.tech/router/)
16+
- CSS Modules with SCSS via [babel-plugin-react-css-modules](https://github.com/gajus/babel-plugin-react-css-modules)
17+
- [React Inline SVG](https://github.com/airbnb/babel-plugin-inline-react-svg)
18+
19+
## Config
20+
21+
For available variables config, please refer to `config/development.js` and `config/production.js`.
22+
23+
## NPM Commands
24+
25+
| Command | Description |
26+
| --------------------- | ----------------------------------------------------------------- |
27+
| `npm start` | Run server which serves production ready build from `dist` folder |
28+
| `npm run dev` | Run app in the development mode |
29+
| `npm run dev-https` | Run app in the development mode using HTTPS protocol |
30+
| `npm run build` | Build app for production and puts files to the `dist` folder |
31+
| `npm run analyze` | Analyze dependencies sizes and opens report in the browser |
32+
| `npm run lint` | Check code for lint errors |
33+
| `npm run format` | Format code using prettier |
34+
| `npm run test` | Run unit tests |
35+
| `npm run watch-tests` | Watch for file changes and run unit tests on changes |
36+
| `npm run coverage` | Generate test code coverage report |
37+
38+
## Local Deployment
39+
40+
Inside the project folder run:
41+
42+
- `npm i` - install dependencies
43+
- `npm run dev` - run app in development mode
44+
- 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:8501/topcoder-micro-frontends-teams.js`.
45+
46+
## Deployment to Production
47+
48+
- `npm i` - install dependencies
49+
- `npm build` - build code to `dist/` folder
50+
- Now you can host `dist/` folder using any static server. For example, you may run a simple `Express` server by running `npm start`.
51+
52+
### Deploying to Heroku
53+
54+
Make sure you have [Heroky CLI](https://devcenter.heroku.com/articles/heroku-cli) installed and you have a Heroku account. And then inside the project folder run the next commands:
55+
56+
- If there is not Git repository inited yet, create a repo and commit all the files:
57+
- `git init`
58+
- `git add .`
59+
- `git commit -m'inital commit'`
60+
- `heroku apps:create` - create Heroku app
61+
- `git push heroku master` - push changes to Heroku and trigger deploying
62+
- Now you have to configure frame app to use the URL provided by Heroku like `https://<APP-NAME>.herokuapp.com/topcoder-micro-frontends-teams.js` to load this microapp.

__mocks__/fileMock.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "";

babel.config.json

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env",
4+
"@babel/preset-react"
5+
],
6+
"plugins": [
7+
[
8+
"@babel/plugin-transform-runtime",
9+
{
10+
"useESModules": true,
11+
"regenerator": false
12+
}
13+
],
14+
[
15+
"react-css-modules",
16+
{
17+
"filetypes": {
18+
".scss": {
19+
"syntax": "postcss-scss"
20+
}
21+
},
22+
"generateScopedName": "teams_[path][name]___[local]___[hash:base64:6]"
23+
}
24+
],
25+
"inline-react-svg"
26+
],
27+
"env": {
28+
"test": {
29+
"presets": [
30+
[
31+
"@babel/preset-env",
32+
{
33+
"targets": "current node"
34+
}
35+
]
36+
],
37+
"plugins": [
38+
["module-resolver", {
39+
"alias": {
40+
"styles": "/src/styles",
41+
"components": "./src/components",
42+
"hooks": "./src/hooks",
43+
"utils": "./src/utils",
44+
"constants": "./src/constants"
45+
}
46+
}]
47+
]
48+
}
49+
}
50+
}

build.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
APP_NAME=$1
4+
UPDATE_CACHE=""
5+
6+
docker build -f docker/Dockerfile -t $APP_NAME:latest .
7+
8+
docker create --name app $APP_NAME:latest
9+
10+
if [ -d node_modules ]
11+
then
12+
mv package-lock.json old-package-lock.json
13+
docker cp app:/$APP_NAME/package-lock.json package-lock.json
14+
set +eo pipefail
15+
UPDATE_CACHE=$(cmp package-lock.json old-package-lock.json)
16+
set -eo pipefail
17+
else
18+
UPDATE_CACHE=1
19+
fi
20+
21+
if [ "$UPDATE_CACHE" == 1 ]
22+
then
23+
docker cp app:/$APP_NAME/node_modules .
24+
fi

config/development.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
/**
3+
* Topcoder Member Service base URL
4+
*/
5+
TC_MEMBER_SERVICE_URL: "https://api.topcoder-dev.com/v3/members",
6+
7+
/**
8+
* Topcoder Teams Service base URL
9+
*/
10+
TC_TEAMS_SERVICE_URL: "http://localhost:8502",
11+
12+
/**
13+
* URL of Topcoder Community Website
14+
*/
15+
TOPCODER_COMMUNITY_WEBSITE_URL: "https://topcoder-dev.com",
16+
};

config/index.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* global process */
2+
3+
module.exports = (() => {
4+
const env = process.env.NODE_ENV || "development";
5+
6+
// for security reason don't let to require any arbitrary file defined in process.env
7+
if (["production", "development"].indexOf(env) < 0) {
8+
return require("./development");
9+
}
10+
11+
return require("./" + env);
12+
})();

0 commit comments

Comments
 (0)