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:
uses: shlinkio/github-actions/.github/workflows/web-app-ci.yml@main
with:
node-version: 16.15
node-version: 18.12
with-mutation-tests: true
publish-coverage: true
force-install: true

View file

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

View file

@ -14,7 +14,7 @@ jobs:
- name: Use node.js
uses: actions/setup-node@v1
with:
node-version: 16.15
node-version: 18.12
- name: Generate release assets
run: npm ci --force && VERSION=${GITHUB_REF#refs/tags/v} npm run build:dist
- 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
ARG VERSION="latest"
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
LABEL maintainer="Alejandro Celaya <alejandro@alejandrocelaya.com>"

View file

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

View file

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