islandjs-rails 0.6.0 → 0.7.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 +6 -0
- data/lib/islandjs_rails/version.rb +1 -1
- data/lib/templates/package.json +2 -2
- data/lib/templates/webpack.config.js +36 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dbf94679b0585877e9d92723888dc23756d797d3221b74ff06f5f54dd10dddcb
|
|
4
|
+
data.tar.gz: a07f1b4306486768fcc1060c1bcc7ebedce403c3d1e36b8193c2e0dab61c4093
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e29967022d5e806b2313e67897e56f4d4a30c81e825b2fb33c1e80dce23fb213ca71a81af4a84033dc1c08db7ab4f91b7e98ed56cfca1dcd3388870f4aff8c64
|
|
7
|
+
data.tar.gz: fb5b8de3b03dc845ed4e1bb4bff6ee12c42ac1c30f0b0f2e1f4ea07340a454ea7b003e85813c6370e72b49c5698071da6262ea5e8182706f5cc62f19928b38c6
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.7.0] - 2025-10-27
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **CleanIslandsPlugin**: Webpack plugin that automatically removes old island bundle files from the public directory after new builds, preventing stale file accumulation
|
|
12
|
+
- Simplified build scripts by removing manual `rm -f public/islands_*` commands
|
|
13
|
+
|
|
8
14
|
## [0.6.0] - 2025-10-24
|
|
9
15
|
|
|
10
16
|
- **React 19 Support Added**
|
data/lib/templates/package.json
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "
|
|
7
|
-
"build:dev": "
|
|
6
|
+
"build": "NODE_ENV=production webpack",
|
|
7
|
+
"build:dev": "NODE_ENV=production webpack",
|
|
8
8
|
"watch": "NODE_ENV=development webpack --watch"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {},
|
|
@@ -1,9 +1,44 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
3
3
|
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
|
|
4
|
+
const fs = require('fs');
|
|
4
5
|
|
|
5
6
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
6
7
|
|
|
8
|
+
// Custom plugin to clean old island bundle files
|
|
9
|
+
class CleanIslandsPlugin {
|
|
10
|
+
apply(compiler) {
|
|
11
|
+
compiler.hooks.afterEmit.tap('CleanIslandsPlugin', (compilation) => {
|
|
12
|
+
const publicDir = path.resolve(__dirname, 'public');
|
|
13
|
+
if (!fs.existsSync(publicDir)) return;
|
|
14
|
+
|
|
15
|
+
// Get the newly emitted files
|
|
16
|
+
const emittedFiles = Object.keys(compilation.assets).map(
|
|
17
|
+
filename => filename.split('/').pop() // Get just the filename
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const files = fs.readdirSync(publicDir);
|
|
21
|
+
files.forEach(file => {
|
|
22
|
+
// Clean old islands files, but keep the newly emitted ones
|
|
23
|
+
// Also include .map and .LICENSE.txt files
|
|
24
|
+
const isEmitted = emittedFiles.includes(file) ||
|
|
25
|
+
emittedFiles.some(ef => file.startsWith(ef) && (
|
|
26
|
+
file.endsWith('.map') || file.endsWith('.LICENSE.txt')
|
|
27
|
+
));
|
|
28
|
+
|
|
29
|
+
if (file.startsWith('islands_') && !isEmitted) {
|
|
30
|
+
const filePath = path.join(publicDir, file);
|
|
31
|
+
try {
|
|
32
|
+
fs.unlinkSync(filePath);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
// Ignore errors
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
7
42
|
module.exports = {
|
|
8
43
|
mode: isProduction ? 'production' : 'development',
|
|
9
44
|
entry: {
|
|
@@ -40,6 +75,7 @@ module.exports = {
|
|
|
40
75
|
minimizer: [new TerserPlugin()]
|
|
41
76
|
},
|
|
42
77
|
plugins: [
|
|
78
|
+
new CleanIslandsPlugin(),
|
|
43
79
|
new WebpackManifestPlugin({
|
|
44
80
|
fileName: 'islands_manifest.json',
|
|
45
81
|
publicPath: '/'
|