@spark-ui/cli-utils 2.13.4 → 2.13.6
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 +10 -0
- package/README.md +2 -2
- package/package.json +2 -2
- package/src/generate/templates/component/[README.md].js +2 -2
- package/src/scan/index.mjs +12 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.6](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.13.5...@spark-ui/cli-utils@2.13.6) (2024-06-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @spark-ui/cli-utils
|
|
9
|
+
|
|
10
|
+
## [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)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **cli-utils:** improve log messages ([9623f94](https://github.com/adevinta/spark/commit/9623f9490cda5af0d00bbb10545e3769922cfc63))
|
|
15
|
+
|
|
6
16
|
## [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)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
[](https://sparkui.vercel.app/?path=/docs/utils-cli--docs)
|
|
5
5
|
[](https://sparkui-adv.vercel.app/docs/utils/cli)
|
|
6
|
-
[](https://github.com/adevinta/spark/issues/new?&projects=4&template=bug-report.yml&assignees=&labels=util,
|
|
6
|
+
[](https://github.com/adevinta/spark/issues/new?&projects=4&template=bug-report.yml&assignees=&labels=util,Type:%20Cli)
|
|
7
7
|
[](https://www.npmjs.com/package/@spark-ui/cli-utils)
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
This package is part of the [`@spark-ui`](https://github.com/adevinta/spark) react-js user interface component library project.
|
|
11
11
|
|
|
12
|
-
[](https://github.com/adevinta/spark/issues?q=is%3Aopen+label%3Autil+label%
|
|
12
|
+
[](https://github.com/adevinta/spark/issues?q=is%3Aopen+label%3Autil+label%3A%22Type%3A+CLI%22)
|
|
13
13
|
[](https://github.com/adevinta/spark/blob/main/packages/utils/cli/LICENSE.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-ui/cli-utils",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.6",
|
|
4
4
|
"description": "Spark CLI utils",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/fs-extra": "11.0.4"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "2946e8b9f309ec97412e8f3915124cc702bf7075"
|
|
49
49
|
}
|
|
@@ -8,12 +8,12 @@ export default ({ name }) => `# ${name
|
|
|
8
8
|
.split('-')
|
|
9
9
|
.join('')}--docs)
|
|
10
10
|
[](https://sparkui-adv.vercel.app/docs/components/${name})
|
|
11
|
-
[](https://github.com/adevinta/spark/issues/new?&projects=4&template=bug-report.yml&assignees=&labels=
|
|
11
|
+
[](https://github.com/adevinta/spark/issues/new?&projects=4&template=bug-report.yml&assignees=&labels=Component,Component:%20${name})
|
|
12
12
|
[](https://www.npmjs.com/package/@spark-ui/${name})
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
This package is part of the [\`@spark-ui\`](https://github.com/adevinta/spark) react-js user interface component library project.
|
|
16
16
|
|
|
17
|
-
[](https://github.com/adevinta/spark/issues?q=is%3Aopen+label%3AComponent+label%3A"Component%3A+${name}")
|
|
18
18
|
[](https://github.com/adevinta/spark/blob/main/packages/components/${name}/LICENSE.md)
|
|
19
19
|
`
|
package/src/scan/index.mjs
CHANGED
|
@@ -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/
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
56
|
+
`🎉 Found ${response.importCount - importCount} imports with "${moduleName}" modules across directory ${directoryPath}.`
|
|
55
57
|
)
|
|
56
58
|
} else {
|
|
57
|
-
logger.warn(
|
|
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(
|
|
121
|
+
logger.error(`💥 Error writing file: ${err}`)
|
|
118
122
|
}
|
|
119
123
|
} else {
|
|
120
124
|
logger.info(JSON.stringify(result, null, 2))
|