TP-46407 | added build and prettier file (#78)
* TP-46407 | added build and prettier file * TP-46407 | yarn pretty added * TP-46407 | package.json configuered * TP-46407 | dockerfile link fix * TP-46407 | dockerfile link fix revert
This commit is contained in:
47
.github/workflows/build.yml
vendored
Normal file
47
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# This workflow will do a clean install of node dependencies, build the source code across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [default]
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18.17.1]
|
||||
|
||||
name: Build Check
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Setup Yarn
|
||||
run: npm install -g yarn
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v3
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-build-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-build-
|
||||
|
||||
- name: Install Dependencies
|
||||
run: yarn
|
||||
|
||||
- name: Check Build
|
||||
run: yarn build
|
||||
50
.github/workflows/lintAndPrettier.yml
vendored
Normal file
50
.github/workflows/lintAndPrettier.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
# This workflow will do a clean install of node dependencies, build the source code across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Lint and Prettier checks
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [default]
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18.17.1]
|
||||
|
||||
name: Lint checks and prettier
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Setup Yarn
|
||||
run: npm install -g yarn
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v3
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
key: ${{ runner.os }}-yarn-lint-and-prettier-${{ hashFiles('**/yarn.lock') }}
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-lint-and-prettier-
|
||||
|
||||
- name: Install Dependencies
|
||||
run: yarn
|
||||
|
||||
- name: Check Lint
|
||||
run: yarn eslint-check-quiet # Using quiet mode to prevent logs in actions
|
||||
|
||||
- name: Check Code Formatting
|
||||
run: yarn prettier-check
|
||||
@@ -3,6 +3,7 @@ FROM 193044292705.dkr.ecr.ap-south-1.amazonaws.com/common/node:16.15.1-alpine3.1
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
RUN yarn install
|
||||
RUN yarn pretty
|
||||
RUN yarn prettier-check
|
||||
RUN yarn eslint-check
|
||||
RUN yarn build
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
"local-copy-config": "cp config.qa.js config.js",
|
||||
"dev": "npm run local-copy-config && vite",
|
||||
"copy-config": "cp setup.template.js dist/config.js",
|
||||
"build": "npm run clear-build && tsc && vite build && npm run copy-config",
|
||||
"build": "yarn run clear-build && tsc && vite build && yarn run copy-config",
|
||||
"lint": "eslint --fix \"**/?*.{ts,tsx,js,jsx}\"",
|
||||
"eslint-check": "eslint \"**/?*.{ts,tsx,js,jsx}\"",
|
||||
"prepare": "husky install",
|
||||
"pretty": "prettier --write \"./**/*.{js,jsx,ts,tsx,css,scss,md}\"",
|
||||
"prettier-check": "prettier --check \"./**/*.{js,jsx,ts,tsx,css,scss,md}\""
|
||||
"prettier-check": "prettier --check \"./**/*.{js,jsx,ts,tsx,css,scss,md}\"",
|
||||
"eslint-check-quiet": "yarn eslint-check --quiet"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
@@ -23,10 +24,10 @@
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"src/**/*.{js,jsx,ts,tsx,css,scss}": [
|
||||
"./**/*.{js,jsx,ts,tsx,css,scss}": [
|
||||
"yarn pretty"
|
||||
],
|
||||
"src/**/*.{js,jsx,ts,tsx}": [
|
||||
"./**/*.{js,jsx,ts,tsx}": [
|
||||
"yarn lint"
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user