@fontoxml/fontoxml-development-tools 8.8.0 → 8.8.1
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/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fontoxml/fontoxml-development-tools",
|
|
3
|
-
"version": "8.8.
|
|
3
|
+
"version": "8.8.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@fontoxml/fontoxml-development-tools",
|
|
9
|
-
"version": "8.8.
|
|
9
|
+
"version": "8.8.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@babel/core": "7.23.3",
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ import getAddonLabelsForChanges from './getAddonLabelsForChanges.js';
|
|
|
12
12
|
|
|
13
13
|
const DEFAULT_STDOUT_COLUMNS = 30;
|
|
14
14
|
|
|
15
|
-
async function disableCancelPrompt
|
|
15
|
+
async function disableCancelPrompt(input, key) {
|
|
16
16
|
if (!key.ctrl || key.name !== 'escape') {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
@@ -80,9 +80,7 @@ async function promptSchema({ data }) {
|
|
|
80
80
|
cancel: disableCancelPrompt,
|
|
81
81
|
validate: (fontoJsonPath) => {
|
|
82
82
|
try {
|
|
83
|
-
if (
|
|
84
|
-
fs.statSync(path.resolve(fontoJsonPath)).isDirectory()
|
|
85
|
-
) {
|
|
83
|
+
if (fs.statSync(path.resolve(fontoJsonPath)).isDirectory()) {
|
|
86
84
|
fs.statSync(path.resolve(fontoJsonPath, 'fonto.json'));
|
|
87
85
|
return true;
|
|
88
86
|
}
|
|
@@ -107,31 +105,34 @@ async function promptSchema({ data }) {
|
|
|
107
105
|
* @returns {Promise<TData>}
|
|
108
106
|
*/
|
|
109
107
|
async function promptAddons({ currentAddons, data, sdkAddons, fdtLicense }) {
|
|
110
|
-
const width = process.stdout?.columns
|
|
111
|
-
|
|
108
|
+
const width = process.stdout?.columns
|
|
109
|
+
? process.stdout?.columns - 2
|
|
110
|
+
: DEFAULT_STDOUT_COLUMNS;
|
|
111
|
+
const checkedAddons = sdkAddons
|
|
112
|
+
.filter((sdkAddon) => data.addons.includes(sdkAddon.package))
|
|
113
|
+
.map((sdkAddon) => sdkAddon.package);
|
|
112
114
|
const promptAnswers = await enquirer.prompt([
|
|
113
115
|
{
|
|
114
116
|
name: 'addons',
|
|
115
117
|
type: 'multiselect',
|
|
116
118
|
message: 'Add-ons',
|
|
117
119
|
emptyError: null,
|
|
118
|
-
initial:
|
|
120
|
+
initial: checkedAddons,
|
|
119
121
|
cancel: disableCancelPrompt,
|
|
120
122
|
columns: width,
|
|
121
123
|
// Every choice has 4 lines.
|
|
122
124
|
rows: Math.max(Math.floor((process.stdout.rows - 4) / 4), 5),
|
|
123
125
|
choices: sdkAddons.reduce((choices, addon) => {
|
|
124
126
|
// Disabled add-ons for which there is no license.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
addon.licenses &&
|
|
128
|
-
!fdtLicense.hasProductLicenses(addon.licenses)
|
|
129
|
-
) {
|
|
130
|
-
disabled = `Your license currently does not include the ${addon.package} add-on, and thus cannot be enabled.\n`;
|
|
131
|
-
}
|
|
127
|
+
const disabled =
|
|
128
|
+
!!addon.licenses && !fdtLicense.hasProductLicenses(addon.licenses);
|
|
132
129
|
|
|
133
130
|
// Hide preview add-ons, if not explicitly enabled.
|
|
134
|
-
if (
|
|
131
|
+
if (
|
|
132
|
+
addon.isPreview &&
|
|
133
|
+
!data.addons.includes(addon.package) &&
|
|
134
|
+
!currentAddons.includes(addon.package)
|
|
135
|
+
) {
|
|
135
136
|
return choices;
|
|
136
137
|
}
|
|
137
138
|
|
|
@@ -140,7 +141,9 @@ async function promptAddons({ currentAddons, data, sdkAddons, fdtLicense }) {
|
|
|
140
141
|
? `${addon.description.substring(0, width - 3)}...`
|
|
141
142
|
: addon.description,
|
|
142
143
|
)}\n`;
|
|
143
|
-
if (
|
|
144
|
+
if (disabled) {
|
|
145
|
+
hint += ` Your license currently does not include the ${addon.package} add-on, and thus cannot be enabled.\n`;
|
|
146
|
+
} else if (addon.dependencies) {
|
|
144
147
|
hint += ` Depends on: ${chalk.dim(
|
|
145
148
|
addon.dependencies.join(', '),
|
|
146
149
|
)}\n`;
|
|
@@ -170,7 +173,7 @@ async function promptAddons({ currentAddons, data, sdkAddons, fdtLicense }) {
|
|
|
170
173
|
function lineBreakAndIndentArray(
|
|
171
174
|
items,
|
|
172
175
|
indentationLength,
|
|
173
|
-
lineLength = process.stdout.columns || DEFAULT_STDOUT_COLUMNS
|
|
176
|
+
lineLength = process.stdout.columns || DEFAULT_STDOUT_COLUMNS,
|
|
174
177
|
) {
|
|
175
178
|
const outputLength = lineLength - indentationLength - 1;
|
|
176
179
|
|
|
@@ -204,16 +207,13 @@ async function promptInitReview(options) {
|
|
|
204
207
|
{
|
|
205
208
|
name: 'schema',
|
|
206
209
|
message: 'Change fonto.json path',
|
|
207
|
-
hint: ` ${chalk.green(
|
|
208
|
-
data.schema || 'not set (required)'
|
|
209
|
-
)}`,
|
|
210
|
+
hint: ` ${chalk.green(data.schema || 'not set (required)')}`,
|
|
210
211
|
},
|
|
211
212
|
{
|
|
212
213
|
name: 'addons',
|
|
213
214
|
message: 'Change add-ons',
|
|
214
215
|
hint: ` ${chalk.green(
|
|
215
|
-
lineBreakAndIndentArray(addonLabels, 26) ||
|
|
216
|
-
'no add-ons selected'
|
|
216
|
+
lineBreakAndIndentArray(addonLabels, 26) || 'no add-ons selected',
|
|
217
217
|
)}`,
|
|
218
218
|
},
|
|
219
219
|
{ role: 'separator' },
|
|
@@ -221,7 +221,7 @@ async function promptInitReview(options) {
|
|
|
221
221
|
name: 'create',
|
|
222
222
|
message: 'Create Fonto Editor instance',
|
|
223
223
|
hint: `(${chalk.green(
|
|
224
|
-
sdkVersion.isNightly ? 'nightly' : sdkVersion.format()
|
|
224
|
+
sdkVersion.isNightly ? 'nightly' : sdkVersion.format(),
|
|
225
225
|
)})`,
|
|
226
226
|
},
|
|
227
227
|
{
|
|
@@ -314,16 +314,15 @@ async function promptUpgradeReview(options) {
|
|
|
314
314
|
message:
|
|
315
315
|
versionDifference === 0
|
|
316
316
|
? `Upgrade the Fonto Editor instance to the same version (${chalk.green(
|
|
317
|
-
nightlyOrVersion
|
|
317
|
+
nightlyOrVersion,
|
|
318
318
|
)})`
|
|
319
|
-
: versionDifference === 'unknown' ||
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
)} to ${chalk.green(nightlyOrVersion)}`,
|
|
319
|
+
: versionDifference === 'unknown' || versionDifference > 0
|
|
320
|
+
? `Upgrade the Fonto Editor instance from ${chalk.green(
|
|
321
|
+
currentVersion.format(),
|
|
322
|
+
)} to ${chalk.green(nightlyOrVersion)}`
|
|
323
|
+
: `Downgrade the Fonto Editor instance from ${chalk.green(
|
|
324
|
+
currentVersion.format(),
|
|
325
|
+
)} to ${chalk.green(nightlyOrVersion)}`,
|
|
327
326
|
},
|
|
328
327
|
{
|
|
329
328
|
name: 'quit',
|
|
@@ -338,19 +337,19 @@ async function promptUpgradeReview(options) {
|
|
|
338
337
|
const didConfirm = await promptConfirm(
|
|
339
338
|
[
|
|
340
339
|
chalk.yellow(
|
|
341
|
-
'Warning: this command will attempt to modify files in the current folder.'
|
|
340
|
+
'Warning: this command will attempt to modify files in the current folder.',
|
|
342
341
|
),
|
|
343
342
|
chalk.yellow(
|
|
344
|
-
'Please close all applications using these files, make sure they are writable, and consider creating a backup before continuing.'
|
|
343
|
+
'Please close all applications using these files, make sure they are writable, and consider creating a backup before continuing.',
|
|
345
344
|
),
|
|
346
345
|
'Are you sure you want to continue?',
|
|
347
|
-
].join('\n ')
|
|
346
|
+
].join('\n '),
|
|
348
347
|
);
|
|
349
348
|
return didConfirm ? {} : promptUpgradeReview(options);
|
|
350
349
|
}
|
|
351
350
|
case 'quit': {
|
|
352
351
|
const quit = await promptConfirm(
|
|
353
|
-
'Are you sure you want to quit? All changes will be lost.'
|
|
352
|
+
'Are you sure you want to quit? All changes will be lost.',
|
|
354
353
|
);
|
|
355
354
|
return quit ? false : promptUpgradeReview(options);
|
|
356
355
|
}
|
|
@@ -373,7 +372,7 @@ async function promptChangeAddonsReview(options) {
|
|
|
373
372
|
const addonLabels = getAddonLabelsForChanges(
|
|
374
373
|
currentAddons,
|
|
375
374
|
data.addons,
|
|
376
|
-
sdkAddons
|
|
375
|
+
sdkAddons,
|
|
377
376
|
);
|
|
378
377
|
const answers = await enquirer.prompt([
|
|
379
378
|
{
|
|
@@ -396,9 +395,7 @@ async function promptChangeAddonsReview(options) {
|
|
|
396
395
|
name: 'apply',
|
|
397
396
|
message: 'Apply add-on changes to the Fonto Editor instance version',
|
|
398
397
|
hint: `(${chalk.green(
|
|
399
|
-
currentVersion.isNightly
|
|
400
|
-
? 'nightly'
|
|
401
|
-
: currentVersion.format()
|
|
398
|
+
currentVersion.isNightly ? 'nightly' : currentVersion.format(),
|
|
402
399
|
)})`,
|
|
403
400
|
},
|
|
404
401
|
{
|
|
@@ -412,25 +409,25 @@ async function promptChangeAddonsReview(options) {
|
|
|
412
409
|
switch (answers.choice) {
|
|
413
410
|
case 'addons':
|
|
414
411
|
return promptAddons(options).then(() =>
|
|
415
|
-
promptChangeAddonsReview(options)
|
|
412
|
+
promptChangeAddonsReview(options),
|
|
416
413
|
);
|
|
417
414
|
case 'apply': {
|
|
418
415
|
const didConfirm = await promptConfirm(
|
|
419
416
|
[
|
|
420
417
|
chalk.yellow(
|
|
421
|
-
'Warning: this command will attempt to modify files in the current folder.'
|
|
418
|
+
'Warning: this command will attempt to modify files in the current folder.',
|
|
422
419
|
),
|
|
423
420
|
chalk.yellow(
|
|
424
|
-
'Please close all applications using these files, make sure they are writable, and consider creating a backup before continuing.'
|
|
421
|
+
'Please close all applications using these files, make sure they are writable, and consider creating a backup before continuing.',
|
|
425
422
|
),
|
|
426
423
|
'Are you sure you want to continue?',
|
|
427
|
-
].join('\n ')
|
|
424
|
+
].join('\n '),
|
|
428
425
|
);
|
|
429
426
|
return didConfirm ? data : promptChangeAddonsReview(options);
|
|
430
427
|
}
|
|
431
428
|
case 'quit': {
|
|
432
429
|
const quit = await promptConfirm(
|
|
433
|
-
'Are you sure you want to quit? All changes will be lost.'
|
|
430
|
+
'Are you sure you want to quit? All changes will be lost.',
|
|
434
431
|
);
|
|
435
432
|
return quit ? false : promptChangeAddonsReview(options);
|
|
436
433
|
}
|
|
@@ -14,6 +14,10 @@ export default async (manifestPath, sdkManifest, addons) => {
|
|
|
14
14
|
manifest.sdkBuildDate = sdkManifest.buildDate;
|
|
15
15
|
manifest.sdkVersion = sdkManifest.version.format();
|
|
16
16
|
|
|
17
|
+
// Delete old and deprecated 'legacyAddonNames' property if it's still
|
|
18
|
+
// present.
|
|
19
|
+
delete manifest.legacyAddonNames;
|
|
20
|
+
|
|
17
21
|
// Update the file.
|
|
18
22
|
await fs.writeJson(manifestPath, manifest, {
|
|
19
23
|
spaces: '\t',
|