diff --git a/.changeset/nasty-hats-rhyme.md b/.changeset/nasty-hats-rhyme.md index 9f88ad32af5a..a6d754c6d60f 100644 --- a/.changeset/nasty-hats-rhyme.md +++ b/.changeset/nasty-hats-rhyme.md @@ -2,4 +2,9 @@ "wrangler": minor --- -feat: experimental workers assets can be ignored by adding a .cfassetsignore file +feat: experimental workers assets can be ignored by adding a .assetsignore file + +This file can be added to the root of the assets directory that is to be uploaded alongside the Worker +when using `experimental_assets`. + +The file follows the `.gitignore` syntax, and any matching paths will not be included in the upload. diff --git a/.vscode/settings.json b/.vscode/settings.json index 3d6691718c5e..af3e13c4c8a8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,7 @@ "editor.defaultFormatter": "esbenp.prettier-vscode", "cSpell.words": [ "Abortable", - "cfassetsignore", + "assetsignore", "cfetch", "chatgpt", "clipboardy", diff --git a/packages/wrangler/src/__tests__/deploy.test.ts b/packages/wrangler/src/__tests__/deploy.test.ts index 921395cc14bb..b1e2759bddf3 100644 --- a/packages/wrangler/src/__tests__/deploy.test.ts +++ b/packages/wrangler/src/__tests__/deploy.test.ts @@ -4371,9 +4371,9 @@ addEventListener('fetch', event => {});` }); }); - it("should ignore assets that match patterns in an .cfassetsignore file in the root of the assets directory", async () => { + it("should ignore assets that match patterns in an .assetsignore file in the root of the assets directory", async () => { const assets = [ - { filePath: ".cfassetsignore", content: "*.bak\nsub-dir" }, + { filePath: ".assetsignore", content: "*.bak\nsub-dir" }, { filePath: "file-1.txt", content: "Content of file-1" }, { filePath: "file-2.bak", content: "Content of file-2" }, { filePath: "file-3.txt", content: "Content of file-3" }, diff --git a/packages/wrangler/src/experimental-assets.ts b/packages/wrangler/src/experimental-assets.ts index 3edf234f1926..11376ad36ac1 100644 --- a/packages/wrangler/src/experimental-assets.ts +++ b/packages/wrangler/src/experimental-assets.ts @@ -388,7 +388,7 @@ const decodeFilepath = (filePath: string) => { * and returns true if the asset should not be ignored. */ async function createAssetIgnoreFunction(dir: string) { - const CF_ASSETS_IGNORE_FILENAME = ".cfassetsignore"; + const CF_ASSETS_IGNORE_FILENAME = ".assetsignore"; const cfAssetIgnorePath = path.resolve(dir, CF_ASSETS_IGNORE_FILENAME); @@ -400,7 +400,7 @@ async function createAssetIgnoreFunction(dir: string) { await readFile(cfAssetIgnorePath, { encoding: "utf8" }) ).split("\n"); - // Always ignore the `.cfassetsignore` file. + // Always ignore the `.assetsignore` file. ignorePatterns.push(CF_ASSETS_IGNORE_FILENAME); return createPatternMatcher(ignorePatterns, true);