@stacksjs/build 0.64.5 → 0.65.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.d.ts +12 -0
- package/dist/index.js +10 -10
- package/dist/index.js.map +62 -67
- package/dist/utils.d.ts +3 -0
- package/package.json +10 -16
- package/src/index.ts +15 -8
- package/src/utils.ts +1 -1
package/dist/utils.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/build",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.65.0",
|
|
5
5
|
"description": "The Stacks framework build tools and configurations.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
|
+
"contributors": ["Chris Breuer <chris@stacksjs.org>"],
|
|
7
8
|
"license": "MIT",
|
|
8
9
|
"funding": "https://github.com/sponsors/chrisbbreuer",
|
|
9
10
|
"homepage": "https://github.com/stacksjs/stacks/tree/main/storage/framework/core/build#readme",
|
|
@@ -37,28 +38,21 @@
|
|
|
37
38
|
},
|
|
38
39
|
"module": "dist/index.js",
|
|
39
40
|
"types": "dist/index.d.ts",
|
|
40
|
-
"
|
|
41
|
-
"Chris Breuer <chris@stacksjs.org>"
|
|
42
|
-
],
|
|
43
|
-
"files": [
|
|
44
|
-
"README.md",
|
|
45
|
-
"dist",
|
|
46
|
-
"src"
|
|
47
|
-
],
|
|
41
|
+
"files": ["README.md", "dist", "src"],
|
|
48
42
|
"scripts": {
|
|
49
|
-
"build": "bun
|
|
50
|
-
"typecheck": "bun
|
|
43
|
+
"build": "bun build.ts",
|
|
44
|
+
"typecheck": "bun tsc --noEmit",
|
|
51
45
|
"prepublishOnly": "bun run build"
|
|
52
46
|
},
|
|
53
47
|
"dependencies": {
|
|
54
|
-
"@stacksjs/cli": "
|
|
55
|
-
"@stacksjs/path": "
|
|
56
|
-
"@stacksjs/storage": "
|
|
57
|
-
"bun-plugin-dts-auto": "^0.
|
|
48
|
+
"@stacksjs/cli": "0.64.6",
|
|
49
|
+
"@stacksjs/path": "0.64.6",
|
|
50
|
+
"@stacksjs/storage": "0.64.6",
|
|
51
|
+
"bun-plugin-dts-auto": "^0.20.6",
|
|
58
52
|
"vue-docgen-web-types": "^0.1.8"
|
|
59
53
|
},
|
|
60
54
|
"devDependencies": {
|
|
61
|
-
"@stacksjs/development": "
|
|
55
|
+
"@stacksjs/development": "0.64.6",
|
|
62
56
|
"@types/babel__generator": "^7.6.8",
|
|
63
57
|
"@types/babel__traverse": "^7.20.6"
|
|
64
58
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import { bold, dim, green, italic } from '@stacksjs/cli'
|
|
2
|
+
import { bold, dim, green, italic, log } from '@stacksjs/cli'
|
|
3
3
|
import { path as p } from '@stacksjs/path'
|
|
4
4
|
import { fs, glob } from '@stacksjs/storage'
|
|
5
5
|
|
|
@@ -8,18 +8,19 @@ export async function outro(options: {
|
|
|
8
8
|
startTime: number
|
|
9
9
|
result: any
|
|
10
10
|
pkgName?: string
|
|
11
|
-
}) {
|
|
11
|
+
}): Promise<void> {
|
|
12
12
|
const endTime = Date.now()
|
|
13
13
|
const timeTaken = endTime - options.startTime
|
|
14
14
|
const pkgName = options.pkgName ?? `@stacksjs/${p.basename(options.dir)}`
|
|
15
15
|
|
|
16
16
|
if (!options.result.success) {
|
|
17
|
+
// eslint-disable-next-line no-console
|
|
17
18
|
console.log(options.result.logs[0])
|
|
18
19
|
process.exit(1)
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
// loop over all the files in the dist directory and log them and their size
|
|
22
|
-
const files = await glob(p.resolve(options.dir, 'dist', '**/*'))
|
|
23
|
+
const files = await glob([p.resolve(options.dir, 'dist', '**/*')], { absolute: true })
|
|
23
24
|
for (const file of files) {
|
|
24
25
|
const stats = await fs.stat(file)
|
|
25
26
|
|
|
@@ -27,25 +28,31 @@ export async function outro(options: {
|
|
|
27
28
|
if (stats.size < 1024 * 1024) {
|
|
28
29
|
const sizeInKb = stats.size / 1024
|
|
29
30
|
sizeStr = `${sizeInKb.toFixed(2)}kb`
|
|
30
|
-
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
31
33
|
const sizeInMb = stats.size / 1024 / 1024
|
|
32
34
|
sizeStr = `${sizeInMb.toFixed(2)}mb`
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
const relativeFilePath = p.relative(options.dir, file).replace('dist/', '')
|
|
38
|
+
// eslint-disable-next-line no-console
|
|
36
39
|
console.log(`${bold(dim(`[${sizeStr}]`))} ${dim('dist/')}${relativeFilePath}`)
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
// eslint-disable-next-line no-console
|
|
39
43
|
console.log(`${bold(dim(`[${timeTaken}ms]`))} Built ${italic(bold(green(pkgName)))}`)
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
export async function intro(options: { dir: string
|
|
46
|
+
export async function intro(options: { dir: string, pkgName?: string, styled?: boolean }): Promise<{
|
|
47
|
+
startTime: number
|
|
48
|
+
}> {
|
|
43
49
|
const pkgName = options.pkgName ?? `@stacksjs/${p.basename(options.dir)}`
|
|
44
50
|
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
if (options.styled === false) // eslint-disable-next-line no-console
|
|
52
|
+
console.log(`Building ${pkgName}...`)
|
|
53
|
+
else log.info(`Building ${italic(pkgName)}...`)
|
|
47
54
|
|
|
48
|
-
return { startTime }
|
|
55
|
+
return { startTime: Date.now() }
|
|
49
56
|
}
|
|
50
57
|
|
|
51
58
|
export * from './utils'
|
package/src/utils.ts
CHANGED