From de736f9350fe7d5952f99fc78d790004a9f759cd Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Sat, 21 Aug 2021 20:58:46 +0700 Subject: [PATCH] [fix] clear adapter-static output (#2260) --- .changeset/large-horses-flash.md | 5 +++++ packages/adapter-static/index.js | 16 +++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 .changeset/large-horses-flash.md diff --git a/.changeset/large-horses-flash.md b/.changeset/large-horses-flash.md new file mode 100644 index 000000000000..ccef864233ad --- /dev/null +++ b/.changeset/large-horses-flash.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/adapter-static': patch +--- + +Clear output before adapting diff --git a/packages/adapter-static/index.js b/packages/adapter-static/index.js index 5155fec1b8a6..e1cc80ce042f 100644 --- a/packages/adapter-static/index.js +++ b/packages/adapter-static/index.js @@ -1,16 +1,12 @@ -/** - * @param {{ - * pages?: string; - * assets?: string; - * fallback?: string; - * }} [opts] - */ +/** @type {import('.')} */ export default function ({ pages = 'build', assets = pages, fallback } = {}) { - /** @type {import('@sveltejs/kit').Adapter} */ - const adapter = { + return { name: '@sveltejs/adapter-static', async adapt({ utils }) { + utils.rimraf(assets); + utils.rimraf(pages); + utils.copy_static_files(assets); utils.copy_client_files(assets); @@ -21,6 +17,4 @@ export default function ({ pages = 'build', assets = pages, fallback } = {}) { }); } }; - - return adapter; }