[packaging] switch to pnpm (#6186)

* [packaging] switch to pnpm
* Bump compiler version
* Change pnpm store in docker build
---------

Co-authored-by: feederbox826 <feederbox826@users.noreply.github.com>
Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
feederbox826 2025-11-09 17:17:25 -05:00 committed by GitHub
parent d52b6afd4a
commit 600cb15102
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 12797 additions and 9674 deletions

View file

@ -12,7 +12,7 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
env: env:
COMPILER_IMAGE: stashapp/compiler:11 COMPILER_IMAGE: stashapp/compiler:12
jobs: jobs:
build: build:
@ -37,7 +37,7 @@ jobs:
cache-name: cache-node_modules cache-name: cache-node_modules
with: with:
path: ui/v2.5/node_modules path: ui/v2.5/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ui/v2.5/yarn.lock') }} key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ui/v2.5/pnpm-lock.yaml') }}
- name: Cache UI build - name: Cache UI build
uses: actions/cache@v3 uses: actions/cache@v3
@ -46,7 +46,7 @@ jobs:
cache-name: cache-ui cache-name: cache-ui
with: with:
path: ui/v2.5/build path: ui/v2.5/build
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ui/v2.5/yarn.lock', 'ui/v2.5/public/**', 'ui/v2.5/src/**', 'graphql/**/*.graphql') }} key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('ui/v2.5/pnpm-lock.yaml', 'ui/v2.5/public/**', 'ui/v2.5/src/**', 'graphql/**/*.graphql') }}
- name: Cache go build - name: Cache go build
uses: actions/cache@v3 uses: actions/cache@v3
@ -65,7 +65,7 @@ jobs:
docker run -d --name build --mount type=bind,source="$(pwd)",target=/stash,consistency=delegated --mount type=bind,source="$(pwd)/.go-cache",target=/root/.cache/go-build,consistency=delegated --env OFFICIAL_BUILD=${{ env.official-build }} -w /stash $COMPILER_IMAGE tail -f /dev/null docker run -d --name build --mount type=bind,source="$(pwd)",target=/stash,consistency=delegated --mount type=bind,source="$(pwd)/.go-cache",target=/root/.cache/go-build,consistency=delegated --env OFFICIAL_BUILD=${{ env.official-build }} -w /stash $COMPILER_IMAGE tail -f /dev/null
- name: Pre-install - name: Pre-install
run: docker exec -t build /bin/bash -c "make pre-ui" run: docker exec -t build /bin/bash -c "make CI=1 pre-ui"
- name: Generate - name: Generate
run: docker exec -t build /bin/bash -c "make generate" run: docker exec -t build /bin/bash -c "make generate"

View file

@ -9,7 +9,7 @@ on:
pull_request: pull_request:
env: env:
COMPILER_IMAGE: stashapp/compiler:11 COMPILER_IMAGE: stashapp/compiler:12
jobs: jobs:
golangci: golangci:

View file

@ -275,7 +275,7 @@ generate: generate-backend generate-ui
.PHONY: generate-ui .PHONY: generate-ui
generate-ui: generate-ui:
cd ui/v2.5 && yarn run gqlgen cd ui/v2.5 && npm run gqlgen
.PHONY: generate-backend .PHONY: generate-backend
generate-backend: touch-ui generate-backend: touch-ui
@ -338,9 +338,19 @@ server-clean:
# installs UI dependencies. Run when first cloning repository, or if UI # installs UI dependencies. Run when first cloning repository, or if UI
# dependencies have changed # dependencies have changed
# If CI is set, configures pnpm to use a local store to avoid
# putting .pnpm-store in /stash
# NOTE: to run in the docker build container, using the existing
# node_modules folder, rename the .modules.yaml to .modules.yaml.bak
# and a new one will be generated. This will need to be reversed after
# building.
.PHONY: pre-ui .PHONY: pre-ui
pre-ui: pre-ui:
cd ui/v2.5 && yarn install --frozen-lockfile ifdef CI
cd ui/v2.5 && pnpm config set store-dir ~/.pnpm-store && pnpm install --frozen-lockfile
else
cd ui/v2.5 && pnpm install --frozen-lockfile
endif
.PHONY: ui-env .PHONY: ui-env
ui-env: build-info ui-env: build-info
@ -359,7 +369,7 @@ ui: ui-only generate-login-locale
.PHONY: ui-only .PHONY: ui-only
ui-only: ui-env ui-only: ui-env
cd ui/v2.5 && yarn build cd ui/v2.5 && npm run build
.PHONY: zip-ui .PHONY: zip-ui
zip-ui: zip-ui:
@ -368,20 +378,24 @@ zip-ui:
.PHONY: ui-start .PHONY: ui-start
ui-start: ui-env ui-start: ui-env
cd ui/v2.5 && yarn start --host cd ui/v2.5 && npm run start -- --host
.PHONY: fmt-ui .PHONY: fmt-ui
fmt-ui: fmt-ui:
cd ui/v2.5 && yarn format cd ui/v2.5 && npm run format
# runs all of the frontend PR-acceptance steps # runs all of the frontend PR-acceptance steps
.PHONY: validate-ui .PHONY: validate-ui
validate-ui: validate-ui:
cd ui/v2.5 && yarn run validate cd ui/v2.5 && npm run validate
# these targets run the same steps as fmt-ui and validate-ui, but only on files that have changed # these targets run the same steps as fmt-ui and validate-ui, but only on files that have changed
fmt-ui-quick: fmt-ui-quick:
cd ui/v2.5 && yarn run prettier --write $$(git diff --name-only --relative --diff-filter d . ../../graphql) cd ui/v2.5 && \
files=$$(git diff --name-only --relative --diff-filter d . ../../graphql); \
if [ -n "$$files" ]; then \
npm run prettier -- --write $$files; \
fi
# does not run tsc checks, as they are slow # does not run tsc checks, as they are slow
validate-ui-quick: validate-ui-quick:
@ -389,9 +403,9 @@ validate-ui-quick:
tsfiles=$$(git diff --name-only --relative --diff-filter d src | grep -e "\.tsx\?\$$"); \ tsfiles=$$(git diff --name-only --relative --diff-filter d src | grep -e "\.tsx\?\$$"); \
scssfiles=$$(git diff --name-only --relative --diff-filter d src | grep "\.scss"); \ scssfiles=$$(git diff --name-only --relative --diff-filter d src | grep "\.scss"); \
prettyfiles=$$(git diff --name-only --relative --diff-filter d . ../../graphql); \ prettyfiles=$$(git diff --name-only --relative --diff-filter d . ../../graphql); \
if [ -n "$$tsfiles" ]; then yarn run eslint $$tsfiles; fi && \ if [ -n "$$tsfiles" ]; then npm run eslint -- $$tsfiles; fi && \
if [ -n "$$scssfiles" ]; then yarn run stylelint $$scssfiles; fi && \ if [ -n "$$scssfiles" ]; then npm run stylelint -- $$scssfiles; fi && \
if [ -n "$$prettyfiles" ]; then yarn run prettier --check $$prettyfiles; fi if [ -n "$$prettyfiles" ]; then npm run prettier -- --check $$prettyfiles; fi
# runs all of the backend PR-acceptance steps # runs all of the backend PR-acceptance steps
.PHONY: validate-backend .PHONY: validate-backend

View file

@ -1,14 +1,16 @@
# This dockerfile should be built with `make docker-build` from the stash root. # This dockerfile should be built with `make docker-build` from the stash root.
# Build Frontend # Build Frontend
FROM node:20-alpine AS frontend FROM node:24-alpine AS frontend
RUN apk add --no-cache make git RUN apk add --no-cache make git
## cache node_modules separately ## cache node_modules separately
COPY ./ui/v2.5/package.json ./ui/v2.5/yarn.lock /stash/ui/v2.5/ COPY ./ui/v2.5/package.json ./ui/v2.5/pnpm-lock.yaml /stash/ui/v2.5/
WORKDIR /stash WORKDIR /stash
COPY Makefile /stash/ COPY Makefile /stash/
COPY ./graphql /stash/graphql/ COPY ./graphql /stash/graphql/
COPY ./ui /stash/ui/ COPY ./ui /stash/ui/
# pnpm install with npm
RUN npm install -g pnpm
RUN make pre-ui RUN make pre-ui
RUN make generate-ui RUN make generate-ui
ARG GITHASH ARG GITHASH

View file

@ -5,11 +5,13 @@ ARG CUDA_VERSION=12.8.0
FROM node:20-alpine AS frontend FROM node:20-alpine AS frontend
RUN apk add --no-cache make git RUN apk add --no-cache make git
## cache node_modules separately ## cache node_modules separately
COPY ./ui/v2.5/package.json ./ui/v2.5/yarn.lock /stash/ui/v2.5/ COPY ./ui/v2.5/package.json ./ui/v2.5/pnpm-lock.yaml /stash/ui/v2.5/
WORKDIR /stash WORKDIR /stash
COPY Makefile /stash/ COPY Makefile /stash/
COPY ./graphql /stash/graphql/ COPY ./graphql /stash/graphql/
COPY ./ui /stash/ui/ COPY ./ui /stash/ui/
# pnpm install with npm
RUN npm install -g pnpm
RUN make pre-ui RUN make pre-ui
RUN make generate-ui RUN make generate-ui
ARG GITHASH ARG GITHASH

View file

@ -8,15 +8,11 @@ RUN mkdir -p /etc/apt/keyrings
ADD https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key nodesource.gpg.key ADD https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key nodesource.gpg.key
RUN cat nodesource.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && rm nodesource.gpg.key RUN cat nodesource.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && rm nodesource.gpg.key
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_24.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
ADD https://dl.yarnpkg.com/debian/pubkey.gpg yarn.gpg
RUN cat yarn.gpg | gpg --dearmor -o /etc/apt/keyrings/yarn.gpg && rm yarn.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
git make tar bash nodejs yarn zip \ git make tar bash nodejs zip \
clang llvm-dev cmake patch libxml2-dev uuid-dev libssl-dev xz-utils \ clang llvm-dev cmake patch libxml2-dev uuid-dev libssl-dev xz-utils \
bzip2 gzip sed cpio libbz2-dev zlib1g-dev \ bzip2 gzip sed cpio libbz2-dev zlib1g-dev \
gcc-mingw-w64 \ gcc-mingw-w64 \
@ -24,6 +20,9 @@ RUN apt-get update && \
gcc-aarch64-linux-gnu libc-dev-arm64-cross && \ gcc-aarch64-linux-gnu libc-dev-arm64-cross && \
rm -rf /var/lib/apt/lists/*; rm -rf /var/lib/apt/lists/*;
# pnpm install with npm
RUN npm install -g pnpm
# FreeBSD cross-compilation setup # FreeBSD cross-compilation setup
# https://github.com/smartmontools/docker-build/blob/6b8c92560d17d325310ba02d9f5a4b250cb0764a/Dockerfile#L66 # https://github.com/smartmontools/docker-build/blob/6b8c92560d17d325310ba02d9f5a4b250cb0764a/Dockerfile#L66
ENV FREEBSD_VERSION 13.4 ENV FREEBSD_VERSION 13.4

View file

@ -1,6 +1,6 @@
user=stashapp user=stashapp
repo=compiler repo=compiler
version=11 version=12
latest: latest:
docker build -t ${user}/${repo}:latest . docker build -t ${user}/${repo}:latest .

View file

@ -5,7 +5,8 @@
* [Go](https://golang.org/dl/) * [Go](https://golang.org/dl/)
* [GolangCI](https://golangci-lint.run/) - A meta-linter which runs several linters in parallel * [GolangCI](https://golangci-lint.run/) - A meta-linter which runs several linters in parallel
* To install, follow the [local installation instructions](https://golangci-lint.run/welcome/install/#local-installation) * To install, follow the [local installation instructions](https://golangci-lint.run/welcome/install/#local-installation)
* [Yarn](https://yarnpkg.com/en/docs/install) - Yarn package manager * [nodejs](https://nodejs.org/en/download) - nodejs runtime
* corepack/[pnpm](https://pnpm.io/installation) - nodejs package manager (included with nodejs)
## Environment ## Environment
@ -22,21 +23,21 @@ NOTE: The `make` command in Windows will be `mingw32-make` with MinGW. For examp
### macOS ### macOS
1. If you don't have it already, install the [Homebrew package manager](https://brew.sh). 1. If you don't have it already, install the [Homebrew package manager](https://brew.sh).
2. Install dependencies: `brew install go git yarn gcc make node ffmpeg` 2. Install dependencies: `brew install go git gcc make node ffmpeg`
### Linux ### Linux
#### Arch Linux #### Arch Linux
1. Install dependencies: `sudo pacman -S go git yarn gcc make nodejs ffmpeg --needed` 1. Install dependencies: `sudo pacman -S go git gcc make nodejs ffmpeg --needed`
#### Ubuntu #### Ubuntu
1. Install dependencies: `sudo apt-get install golang git yarnpkg gcc nodejs ffmpeg -y` 1. Install dependencies: `sudo apt-get install golang git gcc nodejs ffmpeg -y`
### OpenBSD ### OpenBSD
1. Install dependencies `doas pkg_add gmake go git yarn node cmake ffmpeg` 1. Install dependencies `doas pkg_add gmake go git node cmake ffmpeg`
2. Follow the instructions below to build a release, but replace the final step `make build-release` with `gmake flags-release stash`, to [avoid the PIE buildmode](https://github.com/golang/go/issues/59866). 2. Follow the instructions below to build a release, but replace the final step `make build-release` with `gmake flags-release stash`, to [avoid the PIE buildmode](https://github.com/golang/go/issues/59866).
NOTE: The `make` command in OpenBSD will be `gmake`. For example, `make pre-ui` will be `gmake pre-ui`. NOTE: The `make` command in OpenBSD will be `gmake`. For example, `make pre-ui` will be `gmake pre-ui`.

View file

@ -1,7 +1,7 @@
This is a reference React component plugin. It replaces the `details` part of scene cards with a list of performers and tags. This is a reference React component plugin. It replaces the `details` part of scene cards with a list of performers and tags.
To build: To build:
- run `yarn install --frozen-lockfile` - run `pnpm install --frozen-lockfile`
- run `yarn run build` - run `npm run build`
This will copy the plugin files into the `dist` directory. These files can be copied to a `plugins` directory. This will copy the plugin files into the `dist` directory. These files can be copied to a `plugins` directory.

View file

@ -5,11 +5,11 @@
"author": "WithoutPants", "author": "WithoutPants",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {
"compile:ts": "yarn tsc", "compile:ts": "npm run tsc",
"compile:sass": "yarn sass src/testReact.scss dist/testReact.css", "compile:sass": "npm run sass src/testReact.scss dist/testReact.css",
"copy:yml": "cpx \"src/testReact.yml\" \"dist\"", "copy:yml": "cpx \"src/testReact.yml\" \"dist\"",
"compile": "yarn run compile:ts && yarn run compile:sass", "compile": "npm run compile:ts && npm run compile:sass",
"build": "yarn run compile && yarn run copy:yml" "build": "npm run compile && npm run copy:yml"
}, },
"devDependencies": { "devDependencies": {
"@types/react": "^18.2.31", "@types/react": "^18.2.31",

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -2,8 +2,8 @@
# dependencies # dependencies
/node_modules /node_modules
/.pnp pnpm-lock.yaml
.pnp.js pnpm-workspace.yaml
# locales # locales
src/locales/**/*.json src/locales/**/*.json

View file

@ -4,7 +4,7 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
In the project directory, you can run: In the project directory, you can run:
### `yarn start` ### `npm run start`
Runs the app in the development mode.<br /> Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
@ -12,12 +12,12 @@ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br /> The page will reload if you make edits.<br />
You will also see any lint errors in the console. You will also see any lint errors in the console.
### `yarn test` ### `npm run test`
Launches the test runner in the interactive watch mode.<br /> Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `yarn build` ### `npm run build`
Builds the app for production to the `build` folder.<br /> Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance. It correctly bundles React in production mode and optimizes the build for the best performance.
@ -27,13 +27,13 @@ Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `yarn format` ### `npm run format`
Formats the whitespace of all typescript and scss code with prettier, to ease editing and ensure a common code style. Formats the whitespace of all typescript and scss code with prettier, to ease editing and ensure a common code style.
Should ideally be run before all frontend PRs. Should ideally be run before all frontend PRs.
### `yarn eject` ### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you cant go back!** **Note: this is a one-way operation. Once you `eject`, you cant go back!**
@ -69,6 +69,6 @@ This section has moved here: https://facebook.github.io/create-react-app/docs/ad
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
### `yarn build` fails to minify ### `npm run build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

View file

@ -6,9 +6,9 @@
"scripts": { "scripts": {
"start": "vite", "start": "vite",
"build": "vite build", "build": "vite build",
"build-ci": "yarn run validate && yarn run build", "build-ci": "npm run validate && npm run build",
"validate": "yarn run lint && yarn run check && yarn run format-check", "validate": "npm run lint && npm run check && npm run format-check",
"lint": "yarn run lint:js && yarn run lint:css", "lint": "npm run lint:js && npm run lint:css",
"lint:css": "stylelint --cache \"src/**/*.scss\"", "lint:css": "stylelint --cache \"src/**/*.scss\"",
"lint:js": "eslint --cache src/", "lint:js": "eslint --cache src/",
"check": "tsc --noEmit", "check": "tsc --noEmit",
@ -35,6 +35,7 @@
"@react-hook/resize-observer": "^1.2.6", "@react-hook/resize-observer": "^1.2.6",
"@silvermine/videojs-airplay": "^1.2.0", "@silvermine/videojs-airplay": "^1.2.0",
"@silvermine/videojs-chromecast": "^1.4.1", "@silvermine/videojs-chromecast": "^1.4.1",
"@types/react-router-dom": "^5.3.3",
"apollo-upload-client": "^18.0.1", "apollo-upload-client": "^18.0.1",
"base64-blob": "^1.4.1", "base64-blob": "^1.4.1",
"bootstrap": "^4.6.2", "bootstrap": "^4.6.2",

11148
ui/v2.5/pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,4 @@
onlyBuiltDependencies:
- '@parcel/watcher'
- core-js
- esbuild

View file

@ -1614,7 +1614,7 @@ export const mutateAddGalleryImages = (input: GQL.GalleryAddInput) =>
}); });
function evictCover(cache: ApolloCache<GQL.Gallery>, gallery_id: string) { function evictCover(cache: ApolloCache<GQL.Gallery>, gallery_id: string) {
const fields: Pick<Modifiers<GQL.Gallery>, "paths" | "cover"> = {}; const fields: Partial<Pick<Modifiers<GQL.Gallery>, "paths" | "cover">> = {};
fields.paths = (paths) => { fields.paths = (paths) => {
if (!("cover" in paths)) { if (!("cover" in paths)) {
return paths; return paths;

File diff suppressed because it is too large Load diff