diff --git a/scripts/build-solid.js b/scripts/build-solid.js index 8f7589cf4..cefe8185e 100644 --- a/scripts/build-solid.js +++ b/scripts/build-solid.js @@ -1,4 +1,5 @@ import execSh from 'exec-sh'; +import fs from 'fs-extra'; import { outputDir } from './utils/output-dir.js'; import { addBannerToFile } from './utils/banner.js'; /* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */ @@ -9,5 +10,7 @@ async function buildSolid() { `npx babel --config-file ./scripts/babel/babel.config.solid.json src/solid --out-dir ${outputDir}/solid`, ); await addBannerToFile(`./${outputDir}/solid/swiper-solid.js`, 'SolidJS'); + await fs.copyFile('./src/solid/swiper.js', `./${outputDir}/solid/swiper.js`); + await fs.copyFile('./src/solid/swiper-slide.js', `./${outputDir}/solid/swiper-slide.js`); } export default buildSolid; diff --git a/scripts/build-svelte.js b/scripts/build-svelte.js index 50e83d03a..14764999c 100644 --- a/scripts/build-svelte.js +++ b/scripts/build-svelte.js @@ -6,33 +6,9 @@ import { addBannerToFile } from './utils/banner.js'; export default async function buildSvelte() { await exec.promise(`npx babel src/svelte --out-dir ${outputDir}/svelte`); await addBannerToFile(`./${outputDir}/svelte/swiper-svelte.js`, 'Svelte'); - /* DON'T TRANSFORM SVELTE FILES - // Transform svelte files - let swiper = await fs.readFile('./src/svelte/swiper.svelte', 'utf8'); - const swiperResult = svelte.compile(swiper, { - format: 'esm', - filename: 'swiper.svelte', - }); - swiper = swiperResult.js.code; - await fs.writeFile(`./${outputDir}/svelte/swiper.js`, swiper); - - let swiperSlide = await fs.readFile('./src/svelte/swiper-slide.svelte', 'utf8'); - const swiperSlideResult = svelte.compile(swiperSlide, { - format: 'esm', - filename: 'swiper.svelte', - }); - swiperSlide = swiperSlideResult.js.code; - await fs.writeFile(`./${outputDir}/svelte/swiper-slide.js`, swiperSlide); - */ await fs.copyFile('./src/svelte/swiper.svelte', `./${outputDir}/svelte/swiper.svelte`); await fs.copyFile( './src/svelte/swiper-slide.svelte', `./${outputDir}/svelte/swiper-slide.svelte`, ); - // try { - // await fs.remove(`./${outputDir}/svelte/swiper-slide.svelte`); - // await fs.remove(`./${outputDir}/svelte/swiper.svelte`); - // } catch (err) { - // // no files - // } }