galbe 0.10.0 → 0.10.1

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.
@@ -10,6 +10,7 @@ import { Galbe } from '../../src'
10
10
  import { defineRoutes, GalbeProxy } from '../../src/routes'
11
11
  import { BuildConfig } from 'bun'
12
12
  import { existsSync } from 'fs'
13
+ import { softMerge } from '../../src/util'
13
14
 
14
15
  const createBuildIndex = async (indexPath: string, g: Galbe, buildId: string) => {
15
16
  const buildPath = resolve(tmpdir(), buildId)
@@ -61,10 +62,19 @@ export default (cmd: Command) => {
61
62
  .option('-c, --config <file>', 'bun js or ts config file')
62
63
  .action(async (index, props) => {
63
64
  const { out, compile, config } = props
64
-
65
+ const indexPath = resolve(CWD, index)
66
+ const indexDir = dirname(indexPath)
65
67
  const buildID = crypto.randomUUID()
66
68
  const outPath = resolve(CWD, out)
67
69
 
70
+ let galbeConfig = {}
71
+
72
+ if (existsSync(`${indexDir}/galbe.config.ts`)) {
73
+ galbeConfig = (await import(`${indexDir}/galbe.config.ts`)).default
74
+ } else if (existsSync(`${indexDir}/galbe.config.js`)) {
75
+ galbeConfig = (await import(`${indexDir}/galbe.config.js`)).default
76
+ }
77
+
68
78
  Bun.env.GALBE_BUILD = buildID
69
79
  Bun.env.GALBE_BUILD_OUT = outPath
70
80
 
@@ -77,6 +87,8 @@ export default (cmd: Command) => {
77
87
  let g: Galbe = await silentExec(async () => {
78
88
  try {
79
89
  const g = (await import(resolve(CWD, index))).default
90
+ let conf = g.config
91
+ g.config = softMerge(galbeConfig, conf)
80
92
  return g
81
93
  } catch (err) {
82
94
  error = err
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "galbe",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Fast, lightweight and highly customizable JavaScript web framework based on Bun",
5
5
  "author": "Pierre Caillaud M (https://github.com/pierre-cm)",
6
6
  "type": "module",