Skip to content

Commit

Permalink
fix: from yarn to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
DevNono committed Sep 17, 2023
1 parent a72a102 commit b311ec5
Show file tree
Hide file tree
Showing 7 changed files with 3,173 additions and 2,847 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# production
/build
yarn-error.log
pnpm-error.log

# misc
.DS_Store
Expand Down
38 changes: 26 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,36 @@ on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn lint
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm lint

build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn build
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm build
46 changes: 23 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
.env

/node_modules

# testing
/coverage

# production
/build

# misc
.DS_Store

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# IDE Configs
/.idea

# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
.env

/node_modules

# testing
/coverage

# production
/build

# misc
.DS_Store

npm-debug.log*
pnpm-debug.log*
pnpm-error.log*

# IDE Configs
/.idea

TODO.txt
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
FROM node:16
FROM node:18

ENV NODE_ENV=production
WORKDIR /srv/app

RUN npm install -g pnpm

RUN chown node:node .

USER node

# Node has the uid 1000
COPY --chown=node:node package.json yarn.lock ./
COPY --chown=node:node package.json pnpm-lock.yaml ./

RUN yarn --frozen-lockfile --production=false
RUN pnpm install --frozen-lockfile

COPY --chown=node:node ./ ./

# Build api
RUN yarn build
RUN pnpm build

# Prunes devDependencies
RUN yarn install --production --ignore-scripts --prefer-offline
RUN pnpm install --production --ignore-scripts --prefer-offline

CMD yarn start
CMD pnpm start
100 changes: 50 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@

# UA Bouffe API
[![Build status](https://github.com/ungdev/UA-bouffe-api/actions/workflows/ci.yml/badge.svg)](https://github.com/ungdev/UA-bouffe-api/actions/workflows/ci.yml)

API du microservice [UA Bouffe](https://github.com/ungdev/UA-bouffe)

## Installation
### Prérequis
- NodeJS
- Yarn
- MySQL
### Base de données
Créer la base de données uabouffe
```
CREATE DATABASE uabouffe CHARACTER SET utf8;
```
### Installation de l'API et des dépendances
```
git clone https://github.com/ungdev/UA-bouffe-api
cp .env.example .env
yarn
yarn seed
```
## Développement
### Démarrer l'API en développement
```
yarn dev
```
### Avant de commit
Afin de garder une certaine cohérence dans le code, on utilise EsLint et Prettier. Il faut donc bien lint le code avant de commit
```
yarn lint-fix
```
### Démarrer l'API en production
```
yarn build
yarn start
```

### CI/CD
La pipeline de CI/CD est assurée par GitHub Actions.

A chaque push sur master, GitHub Action lint le code, le build et trigger okd pour déployer le code en production ainsi que Slack pour notifier l'avancée de la vérification
Il se passe en moyenne 5 minutes entre un push et un déploiement.

### Diagramme de séquence lors d'une commande
![Diagramme de séquence](./docs/sequence.svg)

### Licence
Le code est sous licence MIT.

# UA Bouffe API
[![Build status](https://github.com/ungdev/UA-bouffe-api/actions/workflows/ci.yml/badge.svg)](https://github.com/ungdev/UA-bouffe-api/actions/workflows/ci.yml)

API du microservice [UA Bouffe](https://github.com/ungdev/UA-bouffe)

## Installation
### Prérequis
- NodeJS
- Pnpm
- MySQL
### Base de données
Créer la base de données uabouffe
```
CREATE DATABASE uabouffe CHARACTER SET utf8;
```
### Installation de l'API et des dépendances
```
git clone https://github.com/ungdev/UA-bouffe-api
cp .env.example .env
pnpm
pnpm seed
```
## Développement
### Démarrer l'API en développement
```
pnpm dev
```
### Avant de commit
Afin de garder une certaine cohérence dans le code, on utilise EsLint et Prettier. Il faut donc bien lint le code avant de commit
```
pnpm lint-fix
```
### Démarrer l'API en production
```
pnpm build
pnpm start
```

### CI/CD
La pipeline de CI/CD est assurée par GitHub Actions.

A chaque push sur master, GitHub Action lint le code, le build et trigger okd pour déployer le code en production ainsi que Slack pour notifier l'avancée de la vérification
Il se passe en moyenne 5 minutes entre un push et un déploiement.

### Diagramme de séquence lors d'une commande
![Diagramme de séquence](./docs/sequence.svg)

### Licence
Le code est sous licence MIT.
Loading

0 comments on commit b311ec5

Please sign in to comment.