Skip to content

Commit baff004

Browse files
committed
chore: wip
1 parent dbda38c commit baff004

File tree

58 files changed

+693
-78
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+693
-78
lines changed

storage/framework/core/actions/build.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { outro } from '@stacksjs/build'
1+
import { intro, outro } from '@stacksjs/build'
22

3-
const startTime = Date.now()
3+
const { startTime } = await intro({
4+
dir: import.meta.dir,
5+
})
46

57
const result = await Bun.build({
68
root: './src',

storage/framework/core/ai/build.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
await Bun.build({
1+
import { intro, outro } from '@stacksjs/build'
2+
3+
const { startTime } = await intro({
4+
dir: import.meta.dir,
5+
})
6+
7+
const result = await Bun.build({
28
root: './src',
39

410
entrypoints: [
@@ -12,5 +18,10 @@ await Bun.build({
1218
'@aws-sdk/client-bedrock-runtime',
1319
'@aws-sdk/client-bedrock',
1420
],
21+
})
1522

23+
await outro({
24+
dir: import.meta.dir,
25+
startTime,
26+
result,
1627
})

storage/framework/core/alias/build.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
await Bun.build({
1+
import { intro, outro } from '@stacksjs/build'
2+
3+
const { startTime } = await intro({
4+
dir: import.meta.dir,
5+
})
6+
7+
const result = await Bun.build({
28
entrypoints: [
39
'./src/index.ts',
410
],
@@ -9,5 +15,10 @@ await Bun.build({
915
external: [
1016
'@stacksjs/path',
1117
],
18+
})
1219

20+
await outro({
21+
dir: import.meta.dir,
22+
startTime,
23+
result,
1324
})
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1-
await Bun.build({
1+
import { intro, outro } from '@stacksjs/build'
2+
3+
const { startTime } = await intro({
4+
dir: import.meta.dir,
5+
})
6+
7+
const result = await Bun.build({
28
entrypoints: [
39
'./src/index.ts',
410
],
511

612
outdir: './dist',
713
format: 'esm',
14+
})
815

16+
await outro({
17+
dir: import.meta.dir,
18+
startTime,
19+
result,
920
})

storage/framework/core/build/build.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
await Bun.build({
1+
import { intro, outro } from '@stacksjs/build'
2+
3+
const { startTime } = await intro({
4+
dir: import.meta.dir,
5+
})
6+
7+
const result = await Bun.build({
28
entrypoints: ['./src/index.ts'],
39
outdir: './dist',
410
format: 'esm',
@@ -7,5 +13,10 @@ await Bun.build({
713
'bun',
814
'@stacksjs/vite',
915
],
16+
})
1017

18+
await outro({
19+
dir: import.meta.dir,
20+
startTime,
21+
result,
1122
})

storage/framework/core/build/src/index.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import process from 'node:process'
22
import { path as p } from '@stacksjs/path'
33
import { fs, glob } from '@stacksjs/storage'
4-
import { bold, dim, log } from '@stacksjs/cli'
4+
import { bold, dim, green, italic, log } from '@stacksjs/cli'
55

66
export {
77
vueComponentExample,
@@ -50,5 +50,16 @@ export async function outro(options: {
5050
console.log(`${bold(dim(`[${sizeStr}]`))} ${dim('dist/')}${relativeFilePath}`)
5151
}
5252

53-
log.success(`${bold(dim(`[${timeTaken}ms]`))} Built ${pkgName}`)
53+
log.success(`${bold(dim(`[${timeTaken}ms]`))} Built ${italic(bold(green(pkgName)))}`)
54+
}
55+
56+
export async function intro(options: {
57+
dir: string
58+
}) {
59+
const pkgName = `@stacksjs/${p.basename(options.dir)}`
60+
61+
log.info(`Building ${italic(pkgName)}...`)
62+
const startTime = Date.now()
63+
64+
return { startTime }
5465
}

storage/framework/core/cache/build.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
await Bun.build({
1+
import { intro, outro } from '@stacksjs/build'
2+
3+
const { startTime } = await intro({
4+
dir: import.meta.dir,
5+
})
6+
7+
const result = await Bun.build({
28
entrypoints: ['./src/index.ts'],
39

410
outdir: './dist',
@@ -9,5 +15,10 @@ await Bun.build({
915
'ioredis',
1016
'@stacksjs/config',
1117
],
18+
})
1219

20+
await outro({
21+
dir: import.meta.dir,
22+
startTime,
23+
result,
1324
})

storage/framework/core/chat/build.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
await Bun.build({
1+
import { intro, outro } from '@stacksjs/build'
2+
3+
const { startTime } = await intro({
4+
dir: import.meta.dir,
5+
})
6+
7+
const result = await Bun.build({
28
entrypoints: ['./src/index.ts'],
39

410
outdir: './dist',
@@ -9,5 +15,10 @@ await Bun.build({
915
'@stacksjs/cli',
1016
'@stacksjs/error-handling',
1117
],
18+
})
1219

20+
await outro({
21+
dir: import.meta.dir,
22+
startTime,
23+
result,
1324
})

storage/framework/core/cli/build.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
await Bun.build({
1+
import { intro, outro } from '@stacksjs/build'
2+
3+
const { startTime } = await intro({
4+
dir: import.meta.dir,
5+
})
6+
7+
const result = await Bun.build({
28
entrypoints: ['./src/index.ts'],
39
outdir: './dist',
410
target: 'bun',
@@ -19,5 +25,10 @@ await Bun.build({
1925
'cac',
2026
'@stacksjs/collections',
2127
],
28+
})
2229

30+
await outro({
31+
dir: import.meta.dir,
32+
startTime,
33+
result,
2334
})

storage/framework/core/cloud/build.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
await Bun.build({
1+
import { intro, outro } from '@stacksjs/build'
2+
3+
const { startTime } = await intro({
4+
dir: import.meta.dir,
5+
})
6+
7+
const result = await Bun.build({
28
entrypoints: ['./src/index.ts'],
39
outdir: './dist',
410
target: 'bun',
@@ -71,8 +77,17 @@ await Bun.build({
7177
})
7278

7379
// Building the edge/origin-request separately
74-
await Bun.build({
80+
const res = await Bun.build({
7581
entrypoints: ['./src/edge/origin-request.ts'],
7682
outdir: './dist',
7783
// Specify any additional options if needed
7884
})
85+
86+
if (!res.success)
87+
throw new Error('Failed to build edge/origin-request')
88+
89+
await outro({
90+
dir: import.meta.dir,
91+
startTime,
92+
result,
93+
})

0 commit comments

Comments
 (0)