mirror of
https://github.com/Mibew/simple-icons.git
synced 2025-02-12 20:21:07 +03:00
Handle cleanly interruption signals on add-icon-data script (#10620)
This commit is contained in:
parent
8aab5ab4e5
commit
1401fb2a05
@ -84,7 +84,7 @@
|
|||||||
"url": "https://opencollective.com/simple-icons"
|
"url": "https://opencollective.com/simple-icons"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@inquirer/prompts": "3.2.0",
|
"@inquirer/prompts": "4.3.0",
|
||||||
"chalk": "5.3.0",
|
"chalk": "5.3.0",
|
||||||
"del-cli": "5.1.0",
|
"del-cli": "5.1.0",
|
||||||
"editorconfig-checker": "5.1.1",
|
"editorconfig-checker": "5.1.1",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { input, confirm, checkbox } from '@inquirer/prompts';
|
import { input, confirm, checkbox, ExitPromptError } from '@inquirer/prompts';
|
||||||
import autocomplete from 'inquirer-autocomplete-standalone';
|
import autocomplete from 'inquirer-autocomplete-standalone';
|
||||||
import getRelativeLuminance from 'get-relative-luminance';
|
import getRelativeLuminance from 'get-relative-luminance';
|
||||||
import { search } from 'fast-fuzzy';
|
import { search } from 'fast-fuzzy';
|
||||||
@ -88,6 +88,7 @@ const getIconDataFromAnswers = (answers) => ({
|
|||||||
: {}),
|
: {}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const run = async () => {
|
||||||
const answers = {};
|
const answers = {};
|
||||||
|
|
||||||
answers.title = await input({
|
answers.title = await input({
|
||||||
@ -184,3 +185,19 @@ if (answers.confirmToAdd) {
|
|||||||
console.log(chalk.red('\nAborted.'));
|
console.log(chalk.red('\nAborted.'));
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
try {
|
||||||
|
await run();
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof ExitPromptError) {
|
||||||
|
console.log(chalk.red('\nAborted.'));
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
await main();
|
||||||
|
Loading…
Reference in New Issue
Block a user