-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build UI builder with live svelte (#80)
- Loading branch information
Showing
67 changed files
with
16,347 additions
and
1,603 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
[ | ||
{"lib/beacon/live_admin/components.ex", :unknown_function} | ||
] | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
node: true, | ||
es2021: true, | ||
}, | ||
extends: ["eslint:recommended", "prettier"], | ||
globals: { | ||
global: "writable", | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 12, | ||
sourceType: "module", | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
css/app.css | ||
/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
printWidth: 120, | ||
semi: false, | ||
plugins: ["prettier-plugin-svelte"], | ||
overrides: [{ files: "*.svelte", options: { parser: "svelte" } }], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
const esbuild = require("esbuild") | ||
const sveltePlugin = require("esbuild-svelte") | ||
const importGlobPlugin = require("esbuild-plugin-import-glob").default | ||
const sveltePreprocess = require("svelte-preprocess") | ||
|
||
const args = process.argv.slice(2) | ||
const watch = args.includes("--watch") | ||
const deploy = args.includes("--deploy") | ||
|
||
let optsClient = { | ||
entryPoints: ["js/beacon_live_admin.js"], | ||
globalName: "BeaconLiveAdmin", | ||
format: "iife", | ||
loader: { | ||
".ttf": "dataurl", | ||
".woff": "dataurl", | ||
".woff2": "dataurl", | ||
}, | ||
bundle: true, | ||
minify: deploy, | ||
target: "es2020", | ||
conditions: ["svelte", "browser"], | ||
outfile: deploy ? "../priv/static/beacon_live_admin.min.js" : "../priv/static/beacon_live_admin.js", | ||
logLevel: "info", | ||
sourcemap: "external", | ||
tsconfig: "./tsconfig.json", | ||
plugins: [ | ||
importGlobPlugin(), | ||
sveltePlugin({ | ||
preprocess: sveltePreprocess(), | ||
compilerOptions: { | ||
dev: !deploy, | ||
hydratable: true, | ||
css: "injected", | ||
customElement: true, | ||
}, | ||
}), | ||
], | ||
} | ||
|
||
let optsServer = { | ||
entryPoints: ["js/server.js"], | ||
platform: "node", | ||
bundle: true, | ||
minify: deploy, | ||
target: "node19.6.1", | ||
conditions: ["svelte"], | ||
outdir: "../priv/svelte", | ||
logLevel: "info", | ||
sourcemap: "external", | ||
tsconfig: "./tsconfig.json", | ||
plugins: [ | ||
importGlobPlugin(), | ||
sveltePlugin({ | ||
preprocess: sveltePreprocess(), | ||
compilerOptions: { | ||
dev: !deploy, | ||
hydratable: true, | ||
generate: "ssr", | ||
customElement: true, | ||
}, | ||
}), | ||
], | ||
} | ||
|
||
esbuild.build(optsServer) | ||
|
||
if (watch) { | ||
esbuild | ||
.context(optsClient) | ||
.then((ctx) => { | ||
ctx.watch() | ||
}) | ||
.catch((error) => { | ||
console.log(error) | ||
process.exit(1) | ||
}) | ||
} else { | ||
esbuild.build(optsClient) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import * as Components from "../svelte/**/*.svelte" | ||
import { getRender } from "live_svelte" | ||
|
||
export const render = getRender(Components) |
Oops, something went wrong.