Skip to content

Commit

Permalink
Merge pull request #16 from exoego/glob
Browse files Browse the repository at this point in the history
Support glob in metafiles
  • Loading branch information
exoego committed May 7, 2024
2 parents f9eb31a + f4a40c0 commit 7429f1f
Show file tree
Hide file tree
Showing 10 changed files with 7,241 additions and 121 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ permissions:
| Name | Default | Description |
|---------------------------|---------------------------------------|------------------------------------------------------------------------------------------------------------------|
| `metafiles` | - | A required comma-separated list of paths to [esbuild's meta file]([https://esbuild.github.io/api/#metafile]). |
| `metafiles` | - | A required comma-separated list of paths to [esbuild's meta file]([https://esbuild.github.io/api/#metafile]). Glob (`dist/**/meta.json`) is supported. |
| `name` | ${{ github.event.<br>repository.name }} | The name of your project. This will be used in the comment header. |
| `analyze_directory` | `.analyzer` | A path to working directory where bundle analysis are stored. |
| `include_extensions` | `.js,.cjs,.mjs` | A comma-separated list of file extension to be included in the analysis table. |
Expand Down
5 changes: 3 additions & 2 deletions __tests__/__fixtures__/examples/basic/esbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { writeFileSync } from "node:fs";
import {mkdirSync, writeFileSync} from "node:fs";
import { build } from "esbuild";

const result = await build({
Expand All @@ -17,4 +17,5 @@ const result = await build({
assetNames: "resources/[name]-[hash]",
});

writeFileSync(`out/meta.json`, JSON.stringify(result.metafile, null, 2));
mkdirSync(`out/foo`, { recursive: true });
writeFileSync(`out/foo/meta.json`, JSON.stringify(result.metafile, null, 2));
5 changes: 3 additions & 2 deletions __tests__/__fixtures__/examples/multi-outputs/esbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { writeFileSync } from "node:fs";
import { writeFileSync, mkdirSync } from "node:fs";
import { build } from "esbuild";

const result = await build({
Expand All @@ -17,4 +17,5 @@ const result = await build({
assetNames: "resources/[name]-[hash]",
});

writeFileSync(`out/meta.json`, JSON.stringify(result.metafile, null, 2));
mkdirSync(`out/bar`, { recursive: true });
writeFileSync(`out/bar/meta.json`, JSON.stringify(result.metafile, null, 2));
2 changes: 1 addition & 1 deletion __tests__/no-base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("examples w/o base analysis", () => {
analyzerDirectory: ".analyzer",
percentExtraAttention: 20,
includeExtensions: [".js", ".mjs", ".cjs"],
metafiles: ["out/meta.json"],
metafiles: ["out/**/meta.json"],
name: "test",
showDetails: false,
};
Expand Down
4 changes: 3 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ inputs:
metafiles:
required: true
description: |
A comma-separated list of paths to [esbuild's meta file]([https://esbuild.github.io/api/#metafile]). Must be non-empty.
A comma-separated list of paths to [esbuild's meta file]([https://esbuild.github.io/api/#metafile]).
Must be non-empty.
Glob (`dist/**/meta.json`) is supported.
As of esbuild v0.20.0, you need to write the meta file by yourself after build, something like this:
Expand Down
Loading

0 comments on commit 7429f1f

Please sign in to comment.