diff options
author | Hayleigh Thompson <me@hayleigh.dev> | 2024-03-17 17:33:50 +0000 |
---|---|---|
committer | Hayleigh Thompson <me@hayleigh.dev> | 2024-03-17 17:33:50 +0000 |
commit | 32b4bbc572f1c03e52f4be650e750f16dae645f6 (patch) | |
tree | 93d1a2fbb76540bb831cd7343851f5371e5e3a98 /src | |
parent | 80b418f6ee44321d55ed18375d34db1d35620deb (diff) | |
download | lustre-32b4bbc572f1c03e52f4be650e750f16dae645f6.tar.gz lustre-32b4bbc572f1c03e52f4be650e750f16dae645f6.zip |
:recycle: Move component entry script into external template.
Diffstat (limited to 'src')
-rw-r--r-- | src/lustre/cli/build.gleam | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/lustre/cli/build.gleam b/src/lustre/cli/build.gleam index 352329d..656cfcc 100644 --- a/src/lustre/cli/build.gleam +++ b/src/lustre/cli/build.gleam @@ -11,7 +11,7 @@ import glint.{type Command, CommandInput} import glint/flag import lustre/cli/esbuild import lustre/cli/project.{type Module} -import lustre/cli/utils.{keep, replace, try} +import lustre/cli/utils.{keep, replace, template, try} import lustre/cli/step.{type Step} import simplifile @@ -47,11 +47,8 @@ JavaScript module for you to host or distribute. let _ = simplifile.create_directory_all(tempdir) let _ = simplifile.create_directory_all(outdir) let entry = - "import { main } from '../dev/javascript/${project_name}/${project_name}.mjs'; - - main(); - " - |> string.replace("${project_name}", project_name) + template("entry-with-main.mjs") + |> string.replace("{app_name}", project_name) let entryfile = filepath.join(tempdir, "entry.mjs") let ext = case minify { @@ -117,14 +114,10 @@ present. use project_name <- step.try(get_project_name(), keep) let entry = - "import { register } from '../dev/javascript/lustre/client-component.ffi.mjs'; - import { name, ${component} as component } from '../dev/javascript/${project_name}/${module_path}.mjs'; - - register(component(), name); - " - |> string.replace("${component}", component) - |> string.replace("${project_name}", project_name) - |> string.replace("${module_path}", module_path) + template("component-entry.mjs") + |> string.replace("{component_name}", component) + |> string.replace("{app_name}", project_name) + |> string.replace("{module_path}", module_path) let entryfile = filepath.join(tempdir, "entry.mjs") let ext = case minify { |