@quasar/icongenie 3.1.1 → 5.0.0
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/README.md +7 -1
- package/bin/icongenie.js +22 -22
- package/lib/cmd/generate.js +36 -41
- package/lib/cmd/help.js +1 -1
- package/lib/cmd/profile.js +34 -38
- package/lib/cmd/verify.js +18 -17
- package/lib/generators/icns.js +7 -3
- package/lib/generators/ico.js +7 -3
- package/lib/generators/index.js +0 -1
- package/lib/generators/png.js +7 -6
- package/lib/generators/splashscreen.js +6 -12
- package/lib/generators/svg.js +3 -4
- package/lib/modes/index.js +1 -8
- package/lib/modes/{quasar-app-v2 → v2}/bex.js +1 -2
- package/lib/modes/{quasar-app-v1 → v2}/capacitor.js +28 -35
- package/lib/modes/{quasar-app-v1 → v2}/cordova.js +40 -47
- package/lib/modes/v2/electron.js +32 -0
- package/lib/modes/{quasar-app-v1 → v2}/index.js +0 -1
- package/lib/modes/v2/pwa.js +71 -0
- package/lib/modes/{quasar-app-v2 → v2}/spa.js +1 -2
- package/lib/modes/{quasar-app-v1 → v2}/ssr.js +1 -2
- package/lib/mount/index.js +4 -7
- package/lib/mount/mount-cordova.js +71 -63
- package/lib/mount/mount-tag.js +3 -6
- package/lib/runner/generate.js +57 -55
- package/lib/runner/profile.js +18 -26
- package/lib/runner/verify.js +29 -27
- package/lib/utils/app-paths.js +8 -9
- package/lib/utils/default-params.js +0 -1
- package/lib/utils/filter-argv-params.js +3 -4
- package/lib/utils/get-argv.js +47 -0
- package/lib/utils/get-assets-files.js +9 -12
- package/lib/utils/get-compression.js +31 -19
- package/lib/utils/get-file-size.js +5 -6
- package/lib/utils/get-files-options.js +18 -21
- package/lib/utils/get-png-size.js +7 -11
- package/lib/utils/get-profile-content.js +3 -7
- package/lib/utils/get-profile-files.js +10 -13
- package/lib/utils/get-square-icon.js +5 -4
- package/lib/utils/logger.js +6 -7
- package/lib/utils/merge-objects.js +5 -6
- package/lib/utils/node-version-check.js +11 -11
- package/lib/utils/package-json.js +1 -5
- package/lib/utils/parse-argv.js +63 -74
- package/lib/utils/spawn-sync.js +10 -10
- package/lib/utils/validate-profile-object.js +34 -27
- package/package.json +48 -50
- package/samples/icongenie-profile.json +9 -17
- package/.editorconfig +0 -13
- package/.eslintignore +0 -1
- package/.eslintrc.cjs +0 -50
- package/lib/modes/quasar-app-v1/bex.js +0 -9
- package/lib/modes/quasar-app-v1/electron.js +0 -24
- package/lib/modes/quasar-app-v1/pwa.js +0 -74
- package/lib/modes/quasar-app-v1/spa.js +0 -17
- package/lib/modes/quasar-app-v2/capacitor.js +0 -155
- package/lib/modes/quasar-app-v2/cordova.js +0 -159
- package/lib/modes/quasar-app-v2/electron.js +0 -24
- package/lib/modes/quasar-app-v2/index.js +0 -45
- package/lib/modes/quasar-app-v2/pwa.js +0 -74
- package/lib/modes/quasar-app-v2/ssr.js +0 -4
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
// version-check
|
|
2
2
|
|
|
3
3
|
const version = process.version.split('.')
|
|
4
|
-
const major = parseInt(version[
|
|
5
|
-
const minor = parseInt(version[
|
|
6
|
-
const patch = parseInt(version[
|
|
4
|
+
const major = Number.parseInt(version[0].replaceAll(/\D/g, ''), 10)
|
|
5
|
+
const minor = Number.parseInt(version[1].replaceAll(/\D/g, ''), 10)
|
|
6
|
+
const patch = Number.parseInt(version[2].replaceAll(/\D/g, ''), 10)
|
|
7
7
|
|
|
8
8
|
const min = {
|
|
9
|
-
major:
|
|
10
|
-
minor:
|
|
9
|
+
major: 22,
|
|
10
|
+
minor: 22,
|
|
11
11
|
patch: 0
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
if (
|
|
15
|
-
major < min.major ||
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
)
|
|
19
|
-
)
|
|
15
|
+
major < min.major ||
|
|
16
|
+
(major === min.major &&
|
|
17
|
+
(minor < min.minor || (minor === min.minor && patch < min.patch)))
|
|
20
18
|
) {
|
|
21
19
|
console.error()
|
|
22
20
|
console.error('--------------------------------------------------------')
|
|
23
21
|
console.error(' INCOMPATIBLE NODE VERSION')
|
|
24
|
-
console.error(
|
|
22
|
+
console.error(
|
|
23
|
+
` @quasar/icongenie requires Node ${min.major}.${min.minor}.${min.patch} or superior`
|
|
24
|
+
)
|
|
25
25
|
console.error()
|
|
26
26
|
console.error(' You are running Node ' + process.version)
|
|
27
27
|
console.error(' Please install a compatible Node version and try again')
|
package/lib/utils/parse-argv.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
1
|
import { existsSync, lstatSync } from 'node:fs'
|
|
3
|
-
import {
|
|
4
|
-
import { fileURLToPath } from 'node:url'
|
|
2
|
+
import { isAbsolute, join, normalize, resolve } from 'node:path'
|
|
5
3
|
import untildify from 'untildify'
|
|
6
4
|
|
|
7
5
|
import { getPngSize } from './get-png-size.js'
|
|
@@ -13,16 +11,14 @@ import { modes } from '../modes/index.js'
|
|
|
13
11
|
|
|
14
12
|
const modesList = Object.keys(modes)
|
|
15
13
|
|
|
16
|
-
function die
|
|
14
|
+
function die(msg) {
|
|
17
15
|
warn(msg)
|
|
18
16
|
warn()
|
|
19
17
|
process.exit(1)
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
function profile
|
|
23
|
-
if (!value)
|
|
24
|
-
return
|
|
25
|
-
}
|
|
20
|
+
function profile(value, argv) {
|
|
21
|
+
if (!value) return
|
|
26
22
|
|
|
27
23
|
const profilePath = resolve(process.cwd(), untildify(value))
|
|
28
24
|
|
|
@@ -30,17 +26,14 @@ function profile (value, argv) {
|
|
|
30
26
|
die(`Profile param does not point to a file or folder that exists!`)
|
|
31
27
|
}
|
|
32
28
|
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
&& !lstatSync(profilePath).isDirectory()
|
|
36
|
-
) {
|
|
37
|
-
die(`Specified profile (${ value }) is not a .json file`)
|
|
29
|
+
if (!value.endsWith('.json') && !lstatSync(profilePath).isDirectory()) {
|
|
30
|
+
die(`Specified profile (${value}) is not a .json file`)
|
|
38
31
|
}
|
|
39
32
|
|
|
40
33
|
argv.profile = profilePath
|
|
41
34
|
}
|
|
42
35
|
|
|
43
|
-
function mode
|
|
36
|
+
function mode(value, argv) {
|
|
44
37
|
if (!value) {
|
|
45
38
|
argv.mode = modesList
|
|
46
39
|
return
|
|
@@ -53,67 +46,66 @@ function mode (value, argv) {
|
|
|
53
46
|
return
|
|
54
47
|
}
|
|
55
48
|
|
|
56
|
-
if (list.some(
|
|
57
|
-
die(`Invalid mode requested: "${
|
|
49
|
+
if (list.some(item => !modesList.includes(item))) {
|
|
50
|
+
die(`Invalid mode requested: "${value}"`)
|
|
58
51
|
}
|
|
59
52
|
|
|
60
53
|
argv.mode = list
|
|
61
54
|
}
|
|
62
55
|
|
|
63
|
-
function include
|
|
64
|
-
if (!value)
|
|
65
|
-
return
|
|
66
|
-
}
|
|
56
|
+
function include(value, argv) {
|
|
57
|
+
if (!value) return
|
|
67
58
|
|
|
68
59
|
if (value.includes('all')) {
|
|
69
60
|
argv.include = modesList
|
|
70
61
|
return
|
|
71
62
|
}
|
|
72
63
|
|
|
73
|
-
if (value.some(
|
|
74
|
-
die(`Invalid include requested: "${
|
|
64
|
+
if (value.some(item => !modesList.includes(item))) {
|
|
65
|
+
die(`Invalid include requested: "${value}"`)
|
|
75
66
|
}
|
|
76
67
|
}
|
|
77
68
|
|
|
78
|
-
function quality
|
|
69
|
+
function quality(value, argv) {
|
|
79
70
|
if (!value) {
|
|
80
71
|
argv.quality = defaultParams.quality
|
|
81
72
|
return
|
|
82
73
|
}
|
|
83
74
|
|
|
84
|
-
const numeric = parseInt(value, 10)
|
|
75
|
+
const numeric = Number.parseInt(value, 10)
|
|
85
76
|
|
|
86
|
-
if (isNaN(numeric)) {
|
|
77
|
+
if (Number.isNaN(numeric)) {
|
|
87
78
|
die(`Invalid quality level number specified`)
|
|
88
79
|
}
|
|
89
80
|
if (numeric < 1 || numeric > 12) {
|
|
90
|
-
die(`Invalid quality level specified (${
|
|
81
|
+
die(`Invalid quality level specified (${value}) - should be between 1 - 12`)
|
|
91
82
|
}
|
|
92
83
|
|
|
93
84
|
argv.quality = numeric
|
|
94
85
|
}
|
|
95
86
|
|
|
96
|
-
function filter
|
|
87
|
+
function filter(value) {
|
|
97
88
|
if (value && !Object.keys(generators).includes(value)) {
|
|
98
|
-
die(`Unknown filter value specified (${
|
|
89
|
+
die(`Unknown filter value specified (${value}); there is no such generator`)
|
|
99
90
|
}
|
|
100
91
|
}
|
|
101
92
|
|
|
102
|
-
function padding
|
|
93
|
+
function padding(value, argv) {
|
|
103
94
|
if (!value) {
|
|
104
|
-
argv.padding = [
|
|
95
|
+
argv.padding = [0, 0]
|
|
105
96
|
return
|
|
106
97
|
}
|
|
107
98
|
|
|
108
|
-
const sizes = (Array.isArray(value) ? value : value.split(','))
|
|
109
|
-
.
|
|
99
|
+
const sizes = (Array.isArray(value) ? value : value.split(',')).map(val =>
|
|
100
|
+
Number.parseInt(val, 10)
|
|
101
|
+
)
|
|
110
102
|
|
|
111
103
|
if (sizes.length > 2) {
|
|
112
104
|
die(`Invalid padding specified`)
|
|
113
105
|
}
|
|
114
106
|
|
|
115
107
|
sizes.forEach(size => {
|
|
116
|
-
if (isNaN(size)) {
|
|
108
|
+
if (Number.isNaN(size)) {
|
|
117
109
|
die(`Invalid padding specified (not numbers)`)
|
|
118
110
|
}
|
|
119
111
|
if (size < 0) {
|
|
@@ -121,38 +113,32 @@ function padding (value, argv) {
|
|
|
121
113
|
}
|
|
122
114
|
})
|
|
123
115
|
|
|
124
|
-
argv.padding = sizes.length === 1
|
|
125
|
-
? [ sizes[ 0 ], sizes[ 0 ] ]
|
|
126
|
-
: sizes
|
|
116
|
+
argv.padding = sizes.length === 1 ? [sizes[0], sizes[0]] : sizes
|
|
127
117
|
}
|
|
128
118
|
|
|
129
|
-
function parseIconPath
|
|
119
|
+
function parseIconPath(value) {
|
|
130
120
|
const __path = untildify(value)
|
|
131
121
|
|
|
132
122
|
if (isAbsolute(__path)) {
|
|
133
|
-
return existsSync(__path)
|
|
134
|
-
? __path
|
|
135
|
-
: null
|
|
123
|
+
return existsSync(__path) ? __path : null
|
|
136
124
|
}
|
|
137
125
|
|
|
138
|
-
let
|
|
126
|
+
let localIcon = resolve(process.cwd(), __path)
|
|
139
127
|
|
|
140
|
-
if (existsSync(
|
|
141
|
-
return
|
|
128
|
+
if (existsSync(localIcon)) {
|
|
129
|
+
return localIcon
|
|
142
130
|
}
|
|
143
131
|
|
|
144
|
-
|
|
132
|
+
localIcon = resolve(appDir, __path)
|
|
145
133
|
|
|
146
|
-
return existsSync(
|
|
134
|
+
return existsSync(localIcon) ? localIcon : null
|
|
147
135
|
}
|
|
148
136
|
|
|
149
|
-
function icon
|
|
137
|
+
function icon(value, argv) {
|
|
150
138
|
if (!value) {
|
|
151
139
|
warn(`No source icon file specified, so using the sample one`)
|
|
152
140
|
argv.icon = normalize(
|
|
153
|
-
|
|
154
|
-
new URL('../../samples/icongenie-icon.png', import.meta.url)
|
|
155
|
-
)
|
|
141
|
+
join(import.meta.dirname, '../../samples/icongenie-icon.png')
|
|
156
142
|
)
|
|
157
143
|
return
|
|
158
144
|
}
|
|
@@ -160,7 +146,7 @@ function icon (value, argv) {
|
|
|
160
146
|
argv.icon = parseIconPath(value)
|
|
161
147
|
|
|
162
148
|
if (!argv.icon) {
|
|
163
|
-
die(`Path to source icon file does not exists: "${
|
|
149
|
+
die(`Path to source icon file does not exists: "${value}"`)
|
|
164
150
|
}
|
|
165
151
|
|
|
166
152
|
const { width, height } = getPngSize(argv.icon)
|
|
@@ -174,15 +160,13 @@ function icon (value, argv) {
|
|
|
174
160
|
}
|
|
175
161
|
}
|
|
176
162
|
|
|
177
|
-
function background
|
|
178
|
-
if (!value)
|
|
179
|
-
return
|
|
180
|
-
}
|
|
163
|
+
function background(value, argv) {
|
|
164
|
+
if (!value) return
|
|
181
165
|
|
|
182
166
|
argv.background = resolve(appDir, untildify(value))
|
|
183
167
|
|
|
184
168
|
if (!existsSync(argv.background)) {
|
|
185
|
-
die(`Path to background source file does not exists: "${
|
|
169
|
+
die(`Path to background source file does not exists: "${value}"`)
|
|
186
170
|
}
|
|
187
171
|
|
|
188
172
|
const { width, height } = getPngSize(argv.background)
|
|
@@ -196,49 +180,51 @@ function background (value, argv) {
|
|
|
196
180
|
}
|
|
197
181
|
}
|
|
198
182
|
|
|
199
|
-
function getColorParser
|
|
183
|
+
function getColorParser(name, defaultValue) {
|
|
200
184
|
return (value, argv) => {
|
|
201
185
|
if (!value) {
|
|
202
|
-
argv[
|
|
186
|
+
argv[name] = argv.themeColor || defaultValue
|
|
203
187
|
return
|
|
204
188
|
}
|
|
205
189
|
|
|
206
190
|
if (
|
|
207
|
-
(value.length !== 3 && value.length !== 6)
|
|
208
|
-
|
|
191
|
+
(value.length !== 3 && value.length !== 6) ||
|
|
192
|
+
/^[0-9A-Fa-f]+$/.test(value) !== true
|
|
209
193
|
) {
|
|
210
|
-
die(`Invalid ${
|
|
194
|
+
die(`Invalid ${name} color specified: "${value}"`)
|
|
211
195
|
}
|
|
212
196
|
|
|
213
|
-
argv[
|
|
197
|
+
argv[name] = '#' + value
|
|
214
198
|
}
|
|
215
199
|
}
|
|
216
200
|
|
|
217
|
-
function splashscreenIconRatio
|
|
201
|
+
function splashscreenIconRatio(value, argv) {
|
|
218
202
|
if (!value && value !== 0) {
|
|
219
203
|
argv.splashscreenIconRatio = defaultParams.splashscreenIconRatio
|
|
220
204
|
return
|
|
221
205
|
}
|
|
222
206
|
|
|
223
|
-
const numeric = parseFloat(value)
|
|
207
|
+
const numeric = Number.parseFloat(value)
|
|
224
208
|
|
|
225
|
-
if (isNaN(numeric)) {
|
|
209
|
+
if (Number.isNaN(numeric)) {
|
|
226
210
|
die(`Invalid splashscreen icon ratio number specified`)
|
|
227
211
|
}
|
|
228
212
|
if (numeric < 0 || numeric > 100) {
|
|
229
|
-
die(
|
|
213
|
+
die(
|
|
214
|
+
`Invalid splashscreen icon ratio specified (${value}) - should be between 0 - 100`
|
|
215
|
+
)
|
|
230
216
|
}
|
|
231
217
|
|
|
232
218
|
argv.splashscreenIconRatio = numeric
|
|
233
219
|
}
|
|
234
220
|
|
|
235
|
-
function output
|
|
221
|
+
function output(value) {
|
|
236
222
|
if (!value) {
|
|
237
223
|
die(`The "output" param is required`)
|
|
238
224
|
}
|
|
239
225
|
}
|
|
240
226
|
|
|
241
|
-
function assets
|
|
227
|
+
function assets(value, argv) {
|
|
242
228
|
if (!value) {
|
|
243
229
|
argv.assets = []
|
|
244
230
|
return
|
|
@@ -251,8 +237,8 @@ function assets (value, argv) {
|
|
|
251
237
|
return
|
|
252
238
|
}
|
|
253
239
|
|
|
254
|
-
if (list.some(
|
|
255
|
-
die(`Invalid assets requested: "${
|
|
240
|
+
if (list.some(item => !modesList.includes(item))) {
|
|
241
|
+
die(`Invalid assets requested: "${value}"`)
|
|
256
242
|
}
|
|
257
243
|
|
|
258
244
|
argv.assets = list
|
|
@@ -270,7 +256,10 @@ const parsers = {
|
|
|
270
256
|
|
|
271
257
|
themeColor: getColorParser('themeColor'),
|
|
272
258
|
pngColor: getColorParser('pngColor', defaultParams.pngColor),
|
|
273
|
-
splashscreenColor: getColorParser(
|
|
259
|
+
splashscreenColor: getColorParser(
|
|
260
|
+
'splashscreenColor',
|
|
261
|
+
defaultParams.splashscreenColor
|
|
262
|
+
),
|
|
274
263
|
svgColor: getColorParser('svgColor', defaultParams.svgColor),
|
|
275
264
|
|
|
276
265
|
include, // profile file param
|
|
@@ -279,13 +268,13 @@ const parsers = {
|
|
|
279
268
|
assets // profile cmd
|
|
280
269
|
}
|
|
281
270
|
|
|
282
|
-
export function parseArgv
|
|
271
|
+
export function parseArgv(argv, list) {
|
|
283
272
|
list.forEach(name => {
|
|
284
|
-
const fn = parsers[
|
|
273
|
+
const fn = parsers[name]
|
|
285
274
|
if (fn === void 0) {
|
|
286
|
-
die(`Invalid command parameter specified (${
|
|
275
|
+
die(`Invalid command parameter specified (${name})`)
|
|
287
276
|
}
|
|
288
277
|
|
|
289
|
-
fn(argv[
|
|
278
|
+
fn(argv[name], argv)
|
|
290
279
|
})
|
|
291
280
|
}
|
package/lib/utils/spawn-sync.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
2
1
|
import crossSpawn from 'cross-spawn'
|
|
3
2
|
|
|
4
3
|
import { log, warn } from './logger.js'
|
|
5
4
|
|
|
6
|
-
export function spawnSync
|
|
7
|
-
log(`[sync] Running "${
|
|
5
|
+
export function spawnSync(cmd, params, opts, onFail) {
|
|
6
|
+
log(`[sync] Running "${cmd} ${params.join(' ')}"\n`)
|
|
8
7
|
|
|
9
|
-
const runner = crossSpawn.sync(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const runner = crossSpawn.sync(cmd, params, {
|
|
9
|
+
stdio: 'inherit',
|
|
10
|
+
stdout: 'inherit',
|
|
11
|
+
stderr: 'inherit',
|
|
12
|
+
...opts
|
|
13
|
+
})
|
|
14
14
|
|
|
15
15
|
if (runner.status || runner.error) {
|
|
16
16
|
warn()
|
|
17
|
-
warn(`Command "${
|
|
18
|
-
onFail
|
|
17
|
+
warn(`Command "${cmd}" failed with exit code: ${runner.status}`)
|
|
18
|
+
onFail?.()
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
+
// oxlint-disable unicorn/no-thenable
|
|
1
2
|
|
|
2
|
-
import Joi from '
|
|
3
|
+
import Joi from 'joi'
|
|
3
4
|
import { red } from 'kolorist'
|
|
4
5
|
|
|
5
6
|
import { generators } from '../generators/index.js'
|
|
6
7
|
import { modes } from '../modes/index.js'
|
|
7
8
|
|
|
8
9
|
const generatorsList = Object.keys(generators)
|
|
9
|
-
const modesList = [
|
|
10
|
-
const platformsList = [
|
|
10
|
+
const modesList = ['all', ...Object.keys(modes)]
|
|
11
|
+
const platformsList = ['cordova-ios', 'cordova-android']
|
|
11
12
|
|
|
12
13
|
const baseParamsSchema = {
|
|
13
|
-
include: Joi.array()
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
include: Joi.array()
|
|
15
|
+
.min(1)
|
|
16
|
+
.items(Joi.string().valid(...modesList)),
|
|
16
17
|
|
|
17
18
|
icon: Joi.string().min(1),
|
|
18
19
|
background: Joi.string().min(1),
|
|
@@ -21,15 +22,15 @@ const baseParamsSchema = {
|
|
|
21
22
|
quality: Joi.number().integer().min(1).max(12),
|
|
22
23
|
|
|
23
24
|
skipTrim: Joi.boolean(),
|
|
24
|
-
padding: Joi.array().items(
|
|
25
|
-
Joi.number().integer().min(0)
|
|
26
|
-
).min(1).max(2),
|
|
25
|
+
padding: Joi.array().items(Joi.number().integer().min(0)).min(1).max(2),
|
|
27
26
|
|
|
28
27
|
splashscreenIconRatio: Joi.number().integer().min(0).max(100)
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
const assetsSchema = Joi.array().items({
|
|
32
|
-
generator: Joi.string()
|
|
31
|
+
generator: Joi.string()
|
|
32
|
+
.required()
|
|
33
|
+
.valid(...generatorsList),
|
|
33
34
|
name: Joi.string().required().min(1),
|
|
34
35
|
folder: Joi.string().required().min(1),
|
|
35
36
|
|
|
@@ -46,12 +47,13 @@ const assetsSchema = Joi.array().items({
|
|
|
46
47
|
|
|
47
48
|
sizes: Joi.when('generator', {
|
|
48
49
|
is: Joi.valid('png', 'splashscreen'),
|
|
49
|
-
then: Joi.array()
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
then: Joi.array()
|
|
51
|
+
.required()
|
|
52
|
+
.min(1)
|
|
53
|
+
.items(
|
|
54
|
+
Joi.number().integer().min(1),
|
|
55
|
+
Joi.array().items(Joi.number().integer().min(1)).length(2)
|
|
56
|
+
)
|
|
55
57
|
}),
|
|
56
58
|
|
|
57
59
|
tag: Joi.string()
|
|
@@ -61,8 +63,10 @@ const assetsSchema = Joi.array().items({
|
|
|
61
63
|
* When generating the profile file, we don't want to validate with # on the hex color.
|
|
62
64
|
* When generating the icon, we're expecting a hash on the color (automatically added to user input via the CLI)
|
|
63
65
|
*/
|
|
64
|
-
const getColorParamsSchema =
|
|
65
|
-
const colorPattern = Joi.string().pattern(
|
|
66
|
+
const getColorParamsSchema = requireHash => {
|
|
67
|
+
const colorPattern = Joi.string().pattern(
|
|
68
|
+
new RegExp(`^${requireHash ? '#' : ''}[0-9A-Fa-f]{3}([0-9A-Fa-f]{3})?$`)
|
|
69
|
+
)
|
|
66
70
|
return {
|
|
67
71
|
themeColor: colorPattern,
|
|
68
72
|
pngColor: colorPattern,
|
|
@@ -71,14 +75,15 @@ const getColorParamsSchema = (requireHash) => {
|
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
const getParamsSchema =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
}
|
|
78
|
+
const getParamsSchema = isGeneratingProfileFile => ({
|
|
79
|
+
...baseParamsSchema,
|
|
80
|
+
...getColorParamsSchema(!isGeneratingProfileFile)
|
|
81
|
+
})
|
|
80
82
|
|
|
81
|
-
export function validateProfileObject
|
|
83
|
+
export function validateProfileObject(
|
|
84
|
+
profileObject,
|
|
85
|
+
generatingProfileFile = false
|
|
86
|
+
) {
|
|
82
87
|
const profileSchema = Joi.object({
|
|
83
88
|
params: getParamsSchema(generatingProfileFile),
|
|
84
89
|
assets: assetsSchema
|
|
@@ -86,8 +91,10 @@ export function validateProfileObject (profileObject, generatingProfileFile = fa
|
|
|
86
91
|
|
|
87
92
|
const { error } = profileSchema.validate(profileObject)
|
|
88
93
|
if (error) {
|
|
89
|
-
console.error(
|
|
90
|
-
|
|
94
|
+
console.error(
|
|
95
|
+
` ${red('ERROR')}: Input parameters are not valid. Please correct them.`
|
|
96
|
+
)
|
|
97
|
+
console.error(` ${error}`)
|
|
91
98
|
console.log()
|
|
92
99
|
process.exit(1)
|
|
93
100
|
}
|
package/package.json
CHANGED
|
@@ -1,73 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quasar/icongenie",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "A Quasar tool for generating all your Quasar App's icons and splashscreens",
|
|
5
|
-
"bin": {
|
|
6
|
-
"icongenie": "./bin/icongenie.js"
|
|
7
|
-
},
|
|
8
|
-
"type": "module",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"lint": "eslint --ext .js ./ --fix --report-unused-disable-directives"
|
|
11
|
-
},
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/quasarframework/quasar.git"
|
|
15
|
-
},
|
|
16
|
-
"engines": {
|
|
17
|
-
"node": ">= 14.19.0"
|
|
18
|
-
},
|
|
19
5
|
"keywords": [
|
|
20
|
-
"
|
|
21
|
-
"
|
|
6
|
+
"bex",
|
|
7
|
+
"desktop",
|
|
8
|
+
"electron",
|
|
22
9
|
"icons",
|
|
23
|
-
"quasar",
|
|
24
10
|
"js",
|
|
25
11
|
"phone",
|
|
26
|
-
"tablet",
|
|
27
|
-
"desktop",
|
|
28
|
-
"spa",
|
|
29
12
|
"pwa",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
13
|
+
"quasar",
|
|
14
|
+
"spa",
|
|
15
|
+
"tablet",
|
|
16
|
+
"vue",
|
|
17
|
+
"vuejs",
|
|
18
|
+
"website"
|
|
33
19
|
],
|
|
20
|
+
"homepage": "https://quasar.dev/icongenie/introduction",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/quasarframework/quasar/issues"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT",
|
|
34
25
|
"author": "Razvan Stoenescu <razvan.stoenescu@gmail.com>",
|
|
35
26
|
"contributors": [
|
|
36
27
|
"Razvan Stoenescu <razvan.stoenescu@gmail.com>",
|
|
37
28
|
"Daniel Thompson-Yvetot <35242872+nothingismagick@users.noreply.github.com>"
|
|
38
29
|
],
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
"url": "https://github.com/quasarframework/quasar
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/quasarframework/quasar.git"
|
|
33
|
+
},
|
|
34
|
+
"bin": {
|
|
35
|
+
"icongenie": "./bin/icongenie.js"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"bin",
|
|
39
|
+
"lib",
|
|
40
|
+
"samples",
|
|
41
|
+
"README.md",
|
|
42
|
+
"LICENSE"
|
|
43
|
+
],
|
|
44
|
+
"type": "module",
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
42
47
|
},
|
|
43
|
-
"homepage": "https://quasar.dev/icongenie/introduction",
|
|
44
48
|
"dependencies": {
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
49
|
+
"@quasar/art": "^1.0.0",
|
|
50
|
+
"ci-info": "^4.4.0",
|
|
51
|
+
"cross-spawn": "^7.0.6",
|
|
47
52
|
"elementtree": "^0.1.7",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"imagemin": "^
|
|
51
|
-
"imagemin-pngquant": "^9.0.2",
|
|
53
|
+
"fs-extra": "^11.2.0",
|
|
54
|
+
"imagemin": "^9.0.1",
|
|
55
|
+
"imagemin-pngquant": "^10.0.0",
|
|
52
56
|
"is-png": "^3.0.1",
|
|
57
|
+
"joi": "^18.2.1",
|
|
53
58
|
"kolorist": "^1.8.0",
|
|
54
|
-
"minimist": "^1.2.8",
|
|
55
59
|
"png2icons": "^2.0.1",
|
|
56
60
|
"potrace": "^2.1.5",
|
|
57
|
-
"read-chunk": "^
|
|
58
|
-
"sharp": "^0.
|
|
59
|
-
"svgo": "^
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
"devDependencies": {
|
|
64
|
-
"eslint": "^8.31.0",
|
|
65
|
-
"eslint-plugin-n": "^15.6.1"
|
|
66
|
-
},
|
|
67
|
-
"resolutions": {
|
|
68
|
-
"minimist": "^1.2.8"
|
|
61
|
+
"read-chunk": "^5.0.0",
|
|
62
|
+
"sharp": "^0.34.5",
|
|
63
|
+
"svgo": "^4.0.1",
|
|
64
|
+
"tinyglobby": "^0.2.10",
|
|
65
|
+
"untildify": "^6.0.0",
|
|
66
|
+
"update-notifier": "^7.0.0"
|
|
69
67
|
},
|
|
70
|
-
"
|
|
71
|
-
"
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">= 22.22.0"
|
|
72
70
|
}
|
|
73
|
-
}
|
|
71
|
+
}
|