mirror of
https://github.com/transmission/transmission
synced 2024-12-21 23:32:35 +00:00
ci: automatically regenerate package.json.buildonly
(#7198)
This commit is contained in:
parent
d5d950e1cf
commit
c36a62e171
3 changed files with 27 additions and 0 deletions
2
.github/workflows/webapp.yml
vendored
2
.github/workflows/webapp.yml
vendored
|
@ -111,6 +111,7 @@ jobs:
|
|||
echo
|
||||
echo Please undo your changes to these files:
|
||||
git diff --exit-code --name-only --merge-base "origin/$GITHUB_BASE_REF" -- \
|
||||
web/package.json.buildonly \
|
||||
web/public_html/transmission-app.css \
|
||||
web/public_html/transmission-app.css.LEGAL.txt \
|
||||
web/public_html/transmission-app.css.map \
|
||||
|
@ -140,6 +141,7 @@ jobs:
|
|||
set -e # abort if any command fails
|
||||
npm --prefix web ci
|
||||
npm --prefix web run build
|
||||
npm --prefix web run generate-buildonly
|
||||
git diff --name-only
|
||||
git add --update web
|
||||
- name: Create pull request
|
||||
|
|
24
web/generate-buildonly.js
Normal file
24
web/generate-buildonly.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const __dirname = import.meta.dirname;
|
||||
const obj = JSON.parse(
|
||||
fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'),
|
||||
);
|
||||
|
||||
obj.scripts = (({ build }) => {
|
||||
return { build };
|
||||
})(obj.scripts);
|
||||
|
||||
obj.devDependencies = (({
|
||||
esbuild,
|
||||
'esbuild-sass-plugin': esbuild_saas_plugin,
|
||||
}) => {
|
||||
return { esbuild, 'esbuild-sass-plugin': esbuild_saas_plugin };
|
||||
})(obj.devDependencies);
|
||||
|
||||
// the replace() call adds a trailing newline if it doesn't exist
|
||||
fs.writeFileSync(
|
||||
path.join(__dirname, 'package.json.buildonly'),
|
||||
JSON.stringify(obj, null, 2).replace(/^(.*?[^\n])$/s, '$1\n'),
|
||||
);
|
|
@ -6,6 +6,7 @@
|
|||
"scripts": {
|
||||
"build": "node esbuild.mjs",
|
||||
"dev": "DEV=true node esbuild.mjs",
|
||||
"generate-buildonly": "node generate-buildonly.js",
|
||||
"lint": "run-p --silent lint:eslint lint:stylelint lint:prettier",
|
||||
"lint:fix": "run-s lint:eslint:fix lint:stylelint:fix lint:prettier:fix",
|
||||
"lint:eslint": "eslint src/*.js",
|
||||
|
|
Loading…
Reference in a new issue