Migrate from yarn to npm

This commit is contained in:
itismadness
2024-11-13 15:48:01 +00:00
committed by Spine
parent 2ea018baef
commit 160292ed47
15 changed files with 6202 additions and 3853 deletions

1
.gitignore vendored
View File

@@ -29,6 +29,7 @@ __MACOSX/
/public/static/local/
/vendor
/lib/override.config.php
/npm-debug.log
/yarn-error.log
/misc/docker/mysql-home/.mysql_history

View File

@@ -24,8 +24,6 @@ RUN apt-get update \
&& echo "deb https://packages.sury.org/php/ $DEB_RELEASE main" | tee /etc/apt/sources.list.d/php.list \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_VERSION}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
cron \
@@ -56,7 +54,6 @@ RUN apt-get update \
python3-wheel \
software-properties-common \
unzip \
yarn \
zlib1g-dev \
# Puppeteer layer
# This installs the necessary packages to run the bundled version of chromium for puppeteer
@@ -123,8 +120,7 @@ RUN useradd -ms /bin/bash gazelle \
&& perl /var/www/bin/generate-storage-dirs /var/lib/gazelle/torrent 2 100 \
&& perl /var/www/bin/generate-storage-dirs /var/lib/gazelle/riplog 2 100 \
&& perl /var/www/bin/generate-storage-dirs /var/lib/gazelle/riploghtml 2 100 \
&& chown -R gazelle:gazelle /var/lib/gazelle /var/www \
&& npm install -g npm@10.8.2
&& chown -R gazelle:gazelle /var/lib/gazelle /var/www
EXPOSE 80/tcp
EXPOSE 3306/tcp

View File

@@ -35,7 +35,7 @@ help:
.PHONY: build-css
build-css:
docker compose exec -T web yarn build:scss
docker compose exec -T web npm run build:scss
.PHONY: check-php
check-php:
@@ -75,7 +75,7 @@ lint-css:
.PHONY: lint-js
lint-js:
yarn run eslint -c misc/eslint.config.mjs public/static
npx eslint -c misc/eslint.config.mjs public/static
.PHONY: lint-php
lint-php:

View File

@@ -75,7 +75,7 @@ page and tick everything for the Sysop class.
Once the Gazelle container has been built successfully, it may be
stopped and subsequently restarted without requiring connectivity
with the outside world. This also means that composer and yarn are
with the outside world. This also means that composer and npm are
not automatically updated during a container restart and is a manual
chore to perform periodically.

View File

@@ -26,12 +26,12 @@ fi
if [ -n "$JS" ]; then
echo "Linting JS"
docker compose exec -T web yarn run eslint -c misc/eslint.config.mjs --no-warn-ignored $JS
docker compose exec -T web npx eslint -c misc/eslint.config.mjs --no-warn-ignored $JS
fi
if [ -n "$CSS" ]; then
echo "Linting CSS"
docker compose exec -T web yarn stylelint --config misc/stylelint.json --cache --cache-location cache/stylelint $CSS
docker compose exec -T web npx stylelint --config misc/stylelint.json --cache --cache-location cache/stylelint $CSS
fi
if [ -n "$PHP" ]; then

View File

@@ -18,7 +18,7 @@ fi
if [ -n "$JS" ]; then
echo "Reformatting JS"
docker compose exec -T web yarn run eslint --fix -c misc/eslint.config.mjs $JS
docker compose exec -T web npx eslint --fix -c misc/eslint.config.mjs $JS
fi
if [ -n "$PHP" ]; then
@@ -28,7 +28,7 @@ fi
if [ -n "$CSS" ]; then
echo "Reformatting CSS"
docker compose exec -T web yarn stylelint --fix --config misc/stylelint.json --cache --cache-location cache/stylelint $CSS
docker compose exec -T web npx stylelint --fix --config misc/stylelint.json --cache --cache-location cache/stylelint $CSS
fi
if [ -n "$STAGED" ]; then

View File

@@ -16,7 +16,7 @@ to do this by hand.
1. First, install the PHP and JS dependencies to setup and run the site.
composer install
yarn install
npm install
2. Install and setup the following services:
* MySQL
@@ -62,7 +62,7 @@ see expired unfetched activity.
8. Generate stylesheets and their previews by running the following:
yarn build
npm run build
Note, generating the previews requires a Chrome instance on the host.

View File

@@ -0,0 +1,10 @@
#!/bin/bash
set -euo pipefail
npm_config_cache="${CI_PROJECT_DIR}/node_modules/.npm-cache"
export npm_config_cache
npm install
npx browserslist@latest --update-db
npm run dev

View File

@@ -1,10 +0,0 @@
#!/bin/bash
set -euo pipefail
YARN_CACHE_FOLDER="${CI_PROJECT_DIR}/node_modules/.yarn-cache"
export YARN_CACHE_FOLDER
yarn
npx browserslist@latest --update-db
yarn dev gazelle

View File

@@ -12,9 +12,9 @@ if [ ! -e .docker-init-done ] ; then
composer --version
composer install --no-progress --optimize-autoloader
bin/local-patch
yarn
npm install
npx update-browserslist-db@latest
yarn dev
npm run dev
touch .docker-init-done
fi

View File

@@ -92,8 +92,8 @@ e2e-tests:
- key:
files:
- package.json
- yarn.lock
prefix: yarn
- package-lock.json
prefix: npm
paths:
- node_modules
- key:
@@ -108,9 +108,9 @@ e2e-tests:
- su gazelle -c "bin/twig-parse \$(find templates -type f)"
- /bin/bash "${CI_PROJECT_DIR}/misc/docker/web/start-services.sh"
- su gazelle -c "composer exec -- phpunit --configuration misc/phpunit.xml --coverage-php /tmp/coverage/phpunit.cov --exclude-group no-ci"
- /bin/bash "${CI_PROJECT_DIR}/misc/docker/web/bootstrap-yarn.sh"
- /bin/bash "${CI_PROJECT_DIR}/misc/docker/web/bootstrap-npm.sh"
- su gazelle -c "make lint-js"
- yarn run cypress run || test "$WAIT_ON_FINISH"
- npx cypress run || test "$WAIT_ON_FINISH"
# note: phpcov has problems if .cov files are somewhere in the src tree
- su gazelle -c 'vendor/bin/phpcov merge "/tmp/coverage" --text "/tmp/coverage/coverage.txt" && cat "/tmp/coverage/coverage.txt"'
- test "$WAIT_ON_FINISH" && sleep 3600 || exit 0

View File

@@ -24,8 +24,6 @@ RUN apt-get update \
&& echo "deb https://packages.sury.org/php/ $DEB_RELEASE main" | tee /etc/apt/sources.list.d/php.list \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_VERSION}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
make \
@@ -55,7 +53,6 @@ RUN apt-get update \
python3-wheel \
software-properties-common \
unzip \
yarn \
zlib1g-dev \
# This installs the necessary packages to run the bundled version of chromium for puppeteer
gconf-service \

6171
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -3,12 +3,12 @@
"version": "0.0.0",
"description": "",
"scripts": {
"dev": "yarn build",
"prod": "cross-env NODE_ENV=production yarn build",
"build": "yarn build:scss && yarn build:previews",
"dev": "npm run build",
"prod": "cross-env NODE_ENV=production npm run build",
"build": "npm run build:scss && npm run build:previews",
"build:scss": "node bin/build-scss.mjs",
"build:previews": "node public/stylesheet-gallery/preview.js",
"start": "yarn build:scss -- --watch"
"start": "npm run build:scss -- --watch"
},
"license": "Unlicense",
"devDependencies": {

3816
yarn.lock

File diff suppressed because it is too large Load Diff