Skip to content

Commit

Permalink
Shakapacker Version 7 (#277)
Browse files Browse the repository at this point in the history
* Rename Webpacker instances to shakapacker (#245)
* Add backward compatibility (#252)
* Update docs for spelling change (#263)
* Fix backward compatibility for setting WEBPACKER_CONFIG in webpack.config.js (#266)
* Remove redundant code for enhancing precompile task (#270)
* Update webpack dev server configuration (#276)
* Stop stripping top level dirs (#283)
* Improve source_entry_path robustness (#284)

---------

Co-authored-by: Tom Dracz <[email protected]>
  • Loading branch information
ahangarha and tomdracz authored Apr 27, 2023
1 parent 1fcf9d3 commit a157223
Show file tree
Hide file tree
Showing 179 changed files with 4,116 additions and 1,130 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ruby-backward-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Ruby specs - Backward compatibility

on: [push, pull_request]

jobs:
test:
name: Ruby specs - Backward compatibility
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
ruby: ['2.6', '2.7', '3.0']
gemfile:
- gemfiles/Gemfile-rails.5.2.x
- gemfiles/Gemfile-rails.6.0.x
- gemfiles/Gemfile-rails.6.1.x
- gemfiles/Gemfile-rails.7.0.x
# Uncomment the following line only to ensure compatibility with the
# upcomming Rails versions, maybe before a release.
#- gemfiles/Gemfile-rails-edge
exclude:
- ruby: 2.6
os: ubuntu-latest
gemfile: gemfiles/Gemfile-rails.7.0.x
- ruby: 2.6
os: ubuntu-latest
gemfile: gemfiles/Gemfile-rails-edge
- ruby: 3.0
os: ubuntu-latest
gemfile: gemfiles/Gemfile-rails.5.2.x

env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Ruby specs - Backward compatibility
run: bundle exec rake test_bc
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* For the changelog of versions prior to v6, see the [5.x stable branch of rails/webpacker](https://github.com/rails/webpacker/tree/5-x-stable).
* Please see the [v7 Upgrade Guide](./docs/v7_upgrade.md) for upgrading to new spelling in version 7.
* Please see the [v6 Upgrade Guide](./docs/v6_upgrade.md) to go from versions prior to v6.
* [ShakaCode](https://www.shakacode.com) offers support for upgrading from Webpacker or using Shakapacker. If interested, contact Justin Gordon, [[email protected]](mailto:[email protected]).

Expand All @@ -18,6 +19,36 @@ _Please add entries here for your pull requests that are not yet released._
### Improved
- Move compilation lock file into the working directory. [PR 272](https://github.com/shakacode/shakapacker/pull/272) by [tomdracz](https://github.com/tomdracz).

### Changed
- Rename Webpacker to Shakapacker in the entire project including config files, binstubs, environment variables, etc. with a high degree of backward compatibility.

This change might be breaking for certain setups and edge cases. More information: [v7 Upgrade Guide](./docs/v7_upgrade.md) [PR157](https://github.com/shakacode/shakapacker/pull/157) by [ahangarha](https://github.com/ahangarha)
- Set `source_entry_path` to `packs` and `nested_entries` to `true` in`shakapacker.yml` [PR 284](https://github.com/shakacode/shakapacker/pull/284) by [ahangarha](https://github.com/ahangarha).

### Fixed
- Process `source_entry_path` with values starting with `/` as a relative path to `source_path` [PR 284](https://github.com/shakacode/shakapacker/pull/284) by [ahangarha](https://github.com/ahangarha).

- Dev server configuration is modified to follow [webpack recommended configurations](https://webpack.js.org/configuration/dev-server/) for dev server. [PR276](https://github.com/shakacode/shakapacker/pull/276) by [ahangarha](https://github.com/ahangarha):
- Deprecated `https` entry is removed from the default configuration file, allowing to set `server` or `https` as per the project requirements. For more detail, check Webpack documentation. The `https` entry can be effective only if there is no `server` entry in the config file.
- `allowed_hosts` is now set to `auto` instead of `all` by default.

- Removes defaults passed to `@babel/preset-typescript`. [PR 273](https://github.com/shakacode/shakapacker/pull/273) by [tomdracz](https://github.com/tomdracz).

`@babel/preset-typescript` has been initialised in default configuration with `{ allExtensions: true, isTSX: true }` - meaning every file in the codebase was treated as TSX leading to potential issues. This has been removed and returns to sensible default of the preset which is to figure out the file type from the extensions. This change might affect generated output however so it is marked as breaking.

- Remove the arbitrary stripping of the top-level directory when generating static file paths. [PR 283](https://github.com/shakacode/shakapacker/pull/283) by [tomdracz](https://github.com/tomdracz).

Prior to this change, top level directory of static assets like images and fonts was stripped. This meant that file in `app/javascript/images/image.png` would be output to `static/image.png` directory and could be referenced through helpers as `image_pack_tag("image.jpg")` or `image_pack_tag("static/image.jpg")`.

Going forward, the top level directory of static files will be retained so this will necessitate the update of file name references in asset helpers. In the example above, the file sourced from `app/javascript/images/image.png` will be now output to `static/images/image.png` and needs to be referenced as `image_pack_tag("images/image.jpg")` or `image_pack_tag("static/images/image.jpg")`.

### Removed
- Remove redundant enhancement for precompile task to run `yarn install` [PR 270](https://github.com/shakacode/shakapacker/pull/270) by [ahangarha](https://github.com/ahangarha).

### Added
- All standard Webpack entries with the camelCase format are now supported in `shakapacker.yml` in snake_case format. [PR276](https://github.com/shakacode/shakapacker/pull/276) by [ahangarha](https://github.com/ahangarha).


## [v6.6.0] - March 7, 2023
### Improved
- Allow configuration of webpacker.yml through env variable. [PR 254](https://github.com/shakacode/shakapacker/pull/254) by [alecslupu](https://github.com/alecslupu).
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ bundle exec rake test
#### 4.1 Run a single ruby test file

```
bundle exec rake test TEST=test/rake_tasks_test.rb
bundle exec rspec spec/configuration_spec.rb
```

#### 4.2 Run a single ruby test

```
bundle exec ruby -I test test/rake_tasks_test.rb -n test_rake_webpacker_install
bundle exec rspec -e "#source_entry_path returns correct path"
```

## Testing the generator
If you change the generator, check that install instructions work.

1. Update the gemfile so that gem "webpacker" has a line like this, pointing to your install of webpacker
1. Update the gemfile so that gem "shakapacker" has a line like this, pointing to your install of shakapacker
```ruby
gem 'webpacker', path: "~/shakacode/forks/shakapacker"
gem 'shakapacker', path: "~/shakacode/forks/shakapacker"
```
2. `bundle`
3. Run the generator confirm that you got the right changes.
Expand Down
Loading

0 comments on commit a157223

Please sign in to comment.