aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/config
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/config')
-rw-r--r--subprojects/frontend/config/backendConfigVitePlugin.ts6
-rw-r--r--subprojects/frontend/config/detectDevModeOptions.ts6
-rw-r--r--subprojects/frontend/config/eslintReport.cjs58
-rw-r--r--subprojects/frontend/config/fetchPackageMetadata.ts6
-rw-r--r--subprojects/frontend/config/manifest.ts8
-rw-r--r--subprojects/frontend/config/minifyHTMLVitePlugin.ts6
-rw-r--r--subprojects/frontend/config/preloadFontsVitePlugin.ts6
7 files changed, 95 insertions, 1 deletions
diff --git a/subprojects/frontend/config/backendConfigVitePlugin.ts b/subprojects/frontend/config/backendConfigVitePlugin.ts
index 7a6bc3db..3bffce3a 100644
--- a/subprojects/frontend/config/backendConfigVitePlugin.ts
+++ b/subprojects/frontend/config/backendConfigVitePlugin.ts
@@ -1,3 +1,9 @@
1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6
1import type { PluginOption } from 'vite'; 7import type { PluginOption } from 'vite';
2 8
3import type BackendConfig from '../src/xtext/BackendConfig'; 9import type BackendConfig from '../src/xtext/BackendConfig';
diff --git a/subprojects/frontend/config/detectDevModeOptions.ts b/subprojects/frontend/config/detectDevModeOptions.ts
index b3696241..665204dc 100644
--- a/subprojects/frontend/config/detectDevModeOptions.ts
+++ b/subprojects/frontend/config/detectDevModeOptions.ts
@@ -1,3 +1,9 @@
1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6
1import type { PluginOption, ServerOptions } from 'vite'; 7import type { PluginOption, ServerOptions } from 'vite';
2 8
3import backendConfigVitePlugin, { 9import backendConfigVitePlugin, {
diff --git a/subprojects/frontend/config/eslintReport.cjs b/subprojects/frontend/config/eslintReport.cjs
new file mode 100644
index 00000000..7c4b7bd6
--- /dev/null
+++ b/subprojects/frontend/config/eslintReport.cjs
@@ -0,0 +1,58 @@
1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6
7const { writeFile } = require('node:fs/promises');
8const path = require('node:path');
9const { Readable } = require('node:stream');
10const { pipeline } = require('node:stream/promises');
11
12const { ESLint } = require('eslint');
13
14const rootDir = path.join(__dirname, '..');
15
16/**
17 * Write ESLint report to console.
18 *
19 * @param cli {import('eslint').ESLint} The ESLint CLI.
20 * @param report {import('eslint').ESLint.LintResult[]} The ESLint report.
21 * @return {Promise<void>} A promise that resolves when the report is finished.
22 */
23async function reportToConsole(cli, report) {
24 const stylishFormatter = await cli.loadFormatter('stylish');
25 const output = new Readable();
26 output.push(await stylishFormatter.format(report));
27 output.push(null);
28 return pipeline(output, process.stdout);
29}
30
31/**
32 * Write ESLint report to the <code>build</code> directory.
33 *
34 * @param cli {import('eslint').ESLint} The ESLint CLI.
35 * @param report {import('eslint').ESLint.LintResult[]} The ESLint report.
36 * @return {Promise<void>} A promise that resolves when the report is finished.
37 */
38async function reportToJson(cli, report) {
39 const jsonFormatter = await cli.loadFormatter('json');
40 const json = await jsonFormatter.format(report);
41 const reportPath = path.join(rootDir, 'build', 'eslint.json');
42 return writeFile(reportPath, json, 'utf-8');
43}
44
45async function createReport() {
46 const cli = new ESLint({
47 useEslintrc: true,
48 cwd: rootDir,
49 });
50 const report = await cli.lintFiles('.');
51 await Promise.all([reportToConsole(cli, report), reportToJson(cli, report)]);
52
53 if (report.some((entry) => entry.errorCount > 0)) {
54 process.exitCode = 1;
55 }
56}
57
58createReport().catch(console.error);
diff --git a/subprojects/frontend/config/fetchPackageMetadata.ts b/subprojects/frontend/config/fetchPackageMetadata.ts
index 50807b03..02e16d57 100644
--- a/subprojects/frontend/config/fetchPackageMetadata.ts
+++ b/subprojects/frontend/config/fetchPackageMetadata.ts
@@ -1,3 +1,9 @@
1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6
1import { readFile } from 'node:fs/promises'; 7import { readFile } from 'node:fs/promises';
2import path from 'node:path'; 8import path from 'node:path';
3 9
diff --git a/subprojects/frontend/config/manifest.ts b/subprojects/frontend/config/manifest.ts
index 3cec777c..1822dc7c 100644
--- a/subprojects/frontend/config/manifest.ts
+++ b/subprojects/frontend/config/manifest.ts
@@ -1,10 +1,16 @@
1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6
1import type { ManifestOptions } from 'vite-plugin-pwa'; 7import type { ManifestOptions } from 'vite-plugin-pwa';
2 8
3const manifest: Partial<ManifestOptions> = { 9const manifest: Partial<ManifestOptions> = {
4 lang: 'en-US', 10 lang: 'en-US',
5 name: 'Refinery', 11 name: 'Refinery',
6 short_name: 'Refinery', 12 short_name: 'Refinery',
7 description: 'An efficient graph sovler for generating well-formed models', 13 description: 'An efficient graph solver for generating well-formed models',
8 theme_color: '#f5f5f5', 14 theme_color: '#f5f5f5',
9 display_override: ['window-controls-overlay'], 15 display_override: ['window-controls-overlay'],
10 display: 'standalone', 16 display: 'standalone',
diff --git a/subprojects/frontend/config/minifyHTMLVitePlugin.ts b/subprojects/frontend/config/minifyHTMLVitePlugin.ts
index 18336d4d..7c08c488 100644
--- a/subprojects/frontend/config/minifyHTMLVitePlugin.ts
+++ b/subprojects/frontend/config/minifyHTMLVitePlugin.ts
@@ -1,3 +1,9 @@
1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6
1import { minify, type Options as TerserOptions } from 'html-minifier-terser'; 7import { minify, type Options as TerserOptions } from 'html-minifier-terser';
2import type { PluginOption } from 'vite'; 8import type { PluginOption } from 'vite';
3 9
diff --git a/subprojects/frontend/config/preloadFontsVitePlugin.ts b/subprojects/frontend/config/preloadFontsVitePlugin.ts
index bc6f8eaf..5c04477a 100644
--- a/subprojects/frontend/config/preloadFontsVitePlugin.ts
+++ b/subprojects/frontend/config/preloadFontsVitePlugin.ts
@@ -1,3 +1,9 @@
1/*
2 * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6
1import micromatch from 'micromatch'; 7import micromatch from 'micromatch';
2import type { PluginOption } from 'vite'; 8import type { PluginOption } from 'vite';
3 9