shakapacker 9.0.0.beta.7 → 9.0.0.beta.9
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/.eslintrc.fast.js +40 -0
- data/.eslintrc.js +48 -0
- data/.gitignore +1 -3
- data/.husky/pre-commit +2 -0
- data/.npmignore +1 -0
- data/CHANGELOG.md +25 -22
- data/CONTRIBUTING.md +75 -21
- data/Gemfile.lock +1 -1
- data/README.md +3 -2
- data/TODO.md +15 -16
- data/TODO_v9.md +5 -2
- data/conductor-setup.sh +12 -0
- data/docs/css-modules-export-mode.md +102 -8
- data/docs/v9_upgrade.md +57 -3
- data/lib/shakapacker/doctor.rb +94 -0
- data/lib/shakapacker/swc_migrator.rb +60 -2
- data/lib/shakapacker/version.rb +1 -1
- data/package/babel/preset.ts +56 -0
- data/package/esbuild/index.ts +42 -0
- data/package/optimization/rspack.ts +36 -0
- data/package/optimization/{webpack.js → webpack.ts} +12 -4
- data/package/plugins/{rspack.js → rspack.ts} +20 -5
- data/package/plugins/{webpack.js → webpack.ts} +2 -2
- data/package/rspack/{index.js → index.ts} +17 -10
- data/package/rules/{babel.js → babel.ts} +1 -1
- data/package/rules/{coffee.js → coffee.ts} +1 -1
- data/package/rules/{css.js → css.ts} +1 -1
- data/package/rules/{erb.js → erb.ts} +1 -1
- data/package/rules/{esbuild.js → esbuild.ts} +2 -2
- data/package/rules/{file.js → file.ts} +11 -6
- data/package/rules/{jscommon.js → jscommon.ts} +4 -4
- data/package/rules/{less.js → less.ts} +3 -3
- data/package/rules/raw.ts +25 -0
- data/package/rules/{rspack.js → rspack.ts} +21 -11
- data/package/rules/{sass.js → sass.ts} +1 -1
- data/package/rules/{stylus.js → stylus.ts} +3 -7
- data/package/rules/{swc.js → swc.ts} +2 -2
- data/package/rules/{webpack.js → webpack.ts} +1 -1
- data/package/swc/index.ts +54 -0
- data/package/utils/getStyleRule.ts +7 -2
- data/package.json +22 -2
- data/scripts/type-check-no-emit.js +27 -0
- data/test/package/rules/raw.test.js +40 -7
- data/test/package/rules/webpack.test.js +21 -2
- data/tools/README.md +2 -2
- data/tsconfig.eslint.json +16 -0
- data/tsconfig.json +9 -10
- data/yarn.lock +415 -6
- metadata +28 -24
- data/package/babel/preset.js +0 -48
- data/package/esbuild/index.js +0 -40
- data/package/optimization/rspack.js +0 -29
- data/package/rules/raw.js +0 -15
- data/package/swc/index.js +0 -50
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5bcee4a9f167db64caa92dd26cc09d18b58a7bcd9e42df48d83a67ee588e4661
|
|
4
|
+
data.tar.gz: 70bee9a11ad197b10731b8f0870c52093fa64092ad470525679d32b44b64fcc2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7c3be887fa8da2e9ef41aaf1753556da768002c7fcb0a765d348dac99c49d092caf2fe652008b86059a98c4b62d78326ff5f14cf4e39ed30696aebcd83560bc0
|
|
7
|
+
data.tar.gz: 2f4e2c8a069381191daed7fa8dbe6a38c93731c31399234d78621448d9a48a9d0759d9f84e29a94e8e87a88e4174e7a52d951470c56779fca673ebdc907fdda9
|
data/.eslintrc.fast.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Fast ESLint config for quick development feedback
|
|
2
|
+
// Skips type-aware rules that require TypeScript compilation
|
|
3
|
+
|
|
4
|
+
const baseConfig = require("./.eslintrc.js")
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
...baseConfig,
|
|
8
|
+
overrides: [
|
|
9
|
+
...baseConfig.overrides.filter((o) => !o.files.includes("**/*.{ts,tsx}")),
|
|
10
|
+
{
|
|
11
|
+
files: ["**/*.{ts,tsx}"],
|
|
12
|
+
parser: "@typescript-eslint/parser",
|
|
13
|
+
parserOptions: {
|
|
14
|
+
// No project specified - disables type-aware linting
|
|
15
|
+
ecmaVersion: 2020,
|
|
16
|
+
sourceType: "module"
|
|
17
|
+
},
|
|
18
|
+
extends: [
|
|
19
|
+
"plugin:@typescript-eslint/recommended",
|
|
20
|
+
// Skip the "recommended-requiring-type-checking" preset
|
|
21
|
+
"plugin:prettier/recommended"
|
|
22
|
+
],
|
|
23
|
+
plugins: ["@typescript-eslint"],
|
|
24
|
+
rules: {
|
|
25
|
+
// Same rules as main config minus type-aware ones
|
|
26
|
+
"import/no-unresolved": "off",
|
|
27
|
+
"import/no-extraneous-dependencies": "off",
|
|
28
|
+
"import/extensions": "off",
|
|
29
|
+
"no-use-before-define": "off",
|
|
30
|
+
"@typescript-eslint/no-use-before-define": ["error"],
|
|
31
|
+
"@typescript-eslint/no-unused-vars": [
|
|
32
|
+
"error",
|
|
33
|
+
{ argsIgnorePattern: "^_" }
|
|
34
|
+
],
|
|
35
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
36
|
+
"@typescript-eslint/explicit-module-boundary-types": "off"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
data/.eslintrc.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
root: true, // Prevent ESLint from looking in parent directories
|
|
2
3
|
extends: ["airbnb", "plugin:prettier/recommended"],
|
|
3
4
|
rules: {
|
|
5
|
+
// Webpack handles module resolution, not ESLint
|
|
4
6
|
"import/no-unresolved": "off",
|
|
7
|
+
// Allow importing devDependencies in config/test files
|
|
5
8
|
"import/no-extraneous-dependencies": "off",
|
|
9
|
+
// TypeScript handles extensions, not needed for JS imports
|
|
6
10
|
"import/extensions": "off",
|
|
7
11
|
indent: ["error", 2]
|
|
8
12
|
},
|
|
13
|
+
settings: {
|
|
14
|
+
react: {
|
|
15
|
+
// Suppress "react package not installed" warning
|
|
16
|
+
// This project doesn't use React but airbnb config requires react-plugin
|
|
17
|
+
version: "999.999.999"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
9
20
|
env: {
|
|
10
21
|
browser: true,
|
|
11
22
|
node: true
|
|
@@ -31,6 +42,43 @@ module.exports = {
|
|
|
31
42
|
"jest/prefer-strict-equal": "error",
|
|
32
43
|
"jest/prefer-todo": "error"
|
|
33
44
|
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
files: ["**/*.{ts,tsx}"],
|
|
48
|
+
parser: "@typescript-eslint/parser",
|
|
49
|
+
parserOptions: {
|
|
50
|
+
// Enables type-aware linting for better type safety
|
|
51
|
+
// Note: This can slow down linting on large codebases
|
|
52
|
+
// Consider using --cache flag with ESLint if performance degrades
|
|
53
|
+
project: "./tsconfig.eslint.json",
|
|
54
|
+
tsconfigRootDir: __dirname
|
|
55
|
+
},
|
|
56
|
+
extends: [
|
|
57
|
+
"plugin:@typescript-eslint/recommended",
|
|
58
|
+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
59
|
+
"plugin:prettier/recommended"
|
|
60
|
+
],
|
|
61
|
+
plugins: ["@typescript-eslint"],
|
|
62
|
+
rules: {
|
|
63
|
+
// TypeScript compiler handles module resolution
|
|
64
|
+
"import/no-unresolved": "off",
|
|
65
|
+
// Allow importing devDependencies in TypeScript files
|
|
66
|
+
"import/no-extraneous-dependencies": "off",
|
|
67
|
+
// TypeScript handles file extensions via moduleResolution
|
|
68
|
+
"import/extensions": "off",
|
|
69
|
+
// Disable base rule in favor of TypeScript version
|
|
70
|
+
"no-use-before-define": "off",
|
|
71
|
+
"@typescript-eslint/no-use-before-define": ["error"],
|
|
72
|
+
// Allow unused vars if they start with underscore (convention for ignored params)
|
|
73
|
+
"@typescript-eslint/no-unused-vars": [
|
|
74
|
+
"error",
|
|
75
|
+
{ argsIgnorePattern: "^_" }
|
|
76
|
+
],
|
|
77
|
+
// Strict: no 'any' types allowed - use 'unknown' or specific types instead
|
|
78
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
79
|
+
// Allow implicit return types - TypeScript can infer them
|
|
80
|
+
"@typescript-eslint/explicit-module-boundary-types": "off"
|
|
81
|
+
}
|
|
34
82
|
}
|
|
35
83
|
]
|
|
36
84
|
}
|
data/.gitignore
CHANGED
|
@@ -11,6 +11,7 @@ yarn-error.log*
|
|
|
11
11
|
/log
|
|
12
12
|
gemfiles/*.lock
|
|
13
13
|
.DS_Store
|
|
14
|
+
.eslintcache
|
|
14
15
|
|
|
15
16
|
.yalc
|
|
16
17
|
yalc.lock
|
|
@@ -25,11 +26,8 @@ package/**/*.js
|
|
|
25
26
|
!package/index.d.ts
|
|
26
27
|
!package/loaders.d.ts
|
|
27
28
|
!package/webpack-types.d.ts
|
|
28
|
-
!package/babel/preset.js
|
|
29
29
|
!package/babel/preset-react.js
|
|
30
|
-
!package/rules/*.js
|
|
31
30
|
!package/loaders/*.js
|
|
32
|
-
!package/plugins/*.js
|
|
33
31
|
!package/__mocks__/*.js
|
|
34
32
|
!package/utils/get_style_rule.js
|
|
35
33
|
!package/utils/node_modules.js
|
data/.husky/pre-commit
ADDED
data/.npmignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
Changes since the last non-beta release.
|
|
11
11
|
|
|
12
|
-
## [v9.0.0-beta.
|
|
12
|
+
## [v9.0.0-beta.8] - October 3, 2025
|
|
13
|
+
|
|
14
|
+
See the [v9 Upgrade Guide](https://github.com/shakacode/shakapacker/blob/main/docs/v9_upgrade.md) for detailed migration instructions.
|
|
13
15
|
|
|
14
16
|
### ⚠️ Breaking Changes
|
|
15
17
|
|
|
@@ -17,7 +19,7 @@ Changes since the last non-beta release.
|
|
|
17
19
|
- Babel dependencies are no longer included as peer dependencies
|
|
18
20
|
- Improves compilation speed by 20x
|
|
19
21
|
- **Migration for existing projects:**
|
|
20
|
-
- **Option 1 (Recommended):** Switch to SWC:
|
|
22
|
+
- **Option 1 (Recommended):** Switch to SWC - Run `rake shakapacker:migrate:to_swc` or manually:
|
|
21
23
|
```yaml
|
|
22
24
|
# config/shakapacker.yml
|
|
23
25
|
javascript_transpiler: 'swc'
|
|
@@ -30,11 +32,9 @@ Changes since the last non-beta release.
|
|
|
30
32
|
```
|
|
31
33
|
|
|
32
34
|
2. **CSS Modules now use named exports by default**
|
|
33
|
-
- Configured with `namedExport: true` and `exportLocalsConvention: 'camelCase'`
|
|
34
35
|
- **JavaScript:** Use named imports: `import { className } from './styles.module.css'`
|
|
35
36
|
- **TypeScript:** Use namespace imports: `import * as styles from './styles.module.css'`
|
|
36
|
-
-
|
|
37
|
-
- See [CSS Modules Export Mode documentation](./docs/css-modules-export-mode.md) for migration details
|
|
37
|
+
- To keep the old behavior with default imports, see [CSS Modules Export Mode documentation](./docs/css-modules-export-mode.md) for configuration instructions
|
|
38
38
|
|
|
39
39
|
3. **Configuration option renamed from `webpack_loader` to `javascript_transpiler`**
|
|
40
40
|
- Better reflects its purpose of configuring JavaScript transpilation
|
|
@@ -46,23 +46,26 @@ Changes since the last non-beta release.
|
|
|
46
46
|
- Faster Rust-based bundling with webpack-compatible APIs
|
|
47
47
|
- Built-in SWC loader and CSS extraction
|
|
48
48
|
- Automatic bundler detection in `bin/shakapacker`
|
|
49
|
-
- **
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
49
|
+
- **TypeScript type definitions** for improved IDE support and autocomplete
|
|
50
|
+
- Types available via `import type { WebpackConfig, RspackConfig, EnvironmentConfig } from "shakapacker/types"`
|
|
51
|
+
- See [TypeScript Documentation](./docs/typescript.md) for migration and usage instructions
|
|
52
|
+
- **Optional peer dependencies** - All peer dependencies now marked as optional, preventing installation warnings while maintaining version compatibility tracking
|
|
53
|
+
- **Private output path** for server-side rendering bundles ([PR 592](https://github.com/shakacode/shakapacker/pull/592))
|
|
54
|
+
- Configure `private_output_path` for private server bundles separate from public assets
|
|
55
|
+
- **`rake shakapacker:doctor` diagnostic command** to check for configuration issues and missing dependencies
|
|
56
|
+
- **`rake shakapacker:migrate:to_swc`** migration helper to assist with switching from Babel to SWC
|
|
57
|
+
|
|
58
|
+
### Security
|
|
59
|
+
- **Path Validation Utilities** ([PR 614](https://github.com/shakacode/shakapacker/pull/614) by [justin808](https://github.com/justin808))
|
|
60
|
+
- Added validation to prevent directory traversal attacks
|
|
61
|
+
- Implemented environment variable sanitization to prevent injection
|
|
62
|
+
- Enforced strict port validation (reject strings with non-digits)
|
|
63
|
+
- Added SHAKAPACKER_NPM_PACKAGE path validation (only .tgz/.tar.gz allowed)
|
|
64
|
+
- Path traversal security checks now run regardless of validation mode
|
|
63
65
|
|
|
64
66
|
### Fixed
|
|
65
|
-
-
|
|
67
|
+
- Fixed private_output_path configuration edge cases ([PR 604](https://github.com/shakacode/shakapacker/pull/604))
|
|
68
|
+
- Updated webpack-dev-server to secure versions (^4.15.2 || ^5.2.2) ([PR 585](https://github.com/shakacode/shakapacker/pull/585))
|
|
66
69
|
|
|
67
70
|
## [v8.4.0] - September 8, 2024
|
|
68
71
|
|
|
@@ -484,8 +487,8 @@ Note: [Rubygem is 6.3.0.pre.rc.1](https://rubygems.org/gems/shakapacker/versions
|
|
|
484
487
|
## v5.4.3 and prior changes from rails/webpacker
|
|
485
488
|
See [CHANGELOG.md in rails/webpacker (up to v5.4.3)](https://github.com/rails/webpacker/blob/master/CHANGELOG.md)
|
|
486
489
|
|
|
487
|
-
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.0.0-beta.
|
|
488
|
-
[v9.0.0-beta.
|
|
490
|
+
[Unreleased]: https://github.com/shakacode/shakapacker/compare/v9.0.0-beta.8...main
|
|
491
|
+
[v9.0.0-beta.8]: https://github.com/shakacode/shakapacker/compare/v8.4.0...v9.0.0-beta.8
|
|
489
492
|
[v8.4.0]: https://github.com/shakacode/shakapacker/compare/v8.3.0...v8.4.0
|
|
490
493
|
[v8.3.0]: https://github.com/shakacode/shakapacker/compare/v8.2.0...v8.3.0
|
|
491
494
|
[v8.2.0]: https://github.com/shakacode/shakapacker/compare/v8.1.0...v8.2.0
|
data/CONTRIBUTING.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Thank you for your interest in contributing to Shakapacker! We welcome all contributions that align with our project goals and values. To ensure a smooth and productive collaboration, please follow these guidelines.
|
|
4
4
|
|
|
5
5
|
## Contents
|
|
6
|
+
|
|
6
7
|
- [Reporting Issues](#reporting-issues)
|
|
7
8
|
- [Submitting Pull Requests](#submitting-pull-requests)
|
|
8
9
|
- [Setting Up a Development Environment](#setting-up-a-development-environment)
|
|
@@ -10,44 +11,89 @@ Thank you for your interest in contributing to Shakapacker! We welcome all contr
|
|
|
10
11
|
- [Testing the generator](#testing-the-generator)
|
|
11
12
|
|
|
12
13
|
## Reporting Issues
|
|
14
|
+
|
|
13
15
|
If you encounter any issues with the project, please first check the existing issues (including closed ones). If the issues is not reported before, please opening an issue on our GitHub repository. Please provide a clear and detailed description of the issue, including steps to reproduce it. Creating a demo repository to demonstrate the issue would be ideal (and in some cases necessary).
|
|
14
16
|
|
|
15
17
|
If looking to contribute to the project by fixing existing issues, we recommend looking at issues, particularly with the "[help wanted](https://github.com/shakacode/shakapacker/issues?q=is%3Aissue+label%3A%22help+wanted%22)" label.
|
|
16
18
|
|
|
17
19
|
## Submitting Pull Requests
|
|
20
|
+
|
|
18
21
|
We welcome pull requests that fix bugs, add new features, or improve existing ones. Before submitting a pull request, please make sure to:
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
- Open an issue about what you want to propose before start working on.
|
|
24
|
+
- Fork the repository and create a new branch for your changes.
|
|
25
|
+
- Write clear and concise commit messages.
|
|
26
|
+
- Follow our code style guidelines.
|
|
27
|
+
- Write tests for your changes and [make sure all tests pass](#making-sure-your-changes-pass-all-tests).
|
|
28
|
+
- Update the documentation as needed.
|
|
29
|
+
- Update CHANGELOG.md if the changes affect public behavior of the project.
|
|
27
30
|
|
|
28
31
|
---
|
|
32
|
+
|
|
33
|
+
## Git Hooks (Optional)
|
|
34
|
+
|
|
35
|
+
This project includes configuration for git hooks via `husky` and `lint-staged`, but they are **opt-in for contributors**.
|
|
36
|
+
|
|
37
|
+
**Why are hooks optional?** As a library project, we don't enforce git hooks because:
|
|
38
|
+
|
|
39
|
+
- Different contributors may have different workflows
|
|
40
|
+
- Forcing hooks can interfere with contributor tooling
|
|
41
|
+
- CI/CD handles the final validation
|
|
42
|
+
|
|
43
|
+
To enable pre-commit hooks locally:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx husky install
|
|
47
|
+
npx husky add .husky/pre-commit "npx lint-staged"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Linting and Code Quality
|
|
53
|
+
|
|
54
|
+
### Running Linters
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Full linting with type checking (slower but thorough)
|
|
58
|
+
yarn lint
|
|
59
|
+
|
|
60
|
+
# Fast linting without type checking (for quick feedback)
|
|
61
|
+
yarn lint:fast
|
|
62
|
+
|
|
63
|
+
# With caching for better performance
|
|
64
|
+
yarn lint --cache
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Performance Note:** TypeScript ESLint uses type-aware linting for better type safety, which can be slower on large codebases. Use `yarn lint:fast` during development for quick feedback.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
29
71
|
## Setting Up a Development Environment
|
|
30
72
|
|
|
31
73
|
1. Install [Yarn](https://classic.yarnpkg.com/)
|
|
32
74
|
2. To test your changes on a Rails test project do the following steps:
|
|
75
|
+
|
|
33
76
|
- For Ruby gem, update `Gemfile` and point the `shakapacker` to the locally developing Shakapacker project:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
77
|
+
```ruby
|
|
78
|
+
gem 'shakapacker', path: "relative_or_absolute_path_to_local_shakapacker"
|
|
79
|
+
```
|
|
37
80
|
- For npm package, use `yalc` with following steps:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# In Shakapacker root directory
|
|
84
|
+
yalc publish
|
|
85
|
+
# In Rails app for testing
|
|
86
|
+
yalc link shakapacker
|
|
87
|
+
|
|
88
|
+
# After every change in shakapacker, run the following in Shakapacker directory
|
|
89
|
+
yalc push # or yalc publish --push
|
|
90
|
+
```
|
|
91
|
+
|
|
47
92
|
3. Run the following commands to set up the development environment.
|
|
48
93
|
```
|
|
49
94
|
bundle install
|
|
50
95
|
yarn install
|
|
96
|
+
yarn prepare:husky # Set up pre-commit hooks for linting
|
|
51
97
|
```
|
|
52
98
|
|
|
53
99
|
## Understanding Optional Peer Dependencies
|
|
@@ -59,11 +105,13 @@ Shakapacker uses optional peer dependencies (via `peerDependenciesMeta`) for max
|
|
|
59
105
|
- **Version constraints still apply** - When a package is installed, version compatibility is enforced
|
|
60
106
|
|
|
61
107
|
### When modifying dependencies:
|
|
108
|
+
|
|
62
109
|
1. Add new peer dependencies to both `peerDependencies` and `peerDependenciesMeta` (marking as optional)
|
|
63
110
|
2. Keep version ranges synchronized between `devDependencies` and `peerDependencies`
|
|
64
111
|
3. Test with multiple package managers: `npm`, `yarn`, and `pnpm`
|
|
65
112
|
|
|
66
113
|
### Testing peer dependency changes:
|
|
114
|
+
|
|
67
115
|
```bash
|
|
68
116
|
# Test with npm (no warnings expected)
|
|
69
117
|
cd /tmp && mkdir test-npm && cd test-npm
|
|
@@ -129,6 +177,7 @@ bundle exec rake run_spec:gem
|
|
|
129
177
|
```
|
|
130
178
|
|
|
131
179
|
#### 4.4 Run only Shakapacker gem specs for backward compatibility
|
|
180
|
+
|
|
132
181
|
These specs are to check Shakapacker v7 backward compatibility with v6.x
|
|
133
182
|
|
|
134
183
|
```
|
|
@@ -136,6 +185,7 @@ bundle exec rake run_spec:gem_bc
|
|
|
136
185
|
```
|
|
137
186
|
|
|
138
187
|
#### 4.5 Run dummy app test
|
|
188
|
+
|
|
139
189
|
For this, you need `yalc` to be installed on your local machine
|
|
140
190
|
|
|
141
191
|
```
|
|
@@ -143,6 +193,7 @@ bundle exec rake run_spec:dummy
|
|
|
143
193
|
```
|
|
144
194
|
|
|
145
195
|
#### 4.6 Testing the installer
|
|
196
|
+
|
|
146
197
|
To ensure that your installer works as expected, either you can run `bundle exec rake run_spec:install`, or take the following manual testing steps:
|
|
147
198
|
|
|
148
199
|
1. Update the `Gemfile` so that gem `shakapacker` has a line like this, pointing to your developing Shakapacker:
|
|
@@ -152,7 +203,7 @@ To ensure that your installer works as expected, either you can run `bundle exec
|
|
|
152
203
|
2. Run `bundle install` to install the updated gem.
|
|
153
204
|
3. Run `bundle exec rails shakapacker:install` to confirm that you got the right changes.
|
|
154
205
|
|
|
155
|
-
|
|
206
|
+
**Note:** Ensure that you use bundle exec otherwise the installed shakapacker gem will run and not the one you are working on.
|
|
156
207
|
|
|
157
208
|
## CI Workflows
|
|
158
209
|
|
|
@@ -161,6 +212,7 @@ Shakapacker uses GitHub Actions for continuous integration. The CI workflows use
|
|
|
161
212
|
### Package Manager Choice
|
|
162
213
|
|
|
163
214
|
The project uses Yarn in CI workflows for the following reasons:
|
|
215
|
+
|
|
164
216
|
- Deterministic dependency resolution with `yarn.lock`
|
|
165
217
|
- Faster installation with offline mirror support
|
|
166
218
|
- Better workspace support for monorepo-style testing
|
|
@@ -174,14 +226,16 @@ The project uses Yarn in CI workflows for the following reasons:
|
|
|
174
226
|
- `.github/workflows/generator.yml` - Generator installation tests
|
|
175
227
|
|
|
176
228
|
All workflows use:
|
|
229
|
+
|
|
177
230
|
```yaml
|
|
178
231
|
- uses: actions/setup-node@v4
|
|
179
232
|
with:
|
|
180
|
-
cache:
|
|
233
|
+
cache: "yarn"
|
|
181
234
|
cache-dependency-path: spec/dummy/yarn.lock
|
|
182
235
|
```
|
|
183
236
|
|
|
184
237
|
And install dependencies with:
|
|
238
|
+
|
|
185
239
|
```bash
|
|
186
240
|
yarn install
|
|
187
241
|
```
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
# Shakapacker (
|
|
1
|
+
# Shakapacker (v9)
|
|
2
2
|
---
|
|
3
3
|
|
|
4
|
-
_🚀 Shakapacker 9
|
|
4
|
+
_🚀 Shakapacker 9 supports [Rspack](https://rspack.rs/)! 10x faster than webpack!_
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
_Official, actively maintained successor to [rails/webpacker](https://github.com/rails/webpacker). ShakaCode stands behind the long-term maintenance and development of this project for the Rails community._
|
|
9
9
|
|
|
10
10
|
* ⚠️ See the [6-stable](https://github.com/shakacode/shakapacker/tree/6-stable) branch for Shakapacker v6.x code and documentation. :warning:
|
|
11
|
+
* **See [V9 Upgrade](./docs/v9_upgrade.md) for upgrading from the v8 release.**
|
|
11
12
|
* See [V8 Upgrade](./docs/v8_upgrade.md) for upgrading from the v7 release.
|
|
12
13
|
* See [V7 Upgrade](./docs/v7_upgrade.md) for upgrading from the v6 release.
|
|
13
14
|
* See [V6 Upgrade](./docs/v6_upgrade.md) for upgrading from v5 or prior v6 releases.
|
data/TODO.md
CHANGED
|
@@ -22,22 +22,21 @@
|
|
|
22
22
|
- [ ] Convert dev_server.js
|
|
23
23
|
- [ ] Convert webpackDevServerConfig.js
|
|
24
24
|
|
|
25
|
-
### Phase 4: Rules & Loaders
|
|
26
|
-
- [
|
|
27
|
-
- [
|
|
28
|
-
- [
|
|
29
|
-
|
|
30
|
-
### Phase 5: Framework-Specific Modules
|
|
31
|
-
- [
|
|
32
|
-
- [
|
|
33
|
-
- [
|
|
34
|
-
- [
|
|
35
|
-
|
|
36
|
-
### Phase 6: Final Cleanup
|
|
37
|
-
- [
|
|
38
|
-
- [
|
|
39
|
-
- [
|
|
40
|
-
- [ ] Update documentation
|
|
25
|
+
### Phase 4: Rules & Loaders (PR #620) ✅
|
|
26
|
+
- [x] Convert all files in `package/rules/`
|
|
27
|
+
- [x] Convert all files in `package/plugins/`
|
|
28
|
+
- [x] Convert all files in `package/optimization/`
|
|
29
|
+
|
|
30
|
+
### Phase 5: Framework-Specific Modules ✅
|
|
31
|
+
- [x] Convert rspack support files
|
|
32
|
+
- [x] Convert swc support files
|
|
33
|
+
- [x] Convert esbuild support files
|
|
34
|
+
- [x] Convert babel preset
|
|
35
|
+
|
|
36
|
+
### Phase 6: Final Cleanup ✅
|
|
37
|
+
- [x] Add TypeScript linting with @typescript-eslint
|
|
38
|
+
- [x] Verify strict mode is enabled (already configured)
|
|
39
|
+
- [x] Update documentation
|
|
41
40
|
|
|
42
41
|
## Why Gradual Migration?
|
|
43
42
|
- **Lower risk**: Each phase can be tested independently
|
data/TODO_v9.md
CHANGED
|
@@ -20,12 +20,15 @@ Align with Next.js and modern tooling by using named exports:
|
|
|
20
20
|
options: {
|
|
21
21
|
modules: {
|
|
22
22
|
namedExport: true,
|
|
23
|
-
exportLocalsConvention: '
|
|
23
|
+
exportLocalsConvention: 'camelCaseOnly' // Must be 'camelCaseOnly' or 'dashesOnly' with namedExport: true
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
**Note:** Using `exportLocalsConvention: 'camelCase'` with `namedExport: true` will cause a build error.
|
|
30
|
+
css-loader only allows `'camelCaseOnly'` or `'dashesOnly'` when named exports are enabled.
|
|
31
|
+
|
|
29
32
|
2. **Update TypeScript types:**
|
|
30
33
|
- Ensure proper typing for CSS modules with named exports
|
|
31
34
|
- May need to update or generate `.d.ts` files for CSS modules
|
|
@@ -81,4 +84,4 @@ Align with Next.js and modern tooling by using named exports:
|
|
|
81
84
|
### Test Infrastructure
|
|
82
85
|
- Successfully implemented dual bundler support (webpack/rspack)
|
|
83
86
|
- test-bundler script working well with status command
|
|
84
|
-
- Consider adding more comprehensive tests for both bundlers
|
|
87
|
+
- Consider adding more comprehensive tests for both bundlers
|
data/conductor-setup.sh
CHANGED
|
@@ -35,6 +35,18 @@ $BUNDLE_CMD install
|
|
|
35
35
|
echo "📦 Installing JavaScript dependencies..."
|
|
36
36
|
yarn install
|
|
37
37
|
|
|
38
|
+
# Set up Husky git hooks
|
|
39
|
+
echo "🪝 Setting up Husky git hooks..."
|
|
40
|
+
npx husky
|
|
41
|
+
if [ ! -f .husky/pre-commit ]; then
|
|
42
|
+
echo "Creating pre-commit hook..."
|
|
43
|
+
cat > .husky/pre-commit << 'EOF'
|
|
44
|
+
#!/usr/bin/env sh
|
|
45
|
+
npx lint-staged
|
|
46
|
+
EOF
|
|
47
|
+
chmod +x .husky/pre-commit
|
|
48
|
+
fi
|
|
49
|
+
|
|
38
50
|
# Copy environment files if they exist in root
|
|
39
51
|
if [ -n "${CONDUCTOR_ROOT_PATH:-}" ]; then
|
|
40
52
|
if [ -f "$CONDUCTOR_ROOT_PATH/.env" ]; then
|