@@ -2,38 +2,35 @@ import { log, runCommand } from '@stacksjs/cli'
2
2
import { path as p } from '@stacksjs/path'
3
3
import { exists , glob } from '@stacksjs/storage'
4
4
5
- // import { $ } from 'bun'
6
- console . log ( 'Building in here...' )
7
-
8
5
const dirs = await glob ( [ p . resolve ( './' , '*' ) ] , { onlyDirectories : true , absolute : true } )
9
6
dirs . sort ( ( a , b ) => a . localeCompare ( b ) )
10
7
11
8
const startTime = Date . now ( )
12
9
13
- console . log ( 'dirs' , dirs )
14
- // for (const dir of dirs) {
15
- // // bun-create has only nested dirs, no need to build
16
- // if (dir.includes('bun-create') || dir.includes('components') || dir.includes('dist'))
17
- // continue
18
-
19
- // // rm the dist folder before building
20
- // // await $`rm -rf ${p.resolve(dir, 'dist')}`
21
- // const distPath = p.resolve(dir, 'dist')
22
-
23
- // // Check if the dist folder exists
24
- // if (await exists(distPath)) {
25
- // await runCommand('rm -rf dist', {
26
- // cwd: dir, // Change this to 'dir' to correctly set the working directory
27
- // })
28
- // }
29
-
30
- // log.debug(`Cleaned dist folder`)
31
-
32
- // // Run the build command in each directory
33
- // await runCommand('bun run build', {
34
- // cwd: dir,
35
- // })
36
- // }
10
+ for ( const dir of dirs ) {
11
+ // bun-create has only nested dirs, no need to build
12
+ if ( dir . includes ( ' bun-create' ) || dir . includes ( 'dist' ) )
13
+ continue
14
+
15
+ console . log ( `Building ${ dir } ` )
16
+ // rm the dist folder before building
17
+ // await $`rm -rf ${p.resolve(dir, 'dist')}`
18
+ const distPath = p . resolve ( dir , 'dist' )
19
+
20
+ // Check if the dist folder exists
21
+ if ( await exists ( distPath ) ) {
22
+ await runCommand ( 'rm -rf dist' , {
23
+ cwd : dir , // Change this to 'dir' to correctly set the working directory
24
+ } )
25
+ }
26
+
27
+ log . debug ( `Cleaned dist folder` )
28
+
29
+ // Run the build command in each directory
30
+ await runCommand ( 'bun run build' , {
31
+ cwd : dir ,
32
+ } )
33
+ }
37
34
38
35
const endTime = Date . now ( )
39
36
const timeTaken = endTime - startTime
0 commit comments