Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Nov 26, 2024
1 parent d0e8149 commit a1f0e66
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 33 deletions.
51 changes: 24 additions & 27 deletions storage/framework/core/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,35 @@ import { log, runCommand } from '@stacksjs/cli'
import { path as p } from '@stacksjs/path'
import { exists, glob } from '@stacksjs/storage'

// import { $ } from 'bun'
console.log('Building in here...')

const dirs = await glob([p.resolve('./', '*')], { onlyDirectories: true, absolute: true })
dirs.sort((a, b) => a.localeCompare(b))

const startTime = Date.now()

console.log('dirs', dirs)
// for (const dir of dirs) {
// // bun-create has only nested dirs, no need to build
// if (dir.includes('bun-create') || dir.includes('components') || dir.includes('dist'))
// continue

// // rm the dist folder before building
// // await $`rm -rf ${p.resolve(dir, 'dist')}`
// const distPath = p.resolve(dir, 'dist')

// // Check if the dist folder exists
// if (await exists(distPath)) {
// await runCommand('rm -rf dist', {
// cwd: dir, // Change this to 'dir' to correctly set the working directory
// })
// }

// log.debug(`Cleaned dist folder`)

// // Run the build command in each directory
// await runCommand('bun run build', {
// cwd: dir,
// })
// }
for (const dir of dirs) {
// bun-create has only nested dirs, no need to build
if (dir.includes('bun-create') || dir.includes('dist'))
continue

console.log(`Building ${dir}`)
// rm the dist folder before building
// await $`rm -rf ${p.resolve(dir, 'dist')}`
const distPath = p.resolve(dir, 'dist')

// Check if the dist folder exists
if (await exists(distPath)) {
await runCommand('rm -rf dist', {
cwd: dir, // Change this to 'dir' to correctly set the working directory
})
}

log.debug(`Cleaned dist folder`)

// Run the build command in each directory
await runCommand('bun run build', {
cwd: dir,
})
}

const endTime = Date.now()
const timeTaken = endTime - startTime
Expand Down
6 changes: 0 additions & 6 deletions storage/framework/core/components/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ const startTime = Date.now()

console.log('dirs', dirs)
for (const dir of dirs) {
// bun-create has only nested dirs, no need to build
// if (dir.includes('bun-create') || dir.includes('components') || dir.includes('dist'))
// continue

// rm the dist folder before building
// await $`rm -rf ${p.resolve(dir, 'dist')}`
const distPath = p.resolve(dir, 'dist')

// Check if the dist folder exists
Expand Down

0 comments on commit a1f0e66

Please sign in to comment.