ember-cli-rails 0.14.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -0
- data/README.md +3 -1
- data/lib/ember_cli/build_monitor.rb +4 -3
- data/lib/ember_cli/command.rb +48 -10
- data/lib/ember_cli/path_set.rb +12 -2
- data/lib/ember_cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 89fb2f98a617de8c232e28b044db803f37f5a0b94147bdff07ebf45be3338d7f
|
|
4
|
+
data.tar.gz: 572e612fcac29c7cb1f4d74a28b40e839a07906a4bdca14d03ba1ba4e44c9577
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 631a8276c052830df276b0a53c4ccb46f2b80a6f71ef346002fe260222bc9f4852efc38ddab155c92af8a67e9efad2ab5c91124af2b34eb7cc942f418d097aeb
|
|
7
|
+
data.tar.gz: 1dbc29b10d0f912dd1f9d19419a00d6df87311d6d9e4d2b9448812848916ad53745e81900b7e538e894da77d58987ed7831a18d47da6b0f6476b8f87b4449af0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
0.14.1
|
|
2
|
+
------
|
|
3
|
+
|
|
4
|
+
* Build a Vite-based application with `vite build`, the command its own
|
|
5
|
+
`build` script runs, rather than with `ember build`. `ember build --help`
|
|
6
|
+
calls itself a "Vestigial command in Vite-based projects" and points at
|
|
7
|
+
that script. What the build writes is unchanged, and so is the classic
|
|
8
|
+
blueprint, which keeps building with `ember build`. The `silent` option
|
|
9
|
+
now quiets a Vite build with `--logLevel error`, which drops the progress
|
|
10
|
+
output and keeps the errors
|
|
11
|
+
* Recognise an application as Vite-based from any of the six names Vite
|
|
12
|
+
resolves its configuration from, rather than only `vite.config.js`,
|
|
13
|
+
`vite.config.mjs` and `vite.config.ts`. An application configured in
|
|
14
|
+
`vite.config.mts`, `vite.config.cts` or `vite.config.cjs` was taken for a
|
|
15
|
+
classic one and served with `ember build --watch`, which a Vite-based
|
|
16
|
+
project rejects
|
|
17
|
+
* Report the whole build failure of a classic application in the
|
|
18
|
+
`EmberCli::BuildError` message, instead of only its first line. Such an
|
|
19
|
+
application builds in the background, and `BuildMonitor` turns what
|
|
20
|
+
`ember build --watch` writes into the exception; the line naming the file
|
|
21
|
+
that failed to build is rarely the first one, so a parse error arrived
|
|
22
|
+
with its message and line number but no way to tell which file it came
|
|
23
|
+
from
|
|
24
|
+
* Pass `--watcher` to `ember build` only when the build watches. The flag
|
|
25
|
+
names the backend that watches the file system, so it did nothing for a
|
|
26
|
+
one-off build
|
|
27
|
+
|
|
1
28
|
0.14.0
|
|
2
29
|
------
|
|
3
30
|
|
data/README.md
CHANGED
|
@@ -77,7 +77,9 @@ c.app :frontend, path: "~/projects/my-ember-app"
|
|
|
77
77
|
- `path` - the path where your Ember CLI application is located. The default
|
|
78
78
|
value is the name of your app in the Rails root.
|
|
79
79
|
|
|
80
|
-
- `silent` -
|
|
80
|
+
- `silent` - quiets the build. A classic application is built with
|
|
81
|
+
`ember build --silent`; a Vite-based one with `vite build --logLevel error`,
|
|
82
|
+
which keeps errors while dropping the progress output.
|
|
81
83
|
|
|
82
84
|
- `package_manager` - the package manager that installs the application's
|
|
83
85
|
NodeJS dependencies: `:npm` (the default), `:yarn`, or `:pnpm`. Name the
|
|
@@ -41,6 +41,7 @@ module EmberCli
|
|
|
41
41
|
|
|
42
42
|
def build_errors
|
|
43
43
|
error_lines.
|
|
44
|
+
map(&:chomp).
|
|
44
45
|
reject { |line| is_blank_or_backtrace?(line) }.
|
|
45
46
|
reject { |line| is_deprecation_warning?(line) }.
|
|
46
47
|
reject { |line| is_building_notice?(line) }
|
|
@@ -75,11 +76,11 @@ module EmberCli
|
|
|
75
76
|
end
|
|
76
77
|
|
|
77
78
|
def raise_build_error!
|
|
78
|
-
|
|
79
|
-
message = "#{name.inspect} has failed to build: #{
|
|
79
|
+
errors = build_errors
|
|
80
|
+
message = "#{name.inspect} has failed to build: #{errors.join("\n")}"
|
|
80
81
|
|
|
81
82
|
error = BuildError.new(message)
|
|
82
|
-
error.set_backtrace(
|
|
83
|
+
error.set_backtrace(errors)
|
|
83
84
|
|
|
84
85
|
fail error
|
|
85
86
|
end
|
data/lib/ember_cli/command.rb
CHANGED
|
@@ -14,7 +14,11 @@ module EmberCli
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def build(watch: false)
|
|
17
|
-
|
|
17
|
+
if paths.vite?
|
|
18
|
+
vite_build
|
|
19
|
+
else
|
|
20
|
+
ember_build(watch: watch)
|
|
21
|
+
end
|
|
18
22
|
end
|
|
19
23
|
|
|
20
24
|
# Boots Vite's development server for an application generated with the
|
|
@@ -43,11 +47,53 @@ module EmberCli
|
|
|
43
47
|
options.fetch(:silent) { false }
|
|
44
48
|
end
|
|
45
49
|
|
|
50
|
+
def build_environment
|
|
51
|
+
if EmberCli.env == "production"
|
|
52
|
+
"production"
|
|
53
|
+
else
|
|
54
|
+
"development"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# The Vite-based blueprint (`ember-cli >= 6.8`)
|
|
59
|
+
#
|
|
60
|
+
# Builds the application the way its own `build` script does.
|
|
61
|
+
# `ember build` still drives such a build today, but `ember build --help`
|
|
62
|
+
# calls it a "Vestigial command in Vite-based projects" and has dropped
|
|
63
|
+
# every option but `--environment`, `--suppress-sizes` and
|
|
64
|
+
# `--output-path`.
|
|
65
|
+
#
|
|
66
|
+
# `--emptyOutDir` is needed because the output directory is outside the
|
|
67
|
+
# Ember application, where Vite leaves stale files in place unless asked
|
|
68
|
+
# to clear them.
|
|
69
|
+
def vite_build
|
|
70
|
+
line = Terrapin::CommandLine.new(paths.vite, [
|
|
71
|
+
"build",
|
|
72
|
+
"--mode :mode",
|
|
73
|
+
"--outDir :output_path",
|
|
74
|
+
"--emptyOutDir",
|
|
75
|
+
("--logLevel error" if silent?),
|
|
76
|
+
].compact.join(" "))
|
|
77
|
+
|
|
78
|
+
line.command(
|
|
79
|
+
mode: build_environment,
|
|
80
|
+
output_path: paths.dist,
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# The classic blueprint
|
|
85
|
+
#
|
|
86
|
+
# Builds the application with `ember build`, which watches for changes
|
|
87
|
+
# when asked. A Vite-based project has no equivalent: `ember build` there
|
|
88
|
+
# refuses `--watch`, and its development server watches instead.
|
|
89
|
+
#
|
|
90
|
+
# `--watcher` names the backend that watches, so it rides along only
|
|
91
|
+
# when the build watches.
|
|
46
92
|
def ember_build(watch: false)
|
|
47
93
|
line = Terrapin::CommandLine.new(paths.ember, [
|
|
48
94
|
"build",
|
|
49
95
|
("--watch" if watch),
|
|
50
|
-
("--watcher :watcher" if process_watcher),
|
|
96
|
+
("--watcher :watcher" if watch && process_watcher),
|
|
51
97
|
("--silent" if silent?),
|
|
52
98
|
"--environment :environment",
|
|
53
99
|
"--output-path :output_path",
|
|
@@ -59,13 +105,5 @@ module EmberCli
|
|
|
59
105
|
watcher: process_watcher,
|
|
60
106
|
)
|
|
61
107
|
end
|
|
62
|
-
|
|
63
|
-
def build_environment
|
|
64
|
-
if EmberCli.env == "production"
|
|
65
|
-
"production"
|
|
66
|
-
else
|
|
67
|
-
"development"
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
108
|
end
|
|
71
109
|
end
|
data/lib/ember_cli/path_set.rb
CHANGED
|
@@ -4,6 +4,17 @@ module EmberCli
|
|
|
4
4
|
class PathSet
|
|
5
5
|
PACKAGE_MANAGERS = %i[npm yarn pnpm].freeze
|
|
6
6
|
|
|
7
|
+
# Every name Vite resolves its configuration file from. An application
|
|
8
|
+
# that keeps its configuration under any of them is Vite-based.
|
|
9
|
+
VITE_CONFIG_FILES = %w[
|
|
10
|
+
vite.config.js
|
|
11
|
+
vite.config.mjs
|
|
12
|
+
vite.config.cjs
|
|
13
|
+
vite.config.ts
|
|
14
|
+
vite.config.mts
|
|
15
|
+
vite.config.cts
|
|
16
|
+
].freeze
|
|
17
|
+
|
|
7
18
|
# npm ships with NodeJS, so it has no installation instructions of its own
|
|
8
19
|
# to point at when its executable is missing.
|
|
9
20
|
INSTALL_INSTRUCTIONS = {
|
|
@@ -55,8 +66,7 @@ module EmberCli
|
|
|
55
66
|
# Apps generated with the Vite-based blueprint (`ember-cli >= 6.8`)
|
|
56
67
|
# ship a Vite config file at their root.
|
|
57
68
|
def vite?
|
|
58
|
-
|
|
59
|
-
any? { |config| root.join(config).exist? }
|
|
69
|
+
VITE_CONFIG_FILES.any? { |config| root.join(config).exist? }
|
|
60
70
|
end
|
|
61
71
|
|
|
62
72
|
def ember
|
data/lib/ember_cli/version.rb
CHANGED