shakapacker 6.0.0.rc.6 → 6.0.0.rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -5
- data/README.md +17 -16
- data/docs/customizing_babel_config.md +3 -3
- data/docs/developing_webpacker.md +1 -1
- data/docs/troubleshooting.md +2 -2
- data/docs/v6_upgrade.md +13 -5
- data/lib/install/config/webpack/webpack.config.js +1 -1
- data/lib/install/package.json +1 -1
- data/lib/install/template.rb +5 -5
- data/lib/shakapacker/utils/misc.rb +36 -0
- data/lib/shakapacker.rb +1 -0
- data/lib/tasks/webpacker/info.rake +1 -1
- data/lib/webpacker/version.rb +1 -1
- data/package/babel/preset.js +1 -1
- data/package.json +2 -2
- data/rakelib/release.rake +18 -11
- data/test/mounted_app/test/dummy/package.json +1 -1
- metadata +5 -4
- data/lib/shakapacker/utils/git_utils.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d56f3bf25f84819a60ea5e8ad408d654eec2a208886d7ebb6b84e27dd09af4a0
|
4
|
+
data.tar.gz: f71bf10af00c11400e4fc2edd43e60d6dee2be79ca79cbdd6202c9cc9442e36d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
4
|
+
## Versions
|
5
|
+
### [Unreleased]
|
6
|
+
Changes since last non-beta release.
|
6
7
|
|
7
|
-
Please
|
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
|
-
|
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
|
[](https://github.com/shakacode/shakapacker/actions)
|
7
9
|
[](https://github.com/shakacode/shakapacker/actions)
|
8
10
|
[](https://github.com/shakacode/shakapacker/actions)
|
9
11
|
[](https://github.com/shakacode/shakapacker/actions)
|
10
12
|
|
11
|
-
[](https://www.npmjs.com/package
|
13
|
+
[](https://www.npmjs.com/package/shakapacker)
|
12
14
|
[](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 '
|
113
|
+
gem 'shakapacker', '~> 6.0'
|
113
114
|
|
114
115
|
# OR if you prefer to use master
|
115
|
-
gem '
|
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
|
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('
|
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('
|
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
|
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("
|
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('
|
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('
|
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
|
583
|
+
yarn upgrade shakapacker --latest
|
583
584
|
yarn upgrade webpack-dev-server --latest
|
584
585
|
|
585
586
|
# yarn 2 instructions
|
586
|
-
yarn up
|
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
|
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
|
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
|
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('
|
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
|
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
|
data/docs/troubleshooting.md
CHANGED
@@ -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('
|
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('
|
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
|
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 '
|
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
|
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('
|
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('
|
120
|
+
const { webpackConfig, merge } = require('shakapacker')
|
113
121
|
const customConfig = require('./custom')
|
114
122
|
|
115
123
|
module.exports = merge(webpackConfig, customConfig)
|
data/lib/install/package.json
CHANGED
data/lib/install/template.rb
CHANGED
@@ -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
|
70
|
-
results << run("yarn add
|
69
|
+
say "Installing shakapacker@#{Webpacker::VERSION}"
|
70
|
+
results << run("yarn add shakapacker@#{Webpacker::VERSION}")
|
71
71
|
else
|
72
|
-
say "Installing
|
73
|
-
results << run("yarn add
|
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
|
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
|
data/lib/shakapacker.rb
ADDED
@@ -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 "
|
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'}"
|
data/lib/webpacker/version.rb
CHANGED
data/package/babel/preset.js
CHANGED
data/package.json
CHANGED
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", "
|
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 :
|
27
|
+
task :create_release, %i[gem_version dry_run] do |_t, args|
|
28
28
|
# Check if there are uncommited changes
|
29
|
-
Shakapacker::
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
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.
|
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-
|
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
|
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.
|
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
|