shakapacker 6.0.0.rc.6 → 6.0.0.rc.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3e0b9296c62375b6e7861a599485d262020e8b58ff601a75e136094e8278100
4
- data.tar.gz: 14883fa657938740c400e202f02ddeb72d5fd45dd54bef8d44307ca34915af6e
3
+ metadata.gz: d56f3bf25f84819a60ea5e8ad408d654eec2a208886d7ebb6b84e27dd09af4a0
4
+ data.tar.gz: f71bf10af00c11400e4fc2edd43e60d6dee2be79ca79cbdd6202c9cc9442e36d
5
5
  SHA512:
6
- metadata.gz: 18d3205c3f77361b2cde0c3e8dc2509cee255ba1a4145f0f689d9829366b84ffa6dee038e06b32df695a1754d0c893147fe151203b5d055452521795794110c1
7
- data.tar.gz: 7e88035668059940af4a9edf2a4e4e76fc1d0c9f978ac689c64db9cf3ac8d4c7a50d065bbac293f45e944c75fd3907b5409d166cff592ddb36bb60815c4c9559
6
+ metadata.gz: 3d2efc92056730fa4cd322aff21e9dc328dbf4d2e1699f2792dbab4b633445914c5f224e5aa322721570903cc3610cce6301dc83b46c0fa853606bbc225ab3ec
7
+ data.tar.gz: 62a8fc9cfb3fec708e1dbd0bdb405c5b66edec87d818f5624d94e09acae73a0f558865b504f6cf3c506e230df9b47730712fa002f1d833bd88b8ae8060852cae
data/CHANGELOG.md CHANGED
@@ -1,13 +1,30 @@
1
1
  For versions prior to v6, see the [5.x stable branch of rails/webpacker](https://github.com/rails/webpacker/tree/5-x-stable).
2
2
 
3
- ## [[6.0.0]](https://github.com/rails/webpacker/compare/v5.4.3...master) - 2022
4
3
 
5
- Latest is rc.9.
4
+ ## Versions
5
+ ### [Unreleased]
6
+ Changes since last non-beta release.
6
7
 
7
- Please see [UPGRADE GUIDE](./docs/v6_upgrade.md) for more information.
8
+ *Please add entries here for your pull requests that are not yet released.*
9
+
10
+ ## [6.0.0.rc.12]
11
+
12
+ ### Merged from rails/webpacker
13
+
14
+ - Make watched_files_digest thread safe. [rails/webpacker #3233](https://github.com/rails/webpacker/pull/3233)
15
+ - Use single webpack config webpack.config.js. [rails/webpacker #3240](https://github.com/rails/webpacker/pull/3240)
16
+ - Switch to peer dependencies. [rails/webpacker #3234](https://github.com/rails/webpacker/pull/3234)
17
+
18
+ ### Upgrading from rails/webpacker 6.0.0.rc.6
8
19
  - Single default configuration file of `config/webpack/webpack.config.js`. Previously, the config file was set
9
- to `config/webpack/#{NODE_ENV}.js`.
20
+ to `config/webpack/#{NODE_ENV}.js`.
21
+ - Changed all package.json dependencies to peerDependencies, so upgrading requires adding the dependencies, per the [UPGRADE GUIDE](./docs/v6_upgrade.md).
10
22
 
23
+ ## [6.0.0.rc.6] - Forked January 16, 2022
24
+
25
+ Latest is rc.9.
26
+
27
+ Please see [UPGRADE GUIDE](./docs/v6_upgrade.md) for more information.
11
28
  - `node_modules` will no longer be babel transfomed compiled by default. This primarily fixes [rails issue #35501](https://github.com/rails/rails/issues/35501) as well as [numerous other webpacker issues](https://github.com/rails/webpacker/issues/2131#issuecomment-581618497). The disabled loader can still be required explicitly via:
12
29
 
13
30
  ```js
@@ -22,7 +39,6 @@ Please see [UPGRADE GUIDE](./docs/v6_upgrade.md) for more information.
22
39
  - Adds experimental Yarn 2 support. Note you must manually set `nodeLinker: node-modules` in your `.yarnrc.yml`.
23
40
  - Fixes dev server issues [#2898](https://github.com/rails/webpacker/pull/2898)
24
41
  - Update static files path to from `media/` to `static/`.
25
- - Changed all package.json dependencies to peerDependencies, so upgrading requires adding the dependencies, per the [UPGRADE GUIDE](./docs/v6_upgrade.md).
26
42
  - Deprecated configuration option `watched_paths`. Use `additional_paths` instead in `webpacker.yml`.
27
43
 
28
44
  ### Breaking changes
@@ -30,3 +46,8 @@ Please see [UPGRADE GUIDE](./docs/v6_upgrade.md) for more information.
30
46
  - Removed integration installers
31
47
  - Splitchunks enabled by default
32
48
  - CSS extraction enabled by default, except when devServer is configured and running
49
+
50
+
51
+ [Unreleased]: https://github.com/shakacode/shakapacker/compare/6.0.0-rc.11...master
52
+ [6.0.0.rc.12]: https://github.com/shakacode/shakapacker/compare/aba79635e6ff6562ec04d3c446d57ef19a5fef7d...v6.0.0-rc.12
53
+ [6.0.0.rc.6]: https://github.com/rails/webpacker/compare/v5.4.3...aba79635e6ff6562ec04d3c446d57ef19a5fef7d
data/README.md CHANGED
@@ -1,14 +1,16 @@
1
1
  # Shakapacker
2
2
 
3
+ _Official, actively maintained fork of [rails/webpacker](https://github.com/rails/webpacker). For pre v6, see [rails/webpacker 5-x-stable](https://github.com/rails/webpacker/tree/5-x-stable). Be sure to see the [CHANGELOG](./CHANGELOG.md)._
3
4
 
4
- This is a fork of [rails/webpacker](https://github.com/rails/webpacker). For pre v6, see [rails/webpacker 5-x-stable](https://github.com/rails/webpacker/tree/5-x-stable).
5
+ * Note, internal naming will continue to use `webpacker` where possible.
6
+ * See [V6 Upgrade](./docs/v6_upgrade.md) for upgrading from v5 or prior v6 releases.
5
7
 
6
8
  [![Ruby specs](https://github.com/shakacode/shakapacker/workflows/Ruby%20specs/badge.svg)](https://github.com/shakacode/shakapacker/actions)
7
9
  [![Jest specs](https://github.com/shakacode/shakapacker/workflows/Jest%20specs/badge.svg)](https://github.com/shakacode/shakapacker/actions)
8
10
  [![Rubocop](https://github.com/shakacode/shakapacker/workflows/Rubocop/badge.svg)](https://github.com/shakacode/shakapacker/actions)
9
11
  [![JS lint](https://github.com/shakacode/shakapacker/workflows/JS%20lint/badge.svg)](https://github.com/shakacode/shakapacker/actions)
10
12
 
11
- [![node.js](https://img.shields.io/badge/node-%3E%3D%2012.0.0-brightgreen.svg)](https://www.npmjs.com/package/@shakacode/shakapacker)
13
+ [![node.js](https://img.shields.io/badge/node-%3E%3D%2012.0.0-brightgreen.svg)](https://www.npmjs.com/package/shakapacker)
12
14
  [![Gem](https://img.shields.io/gem/v/shakapacker.svg)](https://rubygems.org/gems/shakapacker)
13
15
 
14
16
  Webpacker makes it easy to use the JavaScript pre-processor and bundler
@@ -16,8 +18,7 @@ Webpacker makes it easy to use the JavaScript pre-processor and bundler
16
18
  to manage application-like JavaScript in Rails. It can coexist with the asset pipeline,
17
19
  leaving Webpack responsible solely for app-like JavaScript, or it can be used exclusively, making it also responsible for images, fonts, and CSS.
18
20
 
19
-
20
- Visit [Shipping Webpacker v6 – Status](https://discuss.rubyonrails.org/t/shipping-webpacker-v6-status/79683) for the latest news on a v6 release.
21
+ See a comparison of [webpacker with jsbundling-rails](https://github.com/rails/jsbundling-rails/blob/main/docs/comparison_with_webpacker.md).
21
22
 
22
23
  Discussion forums to discuss debugging and troubleshooting tips. Please open issues for bugs and feature requests:
23
24
  1. [rails/webpacker discussion forum](https://discuss.rubyonrails.org/c/webpacker/10)
@@ -109,10 +110,10 @@ Update your `Gemfile`:
109
110
 
110
111
  ```ruby
111
112
  # Gemfile
112
- gem 'webpacker', '~> 6.0'
113
+ gem 'shakapacker', '~> 6.0'
113
114
 
114
115
  # OR if you prefer to use master
115
- gem 'webpacker', git: 'https://github.com/shakacode/shakapacker.git'
116
+ gem 'shakapacker', git: 'https://github.com/shakacode/shakapacker.git'
116
117
  yarn add https://github.com/shakacode/shakapacker.git
117
118
  ```
118
119
 
@@ -137,7 +138,7 @@ yarn add @babel/core @babel/plugin-transform-runtime @babel/preset-env @babel/ru
137
138
  webpack webpack-assets-manifest webpack-cli webpack-merge webpack-sources webpack-dev-server
138
139
  ```
139
140
 
140
- Previously, these "webpack" and "babel" packages were direct dependencies for `@shakacode/shakapacker`. By
141
+ Previously, these "webpack" and "babel" packages were direct dependencies for `webpacker`. By
141
142
  making these peer dependencies, you have control over the versions used in your webpack and babel configs.
142
143
 
143
144
  ## Usage
@@ -312,7 +313,7 @@ Then `require` this file in your `config/webpack/webpack.config.js`:
312
313
 
313
314
  ```js
314
315
  // config/webpack/webpack.config.js
315
- const { webpackConfig, merge } = require('@shakacode/shakapacker')
316
+ const { webpackConfig, merge } = require('shakapacker')
316
317
  const customConfig = require('./custom')
317
318
 
318
319
  module.exports = merge(webpackConfig, customConfig)
@@ -322,7 +323,7 @@ If you need access to configs within Webpacker's configuration, you can import t
322
323
 
323
324
  ```js
324
325
  // config/webpack/webpack.config.js
325
- const { webpackConfig } = require('@shakacode/shakapacker')
326
+ const { webpackConfig } = require('shakapacker')
326
327
 
327
328
  console.log(webpackConfig.output_path)
328
329
  console.log(webpackConfig.source_path)
@@ -338,7 +339,7 @@ By default, you will find the Webpacker preset in your `package.json`.
338
339
  ```json
339
340
  "babel": {
340
341
  "presets": [
341
- "./node_modules/@shakacode/shakapacker/package/babel/preset.js"
342
+ "./node_modules/shakapacker/package/babel/preset.js"
342
343
  ]
343
344
  },
344
345
  ```
@@ -421,7 +422,7 @@ Then modify the webpack config to use it as a plugin:
421
422
 
422
423
  ```js
423
424
  // config/webpack/webpack.config.js
424
- const { webpackConfig, merge } = require("@shakacode/shakapacker");
425
+ const { webpackConfig, merge } = require("shakapacker");
425
426
  const ForkTSCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
426
427
 
427
428
  module.exports = merge(webpackConfig, {
@@ -441,7 +442,7 @@ Optionally, add the `CSS` extension to webpack config for easy resolution.
441
442
 
442
443
  ```js
443
444
  // config/webpack/webpack.config.js
444
- const { webpackConfig, merge } = require('@shakacode/shakapacker')
445
+ const { webpackConfig, merge } = require('shakapacker')
445
446
  const customConfig = {
446
447
  resolve: {
447
448
  extensions: ['.css']
@@ -514,7 +515,7 @@ module.exports = {
514
515
 
515
516
  ```js
516
517
  // config/webpack/webpack.config.js
517
- const { webpackConfig, merge } = require('@shakacode/shakapacker')
518
+ const { webpackConfig, merge } = require('shakapacker')
518
519
  const vueConfig = require('./rules/vue')
519
520
 
520
521
  module.exports = merge(vueConfig, webpackConfig)
@@ -579,15 +580,15 @@ bundle update webpacker
579
580
  rails webpacker:install
580
581
 
581
582
  # yarn 1 instructions
582
- yarn upgrade @shakacode/shakapacker --latest
583
+ yarn upgrade shakapacker --latest
583
584
  yarn upgrade webpack-dev-server --latest
584
585
 
585
586
  # yarn 2 instructions
586
- yarn up @shakacode/shakapacker@latest
587
+ yarn up shakapacker@latest
587
588
  yarn up webpack-dev-server@latest
588
589
 
589
590
  # Or to install the latest release (including pre-releases)
590
- yarn add @shakacode/shakapacker@next
591
+ yarn add shakapacker@next
591
592
  ```
592
593
 
593
594
  Also, consult the [CHANGELOG](./CHANGELOG.md) for additional upgrade links.
@@ -1,13 +1,13 @@
1
1
  # Customizing Babel Config
2
2
 
3
3
  ## Default Configuration
4
- The default configuration of babel is done by using `package.json` to use the file within the `@shakacode/shakapacker` package.
4
+ The default configuration of babel is done by using `package.json` to use the file within the `shakapacker` package.
5
5
 
6
6
  ```json
7
7
  {
8
8
  "babel": {
9
9
  "presets": [
10
- "./node_modules/@shakacode/shakapacker/package/babel/preset.js"
10
+ "./node_modules/shakapacker/package/babel/preset.js"
11
11
  ]
12
12
  }
13
13
  }
@@ -27,7 +27,7 @@ yarn add --dev @pmmmwh/react-refresh-webpack-plugin react-refresh
27
27
  ```js
28
28
  // babel.config.js
29
29
  module.exports = function (api) {
30
- const defaultConfigFunc = require('@shakacode/shakapacker/package/babel/preset.js')
30
+ const defaultConfigFunc = require('shakapacker/package/babel/preset.js')
31
31
  const resultConfig = defaultConfigFunc(api)
32
32
  const isProductionEnv = api.env('production')
33
33
 
@@ -13,7 +13,7 @@ Let's call the shakacode/shakapacker directory `WEBPACKER_DIR` which has shakaco
13
13
  ### Setup with Yalc
14
14
  Use [`yalc`](https://github.com/wclr/yalc) unless you like yak shaving weird errors.
15
15
  1. In `WEBPACKER_DIR`, run `yalc publish`
16
- 2. In `TEST_APP_DIR`, run `yalc link @shakacode/shakapacker`
16
+ 2. In `TEST_APP_DIR`, run `yalc link shakapacker`
17
17
 
18
18
  ## Update the Package Code
19
19
  1. Make some JS change in WEBPACKER_DIR
@@ -132,7 +132,7 @@ To silent these warnings, please update `config/webpack/webpack.config.js`:
132
132
  ```js
133
133
  const webpack = require('webpack')
134
134
  const { resolve } = require('path')
135
- const { webpackConfig, merge } = require('@shakacode/shakapacker')
135
+ const { webpackConfig, merge } = require('shakapacker')
136
136
 
137
137
  module.exports = merge(webpackConfig, {
138
138
  plugins: [
@@ -181,7 +181,7 @@ Instead do:
181
181
  // config/webpack/webpack.config.js
182
182
 
183
183
  const webpack = require('webpack')
184
- const { webpackConfig, merge } = require('@shakacode/shakapacker')
184
+ const { webpackConfig, merge } = require('shakapacker')
185
185
 
186
186
  module.exports = merge(webpackConfig, {
187
187
  plugins: [
data/docs/v6_upgrade.md CHANGED
@@ -10,6 +10,14 @@ Webpacker used to configure Webpack indirectly, which lead to a [complicated sec
10
10
 
11
11
  This means you have to configure integration with frameworks yourself, but webpack-merge helps with this. See this example for [Vue](https://github.com/shakacode/shakapacker#other-frameworks) and scroll to the bottom for [more examples](#examples-of-v5-to-v6).
12
12
 
13
+ ## webpacker v6.0.0.rc.6 to shakapacker
14
+ See example migration, [PR 27](https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh/pull/27).
15
+
16
+ ### Update
17
+ 1. Peer dependencies. Run `yarn add @babel/core @babel/plugin-transform-runtime @babel/preset-env @babel/runtime babel-loader compression-webpack-plugin pnp-webpack-plugin terser-webpack-plugin webpack webpack-assets-manifest webpack-cli webpack-merge webpack-sources webpack-dev-server`
18
+ 2. Update your webpack config for a single config file, `config/webpack/webpack.config.js`.
19
+ 3. Update `babel.config.js` if you need JSX support.
20
+
13
21
  ## How to upgrade to Webpacker v6 from v5
14
22
  1. Ensure you have a clean working git branch. You will be overwriting all your files and reverting the changes that you don't want.
15
23
 
@@ -33,13 +41,13 @@ This means you have to configure integration with frameworks yourself, but webpa
33
41
 
34
42
  1. Upgrade the Webpacker Ruby gem and the NPM package
35
43
 
36
- Note: [Check the releases page to verify the latest version](https://github.com/rails/webpacker/releases), and make sure to install identical version numbers of webpacker gem and `@shakacode/shakapacker` npm package. (Gems use a period and packages use a dot between the main version number and the beta version.)
44
+ Note: [Check the releases page to verify the latest version](https://github.com/rails/webpacker/releases), and make sure to install identical version numbers of webpacker gem and `shakapacker` npm package. (Gems use a period and packages use a dot between the main version number and the beta version.)
37
45
 
38
46
  Example going to a specific version:
39
47
 
40
48
  ```ruby
41
49
  # Gemfile
42
- gem 'webpacker', '6.0.0.rc.7'
50
+ gem 'shakapacker', '6.0.0.rc.13', require: 'webpacker'
43
51
  ```
44
52
 
45
53
  ```bash
@@ -47,7 +55,7 @@ This means you have to configure integration with frameworks yourself, but webpa
47
55
  ```
48
56
 
49
57
  ```bash
50
- yarn add @shakacode/shakapacker@6.0.0-rc.7 --exact
58
+ yarn add shakapacker@6.0.0-rc.7 --exact
51
59
  ```
52
60
 
53
61
  ```bash
@@ -64,7 +72,7 @@ This means you have to configure integration with frameworks yourself, but webpa
64
72
  1. There is now a single default configuration file of `config/webpack/webpack.config.js`. Previously, the config file was set
65
73
  to `config/webpack/#{NODE_ENV}.js`. In the `config/webpack/` directory, you can either refactor your code in `test.js`, `development.js`, and `production.js` to a single file, `webpack.config.js` or you can replace the contents of `config/webpack/config.webpack.js` to conditionally load the old file based on the NODE_ENV with this snippet:
66
74
  ```js
67
- const { env, webpackConfig } = require('@shakacode/shakapacker')
75
+ const { env, webpackConfig } = require('shakapacker')
68
76
  const { existsSync } = require('fs')
69
77
  const { resolve } = require('path')
70
78
 
@@ -109,7 +117,7 @@ This means you have to configure integration with frameworks yourself, but webpa
109
117
  1. Import `environment` changed to `webpackConfig`. For example, the new code looks like:
110
118
  ```js
111
119
  // config/webpack/webpack.config.js
112
- const { webpackConfig, merge } = require('@shakacode/shakapacker')
120
+ const { webpackConfig, merge } = require('shakapacker')
113
121
  const customConfig = require('./custom')
114
122
 
115
123
  module.exports = merge(webpackConfig, customConfig)
@@ -1,4 +1,4 @@
1
- const { webpackConfig } = require('@shakacode/shakapacker')
1
+ const { webpackConfig } = require('shakapacker')
2
2
 
3
3
  // See the shakacode/shakapacker README and docs directory for advice on customizing your webpackConfig.
4
4
 
@@ -6,7 +6,7 @@
6
6
  "version": "0.1.0",
7
7
  "babel": {
8
8
  "presets": [
9
- "./node_modules/@shakacode/shakapacker/package/babel/preset.js"
9
+ "./node_modules/shakapacker/package/babel/preset.js"
10
10
  ]
11
11
  },
12
12
  "browserslist": [
@@ -66,11 +66,11 @@ results = []
66
66
 
67
67
  Dir.chdir(Rails.root) do
68
68
  if Webpacker::VERSION.match?(/^[0-9]+\.[0-9]+\.[0-9]+$/)
69
- say "Installing @shakacode/shakapacker@#{Webpacker::VERSION}"
70
- results << run("yarn add @shakacode/shakapacker@#{Webpacker::VERSION}")
69
+ say "Installing shakapacker@#{Webpacker::VERSION}"
70
+ results << run("yarn add shakapacker@#{Webpacker::VERSION}")
71
71
  else
72
- say "Installing @shakacode/shakapacker@next"
73
- results << run("yarn add @shakacode/shakapacker@next")
72
+ say "Installing shakapacker@next"
73
+ results << run("yarn add shakapacker@next")
74
74
  end
75
75
 
76
76
  package_json = File.read("#{__dir__}/../../package.json")
@@ -80,7 +80,7 @@ Dir.chdir(Rails.root) do
80
80
  result << "#{package}@#{major_version}"
81
81
  end.join(" ")
82
82
 
83
- say "Adding @shakacode/shakapacker peerDependencies"
83
+ say "Adding shakapacker peerDependencies"
84
84
  results << run("yarn add #{peers_to_add}")
85
85
 
86
86
  say "Installing webpack-dev-server for live reloading as a development dependency"
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "English"
4
+ require "rake/file_utils"
5
+
6
+ module Shakapacker
7
+ module Utils
8
+ class Misc
9
+ extend FileUtils
10
+
11
+ def self.uncommitted_changes?(message_handler)
12
+ return false if ENV["COVERAGE"] == "true"
13
+
14
+ status = `git status --porcelain`
15
+ return false if $CHILD_STATUS.success? && status.empty?
16
+
17
+ error = if $CHILD_STATUS.success?
18
+ "You have uncommitted code. Please commit or stash your changes before continuing"
19
+ else
20
+ "You do not have Git installed. Please install Git, and commit your changes before continuing"
21
+ end
22
+ message_handler.add_error(error)
23
+ true
24
+ end
25
+
26
+ def self.object_to_boolean(value)
27
+ [true, "true", "yes", 1, "1", "t"].include?(value.instance_of?(String) ? value.downcase : value)
28
+ end
29
+
30
+ # Executes a string or an array of strings in a shell in the given directory in an unbundled environment
31
+ def self.sh_in_dir(dir, *shell_commands)
32
+ shell_commands.flatten.each { |shell_command| sh %(cd #{dir} && #{shell_command.strip}) }
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1 @@
1
+ require "webpacker"
@@ -11,7 +11,7 @@ namespace :webpacker do
11
11
  $stdout.puts "Yarn: #{`yarn --version`}"
12
12
 
13
13
  $stdout.puts "\n"
14
- $stdout.puts "@shakacode/shakapacker: \n#{`npm list @shakacode/shakapacker version`}"
14
+ $stdout.puts "shakapacker: \n#{`npm list shakapacker version`}"
15
15
 
16
16
  $stdout.puts "Is bin/webpacker present?: #{File.exist? 'bin/webpacker'}"
17
17
  $stdout.puts "Is bin/webpacker-dev-server present?: #{File.exist? 'bin/webpacker-dev-server'}"
@@ -1,4 +1,4 @@
1
1
  module Webpacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "6.0.0.rc.6".freeze
3
+ VERSION = "6.0.0.rc.13".freeze
4
4
  end
@@ -1,4 +1,4 @@
1
- const { moduleExists } = require('@shakacode/shakapacker')
1
+ const { moduleExists } = require('shakapacker')
2
2
 
3
3
  module.exports = function config(api) {
4
4
  const validEnv = ['development', 'test', 'production']
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "@shakacode/shakapacker",
3
- "version": "6.0.0-rc.6",
2
+ "name": "shakapacker",
3
+ "version": "6.0.0-rc.13",
4
4
  "description": "Use webpack to manage app-like JavaScript modules in Rails",
5
5
  "main": "package/index.js",
6
6
  "files": [
data/rakelib/release.rake CHANGED
@@ -1,5 +1,5 @@
1
1
  require_relative File.join("..", "lib", "shakapacker", "utils", "version_syntax_converter")
2
- require_relative File.join("..", "lib", "shakapacker", "utils", "git_utils")
2
+ require_relative File.join("..", "lib", "shakapacker", "utils", "misc")
3
3
 
4
4
  class RaisingMessageHandler
5
5
  def add_error(error)
@@ -24,34 +24,41 @@ which are installed via `bundle install` and `yarn global add release-it`
24
24
  Note, accept defaults for npmjs options. Script will pause to get 2FA tokens.
25
25
 
26
26
  Example: `rake release[2.1.0,false]`")
27
- task :release, %i[gem_version dry_run tools_install] do |_t, args|
27
+ task :create_release, %i[gem_version dry_run] do |_t, args|
28
28
  # Check if there are uncommited changes
29
- Shakapacker::GitUtils.uncommitted_changes?(RaisingMessageHandler.new)
29
+ Shakapacker::Utils::Misc.uncommitted_changes?(RaisingMessageHandler.new)
30
30
  args_hash = args.to_hash
31
31
 
32
- is_dry_run = Shakapacker::Utils.object_to_boolean(args_hash[:dry_run])
32
+ is_dry_run = Shakapacker::Utils::Misc.object_to_boolean(args_hash[:dry_run])
33
33
 
34
34
  gem_version = args_hash.fetch(:gem_version, "")
35
35
 
36
36
  gem_root = File.expand_path("..", __dir__)
37
37
 
38
38
  npm_version = if gem_version.strip.empty?
39
- ""
39
+ ""
40
40
  else
41
- Shakapacker::VersionSyntaxConverter.new.rubygem_to_npm(gem_version)
42
- end
41
+ Shakapacker::Utils::VersionSyntaxConverter.new.rubygem_to_npm(gem_version)
42
+ end
43
43
 
44
44
  # See https://github.com/svenfuchs/gem-release
45
- sh_in_dir(gem_root, "git pull --rebase")
46
- sh_in_dir(gem_root, "gem bump --no-commit #{gem_version.strip.empty? ? '' : %(--version #{gem_version})}")
45
+ Shakapacker::Utils::Misc.sh_in_dir(gem_root, "git pull --rebase")
46
+ Shakapacker::Utils::Misc.sh_in_dir(gem_root, "gem bump --no-commit #{gem_version.strip.empty? ? '' : %(--version #{gem_version})}")
47
47
 
48
48
  # Will bump the yarn version, commit, tag the commit, push to repo, and release on yarn
49
49
  release_it_command = +"release-it"
50
50
  release_it_command << " #{npm_version}" unless npm_version.strip.empty?
51
51
  release_it_command << " --npm.publish --no-git.requireCleanWorkingDir"
52
52
  release_it_command << " --dry-run --verbose" if is_dry_run
53
- sh_in_dir(gem_root, release_it_command)
53
+ puts "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
54
+ puts "Use the OTP for NPM!"
55
+ puts "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
56
+ Shakapacker::Utils::Misc.sh_in_dir(gem_root, release_it_command)
54
57
 
55
58
  # Release the new gem version
56
- sh_in_dir(gem_root, "gem release") unless is_dry_run
59
+ puts "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
60
+ puts "Use the OTP for RubyGems!"
61
+ puts "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
62
+
63
+ Shakapacker::Utils::Misc.sh_in_dir(gem_root, "gem release") unless is_dry_run
57
64
  end
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": true,
3
3
  "dependencies": {
4
- "@shakacode/shakapacker": "file:../../../../"
4
+ "shakapacker": "file:../../../../"
5
5
  },
6
6
  "license": "MIT"
7
7
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shakapacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0.rc.6
4
+ version: 6.0.0.rc.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-01-18 00:00:00.000000000 Z
13
+ date: 2022-01-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -157,7 +157,8 @@ files:
157
157
  - lib/install/config/webpacker.yml
158
158
  - lib/install/package.json
159
159
  - lib/install/template.rb
160
- - lib/shakapacker/utils/git_utils.rb
160
+ - lib/shakapacker.rb
161
+ - lib/shakapacker/utils/misc.rb
161
162
  - lib/shakapacker/utils/version_syntax_converter.rb
162
163
  - lib/tasks/webpacker.rake
163
164
  - lib/tasks/webpacker/binstubs.rake
@@ -268,7 +269,7 @@ homepage: https://github.com/shakacode/shakapacker
268
269
  licenses:
269
270
  - MIT
270
271
  metadata:
271
- source_code_uri: https://github.com/shakacode/shakapacker/tree/v6.0.0-rc.6
272
+ source_code_uri: https://github.com/shakacode/shakapacker/tree/v6.0.0-rc.13
272
273
  post_install_message:
273
274
  rdoc_options: []
274
275
  require_paths:
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "English"
4
- module Shakapacker
5
- module Utils
6
- module GitUtils
7
- def self.uncommitted_changes?(message_handler)
8
- return false if ENV["COVERAGE"] == "true"
9
-
10
- status = `git status --porcelain`
11
- return false if $CHILD_STATUS.success? && status.empty?
12
-
13
- error = if $CHILD_STATUS.success?
14
- "You have uncommitted code. Please commit or stash your changes before continuing"
15
- else
16
- "You do not have Git installed. Please install Git, and commit your changes before continuing"
17
- end
18
- message_handler.add_error(error)
19
- true
20
- end
21
- end
22
- end
23
- end