diff options
author | 2023-07-24 14:37:16 +0200 | |
---|---|---|
committer | 2023-07-24 14:37:16 +0200 | |
commit | 8789304690384d19ad829286560aec5ed0917976 (patch) | |
tree | b157e78e8b6a3f2fb3d0eee6e1aa10d2c16e0204 /subprojects/frontend/config | |
parent | decreasing steps in fast fuzz tests (diff) | |
parent | Merge pull request #27 from kris7t/ordered-result-set (diff) | |
download | refinery-8789304690384d19ad829286560aec5ed0917976.tar.gz refinery-8789304690384d19ad829286560aec5ed0917976.tar.zst refinery-8789304690384d19ad829286560aec5ed0917976.zip |
Merge branch 'graphs4value:main' into datastructure
Diffstat (limited to 'subprojects/frontend/config')
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 | |||
1 | import type { PluginOption } from 'vite'; | 7 | import type { PluginOption } from 'vite'; |
2 | 8 | ||
3 | import type BackendConfig from '../src/xtext/BackendConfig'; | 9 | import 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 | |||
1 | import type { PluginOption, ServerOptions } from 'vite'; | 7 | import type { PluginOption, ServerOptions } from 'vite'; |
2 | 8 | ||
3 | import backendConfigVitePlugin, { | 9 | import 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 | |||
7 | const { writeFile } = require('node:fs/promises'); | ||
8 | const path = require('node:path'); | ||
9 | const { Readable } = require('node:stream'); | ||
10 | const { pipeline } = require('node:stream/promises'); | ||
11 | |||
12 | const { ESLint } = require('eslint'); | ||
13 | |||
14 | const 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 | */ | ||
23 | async 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 | */ | ||
38 | async 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 | |||
45 | async 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 | |||
58 | createReport().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 | |||
1 | import { readFile } from 'node:fs/promises'; | 7 | import { readFile } from 'node:fs/promises'; |
2 | import path from 'node:path'; | 8 | import 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 | |||
1 | import type { ManifestOptions } from 'vite-plugin-pwa'; | 7 | import type { ManifestOptions } from 'vite-plugin-pwa'; |
2 | 8 | ||
3 | const manifest: Partial<ManifestOptions> = { | 9 | const 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 | |||
1 | import { minify, type Options as TerserOptions } from 'html-minifier-terser'; | 7 | import { minify, type Options as TerserOptions } from 'html-minifier-terser'; |
2 | import type { PluginOption } from 'vite'; | 8 | import 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 | |||
1 | import micromatch from 'micromatch'; | 7 | import micromatch from 'micromatch'; |
2 | import type { PluginOption } from 'vite'; | 8 | import type { PluginOption } from 'vite'; |
3 | 9 | ||