diff --git a/.gitignore b/.gitignore index 43cdd4575..b5d5a9b14 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ node_modules .env.* !.env.example .vercel +generated/ \ No newline at end of file diff --git a/plugins/sveld.js b/plugins/sveld.js index e5f5561c2..00e94f0c6 100644 --- a/plugins/sveld.js +++ b/plugins/sveld.js @@ -20,7 +20,7 @@ export default function sveld() { } }, // This generates a `COMPONENT_API.json` with sveld in the `/_app` folder on build, which is used by the docs about components (only when built statically) - async generateBundle(options, bundle) { + async buildStart() { const output = {}; const componentFiles = await fs.readdir(path.resolve('./src/lib/components')) @@ -31,11 +31,13 @@ export default function sveld() { output[fileName] = await parseRaw(raw, filePath) } - this.emitFile({ - type: 'asset', - fileName: 'COMPONENT_API.json', - source: JSON.stringify(output), - }) + try { + await fs.mkdir(path.resolve('./src/generated')) + } catch { + // Do nothing, directory already exists + } + + await fs.writeFile(path.resolve('./src/generated/COMPONENT_API.json'), JSON.stringify(output)) }, } } diff --git a/src/lib/components/Avatar.svelte b/src/lib/components/Avatar.svelte index 0a29f4a20..16677983b 100644 --- a/src/lib/components/Avatar.svelte +++ b/src/lib/components/Avatar.svelte @@ -1,4 +1,6 @@