From 60e976eb0acceb4642a0f632f884dc74247345ce Mon Sep 17 00:00:00 2001 From: pushkine Date: Tue, 9 Mar 2021 18:48:01 +0100 Subject: [PATCH] (chore) Generate dts for test build (#867) for svelte2tsx --- packages/svelte2tsx/rollup.config.test.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/svelte2tsx/rollup.config.test.js b/packages/svelte2tsx/rollup.config.test.js index 2da91e0a5..71040a212 100644 --- a/packages/svelte2tsx/rollup.config.test.js +++ b/packages/svelte2tsx/rollup.config.test.js @@ -4,6 +4,17 @@ import resolve from '@rollup/plugin-node-resolve'; import json from '@rollup/plugin-json'; import del from 'rollup-plugin-delete'; import builtins from 'builtin-modules'; +import fs from 'fs'; + +function generateFile(file, x) { + return { + writeBundle() { + if (!process.env.CI) { + fs.writeFileSync(file, x); + } + } + }; +} export default [ { @@ -18,7 +29,8 @@ export default [ resolve({ browser: false, preferBuiltins: true }), commonjs(), json(), - typescript({ include: ['src/**/*'] }) + typescript({ include: ['src/**/*'] }), + generateFile('test/build/index.d.ts', "export { default } from '../../index';") ], external: [...builtins, 'typescript', 'svelte', 'svelte/compiler', 'magic-string'] }, @@ -34,7 +46,11 @@ export default [ resolve({ browser: false, preferBuiltins: true }), commonjs(), json(), - typescript({ include: ['src/**/*'] }) + typescript({ include: ['src/**/*'] }), + generateFile( + 'test/build/htmlxtojsx.d.ts', + "export * from '../../src/htmlxtojsx/index';" + ) ], external: [...builtins, 'typescript', 'svelte', 'svelte/compiler', 'magic-string'] }