Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
main
------

* Pass `--watcher` to `ember build` only when the build watches. The flag
names the backend that watches the file system, so it did nothing for a
one-off build
* Build a Vite-based application with `vite build`, the command its own
`build` script runs, rather than with `ember build`. `ember build --help`
calls itself a "Vestigial command in Vite-based projects" and points at
Expand Down
5 changes: 4 additions & 1 deletion lib/ember_cli/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,14 @@ def vite_build
# Builds the application with `ember build`, which watches for changes
# when asked. A Vite-based project has no equivalent: `ember build` there
# refuses `--watch`, and its development server watches instead.
#
# `--watcher` names the backend that watches, so it rides along only
# when the build watches.
def ember_build(watch: false)
line = Terrapin::CommandLine.new(paths.ember, [
"build",
("--watch" if watch),
("--watcher :watcher" if process_watcher),
("--watcher :watcher" if watch && process_watcher),
("--silent" if silent?),
"--environment :environment",
"--output-path :output_path",
Expand Down
9 changes: 9 additions & 0 deletions spec/lib/ember_cli/command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@
end
end

context "when not configured to watch" do
it "omits the `--watcher` flag" do
paths = build_paths
command = build_command(paths: paths, options: { watcher: "foo" })

expect(command.build).not_to match(/--watcher/)
end
end

context "when configured to watch" do
it "includes the `--watch` flag" do
paths = build_paths
Expand Down