Skip to content

Commit

Permalink
Removed yarn: updated START.md, Dockerfile, dev-branch-pr-build-and-t…
Browse files Browse the repository at this point in the history
…est-pipeline.yaml, lint-staged.config.js
  • Loading branch information
annstriganova committed Jan 31, 2024
1 parent 1b65abb commit 42ced90
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 5,324 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/dev-branch-pr-build-and-test-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
with:
fetch-depth: 0
- name: Install dependencies
run: npm install --development
run: npm ci --only=production

- name: Linter
run: npm run lint

Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
. "$(dirname -- "$0")/_/husky.sh"

# yarn tsc --noEmit && yarn eslint . && yarn prettier --write .
yarn lint-staged
npx lint-staged
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:alpine
ENV NEXT_PUBLIC_API_HOST_REMOTE=https://dev.api.it-sl.ru/api/v1
ENV NODE_ENV production
ENV NEXT_PUBLIC_API_HOST_REMOTE=https://iced-latte.uk/backend/api/v1
WORKDIR /usr/app
COPY ./package*.json ./
RUN chown -R node /usr/app
COPY --chown=node ./package*.json ./
RUN npm install --global pm2
USER node
RUN npm install --development
COPY ./ ./
RUN npm ci --only=production
COPY --chown=node ./ ./
RUN npm run build
EXPOSE 3000
CMD [ "pm2-runtime", "start", "npm", "--", "run", "dev" ]
CMD [ "pm2-runtime", "start", "npm", "--", "run", "start" ]
26 changes: 19 additions & 7 deletions START.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
## Quick start
# Getting Started

- navigate to the root of the project
- `yarn install`
- `yarn husky install` - setup precommit eslint typescript checks
- `yarn dev` - runs project on `localhost:3000` (if on the main page u do not see list of products due to CORS error, run dev server with `yarn next dev --hostname 127.0.0.1`)
## Requirements

- `npm 10.2.4`
- `node 20.11.0 LTS`

## Basic Steps

- `npm install` - install dependencies into the node_modules/ directory
- `npx husky install` - setup precommit eslint typescript checks
- `echo 'NEXT_PUBLIC_API_HOST_REMOTE=https://iced-latte.uk/backend/api/v1' > .env` - create `.env`
- `npm run build`
- `npm run dev` - runs project on `localhost:3000` (if on the main page u do not see list of products due to CORS error, run dev server with `yarn next dev --hostname 127.0.0.1`)

## Run Tests

```bash
yarn test
npm run test
```

## Fix Linter Issues

```bash
npm run lint -- --fix
```
```

## Misc

Backend API reference: https://iced-latte.uk/backend/api/docs/swagger-ui/index.html
8 changes: 4 additions & 4 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
// Type check TypeScript files
'**/*.(ts|tsx)': () => 'yarn tsc --noEmit',
'**/*.(ts|tsx)': () => 'npm run tsc --noEmit',

// Lint then format TypeScript and JavaScript files
'src/**/*.(ts|tsx|js)': (filenames) => [
`yarn eslint --fix ${filenames.join(' ')}`,
`yarn prettier --write ${filenames.join(' ')}`,
`npm run eslint --fix ${filenames.join(' ')}`,
`npx prettier --write ${filenames.join(' ')}`,
],

// Format MarkDown and JSON
'**/*.(md|json)': (filenames) =>
`yarn prettier --write ${filenames.join(' ')}`,
`npx prettier --write ${filenames.join(' ')}`,
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"react-dom": "^18",
"react-hook-form": "^7.47.0",
"react-toastify": "^9.1.3",
"sharp": "^0.33.2",
"swr": "^2.2.4",
"tailwind-merge": "^2.1.0",
"ts-jest": "^29.1.1",
Expand All @@ -40,6 +41,7 @@
"eslint-config-next": "13.5.6",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest-dom": "^5.1.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-testing-library": "^6.1.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
Expand All @@ -48,7 +50,7 @@
"lint-staged": "^15.0.2",
"postcss": "^8",
"prettier": "^3.0.3",
"prettier-plugin-tailwindcss": "^0.5.6",
"prettier-plugin-tailwindcss": "^0.5.11",
"tailwind-merge": "^2.1.0",
"tailwindcss": "^3",
"typescript": "^5",
Expand Down
Loading

0 comments on commit 42ced90

Please sign in to comment.