@stacksjs/build 0.65.0 → 0.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -7
- package/package.json +6 -8
- package/dist/index.js.map +0 -181
- package/src/index.ts +0 -58
- package/src/utils.ts +0 -3
package/src/index.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import process from 'node:process'
|
|
2
|
-
import { bold, dim, green, italic, log } from '@stacksjs/cli'
|
|
3
|
-
import { path as p } from '@stacksjs/path'
|
|
4
|
-
import { fs, glob } from '@stacksjs/storage'
|
|
5
|
-
|
|
6
|
-
export async function outro(options: {
|
|
7
|
-
dir: string
|
|
8
|
-
startTime: number
|
|
9
|
-
result: any
|
|
10
|
-
pkgName?: string
|
|
11
|
-
}): Promise<void> {
|
|
12
|
-
const endTime = Date.now()
|
|
13
|
-
const timeTaken = endTime - options.startTime
|
|
14
|
-
const pkgName = options.pkgName ?? `@stacksjs/${p.basename(options.dir)}`
|
|
15
|
-
|
|
16
|
-
if (!options.result.success) {
|
|
17
|
-
// eslint-disable-next-line no-console
|
|
18
|
-
console.log(options.result.logs[0])
|
|
19
|
-
process.exit(1)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// loop over all the files in the dist directory and log them and their size
|
|
23
|
-
const files = await glob([p.resolve(options.dir, 'dist', '**/*')], { absolute: true })
|
|
24
|
-
for (const file of files) {
|
|
25
|
-
const stats = await fs.stat(file)
|
|
26
|
-
|
|
27
|
-
let sizeStr
|
|
28
|
-
if (stats.size < 1024 * 1024) {
|
|
29
|
-
const sizeInKb = stats.size / 1024
|
|
30
|
-
sizeStr = `${sizeInKb.toFixed(2)}kb`
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
const sizeInMb = stats.size / 1024 / 1024
|
|
34
|
-
sizeStr = `${sizeInMb.toFixed(2)}mb`
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const relativeFilePath = p.relative(options.dir, file).replace('dist/', '')
|
|
38
|
-
// eslint-disable-next-line no-console
|
|
39
|
-
console.log(`${bold(dim(`[${sizeStr}]`))} ${dim('dist/')}${relativeFilePath}`)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// eslint-disable-next-line no-console
|
|
43
|
-
console.log(`${bold(dim(`[${timeTaken}ms]`))} Built ${italic(bold(green(pkgName)))}`)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export async function intro(options: { dir: string, pkgName?: string, styled?: boolean }): Promise<{
|
|
47
|
-
startTime: number
|
|
48
|
-
}> {
|
|
49
|
-
const pkgName = options.pkgName ?? `@stacksjs/${p.basename(options.dir)}`
|
|
50
|
-
|
|
51
|
-
if (options.styled === false) // eslint-disable-next-line no-console
|
|
52
|
-
console.log(`Building ${pkgName}...`)
|
|
53
|
-
else log.info(`Building ${italic(pkgName)}...`)
|
|
54
|
-
|
|
55
|
-
return { startTime: Date.now() }
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export * from './utils'
|
package/src/utils.ts
DELETED