Skip to content

Commit

Permalink
feat(solid): keep solid components incompiled
Browse files Browse the repository at this point in the history
fixes #5943
  • Loading branch information
nolimits4web committed Sep 7, 2022
1 parent 921809b commit 18c6670
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
3 changes: 3 additions & 0 deletions scripts/build-solid.js
Original file line number Diff line number Diff line change
@@ -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}] */
Expand All @@ -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;
24 changes: 0 additions & 24 deletions scripts/build-svelte.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
// }
}

0 comments on commit 18c6670

Please sign in to comment.