ember-cli-rails 0.13.2 → 0.14.0
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 +24 -0
- data/LICENSE.txt +0 -0
- data/README.md +39 -17
- data/app/controller/ember_cli/ember_controller.rb +0 -0
- data/app/helpers/ember_rails_helper.rb +0 -0
- data/app/views/ember_cli/ember/index.html.erb +0 -0
- data/lib/ember-cli-rails.rb +0 -0
- data/lib/ember_cli/app.rb +33 -2
- data/lib/ember_cli/build_monitor.rb +0 -0
- data/lib/ember_cli/command.rb +0 -0
- data/lib/ember_cli/configuration.rb +0 -0
- data/lib/ember_cli/deploy/dev_server.rb +0 -0
- data/lib/ember_cli/deploy/file.rb +0 -0
- data/lib/ember_cli/dev_server.rb +0 -0
- data/lib/ember_cli/dev_server_proxy.rb +0 -0
- data/lib/ember_cli/ember_constraint.rb +0 -0
- data/lib/ember_cli/engine.rb +8 -0
- data/lib/ember_cli/errors.rb +0 -0
- data/lib/ember_cli/helpers.rb +0 -0
- data/lib/ember_cli/path_set.rb +69 -17
- data/lib/ember_cli/route_helpers.rb +0 -0
- data/lib/ember_cli/runner.rb +0 -0
- data/lib/ember_cli/shell.rb +4 -1
- data/lib/ember_cli/trailing_slash_constraint.rb +0 -0
- data/lib/ember_cli/version.rb +1 -1
- data/lib/ember_cli.rb +5 -0
- data/lib/generators/ember/heroku/USAGE +12 -4
- data/lib/generators/ember/heroku/heroku_generator.rb +39 -9
- data/lib/generators/ember/heroku/templates/package.json.erb +8 -0
- data/lib/generators/ember/heroku/templates/pnpm-lock.yaml.erb +1 -0
- data/lib/generators/ember/heroku/templates/yarn.lock.erb +0 -0
- data/lib/generators/ember/init/USAGE +0 -0
- data/lib/generators/ember/init/init_generator.rb +0 -0
- data/lib/generators/ember/init/templates/initializer.rb +0 -0
- data/lib/tasks/ember-cli.rake +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f6524eb048b09d9e7144570bf4c65ede7e324ba40f2ee0631f8c07c9c221be98
|
|
4
|
+
data.tar.gz: a8687bff15afeaefc6261599be718e7d01833237790a9b25c156178f26d692bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9dfcb02b1ad578537c39c1b9758bdd40136bef8deca5470f3ddfa05541dc3bb2030b3f0788ca68b21bae92e2a0f96ccde2fc7392d0e7ef1ea87cd1142217cf7e
|
|
7
|
+
data.tar.gz: 58cfebef2e7e1614beea6a6f93099c98c9f9d0d21964ddd037924e2496aa5015f4f1e19e11fc489e0c4306393f23c693b9704f8837f981e34479dbbeaa69f6ac
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
0.14.0
|
|
2
|
+
------
|
|
3
|
+
|
|
4
|
+
* Add the `package_manager` option to install an application's NodeJS
|
|
5
|
+
dependencies with pnpm (`package_manager: :pnpm`), yarn, or npm. `pnpm_path`
|
|
6
|
+
implies pnpm the way `yarn_path` implies yarn. The package manager is read
|
|
7
|
+
through the new `EmberCli::App#package_manager` and `EmberCli::App#pnpm?`
|
|
8
|
+
* Deprecate `yarn: true` in favour of `package_manager: :yarn`. The shorthand
|
|
9
|
+
still selects yarn, with a deprecation warning, and will be removed in `1.0`
|
|
10
|
+
* Identify a project with a pnpm application to Heroku's NodeJS buildpack
|
|
11
|
+
from `rails generate ember:heroku`, with a root-level `pnpm-lock.yaml`, and
|
|
12
|
+
pin the package manager version in the generated `package.json` from the
|
|
13
|
+
`packageManager` the Ember applications declare, read through the new
|
|
14
|
+
`EmberCli::App#package_manager_spec`
|
|
15
|
+
* Stop adding `rails_12factor` to the `Gemfile` from `rails generate
|
|
16
|
+
ember:heroku`. Rails serves the twelve-factor behaviour the gem backported
|
|
17
|
+
natively since `5.0`, and every Rails version this gem supports is `>= 5.2`.
|
|
18
|
+
To upgrade, remove `rails_12factor` from your project's `Gemfile`
|
|
19
|
+
* Replace `EmberCli::App#yarn_enabled?` with `EmberCli::App#yarn?`
|
|
20
|
+
* Pin the NodeJS version in the `package.json` that `rails generate
|
|
21
|
+
ember:heroku` writes, from the `engines.node` the Ember applications
|
|
22
|
+
declare, read through the new `EmberCli::App#node_engine`. Applications
|
|
23
|
+
that declare different versions are left unpinned
|
|
24
|
+
|
|
1
25
|
0.13.2
|
|
2
26
|
------
|
|
3
27
|
|
data/LICENSE.txt
CHANGED
|
File without changes
|
data/README.md
CHANGED
|
@@ -79,7 +79,10 @@ c.app :frontend, path: "~/projects/my-ember-app"
|
|
|
79
79
|
|
|
80
80
|
- `silent` - this provides `--silent` option for Ember CLI commands to control verbosity of their output.
|
|
81
81
|
|
|
82
|
-
- `
|
|
82
|
+
- `package_manager` - the package manager that installs the application's
|
|
83
|
+
NodeJS dependencies: `:npm` (the default), `:yarn`, or `:pnpm`. Name the
|
|
84
|
+
executable with `npm_path`, `yarn_path`, or `pnpm_path` when it is not on
|
|
85
|
+
the `$PATH`.
|
|
83
86
|
|
|
84
87
|
- `dev_server` - configures [Vite's development server](#vite-based-applications)
|
|
85
88
|
for Vite-based applications in `development`. Pass `false` to opt out of it,
|
|
@@ -364,9 +367,7 @@ To configure your EmberCLI-Rails applications for Heroku:
|
|
|
364
367
|
|
|
365
368
|
1. Execute `rails generate ember:heroku`.
|
|
366
369
|
1. Commit the newly generated files.
|
|
367
|
-
1. [Add the NodeJS buildpack][buildpack]
|
|
368
|
-
`bower` dependency's executable file (if your build process requires
|
|
369
|
-
`bower`).
|
|
370
|
+
1. [Add the NodeJS buildpack][buildpack].
|
|
370
371
|
|
|
371
372
|
```sh
|
|
372
373
|
$ heroku buildpacks:clear
|
|
@@ -381,11 +382,30 @@ You are ready to deploy:
|
|
|
381
382
|
$ git push heroku master
|
|
382
383
|
```
|
|
383
384
|
|
|
384
|
-
EmberCLI compilation happens at deploy-time, triggered by the
|
|
385
|
+
EmberCLI compilation happens at deploy-time, triggered by the
|
|
386
|
+
`assets:precompile` rake task. This is the same for both build systems: Vite's
|
|
387
|
+
[development server](#vite-based-applications) only runs in `development`, so
|
|
388
|
+
a Vite-based application deploys exactly like a classic one — `ember build`
|
|
389
|
+
writes to the build directory, and Rails serves the result.
|
|
385
390
|
|
|
386
391
|
**NOTE** Run the generator each time you introduce additional EmberCLI
|
|
387
392
|
applications into the project.
|
|
388
393
|
|
|
394
|
+
**Package manager** — the buildpack installs the package manager the *project
|
|
395
|
+
root's* lockfile names. The generator writes an empty `yarn.lock` or
|
|
396
|
+
`pnpm-lock.yaml` when an application is configured with yarn or pnpm as its
|
|
397
|
+
`package_manager`, and copies the `packageManager` field the Ember
|
|
398
|
+
applications declare into the generated `package.json` so that the buildpack
|
|
399
|
+
installs that version. Without a `packageManager` field the buildpack installs
|
|
400
|
+
the latest pnpm release.
|
|
401
|
+
|
|
402
|
+
**NodeJS version** — the buildpack reads `engines.node` from the *project
|
|
403
|
+
root's* `package.json` (the file the generator writes), not from the Ember
|
|
404
|
+
application's, and builds on the current LTS release when it names no version.
|
|
405
|
+
Make sure the generated file requires a NodeJS that satisfies your Ember
|
|
406
|
+
application's own `engines.node`: applications generated with `ember-cli >=
|
|
407
|
+
6.8` require NodeJS `>= 20.19.0`.
|
|
408
|
+
|
|
389
409
|
[buildpack]: https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app#adding-a-buildpack
|
|
390
410
|
|
|
391
411
|
#### Slug size
|
|
@@ -400,12 +420,14 @@ A build-pack solution for this is discussed in [Issue #491][#491].
|
|
|
400
420
|
|
|
401
421
|
### Capistrano
|
|
402
422
|
|
|
403
|
-
EmberCLI-Rails
|
|
404
|
-
compilation, triggered by the
|
|
423
|
+
EmberCLI-Rails installs the Ember application's NodeJS dependencies during
|
|
424
|
+
EmberCLI's compilation, triggered by the `assets:precompile` rake task. It runs
|
|
425
|
+
`npm install`, `yarn install`, or `pnpm install`, as the application's
|
|
426
|
+
`package_manager` option names.
|
|
405
427
|
|
|
406
|
-
The
|
|
407
|
-
|
|
408
|
-
|
|
428
|
+
The executables it runs are required to be defined in the deployment SSH
|
|
429
|
+
session's `$PATH`. It is not sufficient to modify the session's `$PATH` in a
|
|
430
|
+
`.bash_profile`.
|
|
409
431
|
|
|
410
432
|
To resolve this issue, prepend the Node installation's `bin` directory to the
|
|
411
433
|
target system's `$PATH`:
|
|
@@ -414,26 +436,26 @@ target system's `$PATH`:
|
|
|
414
436
|
#config/deploy/production.rb
|
|
415
437
|
|
|
416
438
|
set :default_env, {
|
|
417
|
-
"PATH" => "/home/deploy/.nvm/versions/node/
|
|
439
|
+
"PATH" => "/home/deploy/.nvm/versions/node/v22.11.0/bin:$PATH"
|
|
418
440
|
}
|
|
419
441
|
```
|
|
420
442
|
|
|
421
443
|
The system in this example is using `nvm` to configure the node version. If
|
|
422
444
|
you're not using `nvm`, make sure the string you prepend to the `$PATH` variable
|
|
423
|
-
contains the directory or directories that contain the
|
|
424
|
-
|
|
445
|
+
contains the directory or directories that contain the executables above. Point
|
|
446
|
+
it at a NodeJS that satisfies the Ember application's `engines.node`:
|
|
447
|
+
applications generated with `ember-cli >= 6.8` require NodeJS `>= 20.19.0`.
|
|
425
448
|
|
|
426
449
|
#### For faster deployments
|
|
427
450
|
|
|
428
451
|
Place the following in your `deploy/<environment>.rb`
|
|
429
452
|
|
|
430
453
|
```ruby
|
|
431
|
-
set :linked_dirs, %w{<ember-app-name>/node_modules
|
|
454
|
+
set :linked_dirs, %w{<ember-app-name>/node_modules}
|
|
432
455
|
```
|
|
433
456
|
|
|
434
|
-
to avoid rebuilding all the node modules
|
|
435
|
-
|
|
436
|
-
`frontend`).
|
|
457
|
+
to avoid rebuilding all the node modules with every deploy. Replace
|
|
458
|
+
`<ember-app-name>` with the name of your ember app (default is `frontend`).
|
|
437
459
|
|
|
438
460
|
## Override
|
|
439
461
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/ember-cli-rails.rb
CHANGED
|
File without changes
|
data/lib/ember_cli/app.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
1
3
|
require "html_page/renderer"
|
|
2
4
|
require "ember_cli/path_set"
|
|
3
5
|
require "ember_cli/shell"
|
|
@@ -91,14 +93,33 @@ module EmberCli
|
|
|
91
93
|
deploy.mountable?
|
|
92
94
|
end
|
|
93
95
|
|
|
94
|
-
def
|
|
95
|
-
|
|
96
|
+
def package_manager
|
|
97
|
+
paths.package_manager
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def yarn?
|
|
101
|
+
paths.yarn?
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def pnpm?
|
|
105
|
+
paths.pnpm?
|
|
96
106
|
end
|
|
97
107
|
|
|
98
108
|
def bower?
|
|
99
109
|
paths.bower_json.exist?
|
|
100
110
|
end
|
|
101
111
|
|
|
112
|
+
def node_engine
|
|
113
|
+
package_json_value("engines", "node")
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# The `packageManager` field of the application's `package.json`, such as
|
|
117
|
+
# `"pnpm@10.0.0"`: the package manager version Corepack and Heroku's
|
|
118
|
+
# NodeJS buildpack install.
|
|
119
|
+
def package_manager_spec
|
|
120
|
+
package_json_value("packageManager")
|
|
121
|
+
end
|
|
122
|
+
|
|
102
123
|
def to_rack
|
|
103
124
|
deploy.to_rack
|
|
104
125
|
end
|
|
@@ -123,6 +144,16 @@ module EmberCli
|
|
|
123
144
|
|
|
124
145
|
private
|
|
125
146
|
|
|
147
|
+
def package_json_value(*keys)
|
|
148
|
+
package_json = paths.package_json
|
|
149
|
+
|
|
150
|
+
if package_json.exist?
|
|
151
|
+
JSON.parse(package_json.read).dig(*keys)
|
|
152
|
+
end
|
|
153
|
+
rescue JSON::ParserError
|
|
154
|
+
nil
|
|
155
|
+
end
|
|
156
|
+
|
|
126
157
|
def development?
|
|
127
158
|
env.to_s == "development"
|
|
128
159
|
end
|
|
File without changes
|
data/lib/ember_cli/command.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/ember_cli/dev_server.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/ember_cli/engine.rb
CHANGED
|
@@ -3,5 +3,13 @@ module EmberCli
|
|
|
3
3
|
initializer "ember-cli-rails.setup" do
|
|
4
4
|
require "ember_cli/route_helpers"
|
|
5
5
|
end
|
|
6
|
+
|
|
7
|
+
# Rails 7.1 and later manage the deprecators of engines with the
|
|
8
|
+
# application's own, so that `config.active_support.deprecation` applies.
|
|
9
|
+
initializer "ember-cli-rails.deprecator" do |app|
|
|
10
|
+
if app.respond_to?(:deprecators)
|
|
11
|
+
app.deprecators[:ember_cli_rails] = EmberCli.deprecator
|
|
12
|
+
end
|
|
13
|
+
end
|
|
6
14
|
end
|
|
7
15
|
end
|
data/lib/ember_cli/errors.rb
CHANGED
|
File without changes
|
data/lib/ember_cli/helpers.rb
CHANGED
|
File without changes
|
data/lib/ember_cli/path_set.rb
CHANGED
|
@@ -2,6 +2,15 @@ require "ember_cli/helpers"
|
|
|
2
2
|
|
|
3
3
|
module EmberCli
|
|
4
4
|
class PathSet
|
|
5
|
+
PACKAGE_MANAGERS = %i[npm yarn pnpm].freeze
|
|
6
|
+
|
|
7
|
+
# npm ships with NodeJS, so it has no installation instructions of its own
|
|
8
|
+
# to point at when its executable is missing.
|
|
9
|
+
INSTALL_INSTRUCTIONS = {
|
|
10
|
+
yarn: "https://yarnpkg.com/lang/en/docs/install/",
|
|
11
|
+
pnpm: "https://pnpm.io/installation",
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
5
14
|
def initialize(app:, rails_root:, ember_cli_root:, environment:)
|
|
6
15
|
@app = app
|
|
7
16
|
@rails_root = rails_root
|
|
@@ -35,6 +44,10 @@ module EmberCli
|
|
|
35
44
|
@gemfile ||= root.join("Gemfile")
|
|
36
45
|
end
|
|
37
46
|
|
|
47
|
+
def package_json
|
|
48
|
+
@package_json ||= root.join("package.json")
|
|
49
|
+
end
|
|
50
|
+
|
|
38
51
|
def bower_json
|
|
39
52
|
root.join("bower.json")
|
|
40
53
|
end
|
|
@@ -117,21 +130,59 @@ module EmberCli
|
|
|
117
130
|
|
|
118
131
|
def yarn
|
|
119
132
|
if yarn?
|
|
120
|
-
@yarn ||=
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
133
|
+
@yarn ||= package_manager_executable(:yarn)
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def pnpm
|
|
138
|
+
if pnpm?
|
|
139
|
+
@pnpm ||= package_manager_executable(:pnpm)
|
|
140
|
+
end
|
|
141
|
+
end
|
|
124
142
|
|
|
125
|
-
|
|
143
|
+
def node_modules
|
|
144
|
+
@node_modules ||= root.join("node_modules")
|
|
145
|
+
end
|
|
126
146
|
|
|
127
|
-
|
|
147
|
+
# The package manager that installs the application's NodeJS
|
|
148
|
+
# dependencies: the one the `package_manager` option names, else the one
|
|
149
|
+
# whose executable a `yarn_path` or `pnpm_path` option names, else npm.
|
|
150
|
+
# The deprecated `yarn: true` still selects yarn, with a warning.
|
|
151
|
+
def package_manager
|
|
152
|
+
@package_manager ||= begin
|
|
153
|
+
requested = app_options[:package_manager]
|
|
154
|
+
|
|
155
|
+
if requested.present?
|
|
156
|
+
requested.to_s.to_sym.tap do |name|
|
|
157
|
+
unless PACKAGE_MANAGERS.include?(name)
|
|
158
|
+
fail ArgumentError,
|
|
159
|
+
"Unsupported package manager #{requested.inspect} for " \
|
|
160
|
+
"`#{app_name}`; use one of #{PACKAGE_MANAGERS.inspect}"
|
|
161
|
+
end
|
|
128
162
|
end
|
|
163
|
+
elsif app_options[:yarn].present?
|
|
164
|
+
EmberCli.deprecator.warn(
|
|
165
|
+
"The `yarn` option of the `#{app_name}` Ember application is " \
|
|
166
|
+
"deprecated; configure it with `package_manager: :yarn` instead",
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
:yarn
|
|
170
|
+
elsif app_options[:yarn_path].present?
|
|
171
|
+
:yarn
|
|
172
|
+
elsif app_options[:pnpm_path].present?
|
|
173
|
+
:pnpm
|
|
174
|
+
else
|
|
175
|
+
:npm
|
|
129
176
|
end
|
|
130
177
|
end
|
|
131
178
|
end
|
|
132
179
|
|
|
133
|
-
def
|
|
134
|
-
|
|
180
|
+
def yarn?
|
|
181
|
+
package_manager == :yarn
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def pnpm?
|
|
185
|
+
package_manager == :pnpm
|
|
135
186
|
end
|
|
136
187
|
|
|
137
188
|
def tee
|
|
@@ -161,16 +212,17 @@ module EmberCli
|
|
|
161
212
|
end
|
|
162
213
|
end
|
|
163
214
|
|
|
164
|
-
def
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
end
|
|
170
|
-
end
|
|
215
|
+
def package_manager_executable(name)
|
|
216
|
+
path_for_executable(name.to_s).tap do |path|
|
|
217
|
+
unless File.executable?(path.to_s)
|
|
218
|
+
fail DependencyError.new(<<-MSG.strip_heredoc)
|
|
219
|
+
EmberCLI has been configured to install NodeJS dependencies with #{name}, but the #{name} executable is unavailable.
|
|
171
220
|
|
|
172
|
-
|
|
173
|
-
|
|
221
|
+
Install it by following the instructions at #{INSTALL_INSTRUCTIONS.fetch(name)}
|
|
222
|
+
|
|
223
|
+
MSG
|
|
224
|
+
end
|
|
225
|
+
end
|
|
174
226
|
end
|
|
175
227
|
|
|
176
228
|
def app_name
|
|
File without changes
|
data/lib/ember_cli/runner.rb
CHANGED
|
File without changes
|
data/lib/ember_cli/shell.rb
CHANGED
|
@@ -69,8 +69,11 @@ module EmberCli
|
|
|
69
69
|
clean_ember_dependencies!
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
case paths.package_manager
|
|
73
|
+
when :yarn
|
|
73
74
|
run! "#{paths.yarn} install"
|
|
75
|
+
when :pnpm
|
|
76
|
+
run! "#{paths.pnpm} install"
|
|
74
77
|
else
|
|
75
78
|
run! "#{paths.npm} prune && #{paths.npm} install"
|
|
76
79
|
end
|
|
File without changes
|
data/lib/ember_cli/version.rb
CHANGED
data/lib/ember_cli.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require "fileutils"
|
|
2
|
+
require "active_support/deprecation"
|
|
2
3
|
require "ember-cli-rails-assets"
|
|
3
4
|
require "ember_cli/engine"
|
|
4
5
|
require "ember_cli/configuration"
|
|
@@ -16,6 +17,10 @@ module EmberCli
|
|
|
16
17
|
Configuration.instance
|
|
17
18
|
end
|
|
18
19
|
|
|
20
|
+
def deprecator
|
|
21
|
+
@deprecator ||= ActiveSupport::Deprecation.new("1.0", "ember-cli-rails")
|
|
22
|
+
end
|
|
23
|
+
|
|
19
24
|
def app(name)
|
|
20
25
|
apps.fetch(name) do
|
|
21
26
|
fail KeyError, "#{name.inspect} app is not defined"
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
Description:
|
|
2
2
|
Configures a project for deploying to Heroku.
|
|
3
3
|
|
|
4
|
-
Once the generator is complete,
|
|
4
|
+
Once the generator is complete, add the buildpacks the deploy needs:
|
|
5
5
|
|
|
6
6
|
$ heroku buildpacks:clear
|
|
7
7
|
$ heroku buildpacks:add --index 1 heroku/nodejs
|
|
8
8
|
$ heroku buildpacks:add --index 2 heroku/ruby
|
|
9
|
+
|
|
10
|
+
`SKIP_EMBER` skips the build wherever it is set. Unset it on the Heroku
|
|
11
|
+
application, so that `assets:precompile` compiles the EmberCLI
|
|
12
|
+
applications at deploy time:
|
|
13
|
+
|
|
9
14
|
$ heroku config:unset SKIP_EMBER
|
|
10
15
|
|
|
11
16
|
Example:
|
|
12
17
|
rails generate ember:heroku
|
|
13
18
|
|
|
14
|
-
This will install the following gems:
|
|
15
|
-
rails_12factor
|
|
16
|
-
|
|
17
19
|
This will create:
|
|
18
20
|
package.json
|
|
21
|
+
|
|
22
|
+
An application configured with `yarn` also creates:
|
|
23
|
+
yarn.lock
|
|
24
|
+
|
|
25
|
+
Run the generator again whenever you add an EmberCLI application: the
|
|
26
|
+
generated `cacheDirectories` names each application's `node_modules`.
|
|
@@ -9,17 +9,53 @@ module EmberCli
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def identify_as_yarn_project
|
|
12
|
-
if EmberCli.any?(&:
|
|
12
|
+
if EmberCli.any?(&:yarn?)
|
|
13
13
|
template "yarn.lock.erb", "yarn.lock"
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def
|
|
18
|
-
|
|
17
|
+
def identify_as_pnpm_project
|
|
18
|
+
if EmberCli.any?(&:pnpm?)
|
|
19
|
+
template "pnpm-lock.yaml.erb", "pnpm-lock.yaml"
|
|
20
|
+
end
|
|
19
21
|
end
|
|
20
22
|
|
|
21
23
|
private
|
|
22
24
|
|
|
25
|
+
def node_engine
|
|
26
|
+
unless defined?(@node_engine)
|
|
27
|
+
@node_engine = shared_declaration("engines.node", &:node_engine)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
@node_engine
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def package_manager_spec
|
|
34
|
+
unless defined?(@package_manager_spec)
|
|
35
|
+
@package_manager_spec = shared_declaration("packageManager", &:package_manager_spec)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
@package_manager_spec
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# The value every Ember application declares for a `package.json` field, or nil when they declare different ones:
|
|
42
|
+
# the generated `package.json` can only carry one, and picking either would silently break the other application's build.
|
|
43
|
+
def shared_declaration(field)
|
|
44
|
+
declared = apps.map { |app| yield app }.compact.uniq
|
|
45
|
+
|
|
46
|
+
if declared.size > 1
|
|
47
|
+
say_status(
|
|
48
|
+
:conflict,
|
|
49
|
+
"Ember applications declare different `#{field}` (#{declared.join(", ")}); pin one in package.json by hand",
|
|
50
|
+
:red,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
nil
|
|
54
|
+
else
|
|
55
|
+
declared.first
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
23
59
|
def cache_directories
|
|
24
60
|
all_cached_directories.map do |cached_directory|
|
|
25
61
|
cached_directory.relative_path_from(Rails.root).to_s
|
|
@@ -38,12 +74,6 @@ module EmberCli
|
|
|
38
74
|
[Rails.root.join("node_modules")]
|
|
39
75
|
end
|
|
40
76
|
|
|
41
|
-
def app_paths
|
|
42
|
-
EmberCli.apps.values.map do |app|
|
|
43
|
-
app.root_path.relative_path_from(Rails.root)
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
77
|
def apps
|
|
48
78
|
EmberCli.apps.values
|
|
49
79
|
end
|
|
@@ -4,5 +4,13 @@
|
|
|
4
4
|
"bower": "*"
|
|
5
5
|
},
|
|
6
6
|
<% end %>
|
|
7
|
+
<% if package_manager_spec %>
|
|
8
|
+
"packageManager": <%= package_manager_spec.to_json %>,
|
|
9
|
+
<% end %>
|
|
10
|
+
<% if node_engine %>
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": <%= node_engine.to_json %>
|
|
13
|
+
},
|
|
14
|
+
<% end %>
|
|
7
15
|
"cacheDirectories": <%= cache_directories.to_json %>
|
|
8
16
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/tasks/ember-cli.rake
CHANGED
|
File without changes
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ember-cli-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.14.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pavel Pravosud
|
|
@@ -194,6 +194,7 @@ files:
|
|
|
194
194
|
- lib/generators/ember/heroku/USAGE
|
|
195
195
|
- lib/generators/ember/heroku/heroku_generator.rb
|
|
196
196
|
- lib/generators/ember/heroku/templates/package.json.erb
|
|
197
|
+
- lib/generators/ember/heroku/templates/pnpm-lock.yaml.erb
|
|
197
198
|
- lib/generators/ember/heroku/templates/yarn.lock.erb
|
|
198
199
|
- lib/generators/ember/init/USAGE
|
|
199
200
|
- lib/generators/ember/init/init_generator.rb
|
|
@@ -217,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
217
218
|
- !ruby/object:Gem::Version
|
|
218
219
|
version: '0'
|
|
219
220
|
requirements: []
|
|
220
|
-
rubygems_version: 4.0.
|
|
221
|
+
rubygems_version: 4.0.16
|
|
221
222
|
specification_version: 4
|
|
222
223
|
summary: Integration between Ember CLI and Rails
|
|
223
224
|
test_files: []
|