aboutsummaryrefslogtreecommitdiffstats
path: root/packages/preload
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-23 17:19:52 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-23 17:54:03 +0100
commita8c4df8744ac0d9e6a889af3ad3dcbd3e100ee0a (patch)
treed10c6ab5daa20f49594dfcc3b842dff4e963a670 /packages/preload
parentbuild: Enable typescript composite mode and clean (diff)
downloadsophie-a8c4df8744ac0d9e6a889af3ad3dcbd3e100ee0a.tar.gz
sophie-a8c4df8744ac0d9e6a889af3ad3dcbd3e100ee0a.tar.zst
sophie-a8c4df8744ac0d9e6a889af3ad3dcbd3e100ee0a.zip
chore: Add license headers
Centralizes vite configuration to be able to add license banners to outputs in one place.
Diffstat (limited to 'packages/preload')
-rw-r--r--packages/preload/src/SophieRendererImpl.ts20
-rw-r--r--packages/preload/src/index.ts20
-rw-r--r--packages/preload/vite.config.js21
3 files changed, 44 insertions, 17 deletions
diff --git a/packages/preload/src/SophieRendererImpl.ts b/packages/preload/src/SophieRendererImpl.ts
index e03c89e..1ac8b65 100644
--- a/packages/preload/src/SophieRendererImpl.ts
+++ b/packages/preload/src/SophieRendererImpl.ts
@@ -1,3 +1,23 @@
1/*
2 * Copyright (C) 2021-2022 Kristóf Marussy <kristof@marussy.com>
3 *
4 * This file is part of Sophie.
5 *
6 * Sophie is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 *
18 * SPDX-License-Identifier: AGPL-3.0-only
19 */
20
1import { ipcRenderer } from 'electron'; 21import { ipcRenderer } from 'electron';
2import type { IJsonPatch } from 'mobx-state-tree'; 22import type { IJsonPatch } from 'mobx-state-tree';
3import { 23import {
diff --git a/packages/preload/src/index.ts b/packages/preload/src/index.ts
index 19d1285..ef85f70 100644
--- a/packages/preload/src/index.ts
+++ b/packages/preload/src/index.ts
@@ -1,3 +1,23 @@
1/*
2 * Copyright (C) 2021-2022 Kristóf Marussy <kristof@marussy.com>
3 *
4 * This file is part of Sophie.
5 *
6 * Sophie is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 *
18 * SPDX-License-Identifier: AGPL-3.0-only
19 */
20
1import { contextBridge } from 'electron'; 21import { contextBridge } from 'electron';
2 22
3import { createSophieRenderer } from './SophieRendererImpl'; 23import { createSophieRenderer } from './SophieRendererImpl';
diff --git a/packages/preload/vite.config.js b/packages/preload/vite.config.js
index bc37ccb..5af78d9 100644
--- a/packages/preload/vite.config.js
+++ b/packages/preload/vite.config.js
@@ -2,9 +2,7 @@
2 2
3import { builtinModules } from 'module'; 3import { builtinModules } from 'module';
4 4
5// `resolveJsonModule` is disabled for this package, but vite will load the json nevertheless. 5import { chrome, makeConfig } from '../../config/vite-common';
6// @ts-expect-error
7import { chrome } from '../../.electron-vendors.cache.json';
8 6
9/** @type string */ 7/** @type string */
10const PACKAGE_ROOT = __dirname; 8const PACKAGE_ROOT = __dirname;
@@ -13,16 +11,10 @@ const PACKAGE_ROOT = __dirname;
13 * @type {import('vite').UserConfig} 11 * @type {import('vite').UserConfig}
14 * @see https://vitejs.dev/config/ 12 * @see https://vitejs.dev/config/
15 */ 13 */
16const config = { 14const config = makeConfig({
17 mode: process.env.MODE,
18 root: PACKAGE_ROOT, 15 root: PACKAGE_ROOT,
19 envDir: process.cwd(),
20 build: { 16 build: {
21 sourcemap: 'inline', 17 target: chrome,
22 target: `chrome${chrome}`,
23 outDir: 'dist',
24 assetsDir: '.',
25 minify: process.env.MODE !== 'development',
26 lib: { 18 lib: {
27 entry: 'src/index.ts', 19 entry: 'src/index.ts',
28 formats: ['cjs'], 20 formats: ['cjs'],
@@ -32,13 +24,8 @@ const config = {
32 'electron', 24 'electron',
33 ...builtinModules, 25 ...builtinModules,
34 ], 26 ],
35 output: {
36 entryFileNames: '[name].cjs',
37 },
38 }, 27 },
39 emptyOutDir: true,
40 brotliSize: false,
41 }, 28 },
42}; 29});
43 30
44export default config; 31export default config;