shakapacker 9.6.0.rc.0 → 9.6.0.rc.2

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: a5240d4875989d1257b2c24656db7b29c5d052a9c99e22b9203565bf615aaf43
4
- data.tar.gz: 855e3c61ff9169c2f4a34cc864d80f41299e48fd2530fb0def09e5bd9e07651f
3
+ metadata.gz: f8de376ed8bf26aa80f043c1b4f1edfe9fe14e76b8b5db9d4d4bdfc6fc1b0c62
4
+ data.tar.gz: 84db935f44746cc5ec67a1e71018bab24d1a17c2be17a27a4d6d894e35e4e106
5
5
  SHA512:
6
- metadata.gz: 719593b91e0dd86f68db334fe533a76e05ebf7862e04162039b066182bc52642e4c200d0394e6f3cbfaea8a8600d5340d20d9a5cd54bd389c40e4d4ff8c1f055
7
- data.tar.gz: 80f22641a2e9cba2ab9a8ccda6095133e636165185914b8ae1b6f7a85f1b860834913dc4a697db7d1785f001420e47aefad34584389c0221dc7eb7e0f9778957
6
+ metadata.gz: c9b75f026df4c043286fe9d068651de5c67eecd2c34a6946a6d708498d6c9cd032db716805126eb280ef72ef828582391d0579f304d30ccf736fd6d0d3ea6456
7
+ data.tar.gz: 5574ca0d5f1992980e8f2cb615c76fb0934201493d0994fcef5a6824040ba3eb6a01d4aae087fc2941b3fa52529eb6f6ec71e1b4230f9c44c6379d4b0fdb141e
@@ -2,6 +2,68 @@
2
2
 
3
3
  You are helping to add an entry to the CHANGELOG.md file for the Shakapacker project.
4
4
 
5
+ ## Arguments
6
+
7
+ This command accepts an optional argument: `$ARGUMENTS`
8
+
9
+ - **No argument** (`/update-changelog`): Add entries to `[Unreleased]` without stamping a version header. Use this during development.
10
+ - **`release`** (`/update-changelog release`): Add entries and stamp a version header. Auto-compute the next version based on changes (breaking → major, added features → minor, fixes → patch). Then `rake create_release` (with no args) will pick up this version automatically.
11
+ - **`rc`** (`/update-changelog rc`): Same as `release`, but stamps an RC prerelease version (e.g., `v9.7.0-rc.0`). Auto-increments the RC index if prior RCs exist for the same base version.
12
+ - **`beta`** (`/update-changelog beta`): Same as `rc`, but stamps a beta prerelease version (e.g., `v9.7.0-beta.0`).
13
+
14
+ ## When to Use This
15
+
16
+ This command serves three use cases at different points in the release lifecycle:
17
+
18
+ **During development** — Add entries to `[Unreleased]` as PRs merge:
19
+
20
+ - Run `/update-changelog` to find merged PRs missing from the changelog
21
+ - Entries accumulate under `## [Unreleased]`
22
+
23
+ **Before a release** — Stamp a version header and prepare for release:
24
+
25
+ - Run `/update-changelog release` (or `rc` or `beta`) to add entries AND stamp the version header
26
+ - The version is auto-computed from changelog content (see "Auto-Computing the Next Version" below)
27
+ - Commit and push CHANGELOG.md
28
+ - Then run `rake create_release` (no args needed — it reads the version from CHANGELOG.md)
29
+ - The release task automatically creates a GitHub release from the changelog section
30
+
31
+ **After a release you forgot to update the changelog for** — Catch-up mode:
32
+
33
+ - The command can retroactively find commits between tags and add missing entries
34
+ - Ask the user whether to stamp a version header or add to `[Unreleased]`
35
+
36
+ ### Why changelog comes BEFORE the release
37
+
38
+ - `create_release` automatically creates a GitHub release if a changelog section exists — no separate `sync_github_release` step needed
39
+ - The release task warns if no changelog section is found for the target version
40
+ - A premature version header (if release fails) is harmless — you'll release eventually
41
+ - A missing changelog after release means GitHub release must be created manually
42
+
43
+ ## Auto-Computing the Next Version
44
+
45
+ When stamping a version header (`release`, `rc`, or `beta`), compute the next version as follows:
46
+
47
+ 1. **Find the latest stable version tag** using semver sort:
48
+
49
+ ```bash
50
+ git tag -l 'v*' --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1
51
+ ```
52
+
53
+ 2. **Determine bump type from changelog content**:
54
+ - If changes include `### Breaking Changes` or `### ⚠️ Breaking Changes` → **major** bump
55
+ - If changes include `### Added` or `### New Features` → **minor** bump
56
+ - If changes only include `### Fixed`, `### Security`, `### Improved`, `### Changed`, `### Deprecated` → **patch** bump
57
+
58
+ 3. **Compute the version**:
59
+ - For `release`: Apply the bump to the latest stable tag (e.g., `9.5.0` + minor → `9.6.0`)
60
+ - For `rc`: Apply the bump, then find the next RC index (e.g., if `v9.6.0-rc.0` tag exists → `v9.6.0-rc.1`)
61
+ - For `beta`: Same as RC but with beta suffix
62
+
63
+ 4. **Verify**: Check that the computed version is newer than ALL existing tags (stable and prerelease). If not, ask the user what to do.
64
+
65
+ 5. **Show the computed version to the user** and ask for confirmation before stamping the header.
66
+
5
67
  ## Critical Requirements
6
68
 
7
69
  1. **User-visible changes only**: Only add changelog entries for user-visible changes:
@@ -74,6 +136,21 @@ Entries should be organized under these section headings. The project uses both
74
136
 
75
137
  **Only include section headings that have entries.**
76
138
 
139
+ ### Version Header Format
140
+
141
+ **Stable releases**: `## [v9.6.0] - March 7, 2026`
142
+
143
+ **Prerelease versions** (RC and beta): Use npm semver format with dashes, NOT RubyGems dot format:
144
+
145
+ - Correct: `## [v9.6.0-rc.1]` (npm semver — this is what `sync_github_release` expects)
146
+ - Wrong: `## [v9.6.0.rc.1]` (RubyGems format — do NOT use this in CHANGELOG.md headers)
147
+
148
+ This matters because the release rake tasks convert between formats:
149
+
150
+ - Git tags use npm format: `v9.6.0-rc.1`
151
+ - Gem versions use RubyGems format: `9.6.0.rc.1`
152
+ - CHANGELOG.md headers must match git tag format: `## [v9.6.0-rc.1]`
153
+
77
154
  ### Version Management
78
155
 
79
156
  After adding entries, use the rake task to manage version headers:
@@ -110,16 +187,17 @@ When a new version is released:
110
187
  ### For Regular Changelog Updates
111
188
 
112
189
  1. **ALWAYS fetch latest changes first**:
113
- - **CRITICAL**: Run `git fetch origin main` to ensure you have the latest commits
190
+ - **CRITICAL**: Run `git fetch origin main --tags` to ensure you have the latest commits AND tags
114
191
  - The workspace may be behind origin/main, causing you to miss recently merged PRs
115
192
  - After fetching, use `origin/main` for all comparisons, NOT local `main` branch
116
193
 
117
194
  2. **Determine the correct version tag to compare against**:
118
- - First, check the tag dates: `git log --tags --simplify-by-decoration --pretty="format:%ai %d" | head -10`
119
- - Find the latest version tag and its date
120
- - Compare origin/main branch date to the tag date
121
- - If the tag is NEWER than origin/main, it means the branch needs to be updated to include the tag's commits
122
- - **CRITICAL**: Always use `git log TAG..BRANCH` to find commits that are in the tag but not in the branch, as the tag may be ahead
195
+ - List all version tags sorted by semver: `git tag -l 'v*' --sort=-v:refname | head -10`
196
+ - This correctly sorts RC/beta tags (e.g., `v9.6.0-rc.1` sorts after `v9.6.0-rc.0` and before `v9.6.0`)
197
+ - The latest tag may be a stable release, RC, or beta — handle all cases
198
+ - Compare origin/main branch date to the tag date using: `git log -1 --format="%ai" origin/main` and `git log -1 --format="%ai" <tag>`
199
+ - If the tag is NEWER than origin/main, the branch needs updating to include the tag's commits
200
+ - **CRITICAL**: Always use `git log TAG..BRANCH` to find commits in the branch but not the tag, AND `git log BRANCH..TAG` to check if the tag is ahead
123
201
 
124
202
  3. **Check commits and version boundaries**:
125
203
  - **IMPORTANT**: Use `origin/main` in all commands below, not local `main`
@@ -162,37 +240,44 @@ When a new version is released:
162
240
 
163
241
  10. **Show the user** the added or moved entries and explain what was done.
164
242
 
165
- ### For Beta to Non-Beta Version Release
243
+ ### For Prerelease Versions (RC and Beta)
166
244
 
167
- When releasing from beta to a stable version (e.g., v9.1.0-beta.3 v9.1.0):
245
+ When the user passes `rc` or `beta` as an argument (or when creating a prerelease section manually):
168
246
 
169
- 1. **Remove all beta version labels** from the changelog:
170
- - Change `## [v9.1.0-beta.1]`, `## [v9.1.0-beta.2]`, etc. to a single `## [v9.1.0]` section
171
- - Combine all beta entries into the stable release section
247
+ 1. **Find the latest tag** (stable or prerelease) using semver sort:
172
248
 
173
- 2. **Consolidate duplicate entries**:
174
- - If bug fixes or changes were made to features introduced in earlier betas, keep only the final state
175
- - Remove redundant changelog entries for fixes to beta features
176
- - Keep the most recent/accurate description of each change
249
+ ```bash
250
+ git tag -l 'v*' --sort=-v:refname | head -10
251
+ ```
177
252
 
178
- 3. **Update version diff links** at the bottom to point to the stable version
253
+ 2. **Auto-compute the next prerelease version** using the process in "Auto-Computing the Next Version" above.
179
254
 
180
- ### For New Beta Version Release
255
+ 3. **Use npm semver format** for the version header:
256
+ - RC: `## [v9.6.0-rc.1]`
257
+ - Beta: `## [v9.6.0-beta.2]`
181
258
 
182
- When creating a new beta version, ask the user which approach to take:
259
+ 4. **Always collapse prior prereleases into the current prerelease** (this is the default behavior):
260
+ - Combine all prior prerelease changelog entries into the new prerelease version section
261
+ - Remove previous prerelease version sections (e.g., remove `## [v9.6.0-rc.0]` when creating `## [v9.6.0-rc.1]`)
262
+ - Add any new user-visible changes from commits since the last prerelease
263
+ - Update version diff links to point from the last stable version to the new prerelease
264
+ - This keeps the changelog clean with a single prerelease section that accumulates all changes since the last stable release
183
265
 
184
- **Option 1: Process changes since last beta**
266
+ ### For Prerelease to Stable Version Release
185
267
 
186
- - Only add entries for commits since the previous beta version
187
- - Maintains detailed history of what changed in each beta
268
+ When releasing from prerelease to a stable version (e.g., v9.6.0-rc.1 → v9.6.0):
188
269
 
189
- **Option 2: Collapse all prior betas into current beta**
270
+ 1. **Remove all prerelease version labels** from the changelog:
271
+ - Change `## [v9.6.0-rc.0]`, `## [v9.6.0-rc.1]`, etc. to a single `## [v9.6.0]` section
272
+ - Also handle beta versions: `## [v9.6.0-beta.1]` etc.
273
+ - Combine all prerelease entries into the stable release section
190
274
 
191
- - Combine all beta changelog entries into the new beta version
192
- - Removes previous beta version sections
193
- - Cleaner changelog with less version noise
275
+ 2. **Consolidate duplicate entries**:
276
+ - If bug fixes or changes were made to features introduced in earlier prereleases, keep only the final state
277
+ - Remove redundant changelog entries for fixes to prerelease features
278
+ - Keep the most recent/accurate description of each change
194
279
 
195
- After the user chooses, proceed with that approach.
280
+ 3. **Update version diff links** at the bottom to point to the stable version
196
281
 
197
282
  ## Examples
198
283
 
@@ -12,6 +12,7 @@ jobs:
12
12
  contents: read
13
13
  pull-requests: write
14
14
  issues: write
15
+ id-token: write
15
16
 
16
17
  steps:
17
18
  - name: Checkout repository
data/CHANGELOG.md CHANGED
@@ -11,6 +11,8 @@
11
11
 
12
12
  Changes since the last non-beta release.
13
13
 
14
+ ## [v9.6.0-rc.2] - March 7, 2026
15
+
14
16
  ### Security
15
17
 
16
18
  - Removed default `Access-Control-Allow-Origin: *` header from dev server configuration. This header allowed any website to access dev server resources. **If your setup runs webpack-dev-server on a different port from your Rails server, uncomment the `headers` section in `config/shakapacker.yml` to restore cross-origin asset loading.** [PR #936](https://github.com/shakacode/shakapacker/pull/936) by [justin808](https://github.com/justin808). Fixes [#935](https://github.com/shakacode/shakapacker/issues/935).
@@ -35,6 +37,7 @@ Changes since the last non-beta release.
35
37
 
36
38
  ### Changed
37
39
 
40
+ - **Changed default file rule type from `asset/resource` to `asset`**. [PR #901](https://github.com/shakacode/shakapacker/pull/901) by [justin808](https://github.com/justin808). Static assets (images, fonts, SVGs) now use webpack/rspack's `asset` type instead of `asset/resource`, allowing the bundler to automatically inline small files as data URIs for better performance.
38
41
  - Allow `compression-webpack-plugin` v12. [PR #937](https://github.com/shakacode/shakapacker/pull/937) by [G-Rath](https://github.com/G-Rath).
39
42
  - **BREAKING: sass-loader now defaults to modern Sass API**. [PR #879](https://github.com/shakacode/shakapacker/pull/879) by [justin808](https://github.com/justin808). The sass-loader configuration now uses `api: "modern"` instead of the deprecated legacy API. This improves compatibility with plugins like sass-resources-loader that require the modern API. If you experience issues after upgrading, you can revert to the legacy API by customizing your webpack config:
40
43
 
@@ -63,12 +66,13 @@ Changes since the last non-beta release.
63
66
  - **Fixed orphaned webpack/rspack processes when foreman receives SIGTERM**. [PR #888](https://github.com/shakacode/shakapacker/pull/888) by [jordan-brough](https://github.com/jordan-brough). When running under foreman, sending SIGTERM to foreman (e.g. `kill <pid>`) would kill the Ruby shakapacker process but leave the webpack/rspack child process running as an orphan. DevServerRunner now uses `exec` to replace the Ruby process entirely, and Runner uses `spawn` with SIGTERM forwarding to ensure the child process is properly terminated.
64
67
  - **Fixed missing-environment fallback to use production instead of development**. [PR #894](https://github.com/shakacode/shakapacker/pull/894) by [justin808](https://github.com/justin808). When a Rails environment (e.g., staging) is not defined in `shakapacker.yml`, Shakapacker now falls back to the `production` configuration instead of `development`. This ensures unknown environments get production-optimized webpack/rspack builds by default.
65
68
  - **Fixed installer writing wrong shakapacker version in package.json**. [PR #899](https://github.com/shakacode/shakapacker/pull/899) by [justin808](https://github.com/justin808). The `shakapacker:install` generator now keeps the `package.json` dependency value in sync with the exact version or path that was requested, instead of relying on the post-install value which could differ.
69
+ - **Fixed `privateOutputPath` not being computed in JavaScript config**. [PR #891](https://github.com/shakacode/shakapacker/pull/891) by [ihabadham](https://github.com/ihabadham). The `private_output_path` setting from `shakapacker.yml` is now properly resolved to an absolute path and exposed as `privateOutputPath` in the JavaScript configuration, matching the behavior already present in the Ruby configuration.
66
70
  - **Fixed installer not updating `shakapacker.yml` when selecting a non-default transpiler**. [PR #895](https://github.com/shakacode/shakapacker/pull/895) by [codex-rs](https://github.com/apps/codex-rs). Installing with `JAVASCRIPT_TRANSPILER=babel` (or `esbuild`) now correctly updates `config/shakapacker.yml` to match the selected transpiler instead of leaving it set to `swc`. Previously, a quote mismatch in the `gsub_file` call meant the config was never actually updated, and the condition also excluded `JAVASCRIPT_TRANSPILER=babel` from the update entirely. Additionally, `JAVASCRIPT_TRANSPILER=babel` no longer installs SWC packages.
67
71
  - **Fixed ENOENT crash on clean builds when using `webpack-assets-manifest` v6 with `merge: true`**. [PR #931](https://github.com/shakacode/shakapacker/pull/931) by [justin808](https://github.com/justin808). Seeds an empty `{}` manifest file before instantiating the plugin, so the merge read succeeds on first build rather than throwing an unhandled ENOENT.
68
72
  - **Improved error message when manifest is empty or missing**. [PR #872](https://github.com/shakacode/shakapacker/pull/872) by [justin808](https://github.com/justin808). When the bundler is still compiling (empty manifest) or hasn't run yet (missing manifest file), users now see clear, actionable error messages instead of the generic 7-point checklist.
69
73
  - **Fixed NODE_ENV=test causing DefinePlugin warnings**. [PR #870](https://github.com/shakacode/shakapacker/pull/870) by [justin808](https://github.com/justin808). When RAILS_ENV=test, Shakapacker now sets NODE_ENV=development instead of NODE_ENV=test. This prevents webpack/rspack DefinePlugin conflicts since these bundlers only recognize "development" and "production" as valid NODE_ENV values.
70
74
  - **Fixed `--json` flag output being corrupted by log messages**. [PR #869](https://github.com/shakacode/shakapacker/pull/869) by [justin808](https://github.com/justin808). When `--json` is in the command arguments, `[Shakapacker]` log messages are now written to stderr instead of stdout, keeping stdout clean for valid JSON output. This allows `bin/shakapacker --profile --json` to be piped to tools like `webpack-bundle-analyzer`. Normal (non-JSON) usage is unchanged. Resolves [#868](https://github.com/shakacode/shakapacker/issues/868).
71
- - **Require explicit truthy values for `SKIP` and `FORCE` installer env vars**. [PR #926](https://github.com/shakacode/shakapacker/pull/926) by [justin808](https://github.com/justin808). Previously, any set value (including `"false"` or `"0"`) would activate skip/force mode. Now only explicit truthy values (`true`, `1`, `yes`, case-insensitive) are recognized. This behavior change may require CI/scripts that relied on `FORCE=<any non-empty value>` to switch to `FORCE=true`.
75
+ - **Require explicit truthy values for all installer env vars**. [PR #926](https://github.com/shakacode/shakapacker/pull/926), [PR #943](https://github.com/shakacode/shakapacker/pull/943) by [justin808](https://github.com/justin808). Previously, any set value (including `"false"` or `"0"`) would activate these flags. Now only explicit truthy values (`true`, `1`, `yes`, case-insensitive) are recognized for `SKIP`, `FORCE`, `USE_BABEL_PACKAGES`, `SHAKAPACKER_USE_TYPESCRIPT`, and `SKIP_COMMON_LOADERS`. This behavior change may require CI/scripts that relied on arbitrary non-empty values to switch to recognized truthy values like `true`.
72
76
 
73
77
  ### Documentation
74
78
 
@@ -116,7 +120,7 @@ Changes since the last non-beta release.
116
120
 
117
121
  - **Added `SHAKAPACKER_SKIP_PRECOMPILE_HOOK` environment variable to skip precompile hook**. [PR #850](https://github.com/shakacode/shakapacker/pull/850) by [justin808](https://github.com/justin808). Set `SHAKAPACKER_SKIP_PRECOMPILE_HOOK=true` to skip the precompile hook during compilation. This is useful when using process managers like Foreman or Overmind to run the hook once before starting multiple webpack processes, preventing duplicate hook execution. **Migration tip:** If you have a custom `bin/dev` script that starts multiple webpack processes, you can now run the precompile hook once in the script and set this environment variable to prevent each webpack process from running the hook again. See the [precompile hook documentation](./docs/precompile_hook.md#skipping-the-hook) for implementation examples.
118
122
 
119
- ## [v9.3.4-beta.0] - November 17, 2025
123
+ ## [v9.3.4] - November 17, 2025
120
124
 
121
125
  ### Fixed
122
126
 
@@ -864,10 +868,11 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
864
868
 
865
869
  See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
866
870
 
867
- [Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.5.0...main
871
+ [Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.6.0-rc.2...main
872
+ [v9.6.0-rc.2]: https://github.com/shakacode/shakapacker/compare/v9.5.0...v9.6.0-rc.2
868
873
  [v9.5.0]: https://github.com/shakacode/shakapacker/compare/v9.4.0...v9.5.0
869
874
  [v9.4.0]: https://github.com/shakacode/shakapacker/compare/v9.3.4...v9.4.0
870
- [v9.3.4-beta.0]: https://github.com/shakacode/shakapacker/compare/v9.3.3...v9.3.4-beta.0
875
+ [v9.3.4]: https://github.com/shakacode/shakapacker/compare/v9.3.3...v9.3.4
871
876
  [v9.3.3]: https://github.com/shakacode/shakapacker/compare/v9.3.2...v9.3.3
872
877
  [v9.3.2]: https://github.com/shakacode/shakapacker/compare/v9.3.1...v9.3.2
873
878
  [v9.3.1]: https://github.com/shakacode/shakapacker/compare/v9.3.0...v9.3.1
data/docs/releasing.md CHANGED
@@ -9,6 +9,7 @@ This guide is for Shakapacker maintainers who need to publish a new release.
9
9
  ```bash
10
10
  bundle install # Installs gem-release
11
11
  yarn global add release-it # Installs release-it for npm publishing
12
+ gh --version # Required for automatic GitHub release creation
12
13
  ```
13
14
 
14
15
  2. **Ensure you have publishing access:**
@@ -19,53 +20,97 @@ This guide is for Shakapacker maintainers who need to publish a new release.
19
20
  - npm: 2FA is required for publishing
20
21
  - RubyGems: 2FA is required for publishing
21
22
 
23
+ 4. **Authenticate GitHub CLI:**
24
+ - Run `gh auth login` and ensure your account/token has write access to this repository
25
+ - Required for automatic GitHub release creation after publishing
26
+
22
27
  ## Release Process
23
28
 
24
- ### 1. Prepare the Release
29
+ ### 1. Update the Changelog
25
30
 
26
- Before running the release task:
31
+ **Always update CHANGELOG.md before running the release task.** The release task reads the version from CHANGELOG.md and automatically creates a GitHub release from the changelog section.
27
32
 
28
33
  1. Ensure all desired changes are merged to `main` branch
29
- 2. Update `CHANGELOG.md` with the new version and release notes
30
- 3. Commit the CHANGELOG changes
31
- 4. Ensure your working directory is clean (`git status` shows no uncommitted changes)
34
+ 2. Run `/update-changelog release` (or `rc` or `beta` for prereleases) to:
35
+ - Find merged PRs missing from the changelog
36
+ - Add changelog entries under the appropriate category headings
37
+ - Auto-compute the next version based on changes (breaking → major, features → minor, fixes → patch)
38
+ - Stamp the version header (e.g., `## [v9.6.0] - March 7, 2026`)
39
+ 3. Review the changelog entries and verify the computed version
40
+ 4. Commit and push CHANGELOG.md
41
+
42
+ If you forget this step, the release task will print a warning and the GitHub release will need to be created manually afterward using `sync_github_release`.
32
43
 
33
44
  ### 2. Run the Release Task
34
45
 
35
- The automated release task handles the entire release process:
46
+ The simplest way to release is with no arguments — the task reads the version from CHANGELOG.md:
36
47
 
37
48
  ```bash
38
- # For a specific version (e.g., 9.1.0)
39
- bundle exec rake create_release[9.1.0]
49
+ # Recommended: reads version from CHANGELOG.md (requires step 1)
50
+ bundle exec rake create_release
51
+
52
+ # For a specific version (overrides CHANGELOG.md detection)
53
+ bundle exec rake "create_release[9.1.0]"
40
54
 
41
55
  # For a beta release (note: use period, not dash)
42
- bundle exec rake create_release[9.2.0.beta.1] # Creates npm package 9.2.0-beta.1
56
+ bundle exec rake "create_release[9.2.0.beta.1]" # Creates npm package 9.2.0-beta.1
43
57
 
44
- # For a patch version bump (auto-increments)
45
- bundle exec rake create_release
58
+ # For a release candidate
59
+ bundle exec rake "create_release[9.6.0.rc.0]"
46
60
 
47
61
  # Dry run to test without publishing
48
- bundle exec rake create_release[9.1.0,true]
62
+ bundle exec rake "create_release[9.1.0,true]"
63
+
64
+ # Override version policy checks (monotonic + changelog/bump consistency)
65
+ RELEASE_VERSION_POLICY_OVERRIDE=true bundle exec rake "create_release[9.1.0]"
66
+ bundle exec rake "create_release[9.1.0,false,true]"
49
67
  ```
50
68
 
69
+ When called with no arguments, `create_release`:
70
+
71
+ 1. Reads the first versioned header from CHANGELOG.md (e.g., `## [v9.6.0]`)
72
+ 2. Compares it to the current gem version
73
+ 3. If the changelog version is newer, prompts for confirmation and uses it
74
+ 4. If no new version is found, falls back to a patch bump
75
+
76
+ Dry runs use a temporary git worktree so version bumps and installs do not modify your current checkout.
77
+
78
+ `create_release` validates release-version policy before publishing:
79
+
80
+ - Target version must be greater than the latest tagged release.
81
+ - If the versioned target changelog section exists (`## [vX.Y.Z...]`; not `UNRELEASED`), it maps to expected bump type:
82
+ - Breaking changes => major bump
83
+ - Added/New Features/Features/Enhancements => minor bump
84
+ - Fixed/Fixes/Bug Fixes/Security/Improved/Deprecated => patch bump
85
+ - Other headings => no inferred bump level (consistency check is skipped)
86
+
87
+ Use override only when needed:
88
+
89
+ - `RELEASE_VERSION_POLICY_OVERRIDE=true`
90
+ - Or task arg override (`create_release[..., ..., true]`)
91
+
51
92
  ### 3. What the Release Task Does
52
93
 
53
94
  The `create_release` task automatically:
54
95
 
55
- 1. **Pulls latest changes** from the repository
56
- 2. **Bumps version numbers** in:
96
+ 1. **Validates release prerequisites**:
97
+ - Verifies npm authentication
98
+ - Warns if CHANGELOG.md section is missing for the target version
99
+ 2. **Pulls latest changes** from the repository
100
+ 3. **Bumps version numbers** in:
57
101
  - `lib/shakapacker/version.rb` (Ruby gem version)
58
102
  - `package.json` (npm package version - converted from Ruby format)
59
- 3. **Publishes to npm:**
103
+ 4. **Publishes to npm:**
60
104
  - Prompts for npm OTP (2FA code)
61
105
  - Creates git tag
62
106
  - Pushes to GitHub
63
- 4. **Publishes to RubyGems:**
107
+ 5. **Publishes to RubyGems:**
64
108
  - Prompts for RubyGems OTP (2FA code)
65
- 5. **Updates spec/dummy lockfiles:**
109
+ 6. **Updates spec/dummy lockfiles:**
66
110
  - Runs `bundle install` to update `Gemfile.lock`
67
111
  - Runs `npm install` to update `package-lock.json` (yarn.lock may also be updated for multi-package-manager compatibility testing)
68
- 6. **Commits and pushes lockfile changes** automatically
112
+ 7. **Commits and pushes lockfile changes** automatically
113
+ 8. **Creates GitHub release** from CHANGELOG.md (if the matching section exists)
69
114
 
70
115
  ### 4. Version Format
71
116
 
@@ -79,17 +124,25 @@ The task automatically converts Ruby gem format to npm semver format:
79
124
  - Ruby: `9.2.0.beta.1` → npm: `9.2.0-beta.1`
80
125
  - Ruby: `9.0.0.rc.2` → npm: `9.0.0-rc.2`
81
126
 
127
+ **CHANGELOG.md headers** use npm semver format (with dashes):
128
+
129
+ - `## [v9.6.0-rc.1]` — correct (matches git tag format)
130
+ - `## [v9.6.0.rc.1]` — wrong (RubyGems format, will not be found by release tasks)
131
+
82
132
  **Examples:**
83
133
 
84
134
  ```bash
85
135
  # Regular release
86
- bundle exec rake create_release[9.1.0] # Gem: 9.1.0, npm: 9.1.0
136
+ bundle exec rake "create_release[9.1.0]" # Gem: 9.1.0, npm: 9.1.0
87
137
 
88
138
  # Beta release
89
- bundle exec rake create_release[9.2.0.beta.1] # Gem: 9.2.0.beta.1, npm: 9.2.0-beta.1
139
+ bundle exec rake "create_release[9.2.0.beta.1]" # Gem: 9.2.0.beta.1, npm: 9.2.0-beta.1
90
140
 
91
141
  # Release candidate
92
- bundle exec rake create_release[10.0.0.rc.1] # Gem: 10.0.0.rc.1, npm: 10.0.0-rc.1
142
+ bundle exec rake "create_release[10.0.0.rc.1]" # Gem: 10.0.0.rc.1, npm: 10.0.0-rc.1
143
+
144
+ # Prerelease: use /update-changelog rc first, then create_release reads it
145
+ bundle exec rake create_release # reads v10.0.0-rc.0 from CHANGELOG.md
93
146
  ```
94
147
 
95
148
  ### 5. During the Release
@@ -97,7 +150,9 @@ bundle exec rake create_release[10.0.0.rc.1] # Gem: 10.0.0.rc.1, npm: 10.0.0-rc
97
150
  1. When prompted for **npm OTP**, enter your 2FA code from your authenticator app
98
151
  2. Accept defaults for release-it options
99
152
  3. When prompted for **RubyGems OTP**, enter your 2FA code
100
- 4. The script will automatically commit and push lockfile updates
153
+ 4. If using `create_release` with no version, confirm the version detected from CHANGELOG.md (or the computed patch version)
154
+ 5. The script will automatically commit and push lockfile updates
155
+ 6. The script will automatically create a GitHub release (if CHANGELOG.md section exists)
101
156
 
102
157
  ### 6. After Release
103
158
 
@@ -118,6 +173,25 @@ bundle exec rake create_release[10.0.0.rc.1] # Gem: 10.0.0.rc.1, npm: 10.0.0-rc
118
173
  - Tweet about major releases
119
174
  - Update documentation if needed
120
175
 
176
+ ### Syncing GitHub Releases Manually
177
+
178
+ If the automatic GitHub release creation was skipped (e.g., CHANGELOG.md section was missing during release), you can create it manually after updating the changelog:
179
+
180
+ 1. Update `CHANGELOG.md` with the published version section
181
+ - For prerelease entries, use npm semver header format with dashes, for example `## [v9.6.0-rc.1]`
182
+ 2. Commit and push `CHANGELOG.md`
183
+ 3. Run:
184
+
185
+ ```bash
186
+ # Stable
187
+ bundle exec rake "sync_github_release[9.6.0]"
188
+
189
+ # Prerelease
190
+ bundle exec rake "sync_github_release[9.6.0.rc.1]"
191
+ ```
192
+
193
+ `sync_github_release` reads release notes from the matching `CHANGELOG.md` section and creates/updates the GitHub release for the corresponding tag.
194
+
121
195
  ## Troubleshooting
122
196
 
123
197
  ### Uncommitted Changes After Release
@@ -141,6 +215,18 @@ If publishing fails partway through:
141
215
  3. If RubyGems failed: Fix the issue and manually run `gem release`
142
216
  4. Then manually update and commit spec/dummy lockfiles
143
217
 
218
+ ### GitHub Release Sync Fails
219
+
220
+ If package publishing succeeds but GitHub release creation fails:
221
+
222
+ 1. Fix GitHub auth (`gh auth login`) or permissions
223
+ 2. Ensure `CHANGELOG.md` has matching header `## [vX.Y.Z...]` (npm format for prereleases)
224
+ 3. Rerun only:
225
+
226
+ ```bash
227
+ bundle exec rake "sync_github_release[<gem_version>]"
228
+ ```
229
+
144
230
  ### Wrong Version Format
145
231
 
146
232
  If you accidentally use npm format (with dashes):
@@ -18,7 +18,7 @@ install_dir = File.expand_path(File.dirname(__FILE__))
18
18
  # Installation strategy:
19
19
  # - USE_BABEL_PACKAGES installs both babel AND swc for compatibility
20
20
  # - Otherwise install only the specified transpiler
21
- if ENV["USE_BABEL_PACKAGES"] == "true" || ENV["USE_BABEL_PACKAGES"] == "1"
21
+ if Shakapacker::Install::Env.truthy_env?("USE_BABEL_PACKAGES")
22
22
  @transpiler_to_install = "babel"
23
23
  @install_swc_compat_packages = true
24
24
  say "📦 Installing Babel packages (USE_BABEL_PACKAGES is set)", :yellow
@@ -52,7 +52,7 @@ end
52
52
  # Detect TypeScript usage
53
53
  # Auto-detect from tsconfig.json or explicit via SHAKAPACKER_USE_TYPESCRIPT env var
54
54
  @use_typescript = File.exist?(Rails.root.join("tsconfig.json")) ||
55
- ENV["SHAKAPACKER_USE_TYPESCRIPT"] == "true"
55
+ Shakapacker::Install::Env.truthy_env?("SHAKAPACKER_USE_TYPESCRIPT")
56
56
  assets_bundler = ENV["SHAKAPACKER_ASSETS_BUNDLER"] || "webpack"
57
57
  config_extension = @use_typescript ? "ts" : "js"
58
58
 
@@ -225,7 +225,7 @@ Dir.chdir(Rails.root) do
225
225
 
226
226
  # Inline fetch_peer_dependencies and fetch_common_dependencies
227
227
  peers = PackageJson.read(install_dir).fetch(ENV["SHAKAPACKER_ASSETS_BUNDLER"] || "webpack")
228
- common_deps = ENV["SKIP_COMMON_LOADERS"] ? {} : PackageJson.read(install_dir).fetch("common")
228
+ common_deps = Shakapacker::Install::Env.truthy_env?("SKIP_COMMON_LOADERS") ? {} : PackageJson.read(install_dir).fetch("common")
229
229
  peers = peers.merge(common_deps)
230
230
 
231
231
  # Add transpiler-specific dependencies based on detected/configured transpiler
@@ -17,7 +17,7 @@ module Shakapacker
17
17
  .tr("-", ".")
18
18
  .strip
19
19
  .match(/(\d.*)/)
20
- match.present? ? match[0] : nil
20
+ match ? match[0] : nil
21
21
  end
22
22
  end
23
23
  end
@@ -1,4 +1,4 @@
1
1
  module Shakapacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "9.6.0.rc.0".freeze
3
+ VERSION = "9.6.0.rc.2".freeze
4
4
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shakapacker",
3
- "version": "9.6.0-rc.0",
3
+ "version": "9.6.0-rc.2",
4
4
  "description": "Use webpack to manage app-like JavaScript modules in Rails",
5
5
  "homepage": "https://github.com/shakacode/shakapacker",
6
6
  "bugs": {