@fullstackunicorn/style 1.0.3 → 1.0.4
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/commands.js +1 -1
- package/index.js +4 -28
- package/package.json +2 -2
- package/sources/logs.js +127 -0
package/commands.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { fss, path} from '#@/dependencies.js'
|
|
3
3
|
import { run } from '#@/index.js'
|
|
4
4
|
|
|
5
|
-
const configPath = path.resolve(process.cwd(), 'style.
|
|
5
|
+
const configPath = path.resolve(process.cwd(), 'config.style.js')
|
|
6
6
|
|
|
7
7
|
if (!fss.exists(configPath)) {
|
|
8
8
|
console.error(`❌ Missing style.config.js in: ${cwd}`)
|
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { style } from '#@/sources/style.js'
|
|
|
5
5
|
import { color } from '#@/sources/color.js'
|
|
6
6
|
import { font } from '#@/sources/font.js'
|
|
7
7
|
import { files } from '#@/sources/files.js'
|
|
8
|
+
import { logs } from '#@/sources/logs.js'
|
|
8
9
|
|
|
9
10
|
export const run = async (setup) => {
|
|
10
11
|
|
|
@@ -37,27 +38,14 @@ export const run = async (setup) => {
|
|
|
37
38
|
|
|
38
39
|
const parsed = await parse.project()
|
|
39
40
|
|
|
40
|
-
// const styleList = style.getList(test.allStyles)
|
|
41
|
-
// const colorList = color.getList(test.allColors)
|
|
42
|
-
// const fontList = font.getList(test.allFonts)
|
|
43
|
-
|
|
44
41
|
const fontList = parsed.f
|
|
45
42
|
const styleList = style.getList(parsed.s)
|
|
46
43
|
const colorList = color.getList(parsed.c)
|
|
47
44
|
const colors = color.getColors(staticHues, setup.hues, grey, whole)
|
|
48
45
|
|
|
49
46
|
const fontContents = font.getContents(fontList, setup.fontFamily, isWeb, isNative)
|
|
50
|
-
console.log(`Fonts: ${parsed.f.length}\n\n${parsed.f.join('\t')}\n\n`)
|
|
51
|
-
console.log(`Fonts present: ${fontContents.fonts.presentFont.length}\n\n${fontContents.fonts.presentFont.join('\t')}\n`)
|
|
52
|
-
console.log(`Fonts variants present: ${fontContents.fonts.present.length}\n\n${fontContents.fonts.present.join('\t')}\n`)
|
|
53
|
-
|
|
54
47
|
const colorContents = color.getContents(colorList, colors, whole, types, isWeb, isNative, isMono)
|
|
55
|
-
console.log(`Colors: ${parsed.c.length}\n\n${parsed.c.join('\t')}\n\n`)
|
|
56
|
-
console.log(`Colors present: ${colorContents.present.length}\n\n${colorContents.present.join('\t')}\n`)
|
|
57
|
-
|
|
58
48
|
const styleContents = style.getContents(styleList, setup, isWeb, isNative)
|
|
59
|
-
console.log(`Styles: ${parsed.s.length}\n\n${parsed.s.join('\t')}\n\n`)
|
|
60
|
-
console.log(`Styles present: ${styleContents.present.length}\n\n${styleContents.present.join('\t')}\n`)
|
|
61
49
|
|
|
62
50
|
if (isWeb) {
|
|
63
51
|
|
|
@@ -90,19 +78,7 @@ export const run = async (setup) => {
|
|
|
90
78
|
files.writeUse(isWeb, isNative, defaultSass, defaultHtmlSass)
|
|
91
79
|
files.writeFonts(fontContents.alphabets, fontContents.names)
|
|
92
80
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (fontContents.fonts.missingFont.length) console.log(`Font missing: ${fontContents.fonts.missingFont.length}\n${fontContents.fonts.missingFont.join('\t')}\n`)
|
|
98
|
-
if (fontContents.fonts.missingPlatform.length) console.log(`Font Platform missing: ${fontContents.fonts.missingPlatform.length}\n${fontContents.fonts.missingPlatform.join('\t')}\n`)
|
|
99
|
-
if (colorContents.missing.length) console.log(`Colors missing: ${colorContents.missing.length}\n${colorContents.missing.join('\t')}\n`)
|
|
100
|
-
if (styleContents.missing.length) console.log(`Styles missing: ${styleContents.missing.length}\n${styleContents.missing.join('\t')}\n`)
|
|
101
|
-
|
|
102
|
-
console.log(`Missing font: ${fontContents.fonts.missingFont.length}`)
|
|
103
|
-
console.log(`Missing font platform: ${fontContents.fonts.missingPlatform.length}`)
|
|
104
|
-
console.log(`Colors missing: ${colorContents.missing.length}`)
|
|
105
|
-
console.log(`Styles missing: ${styleContents.missing.length}`)
|
|
106
|
-
console.log(``)
|
|
107
|
-
|
|
81
|
+
logs.prepare( fontContents.fonts, colorContents, styleContents)
|
|
82
|
+
logs.toConsole()
|
|
83
|
+
logs.toMarkdown(setup.LOGS_PATH)
|
|
108
84
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.4",
|
|
3
3
|
"name": "@fullstackunicorn/style",
|
|
4
4
|
"author": "lucanigido (https://fullstackunicorn.dev/author/lucanigido)",
|
|
5
5
|
"description": "A development utility for generating responsive web and native styles (CSS, SCSS, JS, RN) from a declarative style.config.js file.",
|
|
@@ -48,6 +48,6 @@
|
|
|
48
48
|
"sass": "^1.94.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@fullstackunicorn/reduce": "^1.0.
|
|
51
|
+
"@fullstackunicorn/reduce": "^1.0.18"
|
|
52
52
|
}
|
|
53
53
|
}
|
package/sources/logs.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { fss, path } from '#@/dependencies.js'
|
|
2
|
+
|
|
3
|
+
class Logs {
|
|
4
|
+
|
|
5
|
+
data = null
|
|
6
|
+
|
|
7
|
+
humanDate() {
|
|
8
|
+
return new Date().toLocaleString('en-US', {
|
|
9
|
+
weekday: 'long',
|
|
10
|
+
day: 'numeric',
|
|
11
|
+
month: 'long',
|
|
12
|
+
year: 'numeric',
|
|
13
|
+
hour: '2-digit',
|
|
14
|
+
minute: '2-digit'
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
prepare(fonts, colors, styles) {
|
|
19
|
+
this.data = {
|
|
20
|
+
date: this.humanDate(),
|
|
21
|
+
|
|
22
|
+
missing: {
|
|
23
|
+
fonts: fonts.missingFont || [],
|
|
24
|
+
colors: colors.missing || [],
|
|
25
|
+
styles: styles.missing || []
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
present: {
|
|
29
|
+
fonts: fonts.presentFont || [],
|
|
30
|
+
colors: colors.present || [],
|
|
31
|
+
styles: styles.present || []
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
variants: {
|
|
35
|
+
fonts: fonts.present || [] // platform variants
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
totals: {
|
|
39
|
+
fonts: fonts.total || 0,
|
|
40
|
+
colors: colors.total || 0,
|
|
41
|
+
styles: styles.total || 0
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
platformsMissing: fonts.missingPlatform || 0
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
toConsole() {
|
|
49
|
+
const d = this.data
|
|
50
|
+
|
|
51
|
+
console.log("")
|
|
52
|
+
console.log("FONT MISSING:", d.missing.fonts.length)
|
|
53
|
+
console.log("FONT PLATFORM MISSING:", d.platformsMissing)
|
|
54
|
+
console.log("FONT variants:", d.variants.fonts.length)
|
|
55
|
+
console.log("FONT present:", d.present.fonts.length)
|
|
56
|
+
console.log("FONT total:", d.totals.fonts)
|
|
57
|
+
console.log("")
|
|
58
|
+
|
|
59
|
+
console.log("COLORS MISSING:", d.missing.colors.length)
|
|
60
|
+
console.log("COLORS present:", d.present.colors.length)
|
|
61
|
+
console.log("COLORS total:", d.totals.colors)
|
|
62
|
+
console.log("")
|
|
63
|
+
|
|
64
|
+
console.log("STYLES MISSING:", d.missing.styles.length)
|
|
65
|
+
console.log("STYLES present:", d.present.styles.length)
|
|
66
|
+
console.log("STYLES total:", d.totals.styles)
|
|
67
|
+
console.log("")
|
|
68
|
+
|
|
69
|
+
console.log("Missing font:", d.missing.fonts.length)
|
|
70
|
+
console.log("Missing font platform:", d.platformsMissing)
|
|
71
|
+
console.log("Colors missing:", d.missing.colors.length)
|
|
72
|
+
console.log("Styles missing:", d.missing.styles.length)
|
|
73
|
+
console.log("")
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
markdownList(arr) {
|
|
77
|
+
if (!arr?.length) return "(none)"
|
|
78
|
+
return arr.join('\n')
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
toMarkdown(dirPath) {
|
|
82
|
+
const folder = dirPath || './.devtools'
|
|
83
|
+
if (!fss.exists(folder)) fss.ensureDir(folder)
|
|
84
|
+
|
|
85
|
+
const d = this.data
|
|
86
|
+
const filePath = path.join(folder, 'style.md')
|
|
87
|
+
|
|
88
|
+
const md = [
|
|
89
|
+
`# ${d.date}
|
|
90
|
+
|
|
91
|
+
## Missing
|
|
92
|
+
|
|
93
|
+
### Fonts (${d.missing.fonts.length})
|
|
94
|
+
${this.markdownList(d.missing.fonts)}
|
|
95
|
+
|
|
96
|
+
### Colors (${d.missing.colors.length})
|
|
97
|
+
${this.markdownList(d.missing.colors)}
|
|
98
|
+
|
|
99
|
+
### Styles (${d.missing.styles.length})
|
|
100
|
+
${this.markdownList(d.missing.styles)}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
## Present
|
|
104
|
+
|
|
105
|
+
### Fonts (${d.present.fonts.length})
|
|
106
|
+
${this.markdownList(d.present.fonts)}
|
|
107
|
+
|
|
108
|
+
### Colors (${d.present.colors.length})
|
|
109
|
+
${this.markdownList(d.present.colors)}
|
|
110
|
+
|
|
111
|
+
### Styles (${d.present.styles.length})
|
|
112
|
+
${this.markdownList(d.present.styles)}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
## Variants
|
|
116
|
+
|
|
117
|
+
### Font variants (${d.variants.fonts.length})
|
|
118
|
+
${this.markdownList(d.variants.fonts)}
|
|
119
|
+
`
|
|
120
|
+
].join('')
|
|
121
|
+
|
|
122
|
+
fss.writeText(filePath, md)
|
|
123
|
+
console.log(`See logs in ${filePath}`)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export const logs = new Logs()
|