webpacker-pnpm 1.2.0 → 1.2.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/.gitignore +5 -2
- data/.rubocop.yml +25 -91
- data/.travis.yml +20 -23
- data/CHANGELOG.md +18 -0
- data/Gemfile +0 -9
- data/README.md +5 -3
- data/Rakefile +1 -1
- data/lib/webpacker/pnpm/railtie.rb +14 -5
- data/lib/webpacker/pnpm/version.rb +3 -1
- data/lib/webpacker/tasks/check_pnpm.rake +21 -6
- data/lib/webpacker/tasks/env.rake +5 -3
- data/lib/webpacker/tasks/pnpm_install.rake +3 -3
- data/test/rake_tasks_test.rb +38 -47
- data/test/test_app/bin/rails +4 -6
- data/test/test_app/bin/rake +4 -6
- data/test/test_app/bin/setup +25 -27
- data/test/test_app/bin/webpack +2 -1
- data/test/test_app/bin/webpack-dev-server +2 -1
- data/test/test_app/config.ru +1 -1
- data/test/test_app/config/boot.rb +5 -0
- data/test/test_helper.rb +2 -5
- data/webpacker-pnpm.gemspec +21 -13
- metadata +68 -40
- data/gemfiles/Gemfile-rails-edge +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ccdea9b9cf8d7a874d90f5bb13f6f20f9229bfcc232085f8d48ec4fb657168e
|
4
|
+
data.tar.gz: bc53eb621ea514efaf2da1891a0e6dcc4c9dad43f217b923ddb479de705b3104
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2091d6c417fcaf65e24bb54f8402001f049b7efa5e4d1bde7594a80f0f87fc5d1a97ea6272012042b3ee1f7980244b728c13b5bdc5ead9b1e69af7a3f4de3b4
|
7
|
+
data.tar.gz: 9932710c5d083577ad15eac9f9086da2355e810e58e84a5d5a4dbda7db9925f14da97c6d6f8c6070f8b33428ede8433ed3a30ddcd2bfd934034b6a32d6d0faff
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,91 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
#
|
19
|
-
# to
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
# to trust your decision making.
|
27
|
-
Lint/UselessAccessModifier:
|
28
|
-
Enabled: false
|
29
|
-
|
30
|
-
# flag potential memory leaks, like when opening a file.
|
31
|
-
Style/AutoResourceCleanup:
|
32
|
-
Enabled: true
|
33
|
-
|
34
|
-
# single quotes are meant for single characters. double quotes are meant for
|
35
|
-
# strings, which are arrays of multiple characters. there are a whole host of
|
36
|
-
# other differences and functions; if you're creating a string, you nearly always
|
37
|
-
# should use double quotes.
|
38
|
-
#
|
39
|
-
# https://en.wikipedia.org/wiki/Delimiter#Bracket_delimiters
|
40
|
-
# Schwartz, Randal (2005). Learning Perl. ISBN 978-0-596-10105-3.
|
41
|
-
Style/StringLiterals:
|
42
|
-
Enabled: true
|
43
|
-
EnforcedStyle: double_quotes
|
44
|
-
|
45
|
-
# flags methods that violate the default ABC magnitude (15). The ABC metric
|
46
|
-
# quantizes the size of a method, and is calculated based on the number of
|
47
|
-
# assignment operations, possible execution branches, and number of conditionals.
|
48
|
-
#
|
49
|
-
# https://en.wikipedia.org/wiki/ABC_Software_Metric
|
50
|
-
Metrics/AbcSize:
|
51
|
-
Enabled: true
|
52
|
-
IgnoredMethods:
|
53
|
-
- test_rake_tasks
|
54
|
-
- chdir_concurrent
|
55
|
-
|
56
|
-
# this simply doesn't work in a cross-platform development environment. Bit
|
57
|
-
# flags across UNIX and Windows platforms are volatile, and thus there is no
|
58
|
-
# way to ensure this passes besides explicitly granting execute permissions
|
59
|
-
# in CI config (which would defeat the purpose).
|
60
|
-
Lint/ScriptPermission:
|
61
|
-
Enabled: false
|
62
|
-
|
63
|
-
Layout/SpaceAroundMethodCallOperator:
|
64
|
-
Enabled: true
|
65
|
-
|
66
|
-
Lint/RaiseException:
|
67
|
-
Enabled: true
|
68
|
-
|
69
|
-
Lint/StructNewOverride:
|
70
|
-
Enabled: true
|
71
|
-
|
72
|
-
Style/ExponentialNotation:
|
73
|
-
Enabled: true
|
74
|
-
|
75
|
-
Style/HashEachMethods:
|
76
|
-
Enabled: true
|
77
|
-
|
78
|
-
Style/HashTransformKeys:
|
79
|
-
Enabled: true
|
80
|
-
|
81
|
-
Style/HashTransformValues:
|
82
|
-
Enabled: true
|
83
|
-
|
84
|
-
Layout/EmptyLinesAroundAttributeAccessor:
|
85
|
-
Enabled: true
|
86
|
-
|
87
|
-
Style/SlicingWithRange:
|
88
|
-
Enabled: true
|
89
|
-
|
90
|
-
Style/RescueModifier:
|
91
|
-
Enabled: false
|
1
|
+
#
|
2
|
+
# RuboCop is a Ruby static code analyzer and code formatter that tries to enforce many of
|
3
|
+
# the guidelines outlined in the community Ruby and Rails
|
4
|
+
# style guides.
|
5
|
+
#
|
6
|
+
# https://docs.rubocop.org/en/latest/
|
7
|
+
# https://rubystyle.guide/
|
8
|
+
# https://rails.rubystyle.guide/
|
9
|
+
inherit_gem:
|
10
|
+
practical-pig: rubocop-base.yaml
|
11
|
+
inherit_mode:
|
12
|
+
merge:
|
13
|
+
- Include
|
14
|
+
- Exclude
|
15
|
+
- IgnoredMethods
|
16
|
+
- AllowedMethods
|
17
|
+
|
18
|
+
# cop-specific excludes are not inherited for some reason (likely a bug in RuboCop) so we
|
19
|
+
# need to manually re-omit the intended files and directories.
|
20
|
+
Layout/LineLength:
|
21
|
+
Exclude:
|
22
|
+
- "**/config/initializers/**/*"
|
23
|
+
Style/MethodCallWithArgsParentheses:
|
24
|
+
Exclude:
|
25
|
+
- "**/Gemfile"
|
data/.travis.yml
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
language: ruby
|
2
|
-
os: linux
|
3
2
|
dist: bionic
|
4
|
-
|
5
|
-
-
|
6
|
-
-
|
3
|
+
os:
|
4
|
+
- linux
|
5
|
+
- osx
|
6
|
+
|
7
|
+
cache:
|
8
|
+
bundler: true
|
9
|
+
npm: true
|
10
|
+
directories:
|
11
|
+
- "~/.pnpm-store"
|
7
12
|
rvm:
|
8
|
-
- 2.4.
|
13
|
+
- 2.4.10
|
9
14
|
- 2.5.5
|
10
15
|
- 2.6.5
|
11
16
|
- 2.7.0
|
@@ -13,33 +18,25 @@ rvm:
|
|
13
18
|
gemfile:
|
14
19
|
- gemfiles/Gemfile-rails.5.2.x
|
15
20
|
- gemfiles/Gemfile-rails.6.0.x
|
16
|
-
- gemfiles/Gemfile-rails-edge
|
17
|
-
cache:
|
18
|
-
bundler: true
|
19
|
-
npm: false
|
20
|
-
yarn: false
|
21
|
-
directories:
|
22
|
-
- node_modules
|
23
|
-
- "~/.pnpm-store"
|
24
21
|
|
25
|
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
-
|
22
|
+
before_install:
|
23
|
+
- gem install rubygems-update && update_rubygems
|
24
|
+
- yes | rvm @global do gem install bundler -v 2.1.4 || true
|
25
|
+
- nvm install --lts
|
29
26
|
- curl -L https://raw.githubusercontent.com/pnpm/self-installer/master/install.js | node
|
30
27
|
- pnpm config set store-dir ~/.pnpm-store
|
28
|
+
- bundle config set path 'vendor/bundle'
|
29
|
+
install:
|
30
|
+
- bundle install --jobs 3 --retry 3
|
31
31
|
- pnpm install --frozen-lockfile
|
32
32
|
script:
|
33
33
|
- bundle exec rubocop
|
34
34
|
- bundle exec rake test
|
35
|
+
|
35
36
|
jobs:
|
37
|
+
fast_finish: true
|
36
38
|
allow_failures:
|
37
|
-
- gemfile: gemfiles/Gemfile-rails-edge
|
38
39
|
- rvm: ruby-head
|
39
40
|
exclude:
|
40
|
-
- rvm: 2.4.
|
41
|
-
gemfile: gemfiles/Gemfile-rails-edge
|
42
|
-
- rvm: 2.5.5
|
43
|
-
gemfile: gemfiles/Gemfile-rails-edge
|
44
|
-
- rvm: 2.4.9
|
41
|
+
- rvm: 2.4.10
|
45
42
|
gemfile: gemfiles/Gemfile-rails.6.0.x
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
The format is based on Keep a Changelog (<https://keepachangelog.com/en/1.0.0/>). This project adheres to Semantic Versioning (<https://semver.org/spec/v2.0.0.html>).
|
6
6
|
|
7
|
+
## [v1.2.1] - 2020-05-16
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- Informative error messages when pnpm is not installed.
|
12
|
+
- Pessimistic gem dependency version specifications to avoid installation conflicts.
|
13
|
+
- Full-length gem description.
|
14
|
+
- Forced shameful hoisting of installed pnpm dependencies via `webpacker:pnpm_install`.
|
15
|
+
- Practical Pig development dependency for external RuboCop linting.
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
|
19
|
+
- Commented and adjusted RuboCop formatting rules to clarify design decisions.
|
20
|
+
|
21
|
+
### Removed
|
22
|
+
|
23
|
+
- Testing configs for bleeding-edge Rails.
|
24
|
+
|
7
25
|
## [v1.2.0] - 2020-05-14
|
8
26
|
|
9
27
|
### Added
|
data/Gemfile
CHANGED
@@ -3,15 +3,6 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem "rack-proxy", require: false
|
7
|
-
gem "rails", ">= 5.2"
|
8
|
-
gem "rake", ">= 12.3.3"
|
9
|
-
gem "semantic_range", require: false
|
10
|
-
|
11
6
|
install_if -> { Gem.win_platform? } do
|
12
7
|
gem "tzinfo-data"
|
13
8
|
end
|
14
|
-
|
15
|
-
group :test do
|
16
|
-
gem "minitest", ">= 5"
|
17
|
-
end
|
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# webpacker-pnpm
|
2
2
|
|
3
|
-

|
3
|
+
[](https://rubygems.org/gems/webpacker-pnpm)
|
4
4
|
[](https://travis-ci.org/github/thearchitector/webpacker-pnpm)
|
5
|
-

|
5
|
+
[](https://rubygems.org/gems/webpacker-pnpm)
|
6
6
|
[](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
7
7
|
|
8
|
-
`webpacker-pnpm` replaces Rails' Yarn environment with [pnpm](https://pnpm.js.org/),
|
8
|
+
`webpacker-pnpm` replaces Rails' Yarn environment with [pnpm](https://pnpm.js.org/), a better, smarter, and more efficient Node.js package manager. As a result, applications become less prone to dependency hell, more functional, more stable, and more flexible. And as an added bonus, dependency resolution times and `node_modules` folder sizes reduce to within reasonable ranges (not 45 seconds and 10 GiB).
|
9
|
+
|
10
|
+
You can read about the philosophy and technology behind `pnpm` in [this convincing blog post](https://www.kochan.io/nodejs/why-should-we-use-pnpm) by Zoltan Kochan (<https://www.kochan.io/nodejs/why-should-we-use-pnpm>).
|
9
11
|
|
10
12
|
## Features
|
11
13
|
|
data/Rakefile
CHANGED
@@ -5,8 +5,6 @@ require "rails/railtie"
|
|
5
5
|
module Webpacker
|
6
6
|
module PNPM
|
7
7
|
class Railtie < Rails::Railtie
|
8
|
-
private
|
9
|
-
|
10
8
|
rake_tasks do
|
11
9
|
# load all the rake tasks within the `tasks` directory
|
12
10
|
Dir[File.join(File.dirname(__FILE__), "../tasks/**/*.rake")].each do |task|
|
@@ -14,10 +12,21 @@ module Webpacker
|
|
14
12
|
end
|
15
13
|
end
|
16
14
|
|
17
|
-
# manually specify bin path to skip Yarn execution during
|
18
|
-
# initialization
|
15
|
+
# manually specify node_modules bin path to skip Yarn execution during
|
16
|
+
# Webpack runner initialization
|
19
17
|
config.before_configuration do
|
20
|
-
|
18
|
+
begin
|
19
|
+
ENV["WEBPACKER_NODE_MODULES_BIN_PATH"] ||= File.join(`pnpm root`.chomp, ".bin")
|
20
|
+
rescue Errno::ENOENT
|
21
|
+
# use abort instead of Rails' logger because it doesn't show up when
|
22
|
+
# run within Rake tasks
|
23
|
+
abort(
|
24
|
+
<<~HEREDOC.squish
|
25
|
+
\e[31m[FATAL] pnpm is not installed or not present in $PATH.
|
26
|
+
Install pnpm and try again.\e[0m
|
27
|
+
HEREDOC
|
28
|
+
)
|
29
|
+
end
|
21
30
|
end
|
22
31
|
end
|
23
32
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "semantic_range"
|
4
|
+
|
4
5
|
namespace :webpacker do
|
5
6
|
desc "Verifies if pnpm is installed"
|
6
7
|
task check_pnpm: [:environment] do
|
@@ -10,17 +11,31 @@ namespace :webpacker do
|
|
10
11
|
pnpm_version = `pnpm --version`.chomp
|
11
12
|
raise Errno::ENOENT if pnpm_version.blank?
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
begin
|
15
|
+
pnpm_range = ">= 3.0.0"
|
16
|
+
is_unsupported = SemanticRange.satisfies?(pnpm_version, pnpm_range)
|
17
|
+
rescue StandardError
|
18
|
+
is_unsupported = false
|
19
|
+
end
|
15
20
|
|
16
21
|
unless is_unsupported
|
17
|
-
warn
|
18
|
-
|
22
|
+
warn(
|
23
|
+
<<~HEREDOC.squish
|
24
|
+
Webpacker requires pnpm \"#{pnpm_range}\" and you are using #{pnpm_version}.
|
25
|
+
Please upgrade pnpm https://pnpm.js.org/en/installation/.
|
26
|
+
HEREDOC
|
27
|
+
)
|
28
|
+
warn("Exiting!")
|
19
29
|
exit!
|
20
30
|
end
|
21
31
|
rescue Errno::ENOENT
|
22
|
-
warn
|
23
|
-
|
32
|
+
warn(
|
33
|
+
<<~HEREDOC.squish
|
34
|
+
pnpm is not installed. Please download and install pnpm from
|
35
|
+
https://pnpm.js.org/en/installation/.
|
36
|
+
HEREDOC
|
37
|
+
)
|
38
|
+
warn("Exiting!")
|
24
39
|
exit!
|
25
40
|
end
|
26
41
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require "webpacker/version"
|
4
4
|
|
5
5
|
namespace :webpacker do
|
6
|
-
desc "Provide information on Webpacker's environment"
|
6
|
+
desc "Provide information on Webpacker's current environment"
|
7
7
|
task env: [:environment] do
|
8
8
|
$stdout.puts "Ruby: #{`ruby --version`}"
|
9
9
|
$stdout.puts "Rails: #{Rails.version}"
|
@@ -14,7 +14,9 @@ namespace :webpacker do
|
|
14
14
|
$stdout.puts "\n"
|
15
15
|
$stdout.puts "@rails/webpacker: \n#{`npm list @rails/webpacker version`}"
|
16
16
|
|
17
|
-
$stdout.puts "Is bin/webpack present?: #{File.exist?
|
18
|
-
$stdout.puts
|
17
|
+
$stdout.puts "Is bin/webpack present?: #{File.exist?("bin/webpack")}"
|
18
|
+
$stdout.puts <<~HEREDOC.squish
|
19
|
+
Is bin/webpack-dev-server present?: #{File.exist?("bin/webpack-dev-server")}
|
20
|
+
HEREDOC
|
19
21
|
end
|
20
22
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
namespace :webpacker do
|
4
|
-
desc "
|
4
|
+
desc "Install all JavaScript dependencies as specified via pnpm."
|
5
5
|
task pnpm_install: [:environment] do
|
6
|
-
valid_node_envs =
|
6
|
+
valid_node_envs = ["test", "development", "production"]
|
7
7
|
|
8
8
|
node_env = ENV.fetch("NODE_ENV") do
|
9
9
|
valid_node_envs.include?(Rails.env) ? Rails.env : "production"
|
10
10
|
end
|
11
11
|
|
12
|
-
system({ "NODE_ENV" => node_env }, "pnpm i --frozen-lockfile")
|
12
|
+
system({ "NODE_ENV" => node_env }, "pnpm i --frozen-lockfile --shamefully-hoist")
|
13
13
|
end
|
14
14
|
end
|
data/test/rake_tasks_test.rb
CHANGED
@@ -7,82 +7,73 @@ module Webpacker
|
|
7
7
|
class RakeTasksTest < Test
|
8
8
|
def test_rake_tasks
|
9
9
|
output = chdir_concurrent(test_path, "bundle exec rake --tasks")
|
10
|
-
assert_includes
|
11
|
-
assert_includes
|
12
|
-
assert_includes
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
assert_includes output, "webpacker:env"
|
19
|
-
assert_includes output, "webpacker:install"
|
20
|
-
assert_includes output, "webpacker:install:angular"
|
21
|
-
assert_includes output, "webpacker:install:coffee"
|
22
|
-
assert_includes output, "webpacker:install:elm"
|
23
|
-
assert_includes output, "webpacker:install:erb"
|
24
|
-
assert_includes output, "webpacker:install:react"
|
25
|
-
assert_includes output, "webpacker:install:svelte"
|
26
|
-
assert_includes output, "webpacker:install:stimulus"
|
27
|
-
assert_includes output, "webpacker:install:typescript"
|
28
|
-
assert_includes output, "webpacker:install:vue"
|
29
|
-
assert_includes output, "webpacker:pnpm_install"
|
30
|
-
assert_includes output, "webpacker:verify_install"
|
31
|
-
|
32
|
-
assert_not_includes output, "webpacker:check_yarn"
|
33
|
-
assert_not_includes output, "webpacker:yarn_install"
|
34
|
-
assert_not_includes output, "yarn:install"
|
10
|
+
assert_includes(output, "webpacker:check_pnpm")
|
11
|
+
assert_includes(output, "webpacker:pnpm_install")
|
12
|
+
assert_includes(output, "webpacker:env")
|
13
|
+
|
14
|
+
assert_not_includes(output, "webpacker:check_yarn")
|
15
|
+
assert_not_includes(output, "webpacker:yarn_install")
|
16
|
+
assert_not_includes(output, "yarn:install")
|
17
|
+
assert_not_includes(output, "webpacker:info")
|
35
18
|
end
|
36
19
|
|
37
20
|
def test_check_pnpm_version
|
38
|
-
output = chdir_concurrent(test_path, "rake webpacker:check_pnpm
|
39
|
-
assert_not_includes
|
40
|
-
assert_not_includes
|
21
|
+
output = chdir_concurrent(test_path, "rake webpacker:check_pnpm")
|
22
|
+
assert_not_includes(output, "pnpm is not installed")
|
23
|
+
assert_not_includes(output, "Webpacker requires pnpm")
|
41
24
|
|
42
|
-
assert_includes
|
25
|
+
assert_includes(output, "Verifying pnpm version...")
|
43
26
|
end
|
44
27
|
|
45
28
|
def test_override_check_yarn_version
|
46
|
-
output = chdir_concurrent(test_path, "rake webpacker:check_yarn
|
47
|
-
assert_not_includes
|
48
|
-
assert_not_includes
|
29
|
+
output = chdir_concurrent(test_path, "rake webpacker:check_yarn")
|
30
|
+
assert_not_includes(output, "pnpm is not installed")
|
31
|
+
assert_not_includes(output, "Webpacker requires pnpm")
|
49
32
|
|
50
|
-
assert_includes
|
33
|
+
assert_includes(output, "Verifying pnpm version...")
|
51
34
|
end
|
52
35
|
|
53
36
|
def test_pnpm_install_in_production_env
|
54
37
|
cmd = "bundle exec rake webpacker:pnpm_install"
|
55
|
-
|
56
|
-
|
57
|
-
assert_not_includes installed_node_modules(temp), "right-pad",
|
38
|
+
chdir_concurrent(test_path, cmd, { "NODE_ENV": "production" },
|
39
|
+
{ isolated: true }) do |temp|
|
40
|
+
assert_not_includes installed_node_modules(temp), "right-pad", <<~HEREDOC
|
41
|
+
Expected only production dependencies to be installed
|
42
|
+
HEREDOC
|
58
43
|
end
|
59
44
|
end
|
60
45
|
|
61
46
|
def test_pnpm_install_in_test_env
|
62
|
-
assert_includes
|
47
|
+
assert_includes(test_app_dev_dependencies, "right-pad")
|
63
48
|
|
64
49
|
cmd = "bundle exec rake webpacker:pnpm_install"
|
65
|
-
|
66
|
-
|
67
|
-
assert_includes installed_node_modules(temp), "right-pad",
|
50
|
+
chdir_concurrent(test_path, cmd, { "NODE_ENV": "test" },
|
51
|
+
{ isolated: true }) do |temp|
|
52
|
+
assert_includes installed_node_modules(temp), "right-pad", <<~HEREDOC
|
53
|
+
Expected dev dependencies to be installed
|
54
|
+
HEREDOC
|
68
55
|
end
|
69
56
|
end
|
70
57
|
|
71
58
|
def test_yarn_install_alias_in_production_env
|
72
59
|
cmd = "bundle exec rake webpacker:yarn_install"
|
73
|
-
|
74
|
-
|
75
|
-
assert_not_includes installed_node_modules(temp), "right-pad",
|
60
|
+
chdir_concurrent(test_path, cmd, { "NODE_ENV": "production" },
|
61
|
+
{ isolated: true }) do |temp|
|
62
|
+
assert_not_includes installed_node_modules(temp), "right-pad", <<~HEREDOC
|
63
|
+
Expected only production dependencies to be installed
|
64
|
+
HEREDOC
|
76
65
|
end
|
77
66
|
end
|
78
67
|
|
79
68
|
def test_yarn_install_alias_in_test_env
|
80
|
-
assert_includes
|
69
|
+
assert_includes(test_app_dev_dependencies, "right-pad")
|
81
70
|
|
82
71
|
cmd = "bundle exec rake webpacker:yarn_install"
|
83
|
-
|
84
|
-
|
85
|
-
assert_includes installed_node_modules(temp), "right-pad",
|
72
|
+
chdir_concurrent(test_path, cmd, { "NODE_ENV": "test" },
|
73
|
+
{ isolated: true }) do |temp|
|
74
|
+
assert_includes installed_node_modules(temp), "right-pad", <<~HEREDOC
|
75
|
+
Expected dev dependencies to be installed
|
76
|
+
HEREDOC
|
86
77
|
end
|
87
78
|
end
|
88
79
|
|
data/test/test_app/bin/rails
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
#!/usr/bin/env ruby.exe
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require_relative "../config/boot"
|
6
|
-
require "rails/commands"
|
1
|
+
#!/usr/bin/env ruby.exe
|
2
|
+
APP_PATH = File.expand_path('../config/application', __dir__)
|
3
|
+
require_relative '../config/boot'
|
4
|
+
require 'rails/commands'
|
data/test/test_app/bin/rake
CHANGED
data/test/test_app/bin/setup
CHANGED
@@ -1,27 +1,25 @@
|
|
1
|
-
#!/usr/bin/env ruby.exe
|
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
|
-
system! "bin/rails restart"
|
27
|
-
end
|
1
|
+
#!/usr/bin/env ruby.exe
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
6
|
+
|
7
|
+
def system!(*args)
|
8
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
9
|
+
end
|
10
|
+
|
11
|
+
FileUtils.chdir APP_ROOT do
|
12
|
+
# This script is a way to setup or update your development environment automatically.
|
13
|
+
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
|
14
|
+
# Add necessary setup steps to this file.
|
15
|
+
|
16
|
+
puts '== Installing dependencies =='
|
17
|
+
system! 'gem install bundler --conservative'
|
18
|
+
system('bundle check') || system!('bundle install')
|
19
|
+
|
20
|
+
puts "\n== Removing old logs and tempfiles =="
|
21
|
+
system! 'bin/rails log:clear tmp:clear'
|
22
|
+
|
23
|
+
puts "\n== Restarting application server =="
|
24
|
+
system! 'bin/rails restart'
|
25
|
+
end
|
data/test/test_app/bin/webpack
CHANGED
@@ -5,7 +5,8 @@ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
|
5
5
|
ENV["NODE_ENV"] ||= ENV["RAILS_ENV"]
|
6
6
|
|
7
7
|
require "pathname"
|
8
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
8
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
9
|
+
Pathname.new(__FILE__).realpath)
|
9
10
|
|
10
11
|
require "bundler/setup"
|
11
12
|
|
@@ -5,7 +5,8 @@ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
|
5
5
|
ENV["NODE_ENV"] ||= ENV["RAILS_ENV"]
|
6
6
|
|
7
7
|
require "pathname"
|
8
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
8
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
9
|
+
Pathname.new(__FILE__).realpath)
|
9
10
|
|
10
11
|
require "bundler/setup"
|
11
12
|
|
data/test/test_app/config.ru
CHANGED
data/test/test_helper.rb
CHANGED
@@ -42,16 +42,13 @@ module Webpacker
|
|
42
42
|
# if we're want an isolated environment, copy the directory contents to
|
43
43
|
# a new temporary directory and change the working directory to it
|
44
44
|
if isolated
|
45
|
-
files = Dir[File.join(dir, "*")].reject
|
46
|
-
f.include?("node_modules")
|
47
|
-
end
|
48
|
-
|
45
|
+
files = Dir[File.join(dir, "*")].reject { |f| f.include?("node_modules") }
|
49
46
|
dir = Dir.mktmpdir
|
50
47
|
FileUtils.cp_r(files, dir)
|
51
48
|
end
|
52
49
|
|
53
50
|
output, = Open3.capture2e(env, "cd #{dir} && #{cmd}", opts)
|
54
|
-
yield(
|
51
|
+
yield(dir) if block_given?
|
55
52
|
ensure
|
56
53
|
# make sure we remove the generated temp directory
|
57
54
|
FileUtils.remove_entry_secure(dir) if isolated
|
data/webpacker-pnpm.gemspec
CHANGED
@@ -7,29 +7,37 @@ require "webpacker/pnpm/version"
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = "webpacker-pnpm"
|
9
9
|
spec.version = Webpacker::PNPM::VERSION
|
10
|
-
spec.
|
11
|
-
spec.email =
|
12
|
-
spec.summary = "Replaces Webpacker's Yarn environment with pnpm"
|
10
|
+
spec.author = "Elias Gabriel"
|
11
|
+
spec.email = "me@eliasfgabriel.com"
|
13
12
|
spec.homepage = "https://github.com/thearchitector/webpacker-pnpm"
|
14
13
|
spec.license = "CC-BY-NC-SA-4.0"
|
15
14
|
|
15
|
+
spec.summary = "Replaces Webpacker's Yarn environment with pnpm."
|
16
|
+
spec.description = <<~HEREDOC.gsub(/[[:space:]]+/, " ").strip
|
17
|
+
webpacker-pnpm minimizes dependency hell, improves code quality stability, and
|
18
|
+
reduces node_modules folder sizes by replacing Webpacker's Yarn environment with pnpm.
|
19
|
+
HEREDOC
|
20
|
+
|
16
21
|
spec.metadata = {
|
17
22
|
"homepage_uri" => spec.homepage,
|
18
|
-
"source_code_uri" => "
|
19
|
-
"changelog_uri" => "
|
23
|
+
"source_code_uri" => "#{spec.homepage}/tree/v#{spec.version}",
|
24
|
+
"changelog_uri" => "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md",
|
25
|
+
"bug_tracker_uri" => "#{spec.homepage}/issues"
|
20
26
|
}
|
21
27
|
|
22
28
|
spec.required_ruby_version = ">= 2.4.0"
|
23
29
|
|
24
|
-
spec.add_dependency "
|
25
|
-
spec.add_dependency "
|
26
|
-
spec.add_dependency "
|
27
|
-
spec.add_dependency "
|
28
|
-
spec.add_dependency "webpacker", "~> 5.x"
|
30
|
+
spec.add_dependency "rails", ">= 5.2"
|
31
|
+
spec.add_dependency "rake", ">= 12.3.3"
|
32
|
+
spec.add_dependency "semantic_range", "~> 2.3"
|
33
|
+
spec.add_dependency "webpacker", "~> 5.0"
|
29
34
|
|
30
|
-
spec.add_development_dependency "
|
31
|
-
spec.add_development_dependency "
|
32
|
-
spec.add_development_dependency "rubocop
|
35
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
36
|
+
spec.add_development_dependency "practical-pig", "~> 1.0"
|
37
|
+
spec.add_development_dependency "rubocop", "~> 0.83.0"
|
38
|
+
spec.add_development_dependency "rubocop-minitest", "~> 0.9"
|
39
|
+
spec.add_development_dependency "rubocop-performance", "~> 1.3"
|
40
|
+
spec.add_development_dependency "rubocop-rails", "~> 2.5"
|
33
41
|
|
34
42
|
spec.files = `git ls-files`.split("\n")
|
35
43
|
spec.test_files = `git ls-files -- test/*`.split("\n")
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpacker-pnpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elias Gabriel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -25,106 +25,135 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 12.3.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 12.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: semantic_range
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.3'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: webpacker
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '5.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '5.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 5.
|
76
|
-
type: :
|
75
|
+
version: '5.0'
|
76
|
+
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 5.
|
82
|
+
version: '5.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: practical-pig
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '1.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '1.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 0.83.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.83.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-minitest
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.9'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
124
|
+
version: '0.9'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-performance
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.3'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.3'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
140
|
name: rubocop-rails
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
114
142
|
requirements:
|
115
|
-
- - "
|
143
|
+
- - "~>"
|
116
144
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
145
|
+
version: '2.5'
|
118
146
|
type: :development
|
119
147
|
prerelease: false
|
120
148
|
version_requirements: !ruby/object:Gem::Requirement
|
121
149
|
requirements:
|
122
|
-
- - "
|
150
|
+
- - "~>"
|
123
151
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
125
|
-
description:
|
126
|
-
|
127
|
-
|
152
|
+
version: '2.5'
|
153
|
+
description: webpacker-pnpm minimizes dependency hell, improves code quality stability,
|
154
|
+
and reduces node_modules folder sizes by replacing Webpacker's Yarn environment
|
155
|
+
with pnpm.
|
156
|
+
email: me@eliasfgabriel.com
|
128
157
|
executables: []
|
129
158
|
extensions: []
|
130
159
|
extra_rdoc_files: []
|
@@ -139,7 +168,6 @@ files:
|
|
139
168
|
- Rakefile
|
140
169
|
- bin/console
|
141
170
|
- bin/setup
|
142
|
-
- gemfiles/Gemfile-rails-edge
|
143
171
|
- gemfiles/Gemfile-rails.5.2.x
|
144
172
|
- gemfiles/Gemfile-rails.6.0.x
|
145
173
|
- lib/webpacker/pnpm.rb
|
@@ -178,8 +206,9 @@ licenses:
|
|
178
206
|
- CC-BY-NC-SA-4.0
|
179
207
|
metadata:
|
180
208
|
homepage_uri: https://github.com/thearchitector/webpacker-pnpm
|
181
|
-
source_code_uri: https://github.com/thearchitector/webpacker-pnpm/tree/v1.2.
|
182
|
-
changelog_uri: https://github.com/thearchitector/webpacker-pnpm/blob/v1.2.
|
209
|
+
source_code_uri: https://github.com/thearchitector/webpacker-pnpm/tree/v1.2.1
|
210
|
+
changelog_uri: https://github.com/thearchitector/webpacker-pnpm/blob/v1.2.1/CHANGELOG.md
|
211
|
+
bug_tracker_uri: https://github.com/thearchitector/webpacker-pnpm/issues
|
183
212
|
post_install_message:
|
184
213
|
rdoc_options: []
|
185
214
|
require_paths:
|
@@ -195,11 +224,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
224
|
- !ruby/object:Gem::Version
|
196
225
|
version: '0'
|
197
226
|
requirements: []
|
198
|
-
|
199
|
-
rubygems_version: 2.7.6.2
|
227
|
+
rubygems_version: 3.1.3
|
200
228
|
signing_key:
|
201
229
|
specification_version: 4
|
202
|
-
summary: Replaces Webpacker's Yarn environment with pnpm
|
230
|
+
summary: Replaces Webpacker's Yarn environment with pnpm.
|
203
231
|
test_files:
|
204
232
|
- test/rake_tasks_test.rb
|
205
233
|
- test/test_app/.gitignore
|
data/gemfiles/Gemfile-rails-edge
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
4
|
-
|
5
|
-
gemspec path: "../"
|
6
|
-
|
7
|
-
gem "rails", github: "rails/rails"
|
8
|
-
gem "arel", github: "rails/arel"
|
9
|
-
gem "rake", ">= 11.1"
|
10
|
-
gem "rack-proxy", require: false
|
11
|
-
gem "minitest", "~> 5.0"
|
12
|
-
gem "byebug"
|