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

Commit c1a6e38

Browse files
committed
Code init
1 parent 9d6aefe commit c1a6e38

28 files changed

+16136
-0
lines changed

.circleci/config.yml

Lines changed: 79 additions & 0 deletions
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-react-app"
51+
steps: *builddeploy_steps
52+
53+
"build-prod":
54+
<<: *defaults
55+
environment:
56+
DEPLOY_ENV: "PROD"
57+
LOGICAL_ENV: "prod"
58+
APPNAME: "micro-frontends-react-app"
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

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

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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

.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

babel.config.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"presets": ["@babel/preset-env", "@babel/preset-react"],
3+
"plugins": [
4+
[
5+
"@babel/plugin-transform-runtime",
6+
{
7+
"useESModules": true,
8+
"regenerator": false
9+
}
10+
]
11+
],
12+
"env": {
13+
"test": {
14+
"presets": [
15+
[
16+
"@babel/preset-env",
17+
{
18+
"targets": "current node"
19+
}
20+
]
21+
]
22+
}
23+
}
24+
}

build.sh

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

docker/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Use the base image with Node.js
2+
FROM node:latest
3+
4+
# Copy the current directory into the Docker image
5+
COPY . /micro-frontends-react-app
6+
7+
# Set working directory for future use
8+
WORKDIR /micro-frontends-react-app
9+
10+
# Install the dependencies from package.json
11+
RUN npm install
12+
13+
RUN npm run build
14+
15+
CMD npm start

docker/docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: '3'
2+
services:
3+
micro-frontends-react-app:
4+
image: micro-frontends-react-app:latest
5+
build:
6+
context: ../
7+
dockerfile: docker/Dockerfile
8+
env_file:
9+
- api.env
10+
network_mode: "host"

docker/sample.api.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
AWS_ACCESS_KEY_ID=<AWS Access Key ID>
2+
AWS_SECRET_ACCESS_KEY=<AWS Secret Access Key>

jest.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
rootDir: "src",
3+
transform: {
4+
"^.+\\.(j|t)sx?$": "babel-jest",
5+
},
6+
moduleNameMapper: {
7+
"\\.(css)$": "identity-obj-proxy",
8+
"\\.svg$": "<rootDir>/__mocks__/fileMock.js",
9+
},
10+
setupFilesAfterEnv: [
11+
"../node_modules/@testing-library/jest-dom/dist/index.js",
12+
],
13+
};

0 commit comments

Comments
 (0)