Skip to content

Commit 180610c

Browse files
Merge pull request #1 from topcoder-platform/earn-restructure
Earn restructure Dev Deployment
2 parents 560f1bd + ba4f1af commit 180610c

File tree

164 files changed

+11876
-1697
lines changed

Some content is hidden

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

164 files changed

+11876
-1697
lines changed

.circleci/config.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,16 @@ builddeploy_steps: &builddeploy_steps
2929
- run: *install_dependency
3030
- run: *install_deploysuite
3131
- restore_cache: *restore_cache_settings_for_build
32-
- run: ./build.sh ${APPNAME}
33-
- save_cache: *save_cache_settings
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
3442
- deploy:
3543
name: Running MasterScript.
3644
command: |

.eslintrc

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

.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

.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: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Topcoder React Microapp Example
1+
# micro-frontends-challenges-app
2+
3+
# Topcoder Challenges App
24

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

@@ -14,9 +16,11 @@ This is a [single-spa](https://single-spa.js.org/) example React microapp.
1416
| Command | Description |
1517
| --------------------- | ----------------------------------------------------------------- |
1618
| `npm start` | Run server which serves production ready build from `dist` folder |
17-
| `npm run dev` | Run app in the development mode |
18-
| `npm run dev-https` | Run app in the development mode using HTTPS protocol |
19-
| `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 `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 |
2024
| `npm run analyze` | Analyze dependencies sizes and opens report in the browser |
2125
| `npm run lint` | Check code for lint errors |
2226
| `npm run format` | Format code using prettier |
@@ -28,24 +32,29 @@ This is a [single-spa](https://single-spa.js.org/) example React microapp.
2832

2933
Inside the project folder run:
3034

35+
- `nvm use 10.22.1;` - to use npm version: 10.22.1
3136
- `npm i` - install dependencies
32-
- `npm run dev` - run app in development mode
33-
- 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:8500/topcoder-micro-frontends-challenges-app.js`.
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
3439

3540
## Deployment to Production
3641

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

4146
### Deploying to Heroku
4247

4348
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:
4449

4550
- If there is not Git repository inited yet, create a repo and commit all the files:
51+
4652
- `git init`
4753
- `git add .`
4854
- `git commit -m'inital commit'`
55+
4956
- `heroku apps:create` - create Heroku app
57+
5058
- `git push heroku master` - push changes to Heroku and trigger deploying
51-
- Now you have to configure frame app to use the URL provided by Heroku like `https://<APP-NAME>.herokuapp.com/topcoder-micro-frontends-challenges-app.js` to load this microapp.
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.

babel.config.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
let cssLocalIdent;
2+
if (process.env.APPMODE === 'production') {
3+
cssLocalIdent = '[hash:base64:6]';
4+
} else {
5+
cssLocalIdent = 'challenges_[path][name]___[local]___[hash:base64:6]';
6+
}
7+
8+
const config = {
9+
presets: [
10+
['@babel/preset-env', { targets: { 'browsers': ['> 1%', 'not dead'] } }],
11+
'@babel/preset-react'
12+
],
13+
plugins: [
14+
['module-resolver', {
15+
extensions: ['.js', '.jsx'],
16+
root: [
17+
'./src',
18+
],
19+
}],
20+
[
21+
'inline-react-svg',
22+
{
23+
ignorePattern: '[/\/]assets[/\/]images'
24+
}
25+
],
26+
[
27+
"@babel/plugin-transform-runtime",
28+
{
29+
useESModules: true,
30+
regenerator: false,
31+
},
32+
],
33+
['react-css-modules', {
34+
filetypes: {
35+
'.scss': {
36+
syntax: 'postcss-scss',
37+
},
38+
},
39+
generateScopedName: cssLocalIdent
40+
}],
41+
]
42+
};
43+
44+
module.exports = config;

babel.config.json

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

build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ set -eo pipefail
33
APP_NAME=$1
44
UPDATE_CACHE=""
55

6-
docker build -f docker/Dockerfile -t $APP_NAME:latest .
6+
docker build -f docker/Dockerfile -t $APP_NAME:latest \
7+
--build-arg APPMODE=$APPMODE \
8+
--build-arg APPENV=$APPENV .
79

810
docker create --name app $APP_NAME:latest
911

config/default.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
require("dotenv").config();
2+
3+
module.exports = {
4+
GUIKIT: {
5+
DEBOUNCE_ON_CHANGE_TIME: 150,
6+
},
7+
API: {
8+
V5: "https://api.topcoder-dev.com/v5",
9+
V3: "https://api.topcoder-dev.com/v3",
10+
},
11+
URL: {
12+
BASE: "https://www.topcoder-dev.com",
13+
COMMUNITY_APP: "https://community-app.topcoder-dev.com",
14+
},
15+
};

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+
};

0 commit comments

Comments
 (0)