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

Dry Release v0.1 #29

Merged
merged 44 commits into from
Dec 16, 2020
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
63dfa02
feat: teams and team details
veshu Nov 7, 2020
d210cc4
job detail page
veshu Nov 9, 2020
c3a3c4e
(chore): verification guide
veshu Nov 9, 2020
5ecdfb3
fix: review issues
veshu Nov 10, 2020
e950253
Merge pull request #2 from topcoder-platform/final-fixes
nkumar-topcoder Nov 11, 2020
9700493
Update config.yml
nkumar-topcoder Nov 11, 2020
cdcea50
[skip ci]
nkumar-topcoder Nov 11, 2020
f2414a8
[skip ci]
nkumar-topcoder Nov 11, 2020
9239696
Update config.yml
nkumar-topcoder Nov 11, 2020
303dfec
[skip ci]
nkumar-topcoder Nov 11, 2020
d815857
Update config.yml
nkumar-topcoder Nov 11, 2020
8609cb8
[skip ci]
nkumar-topcoder Nov 11, 2020
5335605
[skip ci]
nkumar-topcoder Nov 11, 2020
6f8b15a
[skip ci]
nkumar-topcoder Nov 11, 2020
7cee646
Update config.yml
nkumar-topcoder Nov 11, 2020
016245a
Update Dockerfile
nkumar-topcoder Nov 11, 2020
b6586a3
Update Dockerfile
nkumar-topcoder Nov 11, 2020
a216256
Changing the base url from react to taas-app
urwithat Nov 11, 2020
a46ab54
Added mock base url
urwithat Nov 11, 2020
368ec65
teams service url for dev
urwithat Nov 11, 2020
15f23df
Adding AppMode Env
urwithat Nov 11, 2020
04db664
fix mock API behind gateway
veshu Nov 12, 2020
687fe7a
Merge pull request #4 from topcoder-platform/devverify
nkumar-topcoder Nov 16, 2020
35c475d
[skip ci]
nkumar-topcoder Nov 16, 2020
0159912
Merge pull request #3 from topcoder-platform/final-fixes
nkumar-topcoder Nov 17, 2020
179ea3e
TaaS micro-app - Integration
suppermancool Dec 3, 2020
b1e6e8e
Merge pull request #15 from suppermancool/code-30154890
maxceem Dec 7, 2020
82e73d8
chore: deploy feature branch to DEV
maxceem Dec 7, 2020
24f9bf0
chore: fix circle config for branch deployment
maxceem Dec 7, 2020
4c807f4
fix: use httpS for API calls
maxceem Dec 7, 2020
5b18673
fix: rename "weeklyCount" to "weeklyCost"
maxceem Dec 8, 2020
143c312
fix: hide "ratings"
maxceem Dec 8, 2020
4615fc9
fix: show "TBD" remaining time for team
maxceem Dec 8, 2020
703ebc0
fix: remove code to load photoURL from v3
maxceem Dec 8, 2020
24eb0b6
fix: remaining time for teams with resources
maxceem Dec 8, 2020
9c2d2b5
fix: members customer rate
maxceem Dec 8, 2020
c8ce24b
fix: show job description for resources
maxceem Dec 8, 2020
e2c5604
fix: remove 0 from skills lists
maxceem Dec 8, 2020
7874305
fix: hide job rate
maxceem Dec 15, 2020
9681d61
fix: remove formatRate method as incorrect
maxceem Dec 15, 2020
c6029e3
fix: hide cost if 0
maxceem Dec 15, 2020
06df9d1
chore: removed mock server
maxceem Dec 15, 2020
862beb2
Merge pull request #27 from topcoder-platform/feature/api-integration
maxceem Dec 16, 2020
2038065
chore: deploy "dev" branch
maxceem Dec 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
version: 2
defaults: &defaults
docker:
- image: circleci/python:2.7-stretch-browsers
install_dependency: &install_dependency
name: Installation of build and deployment dependencies.
command: |
sudo apt install jq
sudo pip install awscli --upgrade
sudo pip install docker-compose
install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
command: |
git clone --branch v1.4.2 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
cp ./../buildscript/master_deploy.sh .
cp ./../buildscript/buildenv.sh .
cp ./../buildscript/awsconfiguration.sh .
restore_cache_settings_for_build: &restore_cache_settings_for_build
key: docker-node-modules-{{ checksum "package-lock.json" }}

save_cache_settings: &save_cache_settings
key: docker-node-modules-{{ checksum "package-lock.json" }}
paths:
- node_modules

builddeploy_steps: &builddeploy_steps
- checkout
- setup_remote_docker
- run: *install_dependency
- run: *install_deploysuite
#- restore_cache: *restore_cache_settings_for_build
- run:
command: |
./awsconfiguration.sh $DEPLOY_ENV
source awsenvconf
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-buildvar
- run:
command: |
source buildenvvar
./build.sh ${APPNAME}
#- save_cache: *save_cache_settings
- deploy:
name: Running MasterScript.
command: |
./awsconfiguration.sh $DEPLOY_ENV
source awsenvconf
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
source buildenvvar
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
#For mock server
echo "Running Masterscript - For mock server"
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-mock-${APPNAME}-deployvar
source buildenvvar
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-mock-${APPNAME}-appvar -i mock-${APPNAME}
jobs:
# Build & Deploy against development backend
"build-dev":
<<: *defaults
environment:
DEPLOY_ENV: "DEV"
LOGICAL_ENV: "dev"
APPNAME: "taas-app"
steps: *builddeploy_steps

"build-prod":
<<: *defaults
environment:
DEPLOY_ENV: "PROD"
LOGICAL_ENV: "prod"
APPNAME: "taas-app"
steps: *builddeploy_steps

workflows:
version: 2
build:
jobs:
# Development builds are executed on "develop" branch only.
- "build-dev":
context: org-global
filters:
branches:
only:
- dev

# Production builds are exectuted only on tagged commits to the
# master branch.
- "build-prod":
context: org-global
filters:
branches:
only: master
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["react-important-stuff", "plugin:prettier/recommended"],
"parser": "babel-eslint"
}
122 changes: 104 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,104 @@
# Build and Release Folders
bin-debug/
bin-release/
[Oo]bj/
[Bb]in/

# Other files and folders
.settings/

# Executables
*.swf
*.air
*.ipa
*.apk

# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
# should NOT be excluded as they contain compiler settings and other important
# information for Eclipse / Flash Builder.
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.22.1
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.gitignore
.prettierignore
yarn.lock
yarn-error.log
package-lock.json
dist
coverage
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": false
}
70 changes: 68 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,68 @@
# taasapp
TaaS App Front End
# Topcoder Teams Micro-app

This is a [single-spa](https://single-spa.js.org/) example React microapp.

> 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` approach, see this [GitHub Issue](https://github.com/single-spa/single-spa/issues/640) for details.
## Requirements

- node - v10.22.1
- npm - v6.14.6

## Technology Stack

- React 16.12
- Router via [Reach Router](https://reach.tech/router/)
- CSS Modules with SCSS via [babel-plugin-react-css-modules](https://github.com/gajus/babel-plugin-react-css-modules)
- [React Inline SVG](https://github.com/airbnb/babel-plugin-inline-react-svg)

## Config

For available variables config which depend on the running environment (`development` or `production`), please refer to `config/development.js` and `config/production.js`.

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

## NPM Commands

| Command | Description |
| --------------------- | ----------------------------------------------------------------- |
| `npm start` | Run server which serves production ready build from `dist` folder |
| `npm run dev` | Run app in the development mode |
| `npm run dev-https` | Run app in the development mode using HTTPS protocol |
| `npm run build` | Build app for production and puts files to the `dist` folder |
| `npm run analyze` | Analyze dependencies sizes and opens report in the browser |
| `npm run lint` | Check code for lint errors |
| `npm run format` | Format code using prettier |
| `npm run test` | Run unit tests |
| `npm run watch-tests` | Watch for file changes and run unit tests on changes |
| `npm run coverage` | Generate test code coverage report |

## Local Deployment

Inside the project folder run:

- `npm i` - install dependencies
- `npm run dev` - run app in development mode
- 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`.

## Deployment to Production

- `npm i` - install dependencies
- `npm build` - build code to `dist/` folder
- Now you can host `dist/` folder using any static server. For example, you may run a simple `Express` server by running `npm start`.

### Deploying to Heroku

Make sure you have [Heroku 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:

- If there is not Git repository initiated yet, create a repo and commit all the files:
- `git init`
- `git add .`
- `git commit -m 'initial commit'`
- `heroku apps:create` - create Heroku app
- `git push heroku master` - push changes to Heroku and trigger deploying
- 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 micro-app.

## Verification

Please check [verification-guide.md](verification-guide.md)
1 change: 1 addition & 0 deletions __mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = "";
51 changes: 51 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"useESModules": true,
"regenerator": false
}
],
[
"react-css-modules",
{
"filetypes": {
".scss": {
"syntax": "postcss-scss"
}
},
"generateScopedName": "teams_[path][name]___[local]___[hash:base64:6]"
}
],
"inline-react-svg"
],
"env": {
"test": {
"presets": [
[
"@babel/preset-env",
{
"targets": "current node"
}
]
],
"plugins": [
["module-resolver", {
"alias": {
"styles": "./src/styles",
"components": "./src/components",
"hooks": "./src/hooks",
"utils": "./src/utils",
"constants": "./src/constants",
"services": "./src/services"
}
}]
]
}
}
}
28 changes: 28 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -eo pipefail
APP_NAME=$1
UPDATE_CACHE=""

docker build -f docker/Dockerfile -t $APP_NAME:latest \
--build-arg APPMODE=$APPMODE \
--build-arg APPENV=$APPENV .

docker build -f docker/mockDockerfile -t mock-$APP_NAME:latest .

#docker create --name app $APP_NAME:latest

#if [ -d node_modules ]
#then
# mv package-lock.json old-package-lock.json
# docker cp app:/$APP_NAME/package-lock.json package-lock.json
# set +eo pipefail
# UPDATE_CACHE=$(cmp package-lock.json old-package-lock.json)
# set -eo pipefail
#else
# UPDATE_CACHE=1
#fi

#if [ "$UPDATE_CACHE" == 1 ]
#then
# docker cp app:/$APP_NAME/node_modules .
#fi
Loading