shakapacker 9.3.0.beta.6 → 9.3.0
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 +46 -105
- data/ESLINT_TECHNICAL_DEBT.md +8 -2
- data/Gemfile.lock +1 -1
- data/README.md +53 -2
- data/docs/configuration.md +28 -0
- data/docs/rspack_migration_guide.md +238 -2
- data/docs/troubleshooting.md +21 -21
- data/eslint.config.fast.js +8 -0
- data/eslint.config.js +47 -10
- data/knip.ts +8 -1
- data/lib/install/config/shakapacker.yml +6 -6
- data/lib/shakapacker/configuration.rb +227 -4
- data/lib/shakapacker/dev_server.rb +88 -1
- data/lib/shakapacker/doctor.rb +129 -72
- data/lib/shakapacker/instance.rb +85 -1
- data/lib/shakapacker/manifest.rb +85 -11
- data/lib/shakapacker/runner.rb +12 -8
- data/lib/shakapacker/swc_migrator.rb +7 -7
- data/lib/shakapacker/version.rb +1 -1
- data/lib/shakapacker.rb +143 -3
- data/lib/tasks/shakapacker/doctor.rake +1 -1
- data/lib/tasks/shakapacker/export_bundler_config.rake +4 -4
- data/package/config.ts +0 -1
- data/package/configExporter/buildValidator.ts +53 -29
- data/package/configExporter/cli.ts +152 -118
- data/package/configExporter/configFile.ts +33 -26
- data/package/configExporter/fileWriter.ts +3 -3
- data/package/configExporter/types.ts +64 -0
- data/package/configExporter/yamlSerializer.ts +147 -36
- data/package/dev_server.ts +2 -1
- data/package/env.ts +1 -1
- data/package/environments/base.ts +4 -4
- data/package/environments/development.ts +7 -6
- data/package/environments/production.ts +6 -7
- data/package/environments/test.ts +2 -1
- data/package/index.ts +28 -4
- data/package/loaders.d.ts +2 -2
- data/package/optimization/webpack.ts +29 -31
- data/package/plugins/webpack.ts +2 -1
- data/package/rspack/index.ts +2 -1
- data/package/rules/file.ts +1 -0
- data/package/rules/jscommon.ts +1 -0
- data/package/utils/helpers.ts +0 -1
- data/package/utils/pathValidation.ts +68 -7
- data/package/utils/requireOrError.ts +10 -2
- data/package/utils/typeGuards.ts +43 -46
- data/package/webpack-types.d.ts +2 -2
- data/package/webpackDevServerConfig.ts +1 -0
- data/package.json +2 -3
- data/test/configExporter/integration.test.js +8 -8
- data/test/package/configExporter/cli.test.js +440 -0
- data/test/package/configExporter/types.test.js +163 -0
- data/test/package/configExporter.test.js +271 -7
- data/test/package/yamlSerializer.test.js +204 -0
- data/test/typescript/pathValidation.test.js +44 -0
- data/test/typescript/requireOrError.test.js +49 -0
- data/yarn.lock +0 -32
- metadata +11 -6
- data/.eslintrc.fast.js +0 -40
- data/.eslintrc.js +0 -84
- data/package-lock.json +0 -13047
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1e94cd0b57c81506b9cab0fb54cc6a876276c3f3331686cf921fa4485442ab99
|
|
4
|
+
data.tar.gz: 292b0623b5241014524f9227ed2a1009752de53e8db610344567f761c7b8b4bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6dd27e8501b86f06fbefd6f71a2a3ceb9c975dd28f140251ab03cf6bd972b631db35666e9c05bdf434bf2ac13c1568f57bd73a7841efb38befb541f2d0cfaeb1
|
|
7
|
+
data.tar.gz: 623358b9543ddcad7586a68e03aba4848151d4490a298c39320a395cb4aa450783a91f4c21d53b491868600d57e054f3f52bcb72eb244f25ebc0e8cb20ff1738
|
data/CHANGELOG.md
CHANGED
|
@@ -11,128 +11,69 @@
|
|
|
11
11
|
|
|
12
12
|
Changes since the last non-beta release.
|
|
13
13
|
|
|
14
|
-
###
|
|
14
|
+
### Fixed
|
|
15
15
|
|
|
16
|
-
- **
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
- Improved
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- Automatically discovers packs from queues populated by views/partials
|
|
35
|
-
- New `configure_pack_early_hints` class method for controller-level configuration
|
|
36
|
-
- New `skip_send_pack_early_hints` helper to opt-out for specific controllers (e.g., JSON APIs)
|
|
37
|
-
- Optional manual control: `configure_early_hints` can be called in controllers or views
|
|
38
|
-
- Added `early_hints:` option to `javascript_pack_tag` for per-tag control
|
|
39
|
-
- New `early_hints` configuration in `shakapacker.yml` with per-environment settings (`enabled: false` by default)
|
|
40
|
-
- Requires Rails 5.2+ and HTTP/2-capable server (e.g., Puma 5+)
|
|
41
|
-
- Browser support: All modern browsers (Chrome/Edge/Firefox 103+, Safari 16.4+)
|
|
42
|
-
- Gracefully degrades if not supported
|
|
43
|
-
- **Performance note**: May improve or hurt page load performance depending on content - careful testing advised
|
|
44
|
-
- See [Early Hints Guide](docs/early_hints.md) for detailed usage and advanced patterns
|
|
45
|
-
|
|
46
|
-
## [v9.3.0-beta.5] - October 18, 2025
|
|
16
|
+
- **Enhanced error handling for better security and debugging**. [PR #786](https://github.com/shakacode/shakapacker/pull/786) by [justin808](https://github.com/justin808).
|
|
17
|
+
- Path validation now properly reports permission errors instead of silently handling them
|
|
18
|
+
- Module loading errors now include original error context for easier troubleshooting
|
|
19
|
+
- Improved security by only catching ENOENT errors in path resolution, rethrowing permission and access errors
|
|
20
|
+
- Better type safety with custom ErrorWithCause interface and optional chaining for error.code checks
|
|
21
|
+
- **Improved type safety and error handling in configExporter module**. [PR #778](https://github.com/shakacode/shakapacker/pull/778) by [justin808](https://github.com/justin808). Resolves [#707](https://github.com/shakacode/shakapacker/issues/707).
|
|
22
|
+
- Enhanced type safety across configFile, buildValidator, and yamlSerializer modules
|
|
23
|
+
- Improved error message preservation for webpack/rspack build failures
|
|
24
|
+
- Fixed edge cases in YAML serialization (empty arrays, malformed objects)
|
|
25
|
+
- More robust constructor name detection for object serialization
|
|
26
|
+
- Better handling of Symbol, BigInt, and edge case types
|
|
27
|
+
- **Default template no longer triggers production warning**. [PR #774](https://github.com/shakacode/shakapacker/pull/774) by [justin808](https://github.com/justin808). Fixes [#703](https://github.com/shakacode/shakapacker/issues/703).
|
|
28
|
+
- Changed default `useContentHash` to `true` in `shakapacker.yml` template
|
|
29
|
+
- Eliminates confusing warning about `useContentHash: false` not being allowed in production
|
|
30
|
+
- Development environment now explicitly sets `useContentHash: false` for faster builds
|
|
31
|
+
- Production no longer needs explicit override since it inherits the correct default
|
|
32
|
+
|
|
33
|
+
## [v9.3.0] - October 28, 2025
|
|
47
34
|
|
|
48
35
|
### Added
|
|
49
36
|
|
|
50
|
-
- **
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
- **
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
- **Custom help messages for `bin/shakapacker` commands**. [PR #702](https://github.com/shakacode/shakapacker/pull/702) by [justin808](https://github.com/justin808).
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
- **
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- **
|
|
66
|
-
|
|
67
|
-
- Helps identify performance bottlenecks
|
|
68
|
-
- **Named build configurations with `--build` flag**. [PR #728](https://github.com/shakacode/shakapacker/pull/728) by [justin808](https://github.com/justin808).
|
|
69
|
-
- Allows specifying custom build configurations: `bin/shakapacker --build=production` or `bin/shakapacker --build=test`
|
|
70
|
-
- Useful for creating specialized build configurations for different deployment environments
|
|
71
|
-
- **Build validation in `bin/export-bundler-config`**. [PR #717](https://github.com/shakacode/shakapacker/pull/717) by [justin808](https://github.com/justin808).
|
|
72
|
-
- Validates webpack/rspack configuration before export to catch errors early
|
|
73
|
-
- Provides clear error messages for configuration issues
|
|
74
|
-
- **Backward compatibility for rspack config in `config/webpack/`**. [PR #734](https://github.com/shakacode/shakapacker/pull/734) by [justin808](https://github.com/justin808).
|
|
75
|
-
- Rspack configurations can now be placed in `config/webpack/` directory for easier migration
|
|
76
|
-
- Maintains compatibility with existing project structures
|
|
77
|
-
- Added Knip for detecting dead code to CI. [PR #675](https://github.com/shakacode/shakapacker/pull/675) by [justin808](https://github.com/justin808).
|
|
37
|
+
- **HTTP 103 Early Hints support** for faster asset loading. [PR #722](https://github.com/shakacode/shakapacker/pull/722) by [justin808](https://github.com/justin808). Automatically sends early hints when `early_hints: enabled: true` in `shakapacker.yml`. Works with `append_javascript_pack_tag`/`append_stylesheet_pack_tag`, supports per-controller/action configuration, and includes helpers like `configure_pack_early_hints` and `skip_send_pack_early_hints`. Requires Rails 5.2+ and HTTP/2-capable server. See [Early Hints Guide](docs/early_hints.md).
|
|
38
|
+
- **`--help=verbose` flag** to display all available webpack/rspack bundler options. [PR #763](https://github.com/shakacode/shakapacker/pull/763) by [justin808](https://github.com/justin808). Run `bin/shakapacker --help=verbose` to see complete bundler documentation.
|
|
39
|
+
- **Support for arbitrary output names in build configurations**. [PR #752](https://github.com/shakacode/shakapacker/pull/752) by [justin808](https://github.com/justin808). The `outputs` array now accepts any custom names (e.g., `client-modern`, `client-legacy`, `server-bundle`) instead of being limited to only `client`, `server`, and `all`.
|
|
40
|
+
- **Enhanced error reporting in config exporter**. [PR #752](https://github.com/shakacode/shakapacker/pull/752) by [justin808](https://github.com/justin808). Shows detailed environment variable state when config functions fail and provides actionable suggestions based on error patterns.
|
|
41
|
+
- **Config count validation for build outputs**. [PR #752](https://github.com/shakacode/shakapacker/pull/752) by [justin808](https://github.com/justin808). Validates webpack/rspack config array length matches `outputs` array with clear error messages and suggested fixes.
|
|
42
|
+
- **`precompile_hook` configuration option** to run custom commands during asset precompilation. [PR #678](https://github.com/shakacode/shakapacker/pull/678) by [justin808](https://github.com/justin808). Configure in `shakapacker.yml` with `precompile_hook: "command to run"`.
|
|
43
|
+
- **`assets_bundler_config_path` configuration option** for custom bundler config locations. [PR #710](https://github.com/shakacode/shakapacker/pull/710) by [justin808](https://github.com/justin808). Allows specifying a custom path for webpack/rspack configuration files.
|
|
44
|
+
- **YAML output format support for `bin/shakapacker-config`** (formerly `bin/export-bundler-config`). [PR #704](https://github.com/shakacode/shakapacker/pull/704) by [justin808](https://github.com/justin808). New `--format yaml` option exports bundler configuration as YAML.
|
|
45
|
+
- **Plugin names displayed in YAML config export**. [PR #750](https://github.com/shakacode/shakapacker/pull/750) by [justin808](https://github.com/justin808). Shows plugin constructor names in exported configuration to help identify which plugins are active.
|
|
46
|
+
- **Custom help messages for `bin/shakapacker` commands**. [PR #702](https://github.com/shakacode/shakapacker/pull/702) by [justin808](https://github.com/justin808). Improved help output for better command discoverability with clear usage examples.
|
|
47
|
+
- **HMR client config export in doctor mode**. [PR #701](https://github.com/shakacode/shakapacker/pull/701) by [justin808](https://github.com/justin808). `bin/shakapacker-config --doctor` now includes HMR client configuration to help debug Hot Module Replacement issues.
|
|
48
|
+
- **Build timing logs** for webpack and rspack. [PR #706](https://github.com/shakacode/shakapacker/pull/706) by [justin808](https://github.com/justin808). Shows duration of build operations to help identify performance bottlenecks.
|
|
49
|
+
- **Named build configurations with `--build` flag**. [PR #728](https://github.com/shakacode/shakapacker/pull/728) by [justin808](https://github.com/justin808). Allows specifying custom build configurations like `bin/shakapacker --build=production` or `bin/shakapacker --build=test`.
|
|
50
|
+
- **Build validation in `bin/shakapacker-config`**. [PR #717](https://github.com/shakacode/shakapacker/pull/717) by [justin808](https://github.com/justin808). Validates webpack/rspack configuration before export to catch errors early.
|
|
51
|
+
- **Backward compatibility for rspack config in `config/webpack/`**. [PR #734](https://github.com/shakacode/shakapacker/pull/734) by [justin808](https://github.com/justin808). Rspack configurations can now be placed in `config/webpack/` directory for easier migration.
|
|
52
|
+
- **Merge option for WebpackAssetsManifestPlugin**. [PR #760](https://github.com/shakacode/shakapacker/pull/760) by [justin808](https://github.com/justin808). Adds `merge` option to control manifest merging behavior, useful for multi-compiler setups.
|
|
53
|
+
- Support for esbuild-loader v5. [PR #758](https://github.com/shakacode/shakapacker/pull/758) by [justin808](https://github.com/justin808).
|
|
78
54
|
|
|
79
55
|
### Changed
|
|
80
56
|
|
|
81
|
-
- **
|
|
82
|
-
- Updated all ESLint plugins to latest versions
|
|
83
|
-
- Uses new flat config format for better maintainability
|
|
84
|
-
- **Replaced custom argument parser with yargs**. [PR #692](https://github.com/shakacode/shakapacker/pull/692) by [justin808](https://github.com/justin808).
|
|
85
|
-
- More robust command-line argument parsing
|
|
86
|
-
- Better error messages and help output
|
|
87
|
-
- Replaced `require` with `import` in package/index.ts. [PR #674](https://github.com/shakacode/shakapacker/pull/674) by [justin808](https://github.com/justin808).
|
|
57
|
+
- **Generated `swc.config.js` now uses single quotes and trailing commas**. [PR #755](https://github.com/shakacode/shakapacker/pull/755) by [justin808](https://github.com/justin808). Consistent code style in generated configuration files.
|
|
88
58
|
- Updated @rspack dependencies to 1.5.8. [PR #700](https://github.com/shakacode/shakapacker/pull/700) by [justin808](https://github.com/justin808).
|
|
89
59
|
|
|
90
60
|
### Improved
|
|
91
61
|
|
|
92
|
-
- **
|
|
93
|
-
|
|
94
|
-
- Common pitfalls and solutions documented
|
|
95
|
-
- **Consolidated duplicate configuration documentation**. [PR #714](https://github.com/shakacode/shakapacker/pull/714) by [justin808](https://github.com/justin808).
|
|
96
|
-
- Removed redundant documentation
|
|
97
|
-
- Single source of truth for configuration options
|
|
98
|
-
- **Improved error messages** to suggest `assets_bundler_config_path`. [PR #712](https://github.com/shakacode/shakapacker/pull/712) by [justin808](https://github.com/justin808).
|
|
99
|
-
- More helpful error messages when bundler config is not found
|
|
100
|
-
- Suggests using `assets_bundler_config_path` for custom locations
|
|
101
|
-
- **Improved doctor command output** clarity and accuracy. [PR #682](https://github.com/shakacode/shakapacker/pull/682) by [justin808](https://github.com/justin808).
|
|
102
|
-
- Better formatting and organization of diagnostic information
|
|
103
|
-
- More actionable recommendations
|
|
104
|
-
- **Documented `content_for` pattern to prevent FOUC** with `stylesheet_pack_tag`. [PR #737](https://github.com/shakacode/shakapacker/pull/737) by [justin808](https://github.com/justin808).
|
|
105
|
-
- Added documentation on using `content_for` to prevent Flash of Unstyled Content
|
|
106
|
-
- Best practice patterns for managing stylesheet loading order
|
|
107
|
-
- **Improved upgrade documentation** to clarify dual Gemfile and package.json updates. [PR #731](https://github.com/shakacode/shakapacker/pull/731) by [justin808](https://github.com/justin808).
|
|
108
|
-
- Clearer instructions for upgrading both Ruby gem and NPM package
|
|
109
|
-
- Helps prevent version mismatch issues
|
|
110
|
-
- Formatted all markdown files with prettier. [PR #673](https://github.com/shakacode/shakapacker/pull/673) by [justin808](https://github.com/justin808).
|
|
62
|
+
- **Improved error messages** to suggest `assets_bundler_config_path`. [PR #712](https://github.com/shakacode/shakapacker/pull/712) by [justin808](https://github.com/justin808). More helpful error messages when bundler config is not found, suggesting use of `assets_bundler_config_path` for custom locations.
|
|
63
|
+
- **Improved doctor command output** clarity and accuracy. [PR #682](https://github.com/shakacode/shakapacker/pull/682) by [justin808](https://github.com/justin808). Better formatting and organization of diagnostic information with more actionable recommendations.
|
|
111
64
|
|
|
112
65
|
### Fixed
|
|
113
66
|
|
|
114
|
-
- Fixed
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
- Fixed Rails constant error when using custom environments like staging. [PR #681](https://github.com/shakacode/shakapacker/pull/681) by [justin808](https://github.com/justin808).
|
|
118
|
-
- `RAILS_ENV=staging` no longer causes "uninitialized constant Shakapacker::Instance::Rails" error
|
|
119
|
-
- Shakapacker now works in non-Rails contexts (like standalone runner)
|
|
120
|
-
- Fixed TypeScript type definitions to export proper types instead of `any`. [PR #684](https://github.com/shakacode/shakapacker/pull/684) by [justin808](https://github.com/justin808).
|
|
121
|
-
- Previously `package/index.d.ts` was exporting all types as `any`, breaking IDE autocomplete
|
|
122
|
-
- Now properly exports typed interfaces for `WebpackConfig`, `RspackConfig`, etc.
|
|
123
|
-
- Fixed integrity config handling and sass-loader version check. [PR #688](https://github.com/shakacode/shakapacker/pull/688) by [justin808](https://github.com/justin808).
|
|
124
|
-
- Properly handles subresource integrity configuration
|
|
125
|
-
- Correctly detects sass-loader version for conditional logic
|
|
126
|
-
- Prevented index.d.ts confusion in build process. [PR #698](https://github.com/shakacode/shakapacker/pull/698) by [justin808](https://github.com/justin808).
|
|
127
|
-
- TypeScript declaration files no longer interfere with build output
|
|
128
|
-
- Fixed yarn.lock formatting changes in Conductor setup. [PR #683](https://github.com/shakacode/shakapacker/pull/683) by [justin808](https://github.com/justin808).
|
|
67
|
+
- Fixed Rails constant error when using custom environments like staging. [PR #681](https://github.com/shakacode/shakapacker/pull/681) by [justin808](https://github.com/justin808). `RAILS_ENV=staging` no longer causes "uninitialized constant Shakapacker::Instance::Rails" error. Shakapacker now works in non-Rails contexts.
|
|
68
|
+
- Fixed TypeScript type definitions to export proper types instead of `any`. [PR #684](https://github.com/shakacode/shakapacker/pull/684) by [justin808](https://github.com/justin808). Previously `package/index.d.ts` was exporting all types as `any`, breaking IDE autocomplete. Now properly exports typed interfaces.
|
|
69
|
+
- Fixed integrity config handling and sass-loader version check. [PR #688](https://github.com/shakacode/shakapacker/pull/688) by [justin808](https://github.com/justin808). Properly handles subresource integrity configuration and correctly detects sass-loader version for conditional logic.
|
|
129
70
|
|
|
130
71
|
## [v9.2.0] - October 9, 2025
|
|
131
72
|
|
|
132
73
|
### Added
|
|
133
74
|
|
|
134
75
|
- **New config export utility for debugging webpack/rspack configurations** [PR #647](https://github.com/shakacode/shakapacker/pull/647) by [justin808](https://github.com/justin808).
|
|
135
|
-
- Adds `bin/export-bundler-config
|
|
76
|
+
- Adds `bin/shakapacker-config` utility (originally named `bin/export-bundler-config`, renamed in PR #728) with three modes:
|
|
136
77
|
- **Doctor mode** (`--doctor`): Exports all configs (dev + prod, client + server) to `shakapacker-config-exports/` directory - best for troubleshooting
|
|
137
78
|
- **Save mode** (`--save`): Export current environment configs to files
|
|
138
79
|
- **Stdout mode** (default): View configs in terminal
|
|
@@ -144,7 +85,7 @@ Changes since the last non-beta release.
|
|
|
144
85
|
- Validates bundler value and output paths
|
|
145
86
|
- Sanitizes filenames to prevent path traversal
|
|
146
87
|
- Helpful `.gitignore` suggestions
|
|
147
|
-
- **Usage:** `bin/
|
|
88
|
+
- **Usage:** `bin/shakapacker-config --doctor` or `bundle exec rake shakapacker:export_bundler_config`
|
|
148
89
|
- Works seamlessly with `rake shakapacker:switch_bundler` for comparing webpack vs rspack configs
|
|
149
90
|
- Lays groundwork for future config diff feature (tracked in [#667](https://github.com/shakacode/shakapacker/issues/667))
|
|
150
91
|
|
|
@@ -779,8 +720,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
|
|
|
779
720
|
|
|
780
721
|
See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
|
|
781
722
|
|
|
782
|
-
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.3.0
|
|
783
|
-
[v9.3.0
|
|
723
|
+
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.3.0...main
|
|
724
|
+
[v9.3.0]: https://github.com/shakacode/shakapacker/compare/v9.2.0...v9.3.0
|
|
784
725
|
[v9.2.0]: https://github.com/shakacode/shakapacker/compare/v9.1.0...v9.2.0
|
|
785
726
|
[v9.1.0]: https://github.com/shakacode/shakapacker/compare/v9.0.0...v9.1.0
|
|
786
727
|
[v9.0.0]: https://github.com/shakacode/shakapacker/compare/v8.4.0...v9.0.0
|
data/ESLINT_TECHNICAL_DEBT.md
CHANGED
|
@@ -6,7 +6,7 @@ This document tracks the ESLint errors currently suppressed in the codebase and
|
|
|
6
6
|
|
|
7
7
|
**As of 2025-10-14**: All TypeScript files in `package/` directory are temporarily excluded from linting via the ignore pattern `package/**/*.ts` in `eslint.config.js`. This allows the project to adopt ESLint configuration without requiring immediate fixes to all existing issues.
|
|
8
8
|
|
|
9
|
-
**Latest Update**:
|
|
9
|
+
**Latest Update**: Auto-fixed 28 style violations in `package/configExporter/cli.ts` including unnecessary type assertions, string concatenation to template literals, and object destructuring (reduced from 77 to 49 errors).
|
|
10
10
|
|
|
11
11
|
## Current Linting Status
|
|
12
12
|
|
|
@@ -24,7 +24,7 @@ This document tracks the ESLint errors currently suppressed in the codebase and
|
|
|
24
24
|
- Style/convention issues: ~49 (30%)
|
|
25
25
|
|
|
26
26
|
**Target**: Reduce suppressed errors by 50% within Q1 2025
|
|
27
|
-
**Last Updated**: 2025-10-
|
|
27
|
+
**Last Updated**: 2025-10-18
|
|
28
28
|
|
|
29
29
|
## Priority Matrix
|
|
30
30
|
|
|
@@ -115,6 +115,12 @@ This document tracks the ESLint errors currently suppressed in the codebase and
|
|
|
115
115
|
- ✅ **Fixed `class-methods-use-this`** - Converted FileWriter methods to static methods
|
|
116
116
|
- ✅ **Fixed `no-nested-ternary`** - Refactored to if-else statements for better readability
|
|
117
117
|
- ✅ **Fixed `no-param-reassign`** - Refactored `applyDefaults` to return new objects instead of mutating parameters
|
|
118
|
+
- ✅ **Auto-fixed style violations in cli.ts** (2025-10-18):
|
|
119
|
+
- Removed unnecessary type assertions (`@typescript-eslint/no-unnecessary-type-assertion`)
|
|
120
|
+
- Used object destructuring (`prefer-destructuring`)
|
|
121
|
+
- Converted string concatenation to template literals (`prefer-template`)
|
|
122
|
+
- Removed unused eslint-disable directives
|
|
123
|
+
- Fixed `no-else-return` violations
|
|
118
124
|
|
|
119
125
|
🔧 Could still fix (low risk):
|
|
120
126
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -85,6 +85,7 @@ Read the [full review here](https://clutch.co/profile/shakacode#reviews?sort_by=
|
|
|
85
85
|
- [Automatic Webpack Code Building](#automatic-webpack-code-building)
|
|
86
86
|
- [Compiler strategies](#compiler-strategies)
|
|
87
87
|
- [Common Development Commands](#common-development-commands)
|
|
88
|
+
- [API Documentation](#api-documentation)
|
|
88
89
|
- [Webpack Configuration](#webpack-configuration)
|
|
89
90
|
- [Babel configuration](#babel-configuration)
|
|
90
91
|
- [SWC configuration](#swc-configuration)
|
|
@@ -316,7 +317,15 @@ At its core, Shakapacker's essential function is to:
|
|
|
316
317
|
|
|
317
318
|
### Configuration and Code
|
|
318
319
|
|
|
319
|
-
**📖 For a comprehensive guide to all configuration options, see [Configuration Guide](./docs/configuration.md)**
|
|
320
|
+
**📖 For a comprehensive guide to all configuration options, see the [Configuration Guide](./docs/configuration.md)**
|
|
321
|
+
|
|
322
|
+
This includes documentation for:
|
|
323
|
+
|
|
324
|
+
- All `config/shakapacker.yml` options (including `assets_bundler_config_path`)
|
|
325
|
+
- Environment-specific configuration
|
|
326
|
+
- Development server settings
|
|
327
|
+
- Build configurations (`config/shakapacker-builds.yml`)
|
|
328
|
+
- Best practices and common patterns
|
|
320
329
|
|
|
321
330
|
You will need your file system to correspond to the setup of your `config/shakapacker.yml` file.
|
|
322
331
|
|
|
@@ -664,6 +673,48 @@ end
|
|
|
664
673
|
|
|
665
674
|
**Note:** Don't forget to prefix `ruby` when running these binstubs on Windows
|
|
666
675
|
|
|
676
|
+
### API Documentation
|
|
677
|
+
|
|
678
|
+
Shakapacker's Ruby API is documented using RDoc comments. You can generate the API documentation locally using either RDoc or YARD:
|
|
679
|
+
|
|
680
|
+
#### Using RDoc (Standard Ruby Documentation)
|
|
681
|
+
|
|
682
|
+
```bash
|
|
683
|
+
# Generate documentation in the doc/ directory
|
|
684
|
+
rdoc lib/
|
|
685
|
+
|
|
686
|
+
# View the generated documentation
|
|
687
|
+
open doc/index.html
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
#### Using YARD (Enhanced Documentation)
|
|
691
|
+
|
|
692
|
+
YARD provides better formatting and supports additional tags used in the codebase:
|
|
693
|
+
|
|
694
|
+
```bash
|
|
695
|
+
# Install YARD if you don't have it
|
|
696
|
+
gem install yard
|
|
697
|
+
|
|
698
|
+
# Generate documentation
|
|
699
|
+
yard doc
|
|
700
|
+
|
|
701
|
+
# View the generated documentation
|
|
702
|
+
open doc/index.html
|
|
703
|
+
|
|
704
|
+
# Or start a local documentation server
|
|
705
|
+
yard server
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
The API documentation covers:
|
|
709
|
+
|
|
710
|
+
- **Shakapacker** - Main module with configuration, compilation, and manifest access
|
|
711
|
+
- **Shakapacker::Configuration** - All configuration options from `shakapacker.yml`
|
|
712
|
+
- **Shakapacker::Manifest** - Asset lookup methods used by view helpers
|
|
713
|
+
- **Shakapacker::DevServer** - Development server status and configuration
|
|
714
|
+
- **Shakapacker::Instance** - Instance management and lifecycle
|
|
715
|
+
|
|
716
|
+
For the most up-to-date API reference, generate the documentation from the source code as shown above.
|
|
717
|
+
|
|
667
718
|
### Webpack Configuration
|
|
668
719
|
|
|
669
720
|
First, you don't _need_ to use Shakapacker's webpack configuration. However, the `shakapacker` NPM package provides convenient access to configuration code that reads the `config/shakapacker.yml` file which the view helpers also use. If you have your customized webpack configuration, at the minimum, you must ensure:
|
|
@@ -801,7 +852,7 @@ Shakapacker provides a powerful utility to export and analyze your webpack/rspac
|
|
|
801
852
|
|
|
802
853
|
```bash
|
|
803
854
|
# Export all configs for troubleshooting (recommended)
|
|
804
|
-
bin/
|
|
855
|
+
bin/shakapacker-config --doctor
|
|
805
856
|
|
|
806
857
|
# Or via rake task
|
|
807
858
|
bundle exec rake shakapacker:export_bundler_config -- --doctor
|
data/docs/configuration.md
CHANGED
|
@@ -4,6 +4,7 @@ This guide covers all configuration options available in `config/shakapacker.yml
|
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
7
|
+
- [Quick Reference](#quick-reference)
|
|
7
8
|
- [Basic Configuration](#basic-configuration)
|
|
8
9
|
- [Source Configuration](#source-configuration)
|
|
9
10
|
- [Output Configuration](#output-configuration)
|
|
@@ -16,6 +17,33 @@ This guide covers all configuration options available in `config/shakapacker.yml
|
|
|
16
17
|
- [Environment-Specific Configuration](#environment-specific-configuration)
|
|
17
18
|
- [Build Configurations (config/shakapacker-builds.yml)](#build-configurations-configshakapacker-buildsyml)
|
|
18
19
|
|
|
20
|
+
## Quick Reference
|
|
21
|
+
|
|
22
|
+
Common configuration options with their defaults:
|
|
23
|
+
|
|
24
|
+
| Option | Type | Default | Description |
|
|
25
|
+
| ------------------------------ | ------- | --------------------------------------- | ---------------------------------------------------------- |
|
|
26
|
+
| `assets_bundler` | string | `"webpack"` | Bundler to use: `"webpack"` or `"rspack"` |
|
|
27
|
+
| `assets_bundler_config_path` | string | `"config/webpack"` or `"config/rspack"` | Directory containing bundler config files |
|
|
28
|
+
| `javascript_transpiler` | string | `"swc"` or `"babel"` | Transpiler: `"swc"`, `"babel"`, or `"esbuild"` |
|
|
29
|
+
| `source_path` | string | `"app/javascript"` | Root directory for JavaScript source files |
|
|
30
|
+
| `source_entry_path` | string | `"packs"` | Subdirectory within `source_path` for entry points |
|
|
31
|
+
| `nested_entries` | boolean | `true` | Discover entry points in subdirectories |
|
|
32
|
+
| `public_output_path` | string | `"packs"` | Subdirectory within `public_root_path` for compiled assets |
|
|
33
|
+
| `private_output_path` | string | `nil` | Directory for private server-side bundles (e.g., SSR) |
|
|
34
|
+
| `compile` | boolean | env-specific | Compile assets on-demand when requests are made |
|
|
35
|
+
| `cache_manifest` | boolean | `false` (dev), `true` (prod) | Cache manifest.json in memory |
|
|
36
|
+
| `compiler_strategy` | string | `"mtime"` (dev), `"digest"` (prod) | How to determine if recompilation is needed |
|
|
37
|
+
| `useContentHash` | boolean | `false` (dev), `true` (prod) | Include content hashes in asset filenames |
|
|
38
|
+
| `webpack_compile_output` | boolean | `true` | Show webpack/rspack compilation output |
|
|
39
|
+
| `shakapacker_precompile` | boolean | `true` | Include in `rails assets:precompile` |
|
|
40
|
+
| `ensure_consistent_versioning` | boolean | `true` | Enforce gem/npm version matching |
|
|
41
|
+
| `dev_server.host` | string | `"localhost"` | Development server host |
|
|
42
|
+
| `dev_server.port` | number | `3035` | Development server port |
|
|
43
|
+
| `dev_server.hmr` | boolean | `false` | Enable Hot Module Replacement |
|
|
44
|
+
|
|
45
|
+
For detailed explanations, examples, and additional options, see the sections below.
|
|
46
|
+
|
|
19
47
|
## Basic Configuration
|
|
20
48
|
|
|
21
49
|
### `assets_bundler`
|