From ab01e13daed959fdad02b9a1f9ec541c92cd427e Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 23 Nov 2024 12:56:55 +0100 Subject: [PATCH] Use node --run when possible --- Dockerfile | 4 ++-- README.md | 4 ++-- docker-compose.yml | 2 +- package.json | 8 ++++---- scripts/{purgecss.mjs => purgecss.js} | 0 .../documentation/shlink-web-client/serve-in-sub-path.mdx | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) rename scripts/{purgecss.mjs => purgecss.js} (100%) diff --git a/Dockerfile b/Dockerfile index 8317de24..e7bedd5e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ -FROM node:23.3-alpine as node +FROM node:23.3-alpine AS node USER root COPY . /shlink-website RUN cd /shlink-website && \ npm ci && \ - npm run build:prod + node --run build:prod FROM nginx:1.27.2-alpine LABEL maintainer="Alejandro Celaya " diff --git a/README.md b/README.md index 6a4dad32..623d883d 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ In order to run this project locally, follow these steps: * Run project: `docker compose up`. * Without `docker compose`: * Install dependencies: `npm install`. - * Run project: `npm run dev`. + * Run project: `node --run dev`. * Open app [localhost:3000](http://localhost:3000). Now you can work locally on any change in case you want to provide some improvement. @@ -26,7 +26,7 @@ Now you can work locally on any change in case you want to provide some improvem The project can be exported to a static site fully optimized for production. -Run `npm run export` and you will get an `out` directory with the static files. +Run `node --run build:prod` and you will get a `build` directory with the static files. Now you can serve it with the web server of your choice. diff --git a/docker-compose.yml b/docker-compose.yml index fa4eba5d..0e4dedae 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: container_name: shlink_webstie_node user: 1000:1000 image: node:22.10-alpine - command: /bin/sh -c "cd /shlink-website && npm install && npm run dev" + command: /bin/sh -c "cd /shlink-website && npm install && node --run dev" volumes: - ./:/shlink-website ports: diff --git a/package.json b/package.json index b143d0fb..f6a96d81 100644 --- a/package.json +++ b/package.json @@ -12,15 +12,15 @@ }, "scripts": { "lint": "eslint src test", - "lint:fix": "npm run lint -- --fix", + "lint:fix": "node --run lint -- --fix", "test": "vitest run --run", "test:watch": "vitest --watch", - "test:ci": "npm run test", + "test:ci": "node --run test", "types": "tsc", - "purge": "node scripts/purgecss.mjs", + "purge": "node scripts/purgecss.js", "dev": "astro dev --host=0.0.0.0", "build": "astro build", - "build:prod": "npm run build && npm run purge", + "build:prod": "node --run build && node --run purge", "preview": "astro preview --host=0.0.0.0" }, "dependencies": { diff --git a/scripts/purgecss.mjs b/scripts/purgecss.js similarity index 100% rename from scripts/purgecss.mjs rename to scripts/purgecss.js diff --git a/src/pages/documentation/shlink-web-client/serve-in-sub-path.mdx b/src/pages/documentation/shlink-web-client/serve-in-sub-path.mdx index 71162d9e..253500d1 100644 --- a/src/pages/documentation/shlink-web-client/serve-in-sub-path.mdx +++ b/src/pages/documentation/shlink-web-client/serve-in-sub-path.mdx @@ -22,7 +22,7 @@ If you need to host shlink-web-client yourself and serve it from a subpath, foll * For classic hosting: * Download [node](https://nodejs.org/en/download/package-manager/) 16 or later. * Install project dependencies by running `npm install`. - * Build the project by running `npm run build`. + * Build the project by running `node --run build`. * Once the command finishes, you will have a `build` folder with all the static assets you need to run shlink-web-client. Just place them wherever you want them to be served from. * For docker image: * Download [docker](https://docs.docker.com/install/).