Skip to content

Commit 080203e

Browse files
authored
Merge pull request #2 from topcoder-platform/dev
Earn Restructure Release PR
2 parents 4810f75 + 180610c commit 080203e

File tree

162 files changed

+26584
-1
lines changed

Some content is hidden

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

162 files changed

+26584
-1
lines changed

.DS_Store

6 KB
Binary file not shown.

.circleci/config.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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:
33+
command: |
34+
./awsconfiguration.sh $DEPLOY_ENV
35+
source awsenvconf
36+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-buildvar
37+
- run:
38+
command: |
39+
source buildenvvar
40+
./build.sh ${APPNAME}
41+
#- save_cache: *save_cache_settings
42+
- deploy:
43+
name: Running MasterScript.
44+
command: |
45+
./awsconfiguration.sh $DEPLOY_ENV
46+
source awsenvconf
47+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
48+
source buildenvvar
49+
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
50+
51+
jobs:
52+
# Build & Deploy against development backend
53+
"build-dev":
54+
<<: *defaults
55+
environment:
56+
DEPLOY_ENV: "DEV"
57+
LOGICAL_ENV: "dev"
58+
APPNAME: "micro-frontends-challenges-app"
59+
steps: *builddeploy_steps
60+
61+
"build-prod":
62+
<<: *defaults
63+
environment:
64+
DEPLOY_ENV: "PROD"
65+
LOGICAL_ENV: "prod"
66+
APPNAME: "micro-frontends-challenges-app"
67+
steps: *builddeploy_steps
68+
69+
workflows:
70+
version: 2
71+
build:
72+
jobs:
73+
# Development builds are executed on "develop" branch only.
74+
- "build-dev":
75+
context: org-global
76+
filters:
77+
branches:
78+
only:
79+
- dev
80+
81+
# Production builds are exectuted only on tagged commits to the
82+
# master branch.
83+
- "build-prod":
84+
context: org-global
85+
filters:
86+
branches:
87+
only: master

.eslintrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": ["react-important-stuff", "plugin:prettier/recommended"],
3+
"parser": "babel-eslint",
4+
"env": {
5+
"node": true
6+
}
7+
}

.gitattributes

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
## GITATTRIBUTES FOR WEB PROJECTS
2+
#
3+
# These settings are for any web project.
4+
#
5+
# Details per file setting:
6+
# text These files should be normalized (i.e. convert CRLF to LF).
7+
# binary These files are binary and should be left untouched.
8+
#
9+
# Note that binary is a macro for -text -diff.
10+
######################################################################
11+
12+
*.css merge=ours
13+
*.css.map merge=ours
14+
15+
## AUTO-DETECT
16+
## Handle line endings automatically for files detected as
17+
## text and leave all files detected as binary untouched.
18+
## This will handle all files NOT defined below.
19+
* text=auto eol=lf
20+
21+
## SOURCE CODE
22+
*.bat text eol=crlf
23+
*.coffee text eol=lf
24+
*.css text eol=lf
25+
*.htm text eol=lf
26+
*.html text eol=lf
27+
*.inc text
28+
*.ini text
29+
*.js text eol=lf
30+
*.json text
31+
*.jsx text
32+
*.less text
33+
*.od text
34+
*.onlydata text
35+
*.php text
36+
*.pl text
37+
*.py text
38+
*.rb text
39+
*.sass text eol=lf
40+
*.scm text
41+
*.scss text eol=lf
42+
*.sh text eol=lf
43+
*.sql text
44+
*.styl text
45+
*.tag text
46+
*.ts text
47+
*.tsx text
48+
*.xml text
49+
*.xhtml text
50+
51+
## DOCKER
52+
*.dockerignore text
53+
Dockerfile text
54+
55+
## DOCUMENTATION
56+
*.markdown text
57+
*.md text
58+
*.mdwn text
59+
*.mdown text
60+
*.mkd text
61+
*.mkdn text
62+
*.mdtxt text
63+
*.mdtext text
64+
*.txt text
65+
AUTHORS text
66+
CHANGELOG text
67+
CHANGES text
68+
CONTRIBUTING text
69+
COPYING text
70+
copyright text
71+
*COPYRIGHT* text
72+
INSTALL text
73+
license text
74+
LICENSE text
75+
NEWS text
76+
readme text
77+
*README* text
78+
TODO text
79+
80+
## TEMPLATES
81+
*.dot text
82+
*.ejs text
83+
*.haml text
84+
*.handlebars text
85+
*.hbs text
86+
*.hbt text
87+
*.jade text
88+
*.latte text
89+
*.mustache text
90+
*.njk text
91+
*.phtml text
92+
*.tmpl text
93+
*.tpl text
94+
*.twig text
95+
96+
## LINTERS
97+
.babelrc text
98+
.csslintrc text
99+
.eslintrc text
100+
.htmlhintrc text
101+
.jscsrc text
102+
.jshintrc text
103+
.jshintignore text
104+
.prettierrc text
105+
.stylelintrc text
106+
107+
## CONFIGS
108+
*.bowerrc text
109+
*.cnf text
110+
*.conf text
111+
*.config text
112+
.browserslistrc text
113+
.editorconfig text
114+
.gitattributes text
115+
.gitconfig text
116+
.gitignore text
117+
.htaccess text
118+
*.npmignore text
119+
*.yaml text
120+
*.yml text
121+
browserslist text
122+
Makefile text
123+
makefile text
124+
125+
## HEROKU
126+
Procfile text
127+
.slugignore text
128+
129+
## GRAPHICS
130+
*.ai binary
131+
*.bmp binary
132+
*.eps binary
133+
*.gif binary
134+
*.ico binary
135+
*.jng binary
136+
*.jp2 binary
137+
*.jpg binary
138+
*.jpeg binary
139+
*.jpx binary
140+
*.jxr binary
141+
*.pdf binary
142+
*.png binary
143+
*.psb binary
144+
*.psd binary
145+
*.svg text
146+
*.svgz binary
147+
*.tif binary
148+
*.tiff binary
149+
*.wbmp binary
150+
*.webp binary
151+
152+
## AUDIO
153+
*.kar binary
154+
*.m4a binary
155+
*.mid binary
156+
*.midi binary
157+
*.mp3 binary
158+
*.ogg binary
159+
*.ra binary
160+
161+
## VIDEO
162+
*.3gpp binary
163+
*.3gp binary
164+
*.as binary
165+
*.asf binary
166+
*.asx binary
167+
*.fla binary
168+
*.flv binary
169+
*.m4v binary
170+
*.mng binary
171+
*.mov binary
172+
*.mp4 binary
173+
*.mpeg binary
174+
*.mpg binary
175+
*.ogv binary
176+
*.swc binary
177+
*.swf binary
178+
*.webm binary
179+
180+
## ARCHIVES
181+
*.7z binary
182+
*.gz binary
183+
*.jar binary
184+
*.rar binary
185+
*.tar binary
186+
*.zip binary
187+
188+
## FONTS
189+
*.ttf binary
190+
*.eot binary
191+
*.otf binary
192+
*.woff binary
193+
*.woff2 binary
194+
195+
## EXECUTABLES
196+
*.exe binary
197+
*.pyc binary

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ build/Release
4141
node_modules/
4242
jspm_packages/
4343

44+
# Mac files
45+
.DS_Store
46+
**/.DS_Store
47+
4448
# TypeScript v1 declaration files
4549
typings/
4650

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
10.22.1

.prettierignore

Lines changed: 7 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": false
3+
}

README.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,60 @@
1-
# micro-frontends-challenges-app
1+
# micro-frontends-challenges-app
2+
3+
# Topcoder Challenges App
4+
5+
This is a [single-spa](https://single-spa.js.org/) example React microapp.
6+
7+
> 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.
8+
9+
## Requirements
10+
11+
- node - v10.22.1
12+
- npm - v6.14.6
13+
14+
## NPM Commands
15+
16+
| Command | Description |
17+
| --------------------- | ----------------------------------------------------------------- |
18+
| `npm start` | Run server which serves production ready build from `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 `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 `dev` config |
24+
| `npm run analyze` | Analyze dependencies sizes and opens report in the browser |
25+
| `npm run lint` | Check code for lint errors |
26+
| `npm run format` | Format code using prettier |
27+
| `npm run test` | Run unit tests |
28+
| `npm run watch-tests` | Watch for file changes and run unit tests on changes |
29+
| `npm run coverage` | Generate test code coverage report |
30+
31+
## Local Deployment
32+
33+
Inside the project folder run:
34+
35+
- `nvm use 10.22.1;` - to use npm version: 10.22.1
36+
- `npm i` - install dependencies
37+
- `npm run local` - run app in `development` mode and `dev` config
38+
- This app will be loaded as a normal MFE app, its url is `http://localhost:8009/challenges-app/topcoder-micro-frontends-challenges-app.js` and is configurated in the config file of Earn App
39+
40+
## Deployment to Production
41+
42+
- `npm i` - install dependencies
43+
- `APPMODE=production APPENV=prod npm run build` - build code to `dist/` folder
44+
- Now you can host `dist/` folder using any static server. For example, you may run a simple `Express` server by running `npm start`.
45+
46+
### Deploying to Heroku
47+
48+
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:
49+
50+
- If there is not Git repository inited yet, create a repo and commit all the files:
51+
52+
- `git init`
53+
- `git add .`
54+
- `git commit -m'inital commit'`
55+
56+
- `heroku apps:create` - create Heroku app
57+
58+
- `git push heroku master` - push changes to Heroku and trigger deploying
59+
60+
- Now you have to configure frame app to use the URL provided by Heroku like `https://<APP-NAME>.herokuapp.com/challenges-app/topcoder-micro-frontends-challenges-app.js` to load this microapp.

0 commit comments

Comments
 (0)