@keyline-icons/cli 1.1.1 → 1.3.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/icons.json +1 -1
- package/package.json +1 -1
- package/src/index.mjs +19 -3
package/package.json
CHANGED
package/src/index.mjs
CHANGED
|
@@ -26,7 +26,7 @@ const data = JSON.parse(
|
|
|
26
26
|
// older icons.json still runs rather than reading `undefined.includes`.
|
|
27
27
|
const { icons, styles, corners = ["regular"], keywords = {} } = data
|
|
28
28
|
const NAMES = Object.keys(icons)
|
|
29
|
-
const VERSION = "1.
|
|
29
|
+
const VERSION = "1.3.0"
|
|
30
30
|
|
|
31
31
|
/** Colour only when a human is looking. Piped output stays clean. */
|
|
32
32
|
const tty = process.stdout.isTTY
|
|
@@ -223,6 +223,22 @@ const stemmed = (hay) => hay.replace(/[a-z0-9]+/g, singular)
|
|
|
223
223
|
*/
|
|
224
224
|
const foreign = data.names ?? {}
|
|
225
225
|
|
|
226
|
+
/**
|
|
227
|
+
* A renamed icon's old name, followed to the drawing it names now.
|
|
228
|
+
*
|
|
229
|
+
* Only renames from 1.0.0 on are listed, and only until the next major, for
|
|
230
|
+
* the reason `lib/icon-renames.json` gives: a script that ran `add rocket-2`
|
|
231
|
+
* before 1.3.0 should still run after it. It gets the same drawing under the
|
|
232
|
+
* file name it asked for, and a note saying what the drawing is called now.
|
|
233
|
+
*/
|
|
234
|
+
const renames = data.renames ?? {}
|
|
235
|
+
function current(name) {
|
|
236
|
+
const now = renames[name]
|
|
237
|
+
if (!now || icons[name]) return name
|
|
238
|
+
note(dim(`\`${name}\` is \`${now}\` now. The old name works until the next major.`))
|
|
239
|
+
return now
|
|
240
|
+
}
|
|
241
|
+
|
|
226
242
|
/**
|
|
227
243
|
* Whether `hay` carries `needle` as a whole word, hyphen or space delimited.
|
|
228
244
|
*
|
|
@@ -425,7 +441,7 @@ const commands = {
|
|
|
425
441
|
show({ flags, positional }) {
|
|
426
442
|
const [name] = positional
|
|
427
443
|
if (!name) die("show needs an icon name. Try: keyline-icons show check")
|
|
428
|
-
process.stdout.write(resolveOrDie(name, styleOf(flags), cornersOf(flags)))
|
|
444
|
+
process.stdout.write(resolveOrDie(current(name), styleOf(flags), cornersOf(flags)))
|
|
429
445
|
},
|
|
430
446
|
|
|
431
447
|
async add({ flags, positional }) {
|
|
@@ -444,7 +460,7 @@ const commands = {
|
|
|
444
460
|
// third of five does not leave two files on disk and an error.
|
|
445
461
|
const files = positional.map((name) => [
|
|
446
462
|
`${name}${suffix}`,
|
|
447
|
-
resolveOrDie(name, style, treatment),
|
|
463
|
+
resolveOrDie(current(name), style, treatment),
|
|
448
464
|
])
|
|
449
465
|
|
|
450
466
|
await mkdir(dir, { recursive: true })
|