Switch to PNPM Workspaces for internal packages management

This commit is contained in:
Nicolas Meienberger 2022-05-07 08:03:22 +00:00
parent 237fd56c02
commit 31a76892a5
107 changed files with 10797 additions and 29058 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
.env
.env*
node_modules/
nginx/*
letsencrypt/*
app-data/*

View file

@ -10,8 +10,6 @@ packages:
- nodejs
- npm
username: nicolas
### ZSH Settings
zsh_theme: "powerlevel10k/powerlevel10k"
ohmyzsh_git_url: https://github.com/robbyrussell/oh-my-zsh

View file

@ -4,8 +4,8 @@
tasks:
- import_tasks: ./tasks/common/essential.yml
- import_tasks: ./tasks/common/zsh.yml
# - import_tasks: ./tasks/common/zsh.yml
- import_tasks: ./tasks/common/docker.yml
- import_tasks: ./tasks/network/avahi.yml
# - import_tasks: ./tasks/network/avahi.yml
# - name: Reboot machine
# reboot:

View file

@ -3,4 +3,4 @@
become: yes
tasks:
- import_tasks: ./tasks/common/system-api.yml
- import_tasks: ./tasks/common/packages.yml

View file

@ -3,23 +3,25 @@
name: pm2
global: yes
- name: Install "pnpm" package globally.
community.general.npm:
name: pnpm
global: yes
- name: Run pm2 first time
shell: pm2 list
- name: Enable pm2 as a service
shell: sudo env PATH=$PATH:/usr/local/bin pm2 startup -u {{ username }}
- name: Install packages based on package.json.
community.general.npm:
path: "{{ playbook_dir }}/../system-api"
- name: Install dependencies
shell: cd {{ playbook_dir }} && pnpm install
- name: Remove dist folder
ansible.builtin.file:
path: "{{ playbook_dir }}/../system-api/dist"
state: absent
- name: Clean packages
shell: cd {{ playbook_dir }} && pnpm -r clean
- name: Build system-api
shell: cd {{ playbook_dir }}/../system-api && npm run build
- name: Build packages
shell: cd {{ playbook_dir }} && pnpm -r build-prod
- name: Check if app is already running
become_user: "{{ username }}"
@ -28,7 +30,7 @@
- name: Start app
become_user: "{{ username }}"
shell: cd {{ playbook_dir }}/../system-api && pm2 start npm --name "system-api" -- start
shell: cd {{ playbook_dir }}/../packages/system-api && pm2 start npm --name "system-api" -- start
when: pm2_result.stdout.find("online") == -1
- name: Reload app

File diff suppressed because it is too large Load diff

View file

@ -17,7 +17,7 @@ services:
dashboard:
build:
context: ./dashboard
context: ./packages/dashboard
dockerfile: Dockerfile
args:
INTERNAL_IP_ARG: ${INTERNAL_IP}

View file

@ -3,7 +3,6 @@ FROM node:18
WORKDIR /app
COPY ./package.json ./
COPY ./yarn.lock ./
RUN yarn

View file

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1,003 B

After

Width:  |  Height:  |  Size: 1,003 B

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -5,9 +5,10 @@
"main": "src/server.ts",
"type": "module",
"scripts": {
"clean": "rimraf dist",
"lint": "eslint . --ext .ts",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "esbuild --bundle src/server.ts --outdir=dist --allow-overwrite --sourcemap --platform=node --minify --analyze=verbose --external:./node_modules/* --format=esm",
"build-prod": "esbuild --bundle src/server.ts --outdir=dist --allow-overwrite --sourcemap --platform=node --minify --analyze=verbose --external:./node_modules/* --format=esm",
"build:watch": "esbuild --bundle src/server.ts --outdir=dist --allow-overwrite --sourcemap --platform=node --external:./node_modules/* --format=esm --watch",
"start:dev": "NODE_ENV=development nodemon --trace-deprecation --trace-warnings --watch dist dist/server.js",
"dev": "concurrently \"yarn build:watch\" \"yarn start:dev\"",

Some files were not shown because too many files have changed in this diff Show more