@spark-ui/cli-utils 2.13.3 → 2.13.5

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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.13.5](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.13.4...@spark-ui/cli-utils@2.13.5) (2024-05-30)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **cli-utils:** improve log messages ([9623f94](https://github.com/adevinta/spark/commit/9623f9490cda5af0d00bbb10545e3769922cfc63))
11
+
12
+ ## [2.13.4](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.13.3...@spark-ui/cli-utils@2.13.4) (2024-05-27)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **cli-utils:** fix binary file indicator ([02af669](https://github.com/adevinta/spark/commit/02af669d5f7a583ee36ba86902c182384460c346))
17
+
6
18
  ## [2.13.3](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.13.2...@spark-ui/cli-utils@2.13.3) (2024-05-27)
7
19
 
8
20
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-ui/cli-utils",
3
- "version": "2.13.3",
3
+ "version": "2.13.5",
4
4
  "description": "Spark CLI utils",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -11,6 +11,7 @@
11
11
  "utility"
12
12
  ],
13
13
  "bin": {
14
+ ".": "./bin/spark.mjs",
14
15
  "spark": "./bin/spark.mjs",
15
16
  "spark-generate": "./bin/spark-generate.mjs",
16
17
  "spark-scan": "./bin/spark-scan.mjs"
@@ -44,5 +45,5 @@
44
45
  "devDependencies": {
45
46
  "@types/fs-extra": "11.0.4"
46
47
  },
47
- "gitHead": "706d373778dceb4a250980636e32d3236f248227"
48
+ "gitHead": "61cb5841afbed5c402995b458c8216385dc1424f"
48
49
  }
@@ -4,8 +4,7 @@ import { appendFileSync, existsSync } from 'fs'
4
4
  import path from 'path'
5
5
 
6
6
  import { scanCallback } from './scanCallback.mjs'
7
- import { logger } from './utils/logger.mjs'
8
- import { scanDirectories } from './utils/scan-directories.mjs'
7
+ import { logger, scanDirectories } from './utils/index.mjs'
9
8
 
10
9
  const DEFAULT_CONFIG = {
11
10
  adoption: {
@@ -23,14 +22,17 @@ export async function adoption(options) {
23
22
  const configFileRoute = path.join(process.cwd(), options.configuration || '.spark-ui.cjs')
24
23
  try {
25
24
  if (existsSync(configFileRoute)) {
26
- console.log('✨✨✨ loading spark-ui custom configuration file ✨✨✨')
25
+ logger.info('ℹ️ Loading spark-ui custom configuration file')
27
26
  const { default: customConfig } = await import(
28
27
  path.join(process.cwd(), options.configuration)
29
28
  )
30
29
  config = structuredClone(customConfig, DEFAULT_CONFIG)
30
+ } else {
31
+ logger.warn('⚠️ No custom configuration file found')
32
+ logger.info('ℹ️ Loading default configuration')
31
33
  }
32
34
  } catch (error) {
33
- logger.info('ℹ️ Loading default configuration')
35
+ logger.error('💥 Something went wrong loading the custom configuration file')
34
36
  }
35
37
 
36
38
  const extensions = config.adoption.extensions
@@ -40,7 +42,7 @@ export async function adoption(options) {
40
42
  let importsUsed = {}
41
43
  let importsCount = {}
42
44
  config.adoption.imports.forEach(moduleName => {
43
- console.log(`scanning adoption for ${moduleName}`)
45
+ logger.info(`ℹ️ Scanning adoption for ${moduleName}`)
44
46
  const directoryPath = path.join(process.cwd(), config.adoption.directory)
45
47
 
46
48
  const response = scanDirectories(directoryPath, moduleName, extensions, scanCallback, {
@@ -51,10 +53,12 @@ export async function adoption(options) {
51
53
  })
52
54
  if (importCount !== response.importCount) {
53
55
  logger.success(
54
- `Found ${response.importCount - importCount} imports with "${moduleName}" modules across directory ${directoryPath}.`
56
+ `🎉 Found ${response.importCount - importCount} imports with "${moduleName}" modules across directory ${directoryPath}.`
55
57
  )
56
58
  } else {
57
- logger.warn(`No files found with "${moduleName}" imports across directory ${directoryPath}.`)
59
+ logger.warn(
60
+ `⚠️ No files found with "${moduleName}" imports across directory ${directoryPath}.`
61
+ )
58
62
  }
59
63
  importCount = response.importCount
60
64
  })
@@ -114,7 +118,7 @@ export async function adoption(options) {
114
118
  try {
115
119
  appendFileSync(`${options.output}`, JSON.stringify(result, null, 2))
116
120
  } catch (err) {
117
- logger.error(`Error writing file: ${err}`)
121
+ logger.error(`💥 Error writing file: ${err}`)
118
122
  }
119
123
  } else {
120
124
  logger.info(JSON.stringify(result, null, 2))