Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
81ea079
chore: update @biomejs/biome to 2.3.11
srod Jan 9, 2026
cc99206
chore: add script to check published packages on npm
srod Jan 9, 2026
309af80
chore: remove jules palette documentation
srod Jan 9, 2026
2e60e9f
docs: update AGENTS.md with detailed project architecture and guidelines
srod Jan 9, 2026
494db66
chore(deps): update dependency bun to v1.3.6 (#2773)
renovate[bot] Jan 13, 2026
55c6fb4
fix(deps): update dependency oxc-minify to ^0.108.0
renovate[bot] Jan 13, 2026
344c777
Merge pull request #2772 from srod/renovate/oxlint-monorepo
srod Jan 13, 2026
8c78878
feat(action): add @node-minify/action GitHub Action package
srod Jan 9, 2026
44736c9
feat(action): add marketplace support and documentation
srod Jan 9, 2026
4c23751
fix(action): build dependencies before bundling action
srod Jan 9, 2026
22d7df6
fix(action): also build @node-minify/core before bundling
srod Jan 9, 2026
f20d288
fix(action): install compressor packages in test jobs
srod Jan 9, 2026
f9c4d25
fix(action): install compressors in temp dir to avoid workspace: prot…
srod Jan 9, 2026
7b41637
fix(action): copy compressor packages to repo node_modules
srod Jan 9, 2026
7d79a5a
fix(action): ensure node_modules dir exists and copy all deps
srod Jan 9, 2026
b1c51e8
fix(action): copy deps to packages/action/node_modules for resolution
srod Jan 9, 2026
c9454d8
fix(action): brute force copy of node_modules to all possible locations
srod Jan 9, 2026
7dcf118
refactor(action): cleanup test workflow installation steps
srod Jan 9, 2026
bb7b638
fix(action): ensure root node_modules directory exists before copying
srod Jan 9, 2026
0a51025
chore: add changeset for action and utils
srod Jan 9, 2026
abbfce5
feat(action): extract threshold logic and improve PR reporter pagination
srod Jan 9, 2026
4910a33
test(utils): add coverage for getFilesizeGzippedRaw
srod Jan 9, 2026
3ee69f5
test(utils): improve error assertions and add directory check for get…
srod Jan 9, 2026
757bbcb
📝 Add docstrings to `feature/github-action-package`
coderabbitai[bot] Jan 9, 2026
5b1bee1
fix(security): sanitize inputs in release workflow and check-publishe…
srod Jan 9, 2026
f954034
fix(scripts): allow dots in package names in check-published regex
srod Jan 9, 2026
cd46f1b
ci(release): commit compiled action dist during release
srod Jan 9, 2026
ce947a5
feat(action): add benchmark support to GitHub Action
srod Jan 9, 2026
80af89c
fix(action): add missing @node-minify/benchmark dependency
srod Jan 9, 2026
e481c45
fix(ci): build benchmark package before action in test workflow
srod Jan 9, 2026
ada9968
ci(release): improve release-action workflow robustness and add concu…
srod Jan 9, 2026
10b0760
fix(action): add missing compressor dependencies and robust gzip size…
srod Jan 10, 2026
508c293
feat(action): add benchmark outputs and improve input validation
srod Jan 10, 2026
7bb9549
ci(release): avoid empty commit when building action dist in release-…
srod Jan 10, 2026
6cbf94d
fix(action): improve input validation and push dist to tag in release
srod Jan 10, 2026
658bfc7
fix(action): improve release workflow tag handling, artifact packagin…
srod Jan 10, 2026
fb28e33
fix(benchmark): populate gzipBytes field for action compatibility
srod Jan 10, 2026
e150289
docs(test-action): document why compressor packages must be installed
srod Jan 10, 2026
2ef2d7f
refactor(action): remove misleading validateJavaCompressor alias
srod Jan 10, 2026
53f66a6
docs: use @v1 instead of @main for action version reference
srod Jan 10, 2026
f1c18ca
fix(action): filter out type-required compressors from benchmark when…
srod Jan 10, 2026
c705213
test(action): add comprehensive tests for inputs, outputs, and benchmark
srod Jan 10, 2026
1af49d9
fix(benchmark): only pass type to minify when defined
srod Jan 10, 2026
0360054
fix(action): remove lightningcss from type-required compressors
srod Jan 10, 2026
829aae8
fix(action): improve input parsing robustness and security
srod Jan 10, 2026
9973c64
docs: remove 'requires type' for lightningcss across all documentation
srod Jan 10, 2026
9f1ced3
feat(action): add benchmark-json output and improve release workflow
srod Jan 10, 2026
8f451e6
ci(action): ensure release tag is only updated if dist changes
srod Jan 10, 2026
5ce6645
ci(action): use explicit refspecs for pushing release tags
srod Jan 13, 2026
512da8f
fix(action): throw descriptive error when benchmark yields no results
srod Jan 13, 2026
250f688
docs(action): document compressor package installation requirement
srod Jan 13, 2026
a6a7a0d
test(action): update benchmark test to expect error on empty results
srod Jan 13, 2026
4b465d8
fix: improve gzip size stream handling and action documentation
srod Jan 13, 2026
3d4d2d0
docs: add changeset for gzip and action fixes
srod Jan 13, 2026
3f53cf5
refactor: simplify gzip size implementation for better coverage
srod Jan 13, 2026
fad512f
docs: add removed inputs migration guide for deprecated action
srod Jan 13, 2026
ded6a13
Merge pull request #2760 from srod/feature/github-action-package
srod Jan 13, 2026
4f2ff9b
chore(deps): update dependency tsdown to ^0.19.0
renovate[bot] Jan 13, 2026
c9b24b8
Merge pull request #2764 from srod/renovate/tsdown-0.x
srod Jan 13, 2026
56a8fde
chore(deps): update dependency bun to v1.3.6
renovate[bot] Jan 13, 2026
6878365
Merge pull request #2777 from srod/renovate/bun-1.x
srod Jan 13, 2026
9530d50
fix(cssnano): forward settings.options to cssnano preset
srod Jan 13, 2026
24b2fde
fix(oxc): return sourcemap from minification result
srod Jan 13, 2026
ed39b84
Merge pull request #2778 from srod/refactor/compressor-fixes
srod Jan 13, 2026
cb1efa1
refactor(tests): modernize __dirname to import.meta.url
srod Jan 13, 2026
0580c25
Merge pull request #2781 from srod/refactor/p4-modernize-dirname
srod Jan 14, 2026
7b259cf
refactor: add consistent error handling to 9 compressors
srod Jan 13, 2026
425476c
test: add error handling tests for 9 compressors
srod Jan 14, 2026
01ac891
fix: remove dead code and preserve error cause
srod Jan 14, 2026
d53f187
fix(minify-html): add validateMinifyResult for consistent validation
srod Jan 14, 2026
993cadd
fix(cssnano): add validateMinifyResult for consistent validation
srod Jan 14, 2026
1f13680
fix(cssnano): wrap validation error consistently
srod Jan 14, 2026
5e1c56e
Merge pull request #2779 from srod/refactor/p1-consistent-error-handling
srod Jan 15, 2026
5ccd5c9
refactor: decompose complex functions in utils and benchmark
srod Jan 13, 2026
d3e9143
test(utils): add case for invalid compressor export
srod Jan 14, 2026
966551c
refactor: add benchmark validation & resolver checks
srod Jan 14, 2026
f3b9094
refactor(utils): add getFilesizeBrotliRaw and deduplicate brotli size…
srod Jan 14, 2026
1716594
refactor(utils): prevent double wrapping of FileOperationError in siz…
srod Jan 14, 2026
e5452ad
Merge pull request #2780 from srod/refactor/p2-decompose-complex-func…
srod Jan 15, 2026
1843b20
fix(deps): update dependency terser to v5.45.0
renovate[bot] Jan 15, 2026
1fa9497
Merge pull request #2785 from srod/renovate/terser-5.x
srod Jan 15, 2026
f11d80d
fix(deps): update dependency terser to v5.46.0 (#2786)
renovate[bot] Jan 15, 2026
273ecc6
Fix: Allow string options in Google Closure Compiler wrapper
google-labs-jules[bot] Jan 14, 2026
b1ad499
Merge pull request #2784 from srod/sentinel-fix-gcc-options-629695512…
srod Jan 15, 2026
2b8d793
test(cssnano): increase timeout to 15s for Windows CI
srod Jan 15, 2026
25269e8
⚡ Bolt: Replace mkdirp with native fs.mkdir
google-labs-jules[bot] Jan 13, 2026
0a221f8
Merge pull request #2774 from srod/bolt/optimize-core-mkdirp-18425361…
srod Jan 16, 2026
12360b9
feat: add silence option to run utility to suppress console.error
google-labs-jules[bot] Jan 13, 2026
a476fc7
test(run): add coverage for silence option
srod Jan 16, 2026
25f23c6
Merge pull request #2776 from srod/sentinel-silence-run-8852087828430…
srod Jan 16, 2026
8aff956
chore(docs): use aria-label instead of title for navigation landmarks
google-labs-jules[bot] Jan 13, 2026
3f4fcc8
Merge pull request #2775 from srod/palette-ux-nav-aria-labels-1567061…
srod Jan 16, 2026
4c922b4
perf: Use EAFP pattern in writeFile to reduce syscalls
google-labs-jules[bot] Jan 14, 2026
6dc83f9
Merge pull request #2782 from srod/bolt/optimize-writefile-eafp-13295…
srod Jan 16, 2026
2607b43
feat(docs): add pagination to documentation pages
google-labs-jules[bot] Jan 14, 2026
2c08fe6
fix(docs): guard missing sidebar index in pagination
srod Jan 16, 2026
39c15c5
Merge pull request #2783 from srod/palette-docs-pagination-7195916456…
srod Jan 16, 2026
219dc27
fix(deps): update dependency ora to v9.1.0
renovate[bot] Jan 21, 2026
53617c3
Merge pull request #2789 from srod/renovate/ora-9.x
srod Jan 21, 2026
2e64877
feat(utils): add allowEmptyOutput option to skip empty results
srod Jan 22, 2026
45d2d7f
fix(cli): add explicit action for Commander 14.x compatibility
srod Jan 22, 2026
659c141
📝 Add docstrings to `feature/issue-2790-allow-empty-output`
coderabbitai[bot] Jan 22, 2026
d24b822
Merge pull request #2792 from srod/coderabbitai/docstrings/45d2d7f
srod Jan 22, 2026
78d18da
fix: improve allowEmptyOutput robustness
srod Jan 22, 2026
b7ede16
Merge pull request #2791 from srod/feature/issue-2790-allow-empty-output
srod Jan 22, 2026
e4138d7
fix(deps): update dependency oxc-minify to ^0.110.0
renovate[bot] Jan 22, 2026
d162f26
Merge pull request #2788 from srod/renovate/oxlint-monorepo
srod Jan 22, 2026
cc5fd76
fix(action): handle gzipSize=0 correctly and catch PR comment failures
srod Jan 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/allow-empty-output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@node-minify/types": minor
"@node-minify/utils": minor
"@node-minify/cli": minor
---

feat: add `allowEmptyOutput` option to skip writing empty output files

When minifiers produce empty output (e.g., CSS files with only comments), the new `allowEmptyOutput` option allows gracefully skipping the file write instead of throwing a validation error. Also adds `--allow-empty-output` CLI flag.
8 changes: 8 additions & 0 deletions .changeset/fix-gzip-stream-and-action-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@node-minify/utils": patch
"@node-minify/action": patch
---

fix: improve gzip size stream handling in utils
fix: ensure action build fails if type definitions copy fails
docs: add documentation for action inputs and java-version migration
8 changes: 8 additions & 0 deletions .changeset/fluffy-eagles-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@node-minify/utils": minor
"@node-minify/benchmark": minor
"@node-minify/docs": patch
---

feat: add `getFilesizeGzippedRaw` utility and update benchmark defaults
feat(action): launch `@node-minify/action` GitHub Action
159 changes: 73 additions & 86 deletions .github/actions/node-minify/README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,94 @@
# node-minify GitHub Action
# node-minify GitHub Action (DEPRECATED)

Minify JavaScript, CSS, and HTML files in your CI/CD pipeline with detailed reporting.
> **This action is deprecated.** Please use the new bundled action instead:
>
> ```yaml
> - uses: srod/node-minify@v1
> ```

## Usage
The new action includes:
- Bundled dependencies (faster startup)
- PR comment reporting
- File annotations
- Benchmark comparison
- Threshold enforcement
- More compressor options

### Basic Example
## Migration

Replace:

```yaml
- name: Minify JavaScript
uses: srod/node-minify/.github/actions/node-minify@main
- uses: srod/node-minify/.github/actions/node-minify@main
with:
input: "src/app.js"
output: "dist/app.min.js"
compressor: "terser"
```

With:

```yaml
- uses: srod/node-minify@v1
with:
input: "src/app.js"
output: "dist/app.min.js"
compressor: "terser"
```

### With All Options
### Removed Inputs

The following inputs are **not supported** in the new action and must be removed from your workflow YAML:

| Removed Input | Migration Guide |
|---------------|-----------------|
| `include-gzip` | Gzip sizes are now always included in the output. No action needed. |
| `java-version` | Use `actions/setup-java@v4` before running the action (see example below). |

#### Java Compressors Migration

If you use `gcc` or `yui` compressors that require Java:

**Before (deprecated):**
```yaml
- uses: srod/node-minify/.github/actions/node-minify@main
with:
compressor: gcc
java-version: "17"
```

**After:**
```yaml
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- uses: srod/node-minify@v1
with:
compressor: gcc
```

See [packages/action/README.md](../../../packages/action/README.md) for full documentation.

---

## Legacy Documentation

The following documentation is for the deprecated composite action.

### Basic Example

```yaml
- name: Minify with full options
id: minify
- name: Minify JavaScript
uses: srod/node-minify/.github/actions/node-minify@main
with:
input: "src/app.js"
output: "dist/app.min.js"
compressor: "esbuild"
type: "js"
options: '{"minify": true}'
report-summary: "true"
include-gzip: "true"

- name: Show results
run: |
echo "Reduction: ${{ steps.minify.outputs.reduction-percent }}%"
compressor: "terser"
```

## Inputs
### Inputs

| Input | Description | Required | Default |
|-------|-------------|----------|---------|
Expand All @@ -48,30 +101,7 @@ Minify JavaScript, CSS, and HTML files in your CI/CD pipeline with detailed repo
| `include-gzip` | Include gzip sizes | No | `true` |
| `java-version` | Java version for gcc/yui | No | - |

### Available Compressors

**JavaScript (no Java required):**
- `terser` (recommended)
- `esbuild` (fastest)
- `swc`
- `oxc`
- `uglify-js`

**CSS (no Java required):**
- `lightningcss` (recommended)
- `clean-css`
- `cssnano`
- `csso`
- `esbuild`

**HTML:**
- `html-minifier`

**Requires Java:**
- `gcc` (Google Closure Compiler)
- `yui` (deprecated)

## Outputs
### Outputs

| Output | Description |
|--------|-------------|
Expand All @@ -84,49 +114,6 @@ Minify JavaScript, CSS, and HTML files in your CI/CD pipeline with detailed repo
| `gzip-size-formatted` | Gzipped size formatted |
| `time-ms` | Compression time in milliseconds |

## Examples

### CSS Minification

```yaml
- name: Minify CSS
uses: srod/node-minify/.github/actions/node-minify@main
with:
input: "src/styles.css"
output: "dist/styles.min.css"
compressor: "lightningcss"
type: "css"
```

### Using Google Closure Compiler

```yaml
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"

- name: Minify with GCC
uses: srod/node-minify/.github/actions/node-minify@main
with:
input: "src/app.js"
output: "dist/app.min.js"
compressor: "gcc"
options: '{"compilation_level": "ADVANCED_OPTIMIZATIONS"}'
```

### HTML Minification

```yaml
- name: Minify HTML
uses: srod/node-minify/.github/actions/node-minify@main
with:
input: "src/index.html"
output: "dist/index.html"
compressor: "html-minifier"
```

## License

MIT
21 changes: 13 additions & 8 deletions .github/actions/node-minify/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "node-minify"
description: "Minify JavaScript, CSS, and HTML files with detailed reporting"
name: "node-minify (deprecated)"
description: "DEPRECATED: Use srod/node-minify@v1 instead. This composite action will be removed in a future release."
author: "srod"
branding:
icon: "minimize-2"
color: "green"
color: "gray"

inputs:
input:
Expand All @@ -20,7 +20,7 @@ inputs:
description: "Output file path"
required: true
type:
description: "File type: js or css (required for esbuild, lightningcss, yui)"
description: "File type: js or css (required for esbuild, yui)"
required: false
options:
description: "Compressor-specific options (JSON string)"
Expand Down Expand Up @@ -67,15 +67,18 @@ outputs:
runs:
using: "composite"
steps:
# Setup Java for gcc/yui compressors (auto-setup with default if java-version not specified)
- name: Deprecation warning
shell: bash
run: |
echo "::warning::This action (.github/actions/node-minify) is DEPRECATED. Please migrate to 'uses: srod/node-minify@v1' for the new bundled action with more features (PR comments, annotations, benchmarking)."

- name: Setup Java (for gcc/yui)
if: contains(fromJSON('["gcc", "google-closure-compiler", "yui"]'), inputs.compressor)
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ inputs.java-version || '17' }}

# Warn about deprecated yui compressor
- name: Deprecation warning (yui)
if: inputs.compressor == 'yui'
shell: bash
Expand All @@ -85,7 +88,7 @@ runs:
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.5"
bun-version: "1.3.6"

- name: Install dependencies
shell: bash
Expand Down Expand Up @@ -121,7 +124,7 @@ runs:
shell: bash
run: |
cat >> $GITHUB_STEP_SUMMARY << EOF
## 📦 node-minify Results
## node-minify Results

| Metric | Value |
|--------|-------|
Expand All @@ -134,4 +137,6 @@ runs:
| **Gzip Size** | ${{ steps.minify.outputs.gzip-size-formatted }} |
| **Time** | ${{ steps.minify.outputs.time-ms }}ms |

> **Note:** This action is deprecated. Please migrate to \`uses: srod/node-minify@v1\` for enhanced features.

EOF
67 changes: 5 additions & 62 deletions .github/actions/node-minify/minify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,10 @@ import { appendFileSync, existsSync } from "node:fs";
import { stat } from "node:fs/promises";
import { resolve } from "node:path";
import { minify } from "@node-minify/core";
import { getFilesizeGzippedInBytes } from "@node-minify/utils";

const KNOWN_COMPRESSOR_EXPORTS: Record<string, string> = {
esbuild: "esbuild",
"google-closure-compiler": "gcc",
gcc: "gcc",
oxc: "oxc",
swc: "swc",
terser: "terser",
"uglify-js": "uglifyJs",
"babel-minify": "babelMinify",
"uglify-es": "uglifyEs",
yui: "yui",
"clean-css": "cleanCss",
cssnano: "cssnano",
csso: "csso",
lightningcss: "lightningCss",
crass: "crass",
sqwish: "sqwish",
"html-minifier": "htmlMinifier",
jsonminify: "jsonMinify",
imagemin: "imagemin",
sharp: "sharp",
svgo: "svgo",
"no-compress": "noCompress",
};

/**
* Resolves a compressor function from the @node-minify/{name} package and returns it with a label.
*
* @param name - Compressor package identifier (e.g., "terser", "esbuild"); used to import @node-minify/{name}
* @returns An object containing `compressor` (the resolved compressor function) and `label` (the provided name)
* @throws Error if the package does not export a usable compressor function
*/
async function resolveCompressor(
name: string
): Promise<{ compressor: unknown; label: string }> {
const packageName = `@node-minify/${name}`;
const mod = (await import(packageName)) as Record<string, unknown>;

const knownExport = KNOWN_COMPRESSOR_EXPORTS[name];
if (knownExport && typeof mod[knownExport] === "function") {
return { compressor: mod[knownExport], label: name };
}

if (typeof mod.default === "function") {
return { compressor: mod.default, label: name };
}

for (const value of Object.values(mod)) {
if (typeof value === "function") {
return { compressor: value, label: name };
}
}

throw new Error(
`Package '${packageName}' doesn't export a valid compressor function.`
);
}
import {
getFilesizeGzippedInBytes,
resolveCompressor,
} from "@node-minify/utils";

interface ActionResult {
originalSize: number;
Expand Down Expand Up @@ -164,9 +109,7 @@ async function run(): Promise<void> {

console.log(`Minifying ${inputFile} with ${label}...`);

const requiresType = ["esbuild", "lightningcss", "yui"].includes(
compressorName
);
const requiresType = ["esbuild", "yui"].includes(compressorName);
if (requiresType && !fileType) {
console.error(
`::error::Compressor '${compressorName}' requires the 'type' input (js or css)`
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.5"
bun-version: "1.3.6"

- name: Setup Node.js
uses: actions/setup-node@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: 📦 Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.5"
bun-version: "1.3.6"

- name: ⚙️ Setup Node
uses: actions/setup-node@v6
Expand Down
Loading