An open API service indexing awesome lists of open source software.

https://github.com/kyawthet-naing/web-cache-killer

A Flutter package that solves Flutter web cache problems by automatically renaming JavaScript files with timestamps during build process.
https://github.com/kyawthet-naing/web-cache-killer

flutter flutter-cache flutter-web-cache web-cache-flush

Last synced: about 1 month ago
JSON representation

A Flutter package that solves Flutter web cache problems by automatically renaming JavaScript files with timestamps during build process.

Awesome Lists containing this project

README

          

# Web Cache Killer

Fixes Flutter web cache problems by automatically renaming JavaScript files with timestamps.

## Why You Need This

When you deploy a Flutter web app, users often see the old version because browsers cache JavaScript files. This tool fixes that by renaming your JS files with timestamps so users always get the latest version.

## Installation

```bash
dart pub global activate web_cache_killer
```

## Quick Start

```bash
# Go to your Flutter project folder
cd my_flutter_project

# Build and create web.zip
web_cache_killer

# Build with custom name (creates beta.zip)
web_cache_killer --name beta

# Build and upload automatically
web_cache_killer --auto-upload
```

## What It Does

**Before:**
```
flutter.js
main.dart.js
```

**After:**
```
flutter_20250801_143022_456.js
main_20250801_143022_456.dart.js
```

All HTML files are automatically updated to use the new names.

## Commands

| Command | What It Does |
|---------|-------------|
| `web_cache_killer` | Build and create `web.zip` |
| `web_cache_killer --name release` | Build and create `release.zip` |
| `web_cache_killer --auto-upload` | Build and upload to tmpfiles.org |
| `web_cache_killer --no-zip` | Build only (no zip file) |
| `web_cache_killer --verbose` | Show detailed output |
| `web_cache_killer --no-clean` | Skip flutter clean (faster) |

## Output Example

```
๐Ÿš€ Web Cache Killer
==================================
Checking requirements...
โœ… Requirements satisfied
๐Ÿงน Cleaning...
โœ… Cleaned
๐Ÿ“ฆ Getting dependencies...
โœ… Dependencies ready
๐Ÿ”ง Building web...
โœ… Build completed
๐Ÿ•’ Applying cache busting...
โœ… Cache busting applied (3 files)
๐Ÿ“ฆ Creating deployment package...
โœ… Successfully created web.zip (Size: 7.9M)

==================================
๐ŸŽ‰ Build Completed!
โœ… Created: web.zip
๐Ÿ“ Build: /path/to/project/build/web
```

## File Structure

**Default build:**
```
build/
โ”œโ”€โ”€ web/ # Your app files
โ””โ”€โ”€ web.zip # Ready to deploy
```

**Custom name build:**
```
build/
โ”œโ”€โ”€ release/ # Your app files
โ””โ”€โ”€ release.zip # Ready to deploy
```

## Upload Feature

Upload your zip automatically to get a direct download link:

```bash
web_cache_killer --auto-upload
```

You'll get a link like: `http://tmpfiles.org/dl/123456/web.zip`

## Common Issues

**โŒ "pubspec.yaml not found"**
- Make sure you're in your Flutter project folder

**โŒ "Flutter not found"**
- Install Flutter: https://flutter.dev/docs/get-started/install
- Make sure `flutter` command works in your terminal

**โŒ Upload fails**
- Check your internet connection
- Your zip file is still saved locally in the `build/` folder

## Requirements

- Flutter SDK installed
- Dart 2.12+
- Run from Flutter project root (where `pubspec.yaml` is)

## Features

โœ… **Cross-platform** - Windows, macOS, Linux
โœ… **Zero setup** - Just install and run
โœ… **Cache busting** - Automatic timestamp renaming
โœ… **Custom names** - Name your builds
โœ… **Auto upload** - Get instant download links
โœ… **Fast builds** - Skip clean with `--no-clean`