Updated to node 18 and fixed replace-version script for vite structure

This commit is contained in:
Alejandro Celaya 2022-12-24 11:34:39 +01:00
parent 1d1c8153e7
commit 595b3c0450
6 changed files with 10 additions and 10 deletions

View file

@ -11,7 +11,7 @@ jobs:
ci: ci:
uses: shlinkio/github-actions/.github/workflows/web-app-ci.yml@main uses: shlinkio/github-actions/.github/workflows/web-app-ci.yml@main
with: with:
node-version: 16.15 node-version: 18.12
with-mutation-tests: true with-mutation-tests: true
publish-coverage: true publish-coverage: true
force-install: true force-install: true

View file

@ -16,7 +16,7 @@ jobs:
- name: Use node.js - name: Use node.js
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 16.15 node-version: 18.12
- name: Build - name: Build
run: | run: |
npm ci --force && \ npm ci --force && \

View file

@ -14,7 +14,7 @@ jobs:
- name: Use node.js - name: Use node.js
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 16.15 node-version: 18.12
- name: Generate release assets - name: Generate release assets
run: npm ci --force && VERSION=${GITHUB_REF#refs/tags/v} npm run build:dist run: npm ci --force && VERSION=${GITHUB_REF#refs/tags/v} npm run build:dist
- name: Publish release with assets - name: Publish release with assets

View file

@ -1,8 +1,8 @@
FROM node:16.15-alpine as node FROM node:18.12-alpine as node
COPY . /shlink-web-client COPY . /shlink-web-client
ARG VERSION="latest" ARG VERSION="latest"
ENV VERSION ${VERSION} ENV VERSION ${VERSION}
RUN cd /shlink-web-client && npm ci --force && NODE_ENV=production npm run build RUN cd /shlink-web-client && npm ci --force && npm run build
FROM nginx:1.21-alpine FROM nginx:1.21-alpine
LABEL maintainer="Alejandro Celaya <alejandro@alejandrocelaya.com>" LABEL maintainer="Alejandro Celaya <alejandro@alejandrocelaya.com>"

View file

@ -3,8 +3,8 @@ version: '3'
services: services:
shlink_web_client_node: shlink_web_client_node:
container_name: shlink_web_client_node container_name: shlink_web_client_node
image: node:16.15-alpine image: node:18.12-alpine
command: /bin/sh -c "cd /home/shlink/www && npm install && npm run start" command: /bin/sh -c "cd /home/shlink/www && npm install --force && npm run start"
volumes: volumes:
- ./:/home/shlink/www - ./:/home/shlink/www
ports: ports:

View file

@ -1,10 +1,10 @@
import fs from 'fs'; import fs from 'fs';
function replaceVersionPlaceholder(version) { function replaceVersionPlaceholder(version) {
const staticJsFilesPath = './build/static/js'; const staticJsFilesPath = './build/assets';
const versionPlaceholder = '%_VERSION_%'; const versionPlaceholder = '%_VERSION_%';
const isMainFile = (file) => file.startsWith('main.') && file.endsWith('.js'); const isMainFile = (file) => file.startsWith('index-') && file.endsWith('.js');
const [mainJsFile] = fs.readdirSync(staticJsFilesPath).filter(isMainFile); const [mainJsFile] = fs.readdirSync(staticJsFilesPath).filter(isMainFile);
const filePath = `${staticJsFilesPath}/${mainJsFile}`; const filePath = `${staticJsFilesPath}/${mainJsFile}`;
const fileContent = fs.readFileSync(filePath, 'utf-8'); const fileContent = fs.readFileSync(filePath, 'utf-8');