Lustre's CLI and development tooling: zero-config dev server, bundling, and scaffolding.
at main 2.9 kB view raw
1import glint 2import glint/constraint 3 4pub fn esbuild_os() -> glint.Flag(String) { 5 let description = "Override the automatic OS detection." 6 let allowed = [ 7 "android", "darwin", "freebsd", "linux", "win32", "netbsd", "openbsd", 8 "sunos", 9 ] 10 11 glint.string_flag("os") 12 |> glint.flag_help(description) 13 |> glint.flag_constraint(constraint.one_of(allowed)) 14} 15 16pub fn esbuild_cpu() -> glint.Flag(String) { 17 let description = "Override the automatic CPU architecture detection." 18 let allowed = ["aarch64", "amd64", "arm", "arm64", "ia32", "x64", "x86_64"] 19 20 glint.string_flag("cpu") 21 |> glint.flag_help(description) 22 |> glint.flag_constraint(constraint.one_of(allowed)) 23} 24 25pub fn tailwind_os() -> glint.Flag(String) { 26 let description = "Override the automatic OS detection." 27 let allowed = ["linux", "win32", "darwin"] 28 29 glint.string_flag("os") 30 |> glint.flag_help(description) 31 |> glint.flag_constraint(constraint.one_of(allowed)) 32} 33 34pub fn tailwind_cpu() -> glint.Flag(String) { 35 let description = "Override the automatic CPU architecture detection." 36 let allowed = ["armv7", "arm64", "x64", "x86_64", "aarch64"] 37 38 glint.string_flag("cpu") 39 |> glint.flag_help(description) 40 |> glint.flag_constraint(constraint.one_of(allowed)) 41} 42 43pub fn minify() -> glint.Flag(Bool) { 44 let description = 45 "Minify the output, renaming variables and removing whitespace." 46 47 glint.bool_flag("minify") 48 |> glint.flag_help(description) 49} 50 51pub fn tailwind_entry() -> glint.Flag(String) { 52 let description = 53 "Use a custom CSS file as the entry to a Tailwind CSS bundle." 54 55 glint.string_flag("tailwind-entry") 56 |> glint.flag_help(description) 57} 58 59pub fn outdir() -> glint.Flag(String) { 60 let description = 61 "Use a custom directory as the destination for any built files." 62 63 glint.string_flag("outdir") 64 |> glint.flag_help(description) 65} 66 67pub fn ext() -> glint.Flag(String) { 68 let description = 69 "Use a file extension other than 'mjs' for the built JavaScript." 70 71 glint.string_flag("ext") 72 |> glint.flag_help(description) 73} 74 75pub fn detect_tailwind() -> glint.Flag(Bool) { 76 let description = "Detect and build Tailwind styles automatically." 77 78 glint.bool_flag("detect-tailwind") 79 |> glint.flag_help(description) 80} 81 82pub fn port() -> glint.Flag(Int) { 83 let description = 84 "Specify server port. If the port is taken the dev server will not start." 85 86 glint.int_flag("port") 87 |> glint.flag_help(description) 88} 89 90pub fn proxy_from() -> glint.Flag(String) { 91 let description = 92 "Proxy requests that start with this path to the URL specified by the --proxy-to flag." 93 94 glint.string_flag("proxy-from") 95 |> glint.flag_help(description) 96} 97 98pub fn proxy_to() -> glint.Flag(String) { 99 let description = 100 "Proxy requests that start with the path specified by the --proxy-from flag to this URL." 101 102 glint.string_flag("proxy-to") 103 |> glint.flag_help(description) 104}