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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e0c39889bfdad4a14a2fc35250e7eaa33fd49bf48ecc082c44d1985884fbe89
4
- data.tar.gz: 8f27fae2d742a2b4c27e0fa675480dda85771bfd120e283fa706c80ce7414fa5
3
+ metadata.gz: 9ccdea9b9cf8d7a874d90f5bb13f6f20f9229bfcc232085f8d48ec4fb657168e
4
+ data.tar.gz: bc53eb621ea514efaf2da1891a0e6dcc4c9dad43f217b923ddb479de705b3104
5
5
  SHA512:
6
- metadata.gz: 8715f49514245b10d8ed85169c5edadcb2ab8905880f9afdd273121835336c175dec087f05b639179024eeea4fc1745ca24c73d00c24fc92d06bbb85ab591d02
7
- data.tar.gz: fd7a0f6cc602c9a7d4ba0a2689fc87feae4d7f93c470c9c5fc8b7f62cfd364fd3152839448150a58c523a0e516aa229eed3d9d07cc1083ed0b4ecaeb9938a5b8
6
+ metadata.gz: c2091d6c417fcaf65e24bb54f8402001f049b7efa5e4d1bde7594a80f0f87fc5d1a97ea6272012042b3ee1f7980244b728c13b5bdc5ead9b1e69af7a3f4de3b4
7
+ data.tar.gz: 9932710c5d083577ad15eac9f9086da2355e810e58e84a5d5a4dbda7db9925f14da97c6d6f8c6070f8b33428ede8433ed3a30ddcd2bfd934034b6a32d6d0faff
data/.gitignore CHANGED
@@ -1,3 +1,6 @@
1
1
  /tmp/
2
- /**/*.log
3
- Gemfile.lock
2
+ **/log
3
+ Gemfile.lock
4
+ **/*.gem
5
+ gemfiles/vendor
6
+ .bundle
@@ -1,91 +1,25 @@
1
- require: rubocop-rails
2
- AllCops:
3
- Exclude:
4
- - "node_modules/**/*"
5
-
6
- # disable length length checking, as it tends to make things worse in the majority
7
- # of cases. however, it is good practice keep lines <= 85 columns so they remain
8
- # readable.
9
- Layout/LineLength:
10
- Enabled: false
11
-
12
- # disable documentation checking. many classes do not require top-level comments,
13
- # and their inclusion can actually obscure their function.
14
- Style/Documentation:
15
- Enabled: false
16
-
17
- # functionalization is important, but the Rails' idiom for returning key-value
18
- # maps can raise a false alarm with the max line number (10). increase the value
19
- # to something more reasonable given the circumstances.
20
- Metrics/MethodLength:
21
- Max: 20
22
- ExcludedMethods:
23
- - test_rake_tasks
24
-
25
- # if you're specifying access modifiers, it is likely intentional. force RuboCop
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"
@@ -1,11 +1,16 @@
1
1
  language: ruby
2
- os: linux
3
2
  dist: bionic
4
- before_install:
5
- - gem install rubygems-update && update_rubygems
6
- - yes | rvm @global do gem install bundler -v 2.1.4 || true
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.9
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
- install:
26
- - bundle install --jobs 3 --retry 3
27
- - nvm install 12
28
- - node -v
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.9
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
@@ -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
- ![version](https://img.shields.io/gem/v/webpacker-pnpm?label=version&style=flat-square)
3
+ [![version](https://img.shields.io/gem/v/webpacker-pnpm?label=version&style=flat-square)](https://rubygems.org/gems/webpacker-pnpm)
4
4
  [![status](https://img.shields.io/travis/thearchitector/webpacker-pnpm?style=flat-square)](https://travis-ci.org/github/thearchitector/webpacker-pnpm)
5
- ![downloads](https://img.shields.io/gem/dt/webpacker-pnpm?style=flat-square)
5
+ [![downloads](https://img.shields.io/gem/dt/webpacker-pnpm?style=flat-square)](https://rubygems.org/gems/webpacker-pnpm)
6
6
  [![license](https://img.shields.io/badge/license-CC--BY--NC--SA--4.0-green?style=flat-square)](https://creativecommons.org/licenses/by-nc-sa/4.0/)
7
7
 
8
- `webpacker-pnpm` replaces Rails' Yarn environment with [pnpm](https://pnpm.js.org/), which is a much smarter, efficient, and faster alternative Node.js package manager. 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.html) by Zoltan Kochan, but in essence it reduces dependency resolution times and `node_modules` folder sizes to within reasonable ranges (not 30 seconds and 10 GiB).
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
@@ -8,4 +8,4 @@ Rake::TestTask.new do |t|
8
8
  t.test_files = FileList["test/**/*_test.rb"]
9
9
  end
10
10
 
11
- task default: :test
11
+ task(default: :test)
@@ -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 Webpack runner
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
- ENV["WEBPACKER_NODE_MODULES_BIN_PATH"] ||= File.join(`pnpm root`.chomp, ".bin")
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
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Webpacker
4
4
  module PNPM
5
- VERSION = "1.2.0"
5
+ VERSION = "1.2.1"
6
+
7
+ public_constant :VERSION
6
8
  end
7
9
  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
- pnpm_range = ">=3.0.0"
14
- is_unsupported = SemanticRange.satisfies?(pnpm_version, pnpm_range) rescue false
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 "Webpacker requires pnpm \"#{pnpm_range}\" and you are using #{pnpm_version}. Please upgrade pnpm https://pnpm.js.org/en/installation/"
18
- warn "Exiting!"
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 "pnpm is not installed. Please download and install pnpm from https://pnpm.js.org/en/installation/"
23
- warn "Exiting!"
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? 'bin/webpack'}"
18
- $stdout.puts "Is bin/webpack-dev-server present?: #{File.exist? 'bin/webpack-dev-server'}"
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 "Support for older Rails versions. Install all JavaScript dependencies as specified via pnpm"
4
+ desc "Install all JavaScript dependencies as specified via pnpm."
5
5
  task pnpm_install: [:environment] do
6
- valid_node_envs = %w[test development production]
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
@@ -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 output, "webpacker"
11
- assert_includes output, "webpacker:binstubs"
12
- assert_includes output, "webpacker:check_binstubs"
13
- assert_includes output, "webpacker:check_node"
14
- assert_includes output, "webpacker:check_pnpm"
15
- assert_includes output, "webpacker:clean"
16
- assert_includes output, "webpacker:clobber"
17
- assert_includes output, "webpacker:compile"
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 2>&1")
39
- assert_not_includes output, "pnpm is not installed"
40
- assert_not_includes output, "Webpacker requires pnpm"
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 output, "Verifying pnpm version..."
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 2>&1")
47
- assert_not_includes output, "pnpm is not installed"
48
- assert_not_includes output, "Webpacker requires pnpm"
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 output, "Verifying pnpm version..."
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
- chdir_concurrent(test_path, cmd, { NODE_ENV: :production }, { isolated: true }) do |_, temp|
57
- assert_not_includes installed_node_modules(temp), "right-pad", "Expected only production dependencies to be installed"
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 test_app_dev_dependencies, "right-pad"
47
+ assert_includes(test_app_dev_dependencies, "right-pad")
63
48
 
64
49
  cmd = "bundle exec rake webpacker:pnpm_install"
65
-
66
- chdir_concurrent(test_path, cmd, { NODE_ENV: :test }, { isolated: true }) do |_, temp|
67
- assert_includes installed_node_modules(temp), "right-pad", "Expected dev dependencies to be installed"
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
- chdir_concurrent(test_path, cmd, { NODE_ENV: :production }, { isolated: true }) do |_, temp|
75
- assert_not_includes installed_node_modules(temp), "right-pad", "Expected only production dependencies to be installed"
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 test_app_dev_dependencies, "right-pad"
69
+ assert_includes(test_app_dev_dependencies, "right-pad")
81
70
 
82
71
  cmd = "bundle exec rake webpacker:yarn_install"
83
-
84
- chdir_concurrent(test_path, cmd, { NODE_ENV: :test }, { isolated: true }) do |_, temp|
85
- assert_includes installed_node_modules(temp), "right-pad", "Expected dev dependencies to be installed"
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
 
@@ -1,6 +1,4 @@
1
- #!/usr/bin/env ruby.exe
2
- # frozen_string_literal: true
3
-
4
- APP_PATH = File.expand_path("../config/application", __dir__)
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'
@@ -1,6 +1,4 @@
1
- #!/usr/bin/env ruby.exe
2
- # frozen_string_literal: true
3
-
4
- require_relative "../config/boot"
5
- require "rake"
6
- Rake.application.run
1
+ #!/usr/bin/env ruby.exe
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -1,27 +1,25 @@
1
- #!/usr/bin/env ruby.exe
2
- # frozen_string_literal: true
3
-
4
- require "fileutils"
5
-
6
- # path to your application root.
7
- APP_ROOT = File.expand_path("..", __dir__)
8
-
9
- def system!(*args)
10
- system(*args) || abort("\n== Command #{args} failed ==")
11
- end
12
-
13
- FileUtils.chdir APP_ROOT do
14
- # This script is a way to setup or update your development environment automatically.
15
- # This script is idempotent, so that you can run it at anytime and get an expectable outcome.
16
- # Add necessary setup steps to this file.
17
-
18
- puts "== Installing dependencies =="
19
- system! "gem install bundler --conservative"
20
- system("bundle check") || system!("bundle install")
21
-
22
- puts "\n== Removing old logs and tempfiles =="
23
- system! "bin/rails log:clear tmp:clear"
24
-
25
- puts "\n== Restarting application server =="
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
@@ -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", Pathname.new(__FILE__).realpath)
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", Pathname.new(__FILE__).realpath)
8
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
9
+ Pathname.new(__FILE__).realpath)
9
10
 
10
11
  require "bundler/setup"
11
12
 
@@ -4,4 +4,4 @@
4
4
 
5
5
  require_relative "config/environment"
6
6
 
7
- run Rails.application
7
+ run(Rails.application)
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
4
+
5
+ require "bundler/setup" # Set up gems listed in the Gemfile.
@@ -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 do |f|
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(output, dir) if block_given?
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
@@ -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.authors = ["Elias Gabriel"]
11
- spec.email = ["me@eliasfgabriel.com"]
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" => "https://github.com/thearchitector/webpacker-pnpm/tree/v#{Webpacker::PNPM::VERSION}",
19
- "changelog_uri" => "https://github.com/thearchitector/webpacker-pnpm/blob/v#{Webpacker::PNPM::VERSION}/CHANGELOG.md"
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 "activesupport", ">= 5.2"
25
- spec.add_dependency "rack-proxy", ">= 0.6.1"
26
- spec.add_dependency "railties", ">= 5.2"
27
- spec.add_dependency "semantic_range", ">= 2.3.0"
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 "bundler", "~> 2.0"
31
- spec.add_development_dependency "rubocop"
32
- spec.add_development_dependency "rubocop-rails"
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.0
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-14 00:00:00.000000000 Z
11
+ date: 2020-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activesupport
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: rack-proxy
28
+ name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.6.1
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: 0.6.1
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
- name: railties
42
+ name: semantic_range
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '5.2'
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: '5.2'
54
+ version: '2.3'
55
55
  - !ruby/object:Gem::Dependency
56
- name: semantic_range
56
+ name: webpacker
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.3.0
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: 2.3.0
68
+ version: '5.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: webpacker
70
+ name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 5.x
76
- type: :runtime
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.x
82
+ version: '5.0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: bundler
84
+ name: practical-pig
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '2.0'
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: '2.0'
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: '0'
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: '0'
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: '0'
125
- description:
126
- email:
127
- - me@eliasfgabriel.com
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.0
182
- changelog_uri: https://github.com/thearchitector/webpacker-pnpm/blob/v1.2.0/CHANGELOG.md
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
- rubyforge_project:
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
@@ -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"