@fullstackunicorn/style 1.0.3 → 1.0.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/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.config.js')
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
- console.log(`\nFONT MISSING: ${fontContents.fonts.missingFont.length}\nFONT PLATFORM MISSING: ${fontContents.fonts.missingPlatform.length}\nFONT variants: ${fontContents.fonts.present.length}\nFONT present: ${fontContents.fonts.presentFont.length}\nFONT total: ${parsed.f.length}`)
94
- console.log(`\nCOLORS MISSING: ${colorContents.missing.length}\nCOLORS present: ${colorContents.present.length}\nCOLORS total: ${parsed.c.length}`)
95
- console.log(`\nSTYLES MISSING: ${styleContents.missing.length}\nSTYLES present: ${styleContents.present.length}\nSTYLES total: ${parsed.s.length}\n`)
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, parsed)
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.3",
2
+ "version": "1.0.5",
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.13"
51
+ "@fullstackunicorn/reduce": "^1.0.18"
52
52
  }
53
53
  }
@@ -0,0 +1,148 @@
1
+ import { fss } from '#@/imports/index.js'
2
+ import path from 'path'
3
+
4
+ class Logs {
5
+
6
+ data = null
7
+
8
+ humanDate() {
9
+ return new Date().toLocaleString('en-US', {
10
+ weekday: 'long',
11
+ day: 'numeric',
12
+ month: 'long',
13
+ year: 'numeric',
14
+ hour: '2-digit',
15
+ minute: '2-digit'
16
+ })
17
+ }
18
+
19
+ // fonts = fontContents.fonts
20
+ // colors = colorContents
21
+ // styles = styleContents
22
+ // parsed = { f, c, s }
23
+ prepare(fonts, colors, styles, parsed) {
24
+
25
+ const totals = {
26
+ fonts: parsed?.f?.length || 0,
27
+ colors: parsed?.c?.length || 0,
28
+ styles: parsed?.s?.length || 0
29
+ }
30
+
31
+ this.data = {
32
+ date: this.humanDate(),
33
+
34
+ all: {
35
+ fonts: parsed?.f || [],
36
+ colors: parsed?.c || [],
37
+ styles: parsed?.s || []
38
+ },
39
+
40
+ missing: {
41
+ fonts: fonts.missingFont || [],
42
+ colors: colors.missing || [],
43
+ styles: styles.missing || []
44
+ },
45
+
46
+ present: {
47
+ fonts: fonts.presentFont || [],
48
+ colors: colors.present || [],
49
+ styles: styles.present || []
50
+ },
51
+
52
+ variants: {
53
+ fonts: fonts.present || [] // platform variants
54
+ },
55
+
56
+ totals,
57
+ platformsMissing: (fonts.missingPlatform || []).length
58
+ }
59
+ }
60
+
61
+ toConsole() {
62
+ const d = this.data
63
+
64
+ console.log(`\nFONT MISSING: ${d.missing.fonts.length}`)
65
+ console.log(`FONT PLATFORM MISSING: ${d.platformsMissing}`)
66
+ console.log(`FONT variants: ${d.variants.fonts.length}`)
67
+ console.log(`FONT present: ${d.present.fonts.length}`)
68
+ console.log(`FONT total: ${d.totals.fonts}\n`)
69
+
70
+ console.log(`COLORS MISSING: ${d.missing.colors.length}`)
71
+ console.log(`COLORS present: ${d.present.colors.length}`)
72
+ console.log(`COLORS total: ${d.totals.colors}\n`)
73
+
74
+ console.log(`STYLES MISSING: ${d.missing.styles.length}`)
75
+ console.log(`STYLES present: ${d.present.styles.length}`)
76
+ console.log(`STYLES total: ${d.totals.styles}\n`)
77
+
78
+ console.log(`Missing font: ${d.missing.fonts.length}`)
79
+ console.log(`Missing font platform: ${d.platformsMissing}`)
80
+ console.log(`Colors missing: ${d.missing.colors.length}`)
81
+ console.log(`Styles missing: ${d.missing.styles.length}\n`)
82
+ }
83
+
84
+ markdownList(arr) {
85
+ if (!arr?.length) return '(none)'
86
+ return arr.join('\n')
87
+ }
88
+
89
+ toMarkdown(dirPath) {
90
+
91
+ const folder = dirPath || './.devtools'
92
+ if (!fss.exists(folder)) fss.ensureDir(folder)
93
+
94
+ const d = this.data
95
+ const filePath = path.join(folder, 'style.md')
96
+
97
+ const md = [
98
+ `# ${d.date}
99
+
100
+ ## Missing
101
+
102
+ ### Fonts (${d.missing.fonts.length})
103
+ ${this.markdownList(d.missing.fonts)}
104
+
105
+ ### Colors (${d.missing.colors.length})
106
+ ${this.markdownList(d.missing.colors)}
107
+
108
+ ### Styles (${d.missing.styles.length})
109
+ ${this.markdownList(d.missing.styles)}
110
+
111
+
112
+ ## All
113
+
114
+ ### Fonts (${d.totals.fonts})
115
+ ${this.markdownList(d.all.fonts)}
116
+
117
+ ### Colors (${d.totals.colors})
118
+ ${this.markdownList(d.all.colors)}
119
+
120
+ ### Styles (${d.totals.styles})
121
+ ${this.markdownList(d.all.styles)}
122
+
123
+
124
+ ## Present
125
+
126
+ ### Fonts (${d.present.fonts.length})
127
+ ${this.markdownList(d.present.fonts)}
128
+
129
+ ### Colors (${d.present.colors.length})
130
+ ${this.markdownList(d.present.colors)}
131
+
132
+ ### Styles (${d.present.styles.length})
133
+ ${this.markdownList(d.present.styles)}
134
+
135
+
136
+ ## Variants
137
+
138
+ ### Font variants (${d.variants.fonts.length})
139
+ ${this.markdownList(d.variants.fonts)}
140
+ `
141
+ ].join('')
142
+
143
+ fss.writeText(filePath, md)
144
+ console.log(`See logs in ${filePath}`)
145
+ }
146
+ }
147
+
148
+ export const logs = new Logs()