@quasar/icongenie 2.5.4 → 3.1.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.
Files changed (55) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.cjs +50 -0
  3. package/bin/{icongenie → icongenie.js} +11 -11
  4. package/lib/cmd/generate.js +26 -21
  5. package/lib/cmd/help.js +3 -1
  6. package/lib/cmd/profile.js +19 -15
  7. package/lib/cmd/verify.js +16 -13
  8. package/lib/generators/icns.js +5 -4
  9. package/lib/generators/ico.js +5 -4
  10. package/lib/generators/index.js +13 -6
  11. package/lib/generators/png.js +3 -2
  12. package/lib/generators/splashscreen.js +3 -2
  13. package/lib/generators/svg.js +6 -5
  14. package/lib/modes/index.js +8 -5
  15. package/lib/modes/quasar-app-v1/bex.js +2 -1
  16. package/lib/modes/quasar-app-v1/capacitor.js +11 -10
  17. package/lib/modes/quasar-app-v1/cordova.js +14 -13
  18. package/lib/modes/quasar-app-v1/electron.js +2 -1
  19. package/lib/modes/quasar-app-v1/index.js +16 -8
  20. package/lib/modes/quasar-app-v1/pwa.js +11 -7
  21. package/lib/modes/quasar-app-v1/spa.js +2 -1
  22. package/lib/modes/quasar-app-v1/ssr.js +3 -2
  23. package/lib/modes/quasar-app-v2/bex.js +2 -1
  24. package/lib/modes/quasar-app-v2/capacitor.js +11 -10
  25. package/lib/modes/quasar-app-v2/cordova.js +14 -13
  26. package/lib/modes/quasar-app-v2/electron.js +2 -1
  27. package/lib/modes/quasar-app-v2/index.js +16 -8
  28. package/lib/modes/quasar-app-v2/pwa.js +11 -7
  29. package/lib/modes/quasar-app-v2/spa.js +2 -1
  30. package/lib/modes/quasar-app-v2/ssr.js +3 -2
  31. package/lib/mount/index.js +5 -4
  32. package/lib/mount/mount-cordova.js +31 -30
  33. package/lib/mount/mount-tag.js +3 -2
  34. package/lib/runner/generate.js +37 -36
  35. package/lib/runner/profile.js +12 -11
  36. package/lib/runner/verify.js +23 -22
  37. package/lib/utils/app-paths.js +18 -18
  38. package/lib/utils/default-params.js +2 -1
  39. package/lib/utils/filter-argv-params.js +4 -3
  40. package/lib/utils/get-assets-files.js +6 -5
  41. package/lib/utils/get-compression.js +6 -6
  42. package/lib/utils/get-file-size.js +5 -4
  43. package/lib/utils/get-files-options.js +7 -6
  44. package/lib/utils/get-png-size.js +8 -7
  45. package/lib/utils/get-profile-content.js +9 -5
  46. package/lib/utils/get-profile-files.js +10 -9
  47. package/lib/utils/get-square-icon.js +5 -4
  48. package/lib/utils/logger.js +8 -7
  49. package/lib/utils/merge-objects.js +5 -4
  50. package/lib/utils/node-version-check.js +6 -6
  51. package/lib/utils/package-json.js +6 -0
  52. package/lib/utils/parse-argv.js +43 -45
  53. package/lib/utils/spawn-sync.js +6 -5
  54. package/lib/utils/validate-profile-object.js +12 -8
  55. package/package.json +24 -14
@@ -1,13 +1,13 @@
1
1
  // version-check
2
2
 
3
3
  const version = process.version.split('.')
4
- const major = parseInt(version[0].replace(/\D/g, ''), 10)
5
- const minor = parseInt(version[1].replace(/\D/g,''), 10)
6
- const patch = parseInt(version[2].replace(/\D/g,''), 10)
4
+ const major = parseInt(version[ 0 ].replace(/\D/g, ''), 10)
5
+ const minor = parseInt(version[ 1 ].replace(/\D/g,''), 10)
6
+ const patch = parseInt(version[ 2 ].replace(/\D/g,''), 10)
7
7
 
8
8
  const min = {
9
- major: 10,
10
- minor: 0,
9
+ major: 14,
10
+ minor: 19,
11
11
  patch: 0
12
12
  }
13
13
 
@@ -21,7 +21,7 @@ if (
21
21
  console.error()
22
22
  console.error('--------------------------------------------------------')
23
23
  console.error(' INCOMPATIBLE NODE VERSION')
24
- console.error(` @quasar/icongenie requires Node ${min.major}.${min.minor}.${min.patch} or superior`)
24
+ console.error(` @quasar/icongenie requires Node ${ min.major }.${ min.minor }.${ min.patch } or superior`)
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')
@@ -0,0 +1,6 @@
1
+
2
+ import { readFileSync } from 'node:fs'
3
+
4
+ export const packageJson = JSON.parse(
5
+ readFileSync(new URL('../../package.json', import.meta.url), 'utf-8')
6
+ )
@@ -1,11 +1,16 @@
1
- const { existsSync, lstatSync } = require('fs')
2
- const { resolve, normalize, join, isAbsolute } = require('path')
3
- const untildify = require('untildify')
4
1
 
5
- const getPngSize = require('./get-png-size')
6
- const { warn } = require('./logger')
7
- const generators = require('../generators')
8
- const defaultParams = require('./default-params')
2
+ import { existsSync, lstatSync } from 'node:fs'
3
+ import { resolve, normalize, isAbsolute } from 'node:path'
4
+ import untildify from 'untildify'
5
+
6
+ import { getPngSize } from './get-png-size.js'
7
+ import { warn } from './logger.js'
8
+ import { generators } from '../generators/index.js'
9
+ import { defaultParams } from './default-params.js'
10
+ import { appDir } from './app-paths.js'
11
+ import { modes } from '../modes/index.js'
12
+
13
+ const modesList = Object.keys(modes)
9
14
 
10
15
  function die (msg) {
11
16
  warn(msg)
@@ -25,32 +30,30 @@ function profile (value, argv) {
25
30
  }
26
31
 
27
32
  if (
28
- !value.endsWith('.json') &&
29
- !lstatSync(profilePath).isDirectory()
33
+ !value.endsWith('.json')
34
+ && !lstatSync(profilePath).isDirectory()
30
35
  ) {
31
- die(`Specified profile (${value}) is not a .json file`)
36
+ die(`Specified profile (${ value }) is not a .json file`)
32
37
  }
33
38
 
34
39
  argv.profile = profilePath
35
40
  }
36
41
 
37
42
  function mode (value, argv) {
38
- const possibleValues = Object.keys(require('../modes'))
39
-
40
43
  if (!value) {
41
- argv.mode = possibleValues
44
+ argv.mode = modesList
42
45
  return
43
46
  }
44
47
 
45
48
  const list = value.split(',')
46
49
 
47
50
  if (list.includes('all')) {
48
- argv.mode = possibleValues
51
+ argv.mode = modesList
49
52
  return
50
53
  }
51
54
 
52
- if (list.some(mode => !possibleValues.includes(mode))) {
53
- die(`Invalid mode requested: "${value}"`)
55
+ if (list.some(mode => !modesList.includes(mode))) {
56
+ die(`Invalid mode requested: "${ value }"`)
54
57
  }
55
58
 
56
59
  argv.mode = list
@@ -61,15 +64,13 @@ function include (value, argv) {
61
64
  return
62
65
  }
63
66
 
64
- const possibleValues = Object.keys(require('../modes'))
65
-
66
67
  if (value.includes('all')) {
67
- argv.include = possibleValues
68
+ argv.include = modesList
68
69
  return
69
70
  }
70
71
 
71
- if (value.some(mode => !possibleValues.includes(mode))) {
72
- die(`Invalid include requested: "${value}"`)
72
+ if (value.some(mode => !modesList.includes(mode))) {
73
+ die(`Invalid include requested: "${ value }"`)
73
74
  }
74
75
  }
75
76
 
@@ -85,7 +86,7 @@ function quality (value, argv) {
85
86
  die(`Invalid quality level number specified`)
86
87
  }
87
88
  if (numeric < 1 || numeric > 12) {
88
- die(`Invalid quality level specified (${value}) - should be between 1 - 12`)
89
+ die(`Invalid quality level specified (${ value }) - should be between 1 - 12`)
89
90
  }
90
91
 
91
92
  argv.quality = numeric
@@ -93,7 +94,7 @@ function quality (value, argv) {
93
94
 
94
95
  function filter (value) {
95
96
  if (value && !Object.keys(generators).includes(value)) {
96
- die(`Unknown filter value specified (${value}); there is no such generator`)
97
+ die(`Unknown filter value specified (${ value }); there is no such generator`)
97
98
  }
98
99
  }
99
100
 
@@ -120,7 +121,7 @@ function padding (value, argv) {
120
121
  })
121
122
 
122
123
  argv.padding = sizes.length === 1
123
- ? [ sizes[0], sizes[0] ]
124
+ ? [ sizes[ 0 ], sizes[ 0 ] ]
124
125
  : sizes
125
126
  }
126
127
 
@@ -139,7 +140,6 @@ function parseIconPath (value) {
139
140
  return icon
140
141
  }
141
142
 
142
- const { appDir } = require('./app-paths')
143
143
  icon = resolve(appDir, __path)
144
144
 
145
145
  return existsSync(icon) ? icon : null
@@ -148,14 +148,16 @@ function parseIconPath (value) {
148
148
  function icon (value, argv) {
149
149
  if (!value) {
150
150
  warn(`No source icon file specified, so using the sample one`)
151
- argv.icon = normalize(join(__dirname, '../../samples/icongenie-icon.png'))
151
+ argv.icon = normalize(
152
+ new URL('../../samples/icongenie-icon.png', import.meta.url).pathname
153
+ )
152
154
  return
153
155
  }
154
156
 
155
157
  argv.icon = parseIconPath(value)
156
158
 
157
159
  if (!argv.icon) {
158
- die(`Path to source icon file does not exists: "${value}"`)
160
+ die(`Path to source icon file does not exists: "${ value }"`)
159
161
  }
160
162
 
161
163
  const { width, height } = getPngSize(argv.icon)
@@ -174,12 +176,10 @@ function background (value, argv) {
174
176
  return
175
177
  }
176
178
 
177
- const { appDir } = require('./app-paths')
178
-
179
179
  argv.background = resolve(appDir, untildify(value))
180
180
 
181
181
  if (!existsSync(argv.background)) {
182
- die(`Path to background source file does not exists: "${value}"`)
182
+ die(`Path to background source file does not exists: "${ value }"`)
183
183
  }
184
184
 
185
185
  const { width, height } = getPngSize(argv.background)
@@ -196,18 +196,18 @@ function background (value, argv) {
196
196
  function getColorParser (name, defaultValue) {
197
197
  return (value, argv) => {
198
198
  if (!value) {
199
- argv[name] = argv.themeColor || defaultValue
199
+ argv[ name ] = argv.themeColor || defaultValue
200
200
  return
201
201
  }
202
202
 
203
203
  if (
204
- (value.length !== 3 && value.length !== 6) ||
205
- /^[0-9A-Fa-f]+$/.test(value) !== true
204
+ (value.length !== 3 && value.length !== 6)
205
+ || /^[0-9A-Fa-f]+$/.test(value) !== true
206
206
  ) {
207
- die(`Invalid ${name} color specified: "${value}"`)
207
+ die(`Invalid ${ name } color specified: "${ value }"`)
208
208
  }
209
209
 
210
- argv[name] = '#' + value
210
+ argv[ name ] = '#' + value
211
211
  }
212
212
  }
213
213
 
@@ -223,7 +223,7 @@ function splashscreenIconRatio (value, argv) {
223
223
  die(`Invalid splashscreen icon ratio number specified`)
224
224
  }
225
225
  if (numeric < 0 || numeric > 100) {
226
- die(`Invalid splashscreen icon ratio specified (${value}) - should be between 0 - 100`)
226
+ die(`Invalid splashscreen icon ratio specified (${ value }) - should be between 0 - 100`)
227
227
  }
228
228
 
229
229
  argv.splashscreenIconRatio = numeric
@@ -236,8 +236,6 @@ function output (value) {
236
236
  }
237
237
 
238
238
  function assets (value, argv) {
239
- const possibleValues = Object.keys(require('../modes'))
240
-
241
239
  if (!value) {
242
240
  argv.assets = []
243
241
  return
@@ -246,12 +244,12 @@ function assets (value, argv) {
246
244
  const list = value.split(',')
247
245
 
248
246
  if (list.includes('all')) {
249
- argv.assets = possibleValues
247
+ argv.assets = modesList
250
248
  return
251
249
  }
252
250
 
253
- if (list.some(mode => !possibleValues.includes(mode))) {
254
- die(`Invalid assets requested: "${value}"`)
251
+ if (list.some(mode => !modesList.includes(mode))) {
252
+ die(`Invalid assets requested: "${ value }"`)
255
253
  }
256
254
 
257
255
  argv.assets = list
@@ -278,13 +276,13 @@ const parsers = {
278
276
  assets // profile cmd
279
277
  }
280
278
 
281
- module.exports = function (argv, list) {
279
+ export function parseArgv (argv, list) {
282
280
  list.forEach(name => {
283
- const fn = parsers[name]
281
+ const fn = parsers[ name ]
284
282
  if (fn === void 0) {
285
- die(`Invalid command parameter specified (${name})`)
283
+ die(`Invalid command parameter specified (${ name })`)
286
284
  }
287
285
 
288
- fn(argv[name], argv)
286
+ fn(argv[ name ], argv)
289
287
  })
290
288
  }
@@ -1,9 +1,10 @@
1
- const crossSpawn = require('cross-spawn')
2
1
 
3
- const { log, warn } = require('./logger')
2
+ import crossSpawn from 'cross-spawn'
4
3
 
5
- module.exports = function spawnSync (cmd, params, opts, onFail) {
6
- log(`[sync] Running "${cmd} ${params.join(' ')}"\n`)
4
+ import { log, warn } from './logger.js'
5
+
6
+ export function spawnSync (cmd, params, opts, onFail) {
7
+ log(`[sync] Running "${ cmd } ${ params.join(' ') }"\n`)
7
8
 
8
9
  const runner = crossSpawn.sync(
9
10
  cmd,
@@ -13,7 +14,7 @@ module.exports = function spawnSync (cmd, params, opts, onFail) {
13
14
 
14
15
  if (runner.status || runner.error) {
15
16
  warn()
16
- warn(`Command "${cmd}" failed with exit code: ${runner.status}`)
17
+ warn(`Command "${ cmd }" failed with exit code: ${ runner.status }`)
17
18
  onFail && onFail()
18
19
  }
19
20
  }
@@ -1,8 +1,12 @@
1
- const Joi = require('@hapi/joi')
2
- const { red } = require('kolorist')
3
1
 
4
- const generatorsList = Object.keys(require('../generators'))
5
- const modesList = [ 'all' ].concat(Object.keys(require('../modes')))
2
+ import Joi from '@hapi/joi'
3
+ import { red } from 'kolorist'
4
+
5
+ import { generators } from '../generators/index.js'
6
+ import { modes } from '../modes/index.js'
7
+
8
+ const generatorsList = Object.keys(generators)
9
+ const modesList = [ 'all' ].concat(Object.keys(modes))
6
10
  const platformsList = [ 'cordova-ios', 'cordova-android' ]
7
11
 
8
12
  const baseParamsSchema = {
@@ -58,7 +62,7 @@ const assetsSchema = Joi.array().items({
58
62
  * When generating the icon, we're expecting a hash on the color (automatically added to user input via the CLI)
59
63
  */
60
64
  const getColorParamsSchema = (requireHash) => {
61
- const colorPattern = Joi.string().pattern(new RegExp(`^${requireHash ? '#' : ''}[0-9A-Fa-f]{3}([0-9A-Fa-f]{3})?$`))
65
+ const colorPattern = Joi.string().pattern(new RegExp(`^${ requireHash ? '#' : '' }[0-9A-Fa-f]{3}([0-9A-Fa-f]{3})?$`))
62
66
  return {
63
67
  themeColor: colorPattern,
64
68
  pngColor: colorPattern,
@@ -74,7 +78,7 @@ const getParamsSchema = (isGeneratingProfileFile) => {
74
78
  }
75
79
  }
76
80
 
77
- module.exports = function validateProfileObject (profileObject, generatingProfileFile = false) {
81
+ export function validateProfileObject (profileObject, generatingProfileFile = false) {
78
82
  const profileSchema = Joi.object({
79
83
  params: getParamsSchema(generatingProfileFile),
80
84
  assets: assetsSchema
@@ -82,8 +86,8 @@ module.exports = function validateProfileObject (profileObject, generatingProfil
82
86
 
83
87
  const { error } = profileSchema.validate(profileObject)
84
88
  if (error) {
85
- console.error(` ${red('ERROR')}: Input parameters are not valid. Please correct them.`)
86
- console.error(` ${error}`)
89
+ console.error(` ${ red('ERROR') }: Input parameters are not valid. Please correct them.`)
90
+ console.error(` ${ error }`)
87
91
  console.log()
88
92
  process.exit(1)
89
93
  }
package/package.json CHANGED
@@ -1,15 +1,21 @@
1
1
  {
2
2
  "name": "@quasar/icongenie",
3
- "version": "2.5.4",
3
+ "version": "3.1.0",
4
4
  "description": "A Quasar tool for generating all your Quasar App's icons and splashscreens",
5
5
  "bin": {
6
- "icongenie": "./bin/icongenie"
6
+ "icongenie": "./bin/icongenie.js"
7
+ },
8
+ "type": "module",
9
+ "scripts": {
10
+ "lint": "eslint --ext .js ./ --fix --report-unused-disable-directives"
7
11
  },
8
- "scripts": {},
9
12
  "repository": {
10
13
  "type": "git",
11
14
  "url": "git+https://github.com/quasarframework/quasar.git"
12
15
  },
16
+ "engines": {
17
+ "node": ">= 14.19.0"
18
+ },
13
19
  "keywords": [
14
20
  "vuejs",
15
21
  "vue",
@@ -39,23 +45,27 @@
39
45
  "@hapi/joi": "^17.1.1",
40
46
  "cross-spawn": "^7.0.2",
41
47
  "elementtree": "^0.1.7",
42
- "fast-glob": "^3.2.11",
43
- "fs-extra": "^10.0.1",
44
- "imagemin": "^7.0.1",
48
+ "fast-glob": "^3.2.12",
49
+ "fs-extra": "^11.1.1",
50
+ "imagemin": "^8.0.1",
45
51
  "imagemin-pngquant": "^9.0.2",
46
- "is-png": "^2.0.0",
47
- "kolorist": "^1.5.1",
48
- "minimist": "^1.2.6",
52
+ "is-png": "^3.0.1",
53
+ "kolorist": "^1.8.0",
54
+ "minimist": "^1.2.8",
49
55
  "png2icons": "^2.0.1",
50
56
  "potrace": "^2.1.5",
51
- "read-chunk": "^3.2.0",
52
- "sharp": "^0.30.3",
53
- "svgo": "^2.8.0",
57
+ "read-chunk": "^4.0.3",
58
+ "sharp": "^0.32.1",
59
+ "svgo": "^3.0.2",
54
60
  "untildify": "^4.0.0",
55
- "update-notifier": "^5.1.0"
61
+ "update-notifier": "^6.0.2"
62
+ },
63
+ "devDependencies": {
64
+ "eslint": "^8.31.0",
65
+ "eslint-plugin-n": "^15.6.1"
56
66
  },
57
67
  "resolutions": {
58
- "minimist": "^1.2.6"
68
+ "minimist": "^1.2.8"
59
69
  },
60
70
  "publishConfig": {
61
71
  "access": "public"