update javascript toolchain

This commit is contained in:
Spine
2024-12-01 07:07:41 +00:00
parent 0023565792
commit ed9748842e
7 changed files with 1886 additions and 2722 deletions

View File

@@ -0,0 +1,78 @@
#!/usr/bin/env node
import puppeteer from 'puppeteer';
import sharp from 'sharp';
import { copyFileSync, existsSync, mkdirSync, readdirSync, unlinkSync } from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
// CI environments do not have SIMD vector support for their CPUs, so disable
// this to avoid a warning and any potential issues.
if (process.env.CI) {
sharp.simd(false);
}
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const staticPath = path.join(__dirname, '../public/static');
const stylesPath = path.join(staticPath, 'styles');
const previewPath = path.join(staticPath, 'stylespreview');
if (!existsSync(stylesPath)) {
console.error(`Could not find styles path: ${stylesPath}`);
}
if (!existsSync(previewPath)) {
mkdirSync(previewPath);
}
const styles = [];
const styleCandidates = readdirSync(stylesPath, {withFileTypes: true});
styleCandidates.forEach((entry) => {
if (!entry.isDirectory) {
return;
}
if (!existsSync(path.join(stylesPath, entry.name, 'style.css'))) {
return;
}
if (entry.name === 'public') {
return;
}
styles.push(entry.name);
});
process.setMaxListeners(styles.length);
async function buildPreview(browser, style) {
console.log(` -> ${style}`);
const preview = path.join(stylesPath, style, 'preview.html');
copyFileSync(path.join(__dirname, '../misc/stylesheet-gallery-base.html'), preview);
const context = await browser.createBrowserContext();
const page = await context.newPage();
await page.setViewport({width: 1200, height: 1000});
await page.goto('file://' + preview);
const output = path.join(previewPath, `full_${style}.png`);
await page.screenshot({path: output});
await context.close();
sharp(output).resize(480, 400).toFile(path.join(previewPath, `thumb_${style}.png`));
unlinkSync(preview);
}
puppeteer.launch({args: ['--no-sandbox']})
.then((browser) => {
Promise.all(styles.map((style) => buildPreview(browser, style))).then(() => {
}).catch((err) => {
console.error(err);
process.exitCode = 1;
}).finally(() => {
browser.close();
});
}).catch((err) => {
console.error(err);
process.exitCode = 1;
});

172
composer.lock generated
View File

@@ -1893,16 +1893,16 @@
},
{
"name": "symfony/config",
"version": "v7.1.7",
"version": "v7.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
"reference": "dc373a5cbd345354696f5dfd39c5c7a8ea23f4c8"
"reference": "bcd3c4adf0144dee5011bb35454728c38adec055"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/dc373a5cbd345354696f5dfd39c5c7a8ea23f4c8",
"reference": "dc373a5cbd345354696f5dfd39c5c7a8ea23f4c8",
"url": "https://api.github.com/repos/symfony/config/zipball/bcd3c4adf0144dee5011bb35454728c38adec055",
"reference": "bcd3c4adf0144dee5011bb35454728c38adec055",
"shasum": ""
},
"require": {
@@ -1948,7 +1948,7 @@
"description": "Helps you find, load, combine, autofill and validate configuration values of any kind",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/config/tree/v7.1.7"
"source": "https://github.com/symfony/config/tree/v7.2.0"
},
"funding": [
{
@@ -1964,20 +1964,20 @@
"type": "tidelift"
}
],
"time": "2024-11-04T11:34:07+00:00"
"time": "2024-11-04T11:36:24+00:00"
},
{
"name": "symfony/console",
"version": "v7.1.7",
"version": "v7.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "3284aafcac338b6e86fd955ee4d794cbe434151a"
"reference": "23c8aae6d764e2bae02d2a99f7532a7f6ed619cf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/3284aafcac338b6e86fd955ee4d794cbe434151a",
"reference": "3284aafcac338b6e86fd955ee4d794cbe434151a",
"url": "https://api.github.com/repos/symfony/console/zipball/23c8aae6d764e2bae02d2a99f7532a7f6ed619cf",
"reference": "23c8aae6d764e2bae02d2a99f7532a7f6ed619cf",
"shasum": ""
},
"require": {
@@ -2041,7 +2041,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v7.1.7"
"source": "https://github.com/symfony/console/tree/v7.2.0"
},
"funding": [
{
@@ -2057,20 +2057,20 @@
"type": "tidelift"
}
],
"time": "2024-11-05T15:34:55+00:00"
"time": "2024-11-06T14:24:19+00:00"
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.5.0",
"version": "v3.5.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1"
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"shasum": ""
},
"require": {
@@ -2108,7 +2108,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0"
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1"
},
"funding": [
{
@@ -2124,20 +2124,20 @@
"type": "tidelift"
}
],
"time": "2024-04-18T09:32:20+00:00"
"time": "2024-09-25T14:20:29+00:00"
},
{
"name": "symfony/filesystem",
"version": "v7.1.6",
"version": "v7.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "c835867b3c62bb05c7fe3d637c871c7ae52024d4"
"reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/c835867b3c62bb05c7fe3d637c871c7ae52024d4",
"reference": "c835867b3c62bb05c7fe3d637c871c7ae52024d4",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/b8dce482de9d7c9fe2891155035a7248ab5c7fdb",
"reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb",
"shasum": ""
},
"require": {
@@ -2174,7 +2174,7 @@
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v7.1.6"
"source": "https://github.com/symfony/filesystem/tree/v7.2.0"
},
"funding": [
{
@@ -2190,7 +2190,7 @@
"type": "tidelift"
}
],
"time": "2024-10-25T15:11:02+00:00"
"time": "2024-10-25T15:15:23+00:00"
},
{
"name": "symfony/polyfill-ctype",
@@ -2588,16 +2588,16 @@
},
{
"name": "symfony/process",
"version": "v7.1.7",
"version": "v7.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "9b8a40b7289767aa7117e957573c2a535efe6585"
"reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/9b8a40b7289767aa7117e957573c2a535efe6585",
"reference": "9b8a40b7289767aa7117e957573c2a535efe6585",
"url": "https://api.github.com/repos/symfony/process/zipball/d34b22ba9390ec19d2dd966c40aa9e8462f27a7e",
"reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e",
"shasum": ""
},
"require": {
@@ -2629,7 +2629,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v7.1.7"
"source": "https://github.com/symfony/process/tree/v7.2.0"
},
"funding": [
{
@@ -2645,20 +2645,20 @@
"type": "tidelift"
}
],
"time": "2024-11-06T09:25:12+00:00"
"time": "2024-11-06T14:24:19+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v3.5.0",
"version": "v3.5.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f"
"reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f",
"reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0",
"reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0",
"shasum": ""
},
"require": {
@@ -2712,7 +2712,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/v3.5.0"
"source": "https://github.com/symfony/service-contracts/tree/v3.5.1"
},
"funding": [
{
@@ -2728,20 +2728,20 @@
"type": "tidelift"
}
],
"time": "2024-04-18T09:32:20+00:00"
"time": "2024-09-25T14:20:29+00:00"
},
{
"name": "symfony/string",
"version": "v7.1.6",
"version": "v7.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "61b72d66bf96c360a727ae6232df5ac83c71f626"
"reference": "446e0d146f991dde3e73f45f2c97a9faad773c82"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/61b72d66bf96c360a727ae6232df5ac83c71f626",
"reference": "61b72d66bf96c360a727ae6232df5ac83c71f626",
"url": "https://api.github.com/repos/symfony/string/zipball/446e0d146f991dde3e73f45f2c97a9faad773c82",
"reference": "446e0d146f991dde3e73f45f2c97a9faad773c82",
"shasum": ""
},
"require": {
@@ -2799,7 +2799,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v7.1.6"
"source": "https://github.com/symfony/string/tree/v7.2.0"
},
"funding": [
{
@@ -2815,24 +2815,25 @@
"type": "tidelift"
}
],
"time": "2024-09-25T14:20:29+00:00"
"time": "2024-11-13T13:31:26+00:00"
},
{
"name": "symfony/yaml",
"version": "v7.1.6",
"version": "v7.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "3ced3f29e4f0d6bce2170ff26719f1fe9aacc671"
"reference": "099581e99f557e9f16b43c5916c26380b54abb22"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/3ced3f29e4f0d6bce2170ff26719f1fe9aacc671",
"reference": "3ced3f29e4f0d6bce2170ff26719f1fe9aacc671",
"url": "https://api.github.com/repos/symfony/yaml/zipball/099581e99f557e9f16b43c5916c26380b54abb22",
"reference": "099581e99f557e9f16b43c5916c26380b54abb22",
"shasum": ""
},
"require": {
"php": ">=8.2",
"symfony/deprecation-contracts": "^2.5|^3.0",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
@@ -2870,7 +2871,7 @@
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/yaml/tree/v7.1.6"
"source": "https://github.com/symfony/yaml/tree/v7.2.0"
},
"funding": [
{
@@ -2886,20 +2887,20 @@
"type": "tidelift"
}
],
"time": "2024-09-25T14:20:29+00:00"
"time": "2024-10-23T06:56:12+00:00"
},
{
"name": "twig/twig",
"version": "v3.14.2",
"version": "v3.16.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a"
"reference": "475ad2dc97d65d8631393e721e7e44fb544f0561"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a",
"reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/475ad2dc97d65d8631393e721e7e44fb544f0561",
"reference": "475ad2dc97d65d8631393e721e7e44fb544f0561",
"shasum": ""
},
"require": {
@@ -2910,6 +2911,7 @@
"symfony/polyfill-php81": "^1.29"
},
"require-dev": {
"phpstan/phpstan": "^2.0",
"psr/container": "^1.0|^2.0",
"symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0"
},
@@ -2953,7 +2955,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.14.2"
"source": "https://github.com/twigphp/Twig/tree/v3.16.0"
},
"funding": [
{
@@ -2965,7 +2967,7 @@
"type": "tidelift"
}
],
"time": "2024-11-07T12:36:22+00:00"
"time": "2024-11-29T08:27:05+00:00"
},
{
"name": "whichbrowser/parser",
@@ -3561,16 +3563,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.12.10",
"version": "1.12.12",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "fc463b5d0fe906dcf19689be692c65c50406a071"
"reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/fc463b5d0fe906dcf19689be692c65c50406a071",
"reference": "fc463b5d0fe906dcf19689be692c65c50406a071",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0",
"reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0",
"shasum": ""
},
"require": {
@@ -3615,7 +3617,7 @@
"type": "github"
}
],
"time": "2024-11-11T15:37:09+00:00"
"time": "2024-11-28T22:13:23+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -4004,16 +4006,16 @@
},
{
"name": "phpunit/phpunit",
"version": "11.4.3",
"version": "11.4.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "e8e8ed1854de5d36c088ec1833beae40d2dedd76"
"reference": "f9ba7bd3c9f3ff54ec379d7a1c2e3f13fe0bbde4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e8e8ed1854de5d36c088ec1833beae40d2dedd76",
"reference": "e8e8ed1854de5d36c088ec1833beae40d2dedd76",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f9ba7bd3c9f3ff54ec379d7a1c2e3f13fe0bbde4",
"reference": "f9ba7bd3c9f3ff54ec379d7a1c2e3f13fe0bbde4",
"shasum": ""
},
"require": {
@@ -4023,7 +4025,7 @@
"ext-mbstring": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
"myclabs/deep-copy": "^1.12.0",
"myclabs/deep-copy": "^1.12.1",
"phar-io/manifest": "^2.0.4",
"phar-io/version": "^3.2.1",
"php": ">=8.2",
@@ -4034,7 +4036,7 @@
"phpunit/php-timer": "^7.0.1",
"sebastian/cli-parser": "^3.0.2",
"sebastian/code-unit": "^3.0.1",
"sebastian/comparator": "^6.1.1",
"sebastian/comparator": "^6.2.1",
"sebastian/diff": "^6.0.2",
"sebastian/environment": "^7.2.0",
"sebastian/exporter": "^6.1.3",
@@ -4084,7 +4086,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.4.3"
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.4.4"
},
"funding": [
{
@@ -4100,7 +4102,7 @@
"type": "tidelift"
}
],
"time": "2024-10-28T13:07:50+00:00"
"time": "2024-11-27T10:44:52+00:00"
},
{
"name": "rector/rector",
@@ -5086,16 +5088,16 @@
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.11.0",
"version": "3.11.1",
"source": {
"type": "git",
"url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
"reference": "70c08f8d20c0eb4fe56f26644dd94dae76a7f450"
"reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/70c08f8d20c0eb4fe56f26644dd94dae76a7f450",
"reference": "70c08f8d20c0eb4fe56f26644dd94dae76a7f450",
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/19473c30efe4f7b3cd42522d0b2e6e7f243c6f87",
"reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87",
"shasum": ""
},
"require": {
@@ -5162,20 +5164,20 @@
"type": "open_collective"
}
],
"time": "2024-11-12T09:53:29+00:00"
"time": "2024-11-16T12:02:36+00:00"
},
{
"name": "symfony/dependency-injection",
"version": "v7.1.6",
"version": "v7.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/dependency-injection.git",
"reference": "1f12f9d580ef8dd09e3b756aa111cc2d5f311bfd"
"reference": "a475747af1a1c98272a5471abc35f3da81197c5d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/1f12f9d580ef8dd09e3b756aa111cc2d5f311bfd",
"reference": "1f12f9d580ef8dd09e3b756aa111cc2d5f311bfd",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/a475747af1a1c98272a5471abc35f3da81197c5d",
"reference": "a475747af1a1c98272a5471abc35f3da81197c5d",
"shasum": ""
},
"require": {
@@ -5226,7 +5228,7 @@
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/dependency-injection/tree/v7.1.6"
"source": "https://github.com/symfony/dependency-injection/tree/v7.2.0"
},
"funding": [
{
@@ -5242,20 +5244,20 @@
"type": "tidelift"
}
],
"time": "2024-10-25T15:11:02+00:00"
"time": "2024-11-25T15:45:00+00:00"
},
{
"name": "symfony/var-exporter",
"version": "v7.1.6",
"version": "v7.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-exporter.git",
"reference": "90173ef89c40e7c8c616653241048705f84130ef"
"reference": "1a6a89f95a46af0f142874c9d650a6358d13070d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/90173ef89c40e7c8c616653241048705f84130ef",
"reference": "90173ef89c40e7c8c616653241048705f84130ef",
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/1a6a89f95a46af0f142874c9d650a6358d13070d",
"reference": "1a6a89f95a46af0f142874c9d650a6358d13070d",
"shasum": ""
},
"require": {
@@ -5302,7 +5304,7 @@
"serialize"
],
"support": {
"source": "https://github.com/symfony/var-exporter/tree/v7.1.6"
"source": "https://github.com/symfony/var-exporter/tree/v7.2.0"
},
"funding": [
{
@@ -5318,7 +5320,7 @@
"type": "tidelift"
}
],
"time": "2024-09-25T14:20:29+00:00"
"time": "2024-10-18T07:58:17+00:00"
},
{
"name": "theseer/tokenizer",
@@ -5387,6 +5389,6 @@
"ext-mysqli": "*",
"ext-openssl": "*"
},
"platform-dev": [],
"platform-dev": {},
"plugin-api-version": "2.6.0"
}

View File

@@ -6,5 +6,6 @@ npm_config_cache="${CI_PROJECT_DIR}/node_modules/.npm-cache"
export npm_config_cache
npm install
npx browserslist@latest --update-db
npm run dev
npx update-browserslist-db@latest
npx puppeteer browsers install chrome
npm run build

4247
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,35 +7,32 @@
"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",
"build:previews": "node bin/build-stylesheet-gallery.mjs",
"start": "npm run build:scss -- --watch"
},
"license": "Unlicense",
"devDependencies": {
"@eslint/js": "^9.8.0",
"@stylistic/eslint-plugin-js": "^2.4.0",
"cypress": "^12.0.2",
"cypress-terminal-report": "^5.0.2",
"eslint": "^9.6.0",
"globals": "^15.8.0",
"stylelint": "^13.3.2",
"@eslint/js": "^9.14",
"@stylistic/eslint-plugin-js": "^2.10",
"cypress": "^13.15",
"cypress-terminal-report": "^7.0.4",
"eslint": "^9.14",
"globals": "^15.12",
"stylelint": "^16.9",
"stylelint-checkstyle-formatter": "^0.1.2",
"stylelint-config-recommended": "^3.0.0",
"stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.16.1"
"stylelint-config-recommended": "^14.0.1",
"stylelint-config-standard": "^36.0.1",
"stylelint-scss": "^6.9",
"update-browserslist-db": "1.1.1"
},
"dependencies": {
"cross-env": "^7.0.2",
"puppeteer": "^2.1.1",
"sass": "^1.80.6",
"sharp": "^0.32.6"
"cross-env": "^7.0",
"puppeteer": "^23.8",
"sass": "^1.80.7",
"sharp": "^0.33.5"
},
"browserslist": [
"ie 11",
"safari >= 10",
"ios >= 10",
"android >= 6",
"Firefox ESR",
"last 2 years and > 0.1%"
"last 3 versions",
"not dead"
]
}

View File

@@ -1,67 +0,0 @@
#!/usr/bin/env node
const fs = require('fs');
const { join } = require('path');
const puppeteer = require('puppeteer');
const sharp = require('sharp');
const rootPath = join(__dirname, '../..');
const staticPath = join('public', 'static');
const stylesPath = join(rootPath, staticPath, 'styles');
const stylesPreviewPath = join(rootPath, staticPath, 'stylespreview');
if (!fs.existsSync(stylesPath)) {
console.error(`Could not find styles path: ${stylesPreviewPath}`);
}
if (!fs.existsSync(stylesPreviewPath)) {
fs.mkdirSync(stylesPreviewPath);
}
const styles = [];
const styleCandidates = fs.readdirSync(join(staticPath, 'styles'), {withFileTypes: true});
styleCandidates.forEach((entry) => {
if (!entry.isDirectory) {
return;
}
if (!fs.existsSync(join(stylesPath, entry.name, 'style.css'))) {
return;
}
if (entry.name === 'public') {
return;
}
styles.push(entry.name);
});
process.setMaxListeners(styles.length);
async function buildPreview(browser, style) {
console.log(` -> ${style}`);
var preview = join(stylesPath, style, 'preview.html');
var output = join(stylesPreviewPath, `full_${style}.png`);
fs.copyFileSync(join(__dirname, '../stylesheet-gallery/preview-base.html'), preview);
const context = await browser.createIncognitoBrowserContext();
const page = await context.newPage();
await page.setViewport({width: 1200, height: 1000});
await page.goto('file://' + preview);
await page.screenshot({path: output});
await context.close();
sharp(output).resize(480, 400).toFile(join(stylesPreviewPath, `thumb_${style}.png`));
fs.unlinkSync(preview);
}
puppeteer.launch({args: ['--no-sandbox']}).then((browser) => {
Promise.all(styles.map((style) => buildPreview(browser, style))).then(() => {
}).catch((err) => {
console.error(err);
process.exitCode = 1;
}).finally(() => {
browser.close();
});
}).catch((err) => {
console.error(err);
process.exitCode = 1;
});