1
1
import { basename , join } from "node:path" ;
2
- import * as zip from "jsr:@zip-js/zip-js" ;
3
2
import { format , increment , parse } from "jsr:@std/semver" ;
4
3
5
4
const __dirname = new URL ( "." , import . meta. url ) . pathname ;
@@ -25,24 +24,43 @@ async function compile(src: string, dest: string) {
25
24
26
25
const result = await cmd . output ( ) ;
27
26
28
- console . log ( ` > Exit Code: ${ result . code } ` ) ;
27
+ console . log ( ` > Compile Exit Code: ${ result . code } ` ) ;
29
28
30
29
if ( result . code !== 0 ) {
31
30
return ;
32
31
}
33
32
34
- // output
35
- const output = await Deno . open ( `${ dest } .zip` , {
36
- create : true ,
37
- write : true ,
38
- read : true ,
33
+ const zip = new Deno . Command ( Deno . execPath ( ) , {
34
+ cwd : join ( __dirname , "../dist" ) ,
35
+ args : [
36
+ "zip" ,
37
+ `${ basename ( dest ) } .zip` ,
38
+ basename ( dest ) ,
39
+ ] ,
40
+ stderr : "inherit" ,
41
+ stdout : "inherit" ,
39
42
} ) ;
40
43
41
- const source = await Deno . open ( dest , { read : true } ) ;
44
+ const zipResult = await cmd . output ( ) ;
45
+
46
+ console . log ( ` > Zip Exit Code: ${ zipResult . code } ` ) ;
47
+
48
+ if ( zipResult . code !== 0 ) {
49
+ return ;
50
+ }
51
+
52
+ // // output
53
+ // const output = await Deno.open(`${dest}.zip`, {
54
+ // create: true,
55
+ // write: true,
56
+ // read: true,
57
+ // });
58
+
59
+ // const source = await Deno.open(dest, { read: true });
42
60
43
- const zipWriter = new zip . ZipWriter ( output . writable ) ;
44
- await zipWriter . add ( basename ( dest ) , source . readable ) ;
45
- await zipWriter . close ( ) ;
61
+ // const zipWriter = new zip.ZipWriter(output.writable);
62
+ // await zipWriter.add(basename(dest), source.readable);
63
+ // await zipWriter.close();
46
64
47
65
await Deno . remove ( dest ) ;
48
66
}
0 commit comments