chore(*): use prettier for formatting
This commit is contained in:
parent
6c659fe1d0
commit
ce869012ef
73 changed files with 1393 additions and 794 deletions
|
@ -12,12 +12,12 @@ export const addLinkToShare = async () => {
|
|||
{
|
||||
name: 'title',
|
||||
message: '📝 Title for the link:',
|
||||
validate: input => !!input || 'Title is required'
|
||||
validate: (input) => !!input || 'Title is required'
|
||||
},
|
||||
{
|
||||
name: 'link',
|
||||
message: '🔗 URL to share:',
|
||||
validate: input => input.startsWith('http') || 'Must be a valid URL'
|
||||
validate: (input) => input.startsWith('http') || 'Must be a valid URL'
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
|
@ -26,7 +26,7 @@ export const addLinkToShare = async () => {
|
|||
},
|
||||
{
|
||||
name: 'authorQuery',
|
||||
message: '👤 Search for an author:',
|
||||
message: '👤 Search for an author:'
|
||||
}
|
||||
]);
|
||||
|
||||
|
@ -38,13 +38,17 @@ export const addLinkToShare = async () => {
|
|||
type: 'confirm',
|
||||
name: 'shouldCreate',
|
||||
message: '❌ No authors found. Do you want to create a new one?',
|
||||
default: true,
|
||||
default: true
|
||||
});
|
||||
|
||||
if (!shouldCreate) return;
|
||||
|
||||
const { name, url, mastodon, rss, json, newsletter, blogroll } = await inquirer.prompt([
|
||||
{ name: 'name', message: '👤 Author name:', validate: input => !!input || 'Name is required' },
|
||||
{
|
||||
name: 'name',
|
||||
message: '👤 Author name:',
|
||||
validate: (input) => !!input || 'Name is required'
|
||||
},
|
||||
{ name: 'url', message: '🔗 URL (optional):', default: '' },
|
||||
{ name: 'mastodon', message: '🐘 Mastodon handle (optional):', default: '' },
|
||||
{ name: 'rss', message: '📡 RSS feed (optional):', default: '' },
|
||||
|
@ -69,13 +73,13 @@ export const addLinkToShare = async () => {
|
|||
type: 'list',
|
||||
name: 'author',
|
||||
message: 'Select an author:',
|
||||
choices: authorMatches.map(a => {
|
||||
choices: authorMatches.map((a) => {
|
||||
const cleanUrl = removeUrlProtocol(a.url);
|
||||
const display = cleanUrl ? `${a.name} (${cleanUrl})` : a.name;
|
||||
|
||||
return {
|
||||
name: display,
|
||||
value: a.id,
|
||||
value: a.id
|
||||
};
|
||||
})
|
||||
});
|
||||
|
@ -88,7 +92,7 @@ export const addLinkToShare = async () => {
|
|||
while (true) {
|
||||
const { query } = await inquirer.prompt({
|
||||
name: 'query',
|
||||
message: '🏷 Search for tags (or leave blank to finish):',
|
||||
message: '🏷 Search for tags (or leave blank to finish):'
|
||||
});
|
||||
|
||||
const trimmedQuery = query.trim();
|
||||
|
@ -106,7 +110,7 @@ export const addLinkToShare = async () => {
|
|||
type: 'checkbox',
|
||||
name: 'selected',
|
||||
message: '✔ Select tags to add:',
|
||||
choices: tags.map(tag => ({ name: tag.name, value: tag.id }))
|
||||
choices: tags.map((tag) => ({ name: tag.name, value: tag.id }))
|
||||
});
|
||||
|
||||
tagIds.push(...selected);
|
||||
|
@ -115,7 +119,7 @@ export const addLinkToShare = async () => {
|
|||
type: 'confirm',
|
||||
name: 'again',
|
||||
message: 'Search and select more tags?',
|
||||
default: false,
|
||||
default: false
|
||||
});
|
||||
|
||||
if (!again) break;
|
||||
|
@ -126,7 +130,7 @@ export const addLinkToShare = async () => {
|
|||
link,
|
||||
description,
|
||||
author,
|
||||
link_tags: tagIds.map(tagId => ({ tags_id: tagId })),
|
||||
link_tags: tagIds.map((tagId) => ({ tags_id: tagId })),
|
||||
date: new Date().toISOString()
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue