From 92edbb7b96a842380344727c70a7d2e5aafe421f Mon Sep 17 00:00:00 2001 From: Alessandro Pignotti Date: Sat, 5 Oct 2024 12:36:59 +0200 Subject: [PATCH] Initial support for configuring the disk via a self-contained config file --- diskConfig.cloud.js | 1 + package-lock.json | 18 ++++++++++++++++++ package.json | 1 + rollup.config.js | 10 ++++++++++ src/App.svelte | 1 + 5 files changed, 31 insertions(+) create mode 100644 diskConfig.cloud.js diff --git a/diskConfig.cloud.js b/diskConfig.cloud.js new file mode 100644 index 0000000..d8991b8 --- /dev/null +++ b/diskConfig.cloud.js @@ -0,0 +1 @@ +export const imageUrl = "wss://disks-staging.webvm.io/debian_large_20230522_5044875331.ext2"; diff --git a/package-lock.json b/package-lock.json index 4f0555c..c60c65f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@fortawesome/fontawesome-free": "^6.6.0", "@leaningtech/cheerpx": "latest", "@oddbird/popover-polyfill": "^0.4.4", + "@rollup/plugin-alias": "^5.1.1", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.0", "@rollup/plugin-terser": "^0.4.0", @@ -593,6 +594,23 @@ "integrity": "sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==", "dev": true }, + "node_modules/@rollup/plugin-alias": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-5.1.1.tgz", + "integrity": "sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==", + "dev": true, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, "node_modules/@rollup/plugin-commonjs": { "version": "24.1.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-24.1.0.tgz", diff --git a/package.json b/package.json index b74661c..75564ad 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "@fortawesome/fontawesome-free": "^6.6.0", "@leaningtech/cheerpx": "latest", "@oddbird/popover-polyfill": "^0.4.4", + "@rollup/plugin-alias": "^5.1.1", "@rollup/plugin-commonjs": "^24.0.0", "@rollup/plugin-node-resolve": "^15.0.0", "@rollup/plugin-terser": "^0.4.0", diff --git a/rollup.config.js b/rollup.config.js index 9f1a028..57d1cbc 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,15 +1,20 @@ import copy from 'rollup-plugin-copy'; import svelte from 'rollup-plugin-svelte'; import postcss from 'rollup-plugin-postcss'; +import alias from '@rollup/plugin-alias' import commonjs from '@rollup/plugin-commonjs'; import terser from '@rollup/plugin-terser'; import resolve from '@rollup/plugin-node-resolve'; import css from 'rollup-plugin-css-only'; import autoprefixer from 'autoprefixer'; +import path from 'path'; +import url from 'url'; import tailwindcss from 'tailwindcss'; const production = !process.env.ROLLUP_WATCH; +const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); + export default { input: 'src/main.js', output: { @@ -19,6 +24,11 @@ export default { file: 'build/bundle.js' }, plugins: [ + alias({ + entries: { + 'diskConfig': path.resolve(__dirname, 'diskConfig.cloud.js') + } + }), svelte({ compilerOptions: { // enable run-time checks when not in production diff --git a/src/App.svelte b/src/App.svelte index 9fde8d3..ac8cf0a 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -6,6 +6,7 @@ import Nav from 'labs/packages/global-navbar/src/Nav.svelte'; import SideBar from './SideBar.svelte'; import * as CheerpX from '@leaningtech/cheerpx'; + import { imageUrl } from 'diskConfig' var term = new Terminal({cursorBlink:true, convertEol:true, fontFamily:"monospace", fontWeight: 400, fontWeightBold: 700}); var fitAddon = new FitAddon();