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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 161513f810a18384f6f80fd33826774b01027e0a3167e7cdfea5af2903419ccc
4
- data.tar.gz: 756c73ddf0f8347c4ca86c484fff6c62cb01600304a04abc84f54b693555062b
3
+ metadata.gz: dbf94679b0585877e9d92723888dc23756d797d3221b74ff06f5f54dd10dddcb
4
+ data.tar.gz: a07f1b4306486768fcc1060c1bcc7ebedce403c3d1e36b8193c2e0dab61c4093
5
5
  SHA512:
6
- metadata.gz: 3ca585f21d6501f6fca88792b125fdd9f70ed839867509445a59eca25f521919a6918554168f834d3deb36d9e9e7eb39c05d36c32222e8d354f7442ea4ca394e
7
- data.tar.gz: 6f6eacf4afa87d6f130a71c88724deaa0e17d9d8e06cde38cb883b2a1bc35253604b5163e8d40580fbe0c40e8811fd723c424b3f769c96a495962a38ff3aedda
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**
@@ -1,3 +1,3 @@
1
1
  module IslandjsRails
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -3,8 +3,8 @@
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "scripts": {
6
- "build": "rm -f public/islands_* && NODE_ENV=production webpack",
7
- "build:dev": "rm -f public/islands_* && NODE_ENV=production webpack",
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: '/'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: islandjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Arnold