@spark-ui/cli-utils 2.14.0-beta.5 → 2.14.0-beta.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-ui/cli-utils",
3
- "version": "2.14.0-beta.5",
3
+ "version": "2.14.0-beta.7",
4
4
  "description": "Spark CLI utils",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,6 +1,6 @@
1
1
  import * as process from 'node:process'
2
2
 
3
- import { appendFileSync, existsSync, mkdirSync } from 'fs'
3
+ import { existsSync, mkdirSync, writeFileSync } from 'fs'
4
4
  import merge from 'lodash.merge'
5
5
  import path from 'path'
6
6
 
@@ -20,7 +20,7 @@ export async function adoption(options) {
20
20
  adoption: merge(
21
21
  { ...config.adoption },
22
22
  {
23
- ...optionsConfig.adoption,
23
+ ...optionsConfig,
24
24
  imports: optionsConfig.imports || config.imports,
25
25
  extensions: optionsConfig.extensions || config.extensions,
26
26
  }
@@ -114,7 +114,7 @@ export async function adoption(options) {
114
114
  if (!existsSync(dir)) {
115
115
  mkdirSync(dir, { recursive: true })
116
116
  }
117
- appendFileSync(`${path.join(process.cwd(), output)}`, JSON.stringify(result, null, 2))
117
+ writeFileSync(`${path.join(process.cwd(), output)}`, JSON.stringify(result, null, 2))
118
118
  } catch (err) {
119
119
  logger.error(`💥 Error writing file: ${err}`)
120
120
  process.exit(1)
@@ -1,4 +1,7 @@
1
1
  import { existsSync } from 'fs'
2
+ import merge from 'lodash.merge'
3
+
4
+ import * as defaultConfig from './config.mjs'
2
5
 
3
6
  export async function loadConfig(configFileRoute, { logger }) {
4
7
  try {
@@ -6,16 +9,24 @@ export async function loadConfig(configFileRoute, { logger }) {
6
9
  logger.info('ℹ️ Loading spark-ui custom configuration file')
7
10
  const { default: customConfig } = await import(configFileRoute)
8
11
 
9
- return customConfig
12
+ const config = {
13
+ adoption: merge(defaultConfig, {
14
+ ...customConfig.adoption,
15
+ imports: customConfig.imports || defaultConfig.imports,
16
+ extensions: customConfig.extensions || defaultConfig.extensions,
17
+ }),
18
+ }
19
+
20
+ return config
10
21
  } else {
11
22
  logger.warn('⚠️ No custom configuration file found')
12
23
  logger.info('ℹ️ Loading default configuration')
13
24
 
14
- return {}
25
+ return { ...defaultConfig }
15
26
  }
16
27
  } catch (error) {
17
28
  logger.error('💥 Something went wrong loading the custom configuration file')
18
29
 
19
- return {}
30
+ return { ...defaultConfig }
20
31
  }
21
32
  }