From 14b261de3fa392c754eb78fee4b2154b8f6b7484 Mon Sep 17 00:00:00 2001 From: Juraj <36888576+jurajpiar@users.noreply.github.com> Date: Tue, 23 Mar 2021 14:06:59 +0100 Subject: [PATCH] feat(devops): adds prod build excluding tests fix(devops): changes pre-build sequence (#802) * feat(devops): adds prod build excluding tests * fix(devops): cp the right tsconfig before build * fix(devops): adds unnecesary import to fix build fix(devops): removes production only deps install (#804) fix(devops): add job environment to each workflow fix(devops): corrects build directory to sync aws --- .github/workflows/staging.yml | 12 ++++------ .gitignore | 1 + package.json | 13 +++++----- src/components/organisms/Footer.tsx | 5 +++- src/contracts/rns/Marketplace.ts | 5 ++-- tsconfig.json => tsconfig.dev.json | 2 +- tsconfig.prod.json | 37 +++++++++++++++++++++++++++++ 7 files changed, 58 insertions(+), 17 deletions(-) rename tsconfig.json => tsconfig.dev.json (99%) create mode 100644 tsconfig.prod.json diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 5176fbd41..50e7ed170 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -2,9 +2,6 @@ name: RIF Marketplace UI deploy on: push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+-**' - - 'v[0-9]+.[0-9]+.[0-9]+' branches: - staging @@ -12,6 +9,7 @@ jobs: deploy-staging: name: RIF Marketplace UI - Staging runs-on: ubuntu-latest + environment: staging steps: - name: Checkout @@ -33,7 +31,7 @@ jobs: - name: Install dependencies if: steps.cache.outputs.cache-hit != 'true' run: | - npm ci --only=production + npm ci - name: Build site env: @@ -42,9 +40,9 @@ jobs: REACT_APP_LOG_LEVEL: error REACT_APP_NETWORK: rskstaging REACT_APP_REQUIRED_NETWORK_ID: 31 - REACT_APP_REQUIRED_NETWORK_NAME: RSK Testnet + REACT_APP_REQUIRED_NETWORK_NAME: RSK Staging run: | - npm run build + npm run build:prod - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 @@ -55,7 +53,7 @@ jobs: - name: Deploy site to S3 run: | - aws s3 sync --delete --only-show-errors dist/ ${{ secrets.STAGING_S3_BUCKET }} + aws s3 sync --delete --only-show-errors build/ ${{ secrets.STAGING_S3_BUCKET }} - name: Invalidate CloudFront cache run: | diff --git a/.gitignore b/.gitignore index 1165d966f..70ad89a57 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ # production /build +/dist # misc .DS_Store diff --git a/package.json b/package.json index 4262faf18..5e1f0f17e 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,12 @@ "url": "https://github.com/rsksmart/rif-marketplace-ui.git" }, "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test --unhandled-rejections=strict", - "coverage": "react-scripts test --unhandled-rejections=strict --coverageProvider=v8 --coverage --watchAll=false", - "lint": "eslint --ext=ts --ext=tsx ." + "start": "cp -f ./tsconfig.dev.json ./tsconfig.json && react-scripts start", + "build": "cp -f ./tsconfig.dev.json ./tsconfig.json && react-scripts build", + "build:prod": "cp -f ./tsconfig.prod.json ./tsconfig.json && react-scripts build", + "test": "cp -f ./tsconfig.dev.json ./tsconfig.json && react-scripts test --unhandled-rejections=strict", + "coverage": "cp -f ./tsconfig.dev.json ./tsconfig.json && react-scripts test --unhandled-rejections=strict --coverageProvider=v8 --coverage --watchAll=false", + "lint": "cp -f ./tsconfig.dev.json ./tsconfig.json && eslint --ext=ts --ext=tsx ." }, "dependencies": { "@feathersjs/authentication": "^4.5.10", @@ -104,4 +105,4 @@ "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mocks__/fileMock.ts" } } -} +} \ No newline at end of file diff --git a/src/components/organisms/Footer.tsx b/src/components/organisms/Footer.tsx index 8f9a68f14..87f4d206e 100644 --- a/src/components/organisms/Footer.tsx +++ b/src/components/organisms/Footer.tsx @@ -1,8 +1,9 @@ import React, { FC } from 'react' import { makeStyles } from '@material-ui/core/styles' +import { NavLinkProps } from 'react-router-dom/NavLink' import { Footer as RUIFooter } from '@rsksmart/rif-ui' /* eslint-disable-next-line import/no-unresolved */ -import { FooterProps } from '@rsksmart/rif-ui/dist/components/organisms/Footer' +import { FooterProps as RUIFooterProps } from '@rsksmart/rif-ui/dist/components/organisms/Footer' import { appVersion } from 'config' import PrivacySettingsModal from './tracking/PrivacySettingsModal' @@ -12,6 +13,8 @@ const useStyles = makeStyles(() => ({ }, })) +type FooterProps = RUIFooterProps & NavLinkProps + const Footer: FC = () => { const classes = useStyles() diff --git a/src/contracts/rns/Marketplace.ts b/src/contracts/rns/Marketplace.ts index aa12b9c2f..bd55627eb 100644 --- a/src/contracts/rns/Marketplace.ts +++ b/src/contracts/rns/Marketplace.ts @@ -82,8 +82,9 @@ class MarketplaceContract extends ContractBase { buyTx, { gasMultiplier: MarketplaceContract.gasMultiplier, - ...txOptions - }) + ...txOptions, + }, + ) } } diff --git a/tsconfig.json b/tsconfig.dev.json similarity index 99% rename from tsconfig.json rename to tsconfig.dev.json index 03d1f9f14..af46a0184 100644 --- a/tsconfig.json +++ b/tsconfig.dev.json @@ -24,4 +24,4 @@ "include": [ "src" ] -} \ No newline at end of file +} diff --git a/tsconfig.prod.json b/tsconfig.prod.json new file mode 100644 index 000000000..0fc2f4c23 --- /dev/null +++ b/tsconfig.prod.json @@ -0,0 +1,37 @@ +{ + "compilerOptions": { + "baseUrl": "src", + "target": "es5", + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], + "allowJs": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "preserve", + "noImplicitAny": false + }, + "include": [ + "src" + ], + "exclude":[ + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.test.ts", + "**/*.test.tsx", + "**/__mocks__/*", + "**/__tests__/*", + "src/globals.d.ts", + "src/api/test-utils/*" + ] +} \ No newline at end of file