Switch to PNPM Workspaces for internal packages management
1
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
|||
.env
|
||||
.env*
|
||||
node_modules/
|
||||
nginx/*
|
||||
letsencrypt/*
|
||||
app-data/*
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
become: yes
|
||||
|
||||
tasks:
|
||||
- import_tasks: ./tasks/common/system-api.yml
|
||||
- import_tasks: ./tasks/common/packages.yml
|
||||
|
|
|
@ -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
|
3254
dashboard/yarn.lock
|
@ -17,7 +17,7 @@ services:
|
|||
|
||||
dashboard:
|
||||
build:
|
||||
context: ./dashboard
|
||||
context: ./packages/dashboard
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
INTERNAL_IP_ARG: ${INTERNAL_IP}
|
||||
|
|
|
@ -3,7 +3,6 @@ FROM node:18
|
|||
WORKDIR /app
|
||||
|
||||
COPY ./package.json ./
|
||||
COPY ./yarn.lock ./
|
||||
|
||||
RUN yarn
|
||||
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 1,003 B After Width: | Height: | Size: 1,003 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
@ -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\"",
|