@spark-ui/cli-utils 2.5.3 → 2.6.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.
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.6.1](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.6.0...@spark-ui/cli-utils@2.6.1) (2023-03-14)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @spark-ui/cli-utils
|
|
9
|
+
|
|
10
|
+
# [2.6.0](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.5.3...@spark-ui/cli-utils@2.6.0) (2023-03-14)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **cli-utils:** update setup-themes transformer functions ([5c9a305](https://github.com/adevinta/spark/commit/5c9a3056807758e3178f1ae183b7d5718f06f3b7))
|
|
15
|
+
|
|
6
16
|
## [2.5.3](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.5.2...@spark-ui/cli-utils@2.5.3) (2023-03-13)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @spark-ui/cli-utils
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The documentation for this package is located within our Storybook at https://sparkui.vercel.app/?path=/docs/utils-cli--docs.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-ui/cli-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Spark CLI utils",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@clack/prompts": "0.6.2",
|
|
16
|
-
"@spark-ui/theme-utils": "^2.
|
|
16
|
+
"@spark-ui/theme-utils": "^2.8.0",
|
|
17
17
|
"camel-case": "4.1.2",
|
|
18
18
|
"chalk": "5.2.0",
|
|
19
19
|
"commander": "10.0.0",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"url": "git@github.com:adevinta/spark.git",
|
|
30
30
|
"directory": "packages/utils/cli"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "e6b95c3341e063481dbdec5c78b3b08a618c9fa1"
|
|
33
33
|
}
|
|
@@ -7,6 +7,7 @@ import { DEFAULT_KEY, defaultColors, tailwindKeys } from './constants.js'
|
|
|
7
7
|
import {
|
|
8
8
|
doubleHyphensRegex,
|
|
9
9
|
hasNumber,
|
|
10
|
+
isAlphanumericWithLeadingLetter,
|
|
10
11
|
isCamelCase,
|
|
11
12
|
isHex,
|
|
12
13
|
isObject,
|
|
@@ -19,6 +20,7 @@ function toTailwindConfig(_theme) {
|
|
|
19
20
|
|
|
20
21
|
const { fontSize, colors, screens } = tailwindKeys
|
|
21
22
|
|
|
23
|
+
/* eslint-disable complexity */
|
|
22
24
|
function traverse(theme, paths = []) {
|
|
23
25
|
Object.entries(theme).forEach(([key, value]) => {
|
|
24
26
|
// 👀 see: https://tailwindcss.com/docs/font-size#providing-a-default-line-height
|
|
@@ -92,7 +94,13 @@ function toTailwindConfig(_theme) {
|
|
|
92
94
|
return `var(--${paths.join('-')}-${key.toLowerCase()})`
|
|
93
95
|
})()
|
|
94
96
|
|
|
95
|
-
|
|
97
|
+
const formattedKey = isAlphanumericWithLeadingLetter(key) ? toKebabCase(key) : key
|
|
98
|
+
|
|
99
|
+
if (formattedKey !== key) {
|
|
100
|
+
delete theme[key]
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
theme[formattedKey] = isScreenValue
|
|
96
104
|
? formattedValue
|
|
97
105
|
: toKebabCase(formattedValue).replace(doubleHyphensRegex, '-')
|
|
98
106
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
function toKebabCase(v) {
|
|
2
|
-
return v.replace(/[A-
|
|
2
|
+
return v.replace(/[A-Z]+(?=[a-z0-9])|\d+/g, match => '-' + match.toLowerCase())
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function isAlphanumericWithLeadingLetter(v) {
|
|
6
|
+
return /^[a-zA-Z](?=.*\d)[a-zA-Z\d]*$/.test(v)
|
|
3
7
|
}
|
|
4
8
|
|
|
5
9
|
function isHex(value) {
|
|
@@ -43,6 +47,7 @@ export {
|
|
|
43
47
|
isStringOrNumber,
|
|
44
48
|
isObject,
|
|
45
49
|
isCamelCase,
|
|
50
|
+
isAlphanumericWithLeadingLetter,
|
|
46
51
|
hasNumber,
|
|
47
52
|
getRemEquivalentValue,
|
|
48
53
|
doubleHyphensRegex,
|