[enh] theme/simple: package.json revision

Set minor versioning for most of the packages that iterate fast or we know won't
cause problems, and fixed versioning for the rest.

Packages going into bundles should be placed in "dependencies".

The inspection of prod bundles is necessary. Although it does not make a lot of
sense right now, it will be useful in later PR and will give us a reference to
start with.
This commit is contained in:
Ivan Gabaldon 2025-07-20 12:28:11 +02:00 committed by Markus Heiser
parent 0b913053a7
commit 7e1c7096ce
7 changed files with 285 additions and 441 deletions

View file

@ -81,7 +81,7 @@ MANAGE += py.build py.clean
MANAGE += pyenv pyenv.install pyenv.uninstall
MANAGE += format.python format.shell
MANAGE += test.yamllint test.pylint test.black test.pybabel test.unit test.coverage test.robot test.rst test.clean test.themes test.pyright test.shfmt
MANAGE += themes.all themes.simple themes.fix themes.lint themes.test
MANAGE += themes.all themes.simple themes.simple.analyze themes.fix themes.lint themes.test
MANAGE += static.build.commit static.build.drop static.build.restore
MANAGE += nvm.install nvm.clean nvm.status nvm.nodejs
MANAGE += go.env.dev go.clean

View file

@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.1.1/schema.json",
"$schema": "https://biomejs.dev/schemas/2.1.2/schema.json",
"files": {
"includes": ["**", "!dist/**", "!node_modules/**"],
"ignoreUnknown": true

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "simple",
"name": "@searxng/theme-simple",
"version": "0.0.0",
"private": true,
"license": "AGPL-3.0",
"type": "module",
@ -23,26 +24,28 @@
"Safari >= 15.4",
"not dead"
],
"dependencies": {
"ionicons": "~8.0.13",
"normalize.css": "8.0.1",
"ol": "~10.6.1",
"swiped-events": "1.2.0"
},
"devDependencies": {
"@biomejs/biome": "~2.1.0",
"@types/node": "^24.0.0",
"browserslist": "^4.25.1",
"browserslist-to-esbuild": "^2.1.1",
"edge.js": "^6.2.1",
"ionicons": "^8.0.10",
"less": "^4.3.0",
"lightningcss": "^1.30.1",
"normalize.css": "^8.0.1",
"ol": "^10.6.1",
"sharp": "^0.34.3",
"sort-package-json": "^3.4.0",
"stylelint": "^16.21.1",
"stylelint-config-standard-less": "^3.0.1",
"stylelint-prettier": "^5.0.3",
"svgo": "^4.0.0",
"swiped-events": "^1.2.0",
"@biomejs/biome": "2.1.2",
"@types/node": "~24.0.15",
"browserslist": "~4.25.1",
"browserslist-to-esbuild": "~2.1.1",
"edge.js": "~6.2.1",
"less": "~4.4.0",
"lightningcss": "~1.30.1",
"sharp": "~0.34.3",
"sort-package-json": "~3.4.0",
"stylelint": "~16.22.0",
"stylelint-config-standard-less": "~3.0.1",
"stylelint-prettier": "~5.0.3",
"svgo": "~4.0.0",
"typescript": "~5.8.3",
"vite": "npm:rolldown-vite@~7.0.8",
"vite-plugin-static-copy": "^3.1.0"
"vite": "npm:rolldown-vite@~7.0.9",
"vite-bundle-analyzer": "~1.1.0"
}
}

View file

@ -3,11 +3,13 @@
*/
import { resolve } from "node:path";
import { constants as zlibConstants } from "node:zlib";
import browserslistToEsbuild from "browserslist-to-esbuild";
import { browserslistToTargets } from "lightningcss";
import type { Config } from "svgo";
import type { UserConfig } from "vite";
import { browserslist } from "./package.json";
import analyzer from "vite-bundle-analyzer";
import manifest from "./package.json";
import { plg_svg2png, plg_svg2svg } from "./tools/plg";
const ROOT = "../../"; // root of the git repository
@ -35,8 +37,8 @@ export default {
// mode: "development",
build: {
target: browserslistToEsbuild(browserslist),
cssTarget: browserslistToEsbuild(browserslist),
target: browserslistToEsbuild(manifest.browserslist),
cssTarget: browserslistToEsbuild(manifest.browserslist),
manifest: "manifest.json",
emptyOutDir: true,
assetsDir: "",
@ -85,6 +87,24 @@ export default {
}, // end: build
plugins: [
// -- bundle analyzer
analyzer({
enabled: process.env.VITE_BUNDLE_ANALYZE === "true",
analyzerPort: "auto",
summary: true,
reportTitle: manifest.name,
// sidecars with max compression
gzipOptions: {
level: zlibConstants.Z_BEST_COMPRESSION
},
brotliOptions: {
params: {
[zlibConstants.BROTLI_PARAM_QUALITY]: zlibConstants.BROTLI_MAX_QUALITY
}
}
}),
// -- svg images
plg_svg2svg(
[
@ -134,7 +154,7 @@ export default {
css: {
transformer: "lightningcss",
lightningcss: {
targets: browserslistToTargets(browserslist)
targets: browserslistToTargets(manifest.browserslist)
},
devSourcemap: true
}, // end: css

View file

@ -29,6 +29,15 @@ themes.simple() {
dump_return $?
}
themes.simple.analyze() {
(
set -e
build_msg SIMPLE "theme: run analyze (simple)"
vite.simple.analyze
)
dump_return $?
}
themes.fix() {
(
set -e

View file

@ -44,6 +44,21 @@ vite.simple.build() {
)
}
vite.simple.analyze() {
(
set -e
templates.simple.pygments
node.env
build_msg SIMPLE "run analyze of theme from: ${VITE_SIMPLE_THEME}"
pushd "${VITE_SIMPLE_THEME}"
npm install
VITE_BUNDLE_ANALYZE=true npm run build
popd &>/dev/null
)
}
vite.simple.fix() {
(
set -e