11import { spawn } from "node:child_process" ;
2- import { mkdir , readdir , readFile , rm , writeFile } from "node:fs/promises" ;
2+ import { mkdir , readFile , rm , writeFile } from "node:fs/promises" ;
33import { resolve } from "node:path" ;
44import { rollupBuild } from "project-tool/rollup" ;
5+ import { preSvelte } from "./utils" ;
56
67const externalCorePackage = ( id : string ) =>
78 ( id . includes ( "node_modules" ) || ( id . includes ( "@git-diff-view/" ) && ! id . endsWith ( "@git-diff-view/utils" ) ) ) &&
@@ -22,19 +23,6 @@ const copyCss = async (packageName: string, file: string) => {
2223 await writeFile ( cssDistPath , cssContent ) ;
2324} ;
2425
25- const copyDir = async ( srcDir : string , tarDir : string ) => {
26- const srcPath = resolve ( process . cwd ( ) , "packages" , srcDir ) ;
27- const tarPath = resolve ( process . cwd ( ) , "packages" , tarDir ) ;
28- await mkdir ( tarPath , { recursive : true } ) . catch ( ( ) => void 0 ) ;
29- const files = await readdir ( srcPath ) ;
30- for ( const file of files ) {
31- if ( file . endsWith ( "index.ts" ) ) continue ;
32- const srcFilePath = resolve ( srcPath , file ) ;
33- const tarFilePath = resolve ( tarPath , file ) ;
34- await writeFile ( tarFilePath , await readFile ( srcFilePath ) ) ;
35- }
36- } ;
37-
3826const clean = async ( packageName : string ) => {
3927 const typePath = resolve ( process . cwd ( ) , "packages" , packageName , "index.d.ts" ) ;
4028 const content = await readFile ( typePath , "utf-8" ) ;
@@ -135,7 +123,7 @@ const buildSolid = async () => {
135123} ;
136124
137125const buildSvelte = async ( ) => {
138- await copyDir ( "utils/src" , "svelte/src/lib/utils" ) ;
126+ await preSvelte ( ) ;
139127 await new Promise < void > ( ( r , j ) => {
140128 const ls = spawn ( `cd packages/svelte && pnpm run build` , { shell : true , stdio : "inherit" } ) ;
141129 ls . on ( "close" , ( ) => r ( ) ) ;
0 commit comments