Skip to content

Commit

Permalink
refactor: #1891 Fix conflicts with master
Browse files Browse the repository at this point in the history
  • Loading branch information
Vu Nguyen committed Jul 9, 2020
2 parents 981c936 + d9bec10 commit 6cc54c2
Show file tree
Hide file tree
Showing 2,121 changed files with 181,178 additions and 2,189 deletions.
1 change: 1 addition & 0 deletions packages/admin-portal/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
6 changes: 6 additions & 0 deletions packages/admin-portal/.sentryclirc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[defaults]
project=admin-portal
org=reapit-ltd

[http]
keepalive=false
126 changes: 126 additions & 0 deletions packages/admin-portal/.snyk
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.15.0
ignore: {}
# patches apply the minimum changes required to fix a vulnerability
patch:
SNYK-JS-LODASH-567746:
- react-chartjs-2 > lodash:
patched: '2020-06-03T13:18:59.109Z'
- swagger-ui-react > lodash:
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > formik > lodash':
patched: '2020-06-03T13:18:59.109Z'
- swagger-ui-react > react-redux > lodash:
patched: '2020-06-03T13:18:59.109Z'
- swagger-ui-react > redux > lodash:
patched: '2020-06-03T13:18:59.109Z'
- swagger-ui-react > swagger-client > lodash:
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > formik > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > gh-pages > async > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > styled-components > @babel/traverse > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > styled-components > babel-plugin-styled-components > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > styled-components > @babel/helper-module-imports > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > styled-components > @babel/traverse > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > gh-pages > async > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > styled-components > @babel/traverse > @babel/generator > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > styled-components > @babel/traverse > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > styled-components > babel-plugin-styled-components > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > styled-components > babel-plugin-styled-components > @babel/helper-module-imports > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > styled-components > @babel/helper-module-imports > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > styled-components > @babel/traverse > @babel/generator > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > styled-components > @babel/traverse > @babel/helper-function-name > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > styled-components > @babel/traverse > @babel/helper-split-export-declaration > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > styled-components > @babel/traverse > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > styled-components > babel-plugin-styled-components > @babel/helper-annotate-as-pure > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > styled-components > @babel/traverse > @babel/generator > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > @storybook/theming > @emotion/styled > babel-plugin-emotion > @babel/helper-module-imports > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > styled-components > babel-plugin-styled-components > @babel/helper-module-imports > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > styled-components > @babel/traverse > @babel/generator > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > styled-components > @babel/traverse > @babel/helper-function-name > @babel/helper-get-function-arity > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > styled-components > @babel/traverse > @babel/helper-function-name > @babel/template > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > styled-components > @babel/traverse > @babel/helper-function-name > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > styled-components > @babel/traverse > @babel/helper-split-export-declaration > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > styled-components > babel-plugin-styled-components > @babel/helper-annotate-as-pure > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > @storybook/theming > @emotion/core > @emotion/css > babel-plugin-emotion > @babel/helper-module-imports > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > @storybook/theming > @emotion/styled > babel-plugin-emotion > @babel/helper-module-imports > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > styled-components > @babel/traverse > @babel/helper-function-name > @babel/helper-get-function-arity > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > styled-components > @babel/traverse > @babel/helper-function-name > @babel/template > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/cognito-auth > @reapit/elements > @storybook/theming > @emotion/core > @emotion/css > babel-plugin-emotion > @babel/helper-module-imports > @babel/types > lodash':
patched: '2020-06-03T13:18:59.109Z'
- '@reapit/elements > linaria > @babel/register > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > linaria > @babel/plugin-transform-modules-commonjs > @babel/helper-module-transforms > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/cognito-auth > @reapit/elements > linaria > @babel/register > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > linaria > @babel/core > @babel/helpers > @babel/traverse > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/cognito-auth > @reapit/elements > linaria > @babel/plugin-transform-modules-commonjs > @babel/helper-module-transforms > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > linaria > @babel/plugin-transform-modules-commonjs > @babel/helper-module-transforms > @babel/helper-replace-supers > @babel/traverse > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/cognito-auth > @reapit/elements > linaria > @babel/core > @babel/helpers > @babel/traverse > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/cognito-auth > @reapit/elements > linaria > @babel/plugin-transform-modules-commonjs > @babel/helper-module-transforms > @babel/helper-replace-supers > @babel/traverse > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > linaria > @babel/plugin-transform-modules-commonjs > @babel/helper-module-transforms > @babel/helper-replace-supers > @babel/traverse > @babel/generator > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > linaria > @babel/plugin-transform-modules-commonjs > @babel/helper-module-transforms > @babel/helper-replace-supers > @babel/traverse > @babel/helper-split-export-declaration > @babel/types > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/cognito-auth > @reapit/elements > linaria > @babel/plugin-transform-modules-commonjs > @babel/helper-module-transforms > @babel/helper-replace-supers > @babel/traverse > @babel/generator > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/cognito-auth > @reapit/elements > linaria > @babel/plugin-transform-modules-commonjs > @babel/helper-module-transforms > @babel/helper-replace-supers > @babel/traverse > @babel/helper-split-export-declaration > @babel/types > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > linaria > @babel/plugin-transform-modules-commonjs > @babel/helper-module-transforms > @babel/helper-replace-supers > @babel/traverse > @babel/helper-function-name > @babel/template > @babel/types > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/cognito-auth > @reapit/elements > linaria > @babel/plugin-transform-modules-commonjs > @babel/helper-module-transforms > @babel/helper-replace-supers > @babel/traverse > @babel/helper-function-name > @babel/template > @babel/types > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > formik > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > gh-pages > async > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > styled-components > @babel/traverse > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > styled-components > babel-plugin-styled-components > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > styled-components > @babel/traverse > @babel/generator > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > styled-components > babel-plugin-styled-components > @babel/helper-annotate-as-pure > @babel/types > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > styled-components > @babel/traverse > @babel/helper-split-export-declaration > @babel/types > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > @storybook/theming > @emotion/styled > babel-plugin-emotion > @babel/helper-module-imports > @babel/types > lodash':
patched: '2020-06-15T12:09:30.794Z'
- '@reapit/elements > styled-components > @babel/traverse > @babel/helper-function-name > @babel/template > @babel/types > lodash':
patched: '2020-06-15T12:09:30.794Z'
12 changes: 12 additions & 0 deletions packages/admin-portal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Admin Portal

![lines](./src/tests/badges/badge-lines.svg) ![functions](./src/tests/badges/badge-functions.svg) ![branches](./src/tests/badges/badge-branches.svg) ![statements](./src/tests/badges/badge-statements.svg)

The core frontend of the Reapit Foundations platform. Contains all functionality in both the Marketplace and Developer Portal applications.

- **Tech Stack**: React, Redux, React Router, Elements, Cognito Auth, Jest, Cypress, Sass / CSS Modules.
- **Cloud Services**: S3, CloudFront, AWS Cognito, SecretsManager, Sentry
- **Production**: https://admin-portal.reapit.cloud
- **Development**: https://dev.admin-portal.reapit.cloud

For detailed documentation [visit here](https://foundations-documentation.reapit.cloud/open-source/packages#admin-portal).
16 changes: 16 additions & 0 deletions packages/admin-portal/config.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"appEnv": "development",
"sentryDns": "",
"marketplaceApiUrl": "",
"marketplaceApiKey": "",
"uploadApiUrl": "",
"swaggerUrl": "",
"elementDocumentUrl": "",
"cognitoClientId": "",
"googleAnalyticsKey": "",
"cognitoOAuthUrl": "",
"cognitoUserPoolId": "",
"chatbotAppId": "",
"marketplaceUrl": "",
"cypressBaseUrl": "http://localhost:8080"
}
23 changes: 23 additions & 0 deletions packages/admin-portal/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const { pathsToModuleNameMapper } = require('ts-jest/utils')
const baseConfig = require('../../scripts/jest/jest.config')
const { compilerOptions } = require('./tsconfig')

module.exports = {
...baseConfig,
testPathIgnorePatterns: ['<rootDir>/src/tests/'],
moduleNameMapper: {
...baseConfig.moduleNameMapper,
...pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
}),
},
coveragePathIgnorePatterns: ['<rootDir>/src/services', '<rootDir>/src/tests'],
coverageThreshold: {
global: {
branches: 63,
functions: 70,
lines: 88,
statements: 87,
},
},
}
8 changes: 8 additions & 0 deletions packages/admin-portal/linaria.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const dashify = require('dashify')

module.exports = {
evaluate: true,
displayName: false,
// converts camelCase classNames to kebab-case-for-friendly-css
classNameSlug: (_hash, title) => dashify(title),
}
65 changes: 65 additions & 0 deletions packages/admin-portal/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "admin-portal",
"version": "1.0.0",
"description": "Admin portal",
"main": "./src/index.ts",
"repository": "[email protected]:reapit/foundations.git",
"author": "Will McVay <[email protected]>",
"license": "MIT",
"private": true,
"scripts": {
"build:prod": "rimraf public/dist && webpack --config ../../scripts/webpack/webpack.config.prod.js",
"start:dev": "webpack-dev-server --hot --progress --color --mode development --config ../../scripts/webpack/webpack.config.dev.js",
"start:prod": "serve public/dist -s -l 8080",
"test:ci": "cross-env TZ=UTC jest --ci --colors --coverage --silent --forceExit --detectOpenHandles --runInBand",
"test:dev": "cross-env TZ=UTC jest --watch --verbose",
"release:dev": "node ../../scripts/release/release-dev.js admin-portal reapit-admin-portal-dev",
"test-e2e:dev": "cypress open --project './src/tests'",
"cypress:ci": "cypress run --project \"./src/tests\"",
"test-e2e:ci": "start-server-and-test start:prod http://localhost:8080 cypress:ci",

"test:update-badges": "yarn test:ci && jest-coverage-badges --input src/tests/coverage/coverage-summary.json --output src/tests/badges",
"lint": "concurrently \"tsc --noEmit\" \"eslint --cache --ext=ts,tsx src\"",
"lint:fix": "eslint --cache --ext=ts,tsx src --fix",
"fetch-config": "yarn config-manager fetchConfig admin-portal",
"snyk-protect": "snyk protect",
"prepublish": "npm run snyk-protect"
},
"dependencies": {
"@reapit/cognito-auth": "^2.1.7",
"@reapit/elements": "^0.5.60",
"@reapit/utils": "^0.0.1",
"chart.js": "^2.9.3",
"diff": "^4.0.1",
"lodash.isequal": "^4.5.0",
"lodash.orderby": "^4.6.0",
"react-chartjs-2": "^2.8.0",
"react-copy-to-clipboard": "^5.0.2",
"swagger-ui-react": "3.24.3",
"react-responsive": "8.1.0",
"snyk": "^1.341.1"
},
"devDependencies": {
"@reapit/foundations-ts-definitions": "0.0.85",
"@types/nanoid": "^2.1.0",
"redux-mock-store": "^1.5.4"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "yarn test --ci --no-color"
}
},
"lint-staged": {
"!(**/cypress/**/*.{ts,tsx})/**/src/**/*.{ts,tsx}": [
"yarn lint:src",
"git add"
]
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 10"
],
"snyk": true
}
13 changes: 13 additions & 0 deletions packages/admin-portal/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<base href="/" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title>Admin Portal</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
Binary file added packages/admin-portal/public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
111 changes: 111 additions & 0 deletions packages/admin-portal/serverless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# https://www.npmjs.com/package/serverless-single-page-app-plugin
service: admin-portal

plugins:
- serverless-single-page-app-plugin
- serverless-plugin-ifelse

custom:
s3Bucket: reapit-admin-portal-${self:provider.stage}

provider:
name: aws
runtime: nodejs10.x
stage: ${opt:stage, 'dev'}
region: eu-west-2

resources:
Resources:
## Specifying the S3 Bucket
WebAppS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.s3Bucket}
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: error.html

## Specifying the policies to make sure all files inside the Bucket are available to CloudFront
WebAppS3BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket:
Ref: WebAppS3Bucket
PolicyDocument:
Statement:
- Sid: PublicReadGetObject
Effect: Allow
Principal: "*"
Action:
- s3:GetObject
Resource:
Fn::Join: [
"", [
"arn:aws:s3:::",
{ "Ref": "WebAppS3Bucket" },
"/*"
]
]

## Specifying the CloudFront Distribution to server your Web Application
WebAppCloudFrontDistribution:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
Origins:
- DomainName:
Fn::Join: [
"", [
{ "Ref": "WebAppS3Bucket" },
".s3.amazonaws.com"
]
]
Id: S3-${self:custom.s3Bucket}
CustomOriginConfig:
HTTPPort: 80
HTTPSPort: 443
OriginProtocolPolicy: https-only
## In case you want to restrict the bucket access use S3OriginConfig and remove CustomOriginConfig
# S3OriginConfig:
# OriginAccessIdentity: origin-access-identity/cloudfront/E127EXAMPLE51Z
Enabled: 'true'
## Uncomment the following section in case you are using a custom domain
# Aliases:
# If: '"${opt:stage, 'dev'}" == "dev"'
# Set:
# - dev.admin-portal.reapit.cloud
# ElseSet:
# - admin-portal.reapit.cloud
DefaultRootObject: index.html
CustomErrorResponses:
- ErrorCode: 404
ResponseCode: 200
ResponsePagePath: /index.html
- ErrorCode: 403
ResponseCode: 200
ResponsePagePath: /index.html
- ErrorCode: 400
ResponseCode: 200
ResponsePagePath: /index.html
DefaultCacheBehavior:
AllowedMethods:
- GET
- HEAD
- OPTIONS
TargetOriginId: S3-${self:custom.s3Bucket}
ForwardedValues:
QueryString: 'false'
Cookies:
Forward: none
ViewerProtocolPolicy: redirect-to-https
ViewerCertificate:
CloudFrontDefaultCertificate: 'true'
# Logging:
# IncludeCookies: 'false'
# Bucket: mylogs.s3.amazonaws.com
# Prefix: myprefix
Outputs:
WebAppCloudFrontDistributionOutput:
Value:
'Fn::GetAtt': [ WebAppCloudFrontDistribution, DomainName ]
Loading

0 comments on commit 6cc54c2

Please sign in to comment.