-
-
Notifications
You must be signed in to change notification settings - Fork 155
/
Copy pathstart.cr
66 lines (57 loc) · 1.99 KB
/
start.cr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
module Mint
class Cli < Admiral::Command
class Start < Admiral::Command
include Command
define_help description: "Starts the development server."
define_flag runtime : String,
description: "If specified, the supplied runtime will be used instead of the default."
define_flag no_reload : Bool,
description: "Do not reload the browser when something changes.",
default: false
define_flag generate_source_maps : Bool,
description: "If specified, source maps will be generated.",
default: false
define_flag format : Bool,
description: "Formats the source files when they change.",
default: false
define_flag host : String,
description: "The host to serve the application on.",
default: ENV["HOST"]? || "0.0.0.0",
short: "h"
define_flag port : Int32,
description: "The port to serve the application on.",
default: (ENV["PORT"]? || "3000").to_i,
short: "p"
define_flag env : String,
description: "Loads the given .env file.",
short: "e"
def run
execute "Running the development server",
check_dependencies: true do
Reactor.new(
reload: !flags.no_reload,
format: flags.format,
dot_env: flags.env,
host: flags.host,
port: flags.port
) do |type_checker|
Bundler.new(
artifacts: type_checker.artifacts,
config: Bundler::Config.new(
generate_source_maps: flags.generate_source_maps,
live_reload: !flags.no_reload,
runtime_path: flags.runtime,
generate_manifest: false,
json: MintJson.current,
include_program: true,
hash_assets: false,
skip_icons: false,
optimize: false,
test: nil),
).bundle
end
end
end
end
end
end