From 6345846b9afead5ce86790b60952f23c9800f6ef Mon Sep 17 00:00:00 2001 From: Brion Date: Sun, 10 Sep 2023 23:41:32 +0530 Subject: [PATCH 1/5] chore: use `terser` --- lib/rollup.config.cjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rollup.config.cjs b/lib/rollup.config.cjs index 4c734ae..eb05e1d 100644 --- a/lib/rollup.config.cjs +++ b/lib/rollup.config.cjs @@ -34,6 +34,7 @@ const pkg = require('./package.json'); module.exports = [ { cache: false, + external: ['fs', 'path'], input: 'src/index.ts', output: [ { @@ -59,9 +60,8 @@ module.exports = [ typescript({ tsconfig: './tsconfig.lib.json', }), - // terser(), + terser(), ], - // external: ['fs', 'path'], }, { cache: false, From 71ae4d0a3e090cf98494ffe013604d463d94aa84 Mon Sep 17 00:00:00 2001 From: Brion Date: Thu, 28 Dec 2023 14:27:20 +0530 Subject: [PATCH 2/5] feat: add ability to `init` medmark --- .npmrc | 1 + lib/package.json | 1 + lib/src/constants.ts | 8 ++ lib/src/converter.ts | 7 +- lib/src/debug.ts | 9 +- lib/src/index.ts | 51 ++++++-- lib/src/init.ts | 138 ++++++++++++++++++++ lib/src/output.ts | 43 ++++-- lib/src/public-api.ts | 3 + package.json | 2 +- playground/.eslintrc.cjs | 2 +- playground/.gitignore | 3 +- playground/.medmark/templates/playground.js | 81 ------------ playground/next.config.mjs | 34 ++++- playground/package.json | 11 +- playground/pages/blog/.gitkeep | 0 playground/scripts/pre-dev.js | 64 +++++++++ playground/site.config.js | 24 ++++ playground/theme.config.jsx | 25 +++- pnpm-lock.yaml | 62 ++++----- 20 files changed, 412 insertions(+), 157 deletions(-) create mode 100644 .npmrc create mode 100644 lib/src/init.ts delete mode 100755 playground/.medmark/templates/playground.js delete mode 100644 playground/pages/blog/.gitkeep create mode 100644 playground/scripts/pre-dev.js diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..6c59086 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +enable-pre-post-scripts=true diff --git a/lib/package.json b/lib/package.json index e7ede71..04ee5d5 100644 --- a/lib/package.json +++ b/lib/package.json @@ -36,6 +36,7 @@ "scripts": { "build": "pnpm clean:dist && rollup -c rollup.config.cjs", "clean:dist": "rimraf dist", + "dev": "pnpm clean:dist && rollup -c rollup.config.cjs --watch --watch.buildDelay 500", "format": "prettier --write \"**/*.{js,jsx,ts,tsx,css,json,md,mdx}\"", "test": "echo \"Error: no test specified\" && exit 0", "lint": "eslint . --ext .js,.jsx,.ts,.tsx", diff --git a/lib/src/constants.ts b/lib/src/constants.ts index 1ede026..593719e 100644 --- a/lib/src/constants.ts +++ b/lib/src/constants.ts @@ -26,3 +26,11 @@ * The delimiter used to split the HTML of embedded tweets */ export const EMBEDDED_TWEET_HTML_SPIT_DELIMITER: string = 'EMBEDDED_TWEET_HTML_SPIT_DELIMITER'; + +export const DEFAULT_MEDMARK_FOLDER_NAME: string = '.medmark'; +export const DEFAULT_MEDMARK_LOGS_FOLDER_NAME: string = 'logs'; +export const DEFAULT_MEDIUM_EXPORTS_FOLDER_NAME: string = 'medium-export'; +export const DEFAULT_MEDIUM_OUTPUT_FOLDER_NAME: string = 'output'; +export const DEFAULT_TEMPLATES_FOLDER_NAME: string = 'templates'; +export const DEFAULT_MEDMARK_TEMPLATE_SAMPLE_FILENAME: string = 'sample-medmark-template.js'; +export const MEDIUM_EXPORT_POSTS_FOLDER_NAME: string = 'posts'; diff --git a/lib/src/converter.ts b/lib/src/converter.ts index fc237ee..62e8967 100755 --- a/lib/src/converter.ts +++ b/lib/src/converter.ts @@ -47,6 +47,7 @@ import { } from './models/medmark/template'; import {MediumApolloState, MediumPostMetadata} from './models/medium'; import {MedmarkFrontMatterAuthor} from './models/medmark/front-matter'; +import chalk from 'chalk'; interface Paths { /** @@ -194,7 +195,7 @@ async function gatherPostData( postsToSkip: string[], ): Promise { output.note({ - bodyLines: [filePath], + bodyLines: [`${chalk.gray('[path]')} ${filePath}`], title: 'Gathering post data started', }); @@ -204,7 +205,7 @@ async function gatherPostData( await inlineGists($cheerio, reporter); } catch (e) { output.error({ - bodyLines: [`File Path: ${filePath}`, `Stack Trace: ${e}`], + bodyLines: [`${chalk.gray('[path]')} ${chalk.red(filePath)}`, `${chalk.gray('[stack]')} ${chalk.red(e)}`], title: 'An error occurred while inlining Gists', }); } @@ -373,7 +374,7 @@ async function convertMediumFile( const filename: string = basename(PATHS.file, '.html'); output.note({ - bodyLines: [`PATH: ${PATHS.file}`, `FILE: ${filename}`], + bodyLines: [`${chalk.gray('[path]')} ${PATHS.file}`, `${chalk.gray('[output]')} ${filename}`], title: 'Converting', }); diff --git a/lib/src/debug.ts b/lib/src/debug.ts index 3a7e922..563d9bd 100644 --- a/lib/src/debug.ts +++ b/lib/src/debug.ts @@ -25,6 +25,7 @@ import fs from 'fs-extra'; import {dirname, join, resolve} from 'path'; import ConfigurationService from './configuration-service'; +import {DEFAULT_MEDMARK_FOLDER_NAME, DEFAULT_MEDMARK_LOGS_FOLDER_NAME} from './constants'; /** * Defines the structure of the paths for the logs. @@ -83,7 +84,13 @@ const PATHS: { return resolve(join(PATHS.logs.root, articleId, 'meta.json')); }, }, - root: resolve(join('logs', ConfigurationService.getInstance().getRunnerTimestamp())), + root: resolve( + join( + DEFAULT_MEDMARK_FOLDER_NAME, + DEFAULT_MEDMARK_LOGS_FOLDER_NAME, + ConfigurationService.getInstance().getRunnerTimestamp(), + ), + ), }, }; diff --git a/lib/src/index.ts b/lib/src/index.ts index 44addf3..127d967 100644 --- a/lib/src/index.ts +++ b/lib/src/index.ts @@ -23,12 +23,24 @@ * SOFTWARE. */ -import {program} from 'commander'; +import {Command} from 'commander'; import inquirer from 'inquirer'; +import path from 'path'; import convert from './converter'; import ConfigurationService from './configuration-service'; import output from './output'; import debug from './debug'; +import init from './init'; +import { + DEFAULT_MEDIUM_EXPORTS_FOLDER_NAME, + DEFAULT_MEDIUM_OUTPUT_FOLDER_NAME, + DEFAULT_MEDMARK_FOLDER_NAME, + DEFAULT_MEDMARK_TEMPLATE_SAMPLE_FILENAME, + DEFAULT_TEMPLATES_FOLDER_NAME, + MEDIUM_EXPORT_POSTS_FOLDER_NAME, +} from './constants'; + +const program: Command = new Command(); program .version('0.1.0') @@ -49,18 +61,28 @@ program debug: debugMode, } = await inquirer.prompt([ { - message: 'Enter the path to the `posts` folder of the medium exported archive', + default: path.join( + DEFAULT_MEDMARK_FOLDER_NAME, + DEFAULT_MEDIUM_EXPORTS_FOLDER_NAME, + MEDIUM_EXPORT_POSTS_FOLDER_NAME, + ), + message: 'Enter the path to the `posts` folder of the medium exported archive.', name: 'input', type: 'input', }, { - default: 'output', - message: 'Enter destination folder for output files (default is "./")', + default: path.join(DEFAULT_MEDMARK_FOLDER_NAME, DEFAULT_MEDIUM_OUTPUT_FOLDER_NAME), + message: 'Enter destination folder for output files.', name: 'output', type: 'input', }, { - message: 'Enter the path to the template file', + default: path.join( + DEFAULT_MEDMARK_FOLDER_NAME, + DEFAULT_TEMPLATES_FOLDER_NAME, + DEFAULT_MEDMARK_TEMPLATE_SAMPLE_FILENAME, + ), + message: 'Enter the path to the template file.', name: 'template', type: 'input', }, @@ -71,7 +93,7 @@ program type: 'confirm', }, { - message: 'Enter a comma-separated list of files to skip', + message: 'Enter a comma-separated list of files to skip.', name: 'skip', type: 'input', }, @@ -87,11 +109,12 @@ program output.log({ bodyLines: [ - `→ ⬇️ INPUT: ${inputPath}`, - `→ ⬆️ OUTPUT (-o): ${outputPath}`, + `→ ⬇️ INPUT: ${inputPath}`, + `→ ⬆️ OUTPUT (-o): ${outputPath}`, `→ 💅 TEMPLATE (-t): ${templatePath || 'none'}`, `→ ❌ TO SKIP (-s): ${toSkip || 'none'}`, `→ 🚧 SHOULD EXPORT DRAFTS? (-d): ${drafts}`, + `→ 🐞 DEBUG MODE? (-D): ${debugMode}`, ], title: '💡 Following context has been initialized:', }); @@ -104,7 +127,15 @@ program } convert(inputPath, outputPath, templatePath, drafts, toSkip); - }) - .parse(process.argv); + }); + +program + .command('init') + .description('Initialize Medmark') + .action(async () => { + init(); + }); + +program.parse(process.argv); export * from './public-api'; diff --git a/lib/src/init.ts b/lib/src/init.ts new file mode 100644 index 0000000..0072c1c --- /dev/null +++ b/lib/src/init.ts @@ -0,0 +1,138 @@ +/** + * MIT License + * + * Copyright (c) 2023, Brion Mario + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import fs from 'fs'; +import path from 'path'; +import { + DEFAULT_MEDIUM_EXPORTS_FOLDER_NAME, + DEFAULT_MEDMARK_FOLDER_NAME, + DEFAULT_MEDMARK_TEMPLATE_SAMPLE_FILENAME, + DEFAULT_TEMPLATES_FOLDER_NAME, +} from './constants'; +import output from './output'; + +function init(): void { + try { + output.addNewline(); + output.log({ + title: '🚀 Initializing Medmark...', + }); + + const medmarkDir: string = path.join(process.cwd(), DEFAULT_MEDMARK_FOLDER_NAME); + const mediumExportDir: string = path.join(medmarkDir, DEFAULT_MEDIUM_EXPORTS_FOLDER_NAME); + const templatesDir: string = path.join(medmarkDir, DEFAULT_TEMPLATES_FOLDER_NAME); + const sampleTemplateFile: string = path.join(templatesDir, DEFAULT_MEDMARK_TEMPLATE_SAMPLE_FILENAME); + + // Create the .medmark folder + if (!fs.existsSync(medmarkDir)) { + fs.mkdirSync(medmarkDir); + output.log({bodyLines: [output.check({text: `${DEFAULT_MEDMARK_FOLDER_NAME} folder created.`})]}); + } else { + output.log({bodyLines: [output.skip({text: `${DEFAULT_MEDMARK_FOLDER_NAME} folder already exists.`})]}); + } + + // Create the medium-export folder and .gitkeep file + if (!fs.existsSync(mediumExportDir)) { + fs.mkdirSync(mediumExportDir); + fs.writeFileSync(path.join(mediumExportDir, '.gitkeep'), ''); + output.log({bodyLines: [output.check({text: `${DEFAULT_MEDIUM_EXPORTS_FOLDER_NAME} folder created.`})]}); + } else { + output.log({bodyLines: [output.skip({text: `${DEFAULT_MEDIUM_EXPORTS_FOLDER_NAME} folder already exists.`})]}); + } + + // Create the templates folder + if (!fs.existsSync(templatesDir)) { + fs.mkdirSync(templatesDir); + output.log({bodyLines: [output.check({text: `${DEFAULT_TEMPLATES_FOLDER_NAME} folder created.`})]}); + } else { + output.log({bodyLines: [output.skip({text: `${DEFAULT_TEMPLATES_FOLDER_NAME} folder already exists.`})]}); + } + + // Create the sample-template.js file with content + const sampleTemplateContent: string = `\ +const { frontMatterToYaml } = require('medmark'); + +module.exports = { + getOptions() { + return { + defaultCodeBlockLanguage: 'js', + folderForEachSlug: true, + imagePath: '/resources', + imageStorageStrategy: 'REMOTE', + }; + }, + + render(data) { + const date = new Date(data.published); + const prettyDate = \`\${date.getFullYear()}-\${(date.getMonth() + 1).toString().padStart(2, 0)}-\${date.getDate().toString().padStart(2, 0)}\`; + + const frontMatterAsJSON = { + slug: \`/posts/\${data.titleForSlug}/\`, + date: prettyDate, + title: data.title, + description: data.description, + authors: data.authors, + readingTime: data.readingTime, + draft: data.draft, + categories: data.categories, + tags: data.tags, + bannerImage: data.images.map(image => image.mediumUrl)[0], + ogImage: data.images.map(image => image.mediumUrl)[0], + images: data.images.map(image => image.mediumUrl), + }; + + const frontMatter = \`\\ +--- +\${frontMatterToYaml(frontMatterAsJSON)} +--- + +\${data.body} +\`; + + return frontMatter; + }, +}; +`; + + if (!fs.existsSync(sampleTemplateFile)) { + fs.writeFileSync(sampleTemplateFile, sampleTemplateContent); + output.log({bodyLines: [output.check({text: `${DEFAULT_MEDMARK_TEMPLATE_SAMPLE_FILENAME} file created.`})]}); + } else { + output.log({ + bodyLines: [output.skip({text: `${DEFAULT_MEDMARK_TEMPLATE_SAMPLE_FILENAME} file already exists.`})], + }); + } + + output.success({ + title: '🎉 Initialization completed successfully.', + }); + } catch (error) { + output.error({ + bodyLines: [error.message.toString()], + title: '❌ Initialization failed.', + }); + } +} + +export default init; diff --git a/lib/src/output.ts b/lib/src/output.ts index d5a5e21..2700efb 100644 --- a/lib/src/output.ts +++ b/lib/src/output.ts @@ -77,6 +77,17 @@ export interface CLISuccessMessageConfig { title: string; } +export interface CLILogMessageConfig { + /** + * An array of strings representing the body of the log message. + */ + bodyLines?: string[] | void[]; + /** + * The title of the log message. + */ + title?: string; +} + class CLIOutput { readonly X_PADDING: string = ' '; @@ -148,12 +159,12 @@ class CLIOutput { * @param body - The body to write to the response. If `null` or `undefined`, no body will be written. * @returns A Promise that resolves once the body has been written to the response. */ - private writeOptionalOutputBody(bodyLines?: string[]): void { + private writeOptionalOutputBody(bodyLines?: string[] | void[]): void { if (!bodyLines) { return; } - this.addNewline(); - bodyLines.forEach((bodyLine: string) => this.writeToStdOut(` ${bodyLine}${EOL}`)); + + bodyLines.forEach((bodyLine: string | void) => this.writeToStdOut(` ${bodyLine}${EOL}`)); } /** @@ -318,18 +329,32 @@ class CLIOutput { * @param config.bodyLines - The body lines of the log message. Optional. * @param config.color - The color of the log message. Optional. */ - log({title, bodyLines, color}: CLIWarnMessageConfig & {color?: string}): void { - this.addNewline(); + log({title, bodyLines, color}: CLILogMessageConfig & {color?: string}): void { + if (title) { + this.addNewline(); - this.writeOutputTitle({ - color: 'cyan', - title: color ? (chalk as any)[color](title) : title, - }); + this.writeOutputTitle({ + color: 'cyan', + title: color ? (chalk as any)[color](title) : title, + }); + + this.addNewline(); + } this.writeOptionalOutputBody(bodyLines); this.addNewline(); } + + // eslint-disable-next-line class-methods-use-this + check({text, color}: {color?: string; text: string}): string { + return `${chalk.green('✔')} ${color ? (chalk as any)[color](text) : text}`; + } + + // eslint-disable-next-line class-methods-use-this + skip({text, color}: {color?: string; text: string}): string { + return `${chalk.yellow('🚸')} ${color ? (chalk as any)[color](text) : text}`; + } } export default new CLIOutput(); diff --git a/lib/src/public-api.ts b/lib/src/public-api.ts index 20e3e5b..4b5bb9f 100644 --- a/lib/src/public-api.ts +++ b/lib/src/public-api.ts @@ -23,3 +23,6 @@ */ export {frontMatterToYaml} from './utils'; +export {default as chalk} from 'chalk'; +export * from './constants'; +export {default as logger} from './output'; diff --git a/package.json b/package.json index 498b12b..d3e4aef 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "author": "Brion Mario", "repository": { "type": "git", - "url": "https://github.com/brionmario/markdown" + "url": "https://github.com/brionmario/medmark" }, "scripts": { "build": "turbo run build", diff --git a/playground/.eslintrc.cjs b/playground/.eslintrc.cjs index b93f9b6..df02b17 100644 --- a/playground/.eslintrc.cjs +++ b/playground/.eslintrc.cjs @@ -46,6 +46,6 @@ module.exports = { project: [path.resolve(__dirname, 'tsconfig.eslint.json')], }, rules: { - 'import/prefer-default-export': 'off', + 'import/no-extraneous-dependencies': ['error', {devDependencies: ['**/*.config.*cjs', '**/scripts/*.js']}], }, }; diff --git a/playground/.gitignore b/playground/.gitignore index 4f4dd6e..407943b 100755 --- a/playground/.gitignore +++ b/playground/.gitignore @@ -42,5 +42,6 @@ yarn-error.log* next-env.d.ts # Medmark -!.medmark/templates +# TODO: Modify these as necessary if you are planning to use the playground for an actual project. .medmark +pages/blogs diff --git a/playground/.medmark/templates/playground.js b/playground/.medmark/templates/playground.js deleted file mode 100755 index 00905a2..0000000 --- a/playground/.medmark/templates/playground.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * MIT License - * - * Copyright (c) 2022, Brion Mario. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -const {frontMatterToYaml} = require('medmark'); - -module.exports = { - /** - * Returns an object with default options for rendering markdown. - * @returns {Object} Object containing default options. - */ - getOptions() { - return { - defaultCodeBlockLanguage: 'js', // Set default language for code blocks. - folderForEachSlug: true, // Create a separate folder for each blog post. - imagePath: '/resources', // Path for images referenced in markdown files. - imageStorageStrategy: 'REMOTE', // Where to store images. - }; - }, - - /** - * Takes a data object and returns a string of front matter and markdown body. - * @param {Object} data Data object containing blog post information. - * @returns {string} String containing front matter and markdown. - */ - render(data) { - // Convert published date to YYYY-MM-DD format. - const date = new Date(data.published); - const prettyDate = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, 0)}-${date - .getDate() - .toString() - .padStart(2, 0)}`; - - /* eslint-disable sort-keys */ - const frontMatterAsJSON = { - slug: `/posts/${data.titleForSlug}/`, - date: prettyDate, - title: data.title, - description: data.description, - authors: data.authors, - readingTime: data.readingTime, - draft: data.draft, - categories: data.categories, - tags: data.tags, - bannerImage: data.images.map(image => image.mediumUrl)[0], - ogImage: data.images.map(image => image.mediumUrl)[0], - images: data.images.map(image => image.mediumUrl), - }; - /* eslint-enable sort-keys */ - - const frontMatter = `\ ---- -${frontMatterToYaml(frontMatterAsJSON)} ---- - -${data.body} -`; - - return frontMatter; - }, -}; diff --git a/playground/next.config.mjs b/playground/next.config.mjs index e1c9cbb..4a72398 100644 --- a/playground/next.config.mjs +++ b/playground/next.config.mjs @@ -1,13 +1,37 @@ -import nextra from 'nextra' +/** + * MIT License + * + * Copyright (c) 2023, Brion Mario + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +import nextra from 'nextra'; const withNextra = nextra({ theme: 'nextra-theme-blog', themeConfig: './theme.config.jsx', staticImage: true, defaultShowCopyCode: true, - readingTime: true -}) + readingTime: true, +}); export default withNextra({ - reactStrictMode: true -}) + reactStrictMode: true, +}); diff --git a/playground/package.json b/playground/package.json index 4aaaa74..3e3c30d 100644 --- a/playground/package.json +++ b/playground/package.json @@ -19,12 +19,14 @@ "medmark-sample" ], "scripts": { - "dev": "next", "build": "next build", - "lint": "next lint", - "start": "next start", + "clean": "rimraf .next .turbo", "debug": "NODE_OPTIONS='--inspect' next dev", - "clean": "rimraf .next .turbo" + "predev": "node scripts/pre-dev.js", + "dev": "next", + "lint": "next lint", + "medmark": "medmark", + "start": "next start" }, "dependencies": { "next": "^13.4.3", @@ -38,6 +40,7 @@ "@brionmario/prettier-config": "^0.1.0", "eslint": "^8.30.0", "eslint-plugin-mdx": "^2.0.5", + "fs-extra": "^11.1.0", "medmark": "workspace:*", "prettier": "^2.8.1" } diff --git a/playground/pages/blog/.gitkeep b/playground/pages/blog/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/playground/scripts/pre-dev.js b/playground/scripts/pre-dev.js new file mode 100644 index 0000000..6274f35 --- /dev/null +++ b/playground/scripts/pre-dev.js @@ -0,0 +1,64 @@ +#!/usr/bin/env node +/** + * MIT License + * + * Copyright (c) 2023, Brion Mario + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +const path = require('path'); +const fs = require('fs-extra'); + +const logger = { + // eslint-disable-next-line no-console + log: console.log, + // eslint-disable-next-line no-console + error: console.error, +}; + +/* ====================================================================================== */ +/* Execution starts from here */ +/* ====================================================================================== */ + +logger.log('⚠️ Checking for Medmark Posts'); + +if (!fs.existsSync(path.resolve(__dirname, path.join('..', '.medmark', 'output')))) { + logger.log('No Medmark posts directory found (.medmark/output)'); + logger.log( + 'Run `pnpm medmark init` to initialize Medmark and then copy the posts from the medium archive to .medmark/medium-output', + ); + process.exit(1); +} + +logger.log('> Started copying Medmark Posts'); + +try { + fs.copySync( + path.resolve(__dirname, path.join('..', '.medmark', 'output')), + path.resolve(__dirname, path.join('..', 'pages', 'blogs')), + {overwrite: true}, + ); + + logger.log('✅ Successfully copied Medmark Posts'); +} catch (e) { + logger.error('❌ Failed to copy Medmark Posts'); + logger.error(e); + process.exit(1); +} diff --git a/playground/site.config.js b/playground/site.config.js index ff8b4c5..8ea2a4d 100644 --- a/playground/site.config.js +++ b/playground/site.config.js @@ -1 +1,25 @@ +/** + * MIT License + * + * Copyright (c) 2023, Brion Mario + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + export default {}; diff --git a/playground/theme.config.jsx b/playground/theme.config.jsx index a7980c2..6a946f8 100644 --- a/playground/theme.config.jsx +++ b/playground/theme.config.jsx @@ -1,6 +1,29 @@ +/** + * MIT License + * + * Copyright (c) 2023, Brion Mario + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import Footer from './components/Footer'; -/* eslint sort-keys: error */ export default { components: { h1: ({children}) => ( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c5afacc..0564296 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -68,6 +68,9 @@ importers: node-html-parser: specifier: ^6.1.4 version: 6.1.4 + request: + specifier: ^2.88.2 + version: 2.88.2 turndown: specifier: ^4.0.1 version: 4.0.2 @@ -96,6 +99,9 @@ importers: '@rollup/plugin-typescript': specifier: ^11.1.0 version: 11.1.0(rollup@3.20.2)(tslib@2.5.0)(typescript@4.9.5) + '@types/gradient-string': + specifier: ^1.1.5 + version: 1.1.5 '@types/node': specifier: ^18.15.11 version: 18.15.11 @@ -163,12 +169,18 @@ importers: eslint-plugin-mdx: specifier: ^2.0.5 version: 2.1.0(eslint@8.30.0) + fs-extra: + specifier: ^11.1.0 + version: 11.1.0 medmark: specifier: workspace:* version: link:../lib prettier: specifier: ^2.8.1 version: 2.8.1 + request: + specifier: ^2.88.2 + version: 2.88.2 packages: @@ -1240,6 +1252,12 @@ packages: /@types/estree@1.0.0: resolution: {integrity: sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==} + /@types/gradient-string@1.1.5: + resolution: {integrity: sha512-Z2VPQ0q+IhrAO7XjJSjpDsoPc+CsCshRNah1IE9LCo/NzHMHylssvx73i0BAKzuaGj9cdhmgq9rLaietpYAbKQ==} + dependencies: + '@types/tinycolor2': 1.4.6 + dev: true + /@types/hast@2.3.4: resolution: {integrity: sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==} dependencies: @@ -1335,6 +1353,10 @@ packages: resolution: {integrity: sha512-dPWnWsf+kzIG140B8z2w3fr5D03TLWbOAFQl45xUpI3vcizeXriNR5VYkWZ+WTMsUHqZ9Xlt3hrxGNANFyNQfw==} dev: true + /@types/tinycolor2@1.4.6: + resolution: {integrity: sha512-iEN8J0BoMnsWBqjVbWH/c0G0Hh7O21lpR2/+PrvAVgWdzL7eexIFm4JN/Wn10PTcmNdtS6U67r499mlWMXOxNw==} + dev: true + /@types/turndown@5.0.1: resolution: {integrity: sha512-N8Ad4e3oJxh9n9BiZx9cbe/0M3kqDpOTm2wzj13wdDUxDPjfjloWIJaquZzWE1cYTAHpjOH3rcTnXQdpEfS/SQ==} dev: true @@ -1675,12 +1697,10 @@ packages: resolution: {integrity: sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==} dependencies: safer-buffer: 2.1.2 - dev: false /assert-plus@1.0.0: resolution: {integrity: sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==} engines: {node: '>=0.8'} - dev: false /ast-types-flow@0.0.7: resolution: {integrity: sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==} @@ -1697,15 +1717,12 @@ packages: /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - dev: false /aws-sign2@0.7.0: resolution: {integrity: sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==} - dev: false /aws4@1.11.0: resolution: {integrity: sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==} - dev: false /axe-core@4.6.1: resolution: {integrity: sha512-lCZN5XRuOnpG4bpMq8v0khrWtUOn+i8lZSb6wHZH56ZfbIEv6XwJV84AAueh9/zi7qPVJ/E4yz6fmsiyOmXR4w==} @@ -1731,7 +1748,6 @@ packages: resolution: {integrity: sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==} dependencies: tweetnacl: 0.14.5 - dev: false /better-path-resolve@1.0.0: resolution: {integrity: sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==} @@ -1883,7 +1899,6 @@ packages: /caseless@0.12.0: resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==} - dev: false /ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} @@ -2048,7 +2063,6 @@ packages: engines: {node: '>= 0.8'} dependencies: delayed-stream: 1.0.0 - dev: false /comma-separated-tokens@2.0.3: resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} @@ -2100,7 +2114,6 @@ packages: /core-util-is@1.0.2: resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} - dev: false /create-require@1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} @@ -2197,7 +2210,6 @@ packages: engines: {node: '>=0.10'} dependencies: assert-plus: 1.0.0 - dev: false /data-uri-to-buffer@4.0.1: resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==} @@ -2312,7 +2324,6 @@ packages: /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} - dev: false /dequal@2.0.3: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} @@ -2399,7 +2410,6 @@ packages: dependencies: jsbn: 0.1.1 safer-buffer: 2.1.2 - dev: false /electron-to-chromium@1.4.284: resolution: {integrity: sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==} @@ -3140,7 +3150,6 @@ packages: /extsprintf@1.3.0: resolution: {integrity: sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==} engines: {'0': node >=0.6.0} - dev: false /fake-useragent@1.0.1: resolution: {integrity: sha512-BOQh1TM//DhrVaeZ+b3w3s4E40rfYcDTn5aoSM2w1xVsZVGglNOzPR5H8KDO8NmF8sT4ppxyb4/MHGIHfZsVDA==} @@ -3264,7 +3273,6 @@ packages: /forever-agent@0.6.1: resolution: {integrity: sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==} - dev: false /form-data@2.3.3: resolution: {integrity: sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==} @@ -3273,7 +3281,6 @@ packages: asynckit: 0.4.0 combined-stream: 1.0.8 mime-types: 2.1.35 - dev: false /format@0.2.2: resolution: {integrity: sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==} @@ -3294,7 +3301,6 @@ packages: graceful-fs: 4.2.10 jsonfile: 6.1.0 universalify: 2.0.0 - dev: false /fs-extra@7.0.1: resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==} @@ -3382,7 +3388,6 @@ packages: resolution: {integrity: sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==} dependencies: assert-plus: 1.0.0 - dev: false /github-slugger@2.0.0: resolution: {integrity: sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==} @@ -3506,7 +3511,6 @@ packages: /har-schema@2.0.0: resolution: {integrity: sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==} engines: {node: '>=4'} - dev: false /har-validator@5.1.5: resolution: {integrity: sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==} @@ -3515,7 +3519,6 @@ packages: dependencies: ajv: 6.12.6 har-schema: 2.0.0 - dev: false /hard-rejection@2.1.0: resolution: {integrity: sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==} @@ -3699,7 +3702,6 @@ packages: assert-plus: 1.0.0 jsprim: 1.4.2 sshpk: 1.17.0 - dev: false /human-id@1.0.2: resolution: {integrity: sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==} @@ -4051,7 +4053,6 @@ packages: /is-typedarray@1.0.0: resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} - dev: false /is-unicode-supported@1.3.0: resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} @@ -4081,7 +4082,6 @@ packages: /isstream@0.1.2: resolution: {integrity: sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==} - dev: false /jackspeak@2.2.1: resolution: {integrity: sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==} @@ -4118,7 +4118,6 @@ packages: /jsbn@0.1.1: resolution: {integrity: sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==} - dev: false /jsdom@11.12.0: resolution: {integrity: sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==} @@ -4184,7 +4183,6 @@ packages: /json-stringify-safe@5.0.1: resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} - dev: false /json-to-pretty-yaml@1.2.2: resolution: {integrity: sha512-rvm6hunfCcqegwYaG5T4yKJWxc9FXFgBVrcTZ4XfSVRwa5HA/Xs+vB/Eo9treYYHCeNM0nrSUr82V/M31Urc7A==} @@ -4222,7 +4220,6 @@ packages: universalify: 2.0.0 optionalDependencies: graceful-fs: 4.2.10 - dev: false /jsprim@1.4.2: resolution: {integrity: sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==} @@ -4232,7 +4229,6 @@ packages: extsprintf: 1.3.0 json-schema: 0.4.0 verror: 1.10.0 - dev: false /jsx-ast-utils@3.3.3: resolution: {integrity: sha512-fYQHZTZ8jSfmWZ0iyzfwiU4WDX4HpHbMCZ3gPlWYiCl3BoeOTsqKBqnTVfH2rYT7eP5c3sVbeSPHnnJOaTrWiw==} @@ -5040,14 +5036,12 @@ packages: /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} - dev: false /mime-types@2.1.35: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} dependencies: mime-db: 1.52.0 - dev: false /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} @@ -5385,7 +5379,6 @@ packages: /oauth-sign@0.9.0: resolution: {integrity: sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==} - dev: false /object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} @@ -5723,7 +5716,6 @@ packages: /performance-now@2.1.0: resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} - dev: false /periscopic@3.1.0: resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==} @@ -5826,7 +5818,6 @@ packages: /psl@1.9.0: resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} - dev: false /punycode@2.1.1: resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==} @@ -5835,7 +5826,6 @@ packages: /qs@6.5.3: resolution: {integrity: sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==} engines: {node: '>=0.6'} - dev: false /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -6119,7 +6109,6 @@ packages: tough-cookie: 2.5.0 tunnel-agent: 0.6.0 uuid: 3.4.0 - dev: false /require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} @@ -6469,7 +6458,6 @@ packages: jsbn: 0.1.1 safer-buffer: 2.1.2 tweetnacl: 0.14.5 - dev: false /stdin-discarder@0.1.0: resolution: {integrity: sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==} @@ -6744,7 +6732,6 @@ packages: dependencies: psl: 1.9.0 punycode: 2.1.1 - dev: false /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} @@ -6848,7 +6835,6 @@ packages: resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==} dependencies: safe-buffer: 5.2.1 - dev: false /turbo-darwin-64@1.10.3: resolution: {integrity: sha512-IIB9IomJGyD3EdpSscm7Ip1xVWtYb7D0x7oH3vad3gjFcjHJzDz9xZ/iw/qItFEW+wGFcLSRPd+1BNnuLM8AsA==} @@ -6926,7 +6912,6 @@ packages: /tweetnacl@0.14.5: resolution: {integrity: sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==} - dev: false /type-check@0.3.2: resolution: {integrity: sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==} @@ -7125,7 +7110,6 @@ packages: /universalify@2.0.0: resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} engines: {node: '>= 10.0.0'} - dev: false /untildify@4.0.0: resolution: {integrity: sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==} @@ -7154,7 +7138,6 @@ packages: resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==} deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. hasBin: true - dev: false /uvu@0.5.6: resolution: {integrity: sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==} @@ -7183,7 +7166,6 @@ packages: assert-plus: 1.0.0 core-util-is: 1.0.2 extsprintf: 1.3.0 - dev: false /vfile-location@4.1.0: resolution: {integrity: sha512-YF23YMyASIIJXpktBa4vIGLJ5Gs88UB/XePgqPmTa7cDA+JeO3yclbpheQYCHjVHBn/yePzrXuygIL+xbvRYHw==} From 9ff5d7641811aa18154ca5802992b2feab5ddf8e Mon Sep 17 00:00:00 2001 From: Brion Date: Thu, 28 Dec 2023 14:32:01 +0530 Subject: [PATCH 3/5] =?UTF-8?q?chore:=20add=20changeset=20=F0=9F=A6=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/smooth-pandas-fetch.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .changeset/smooth-pandas-fetch.md diff --git a/.changeset/smooth-pandas-fetch.md b/.changeset/smooth-pandas-fetch.md new file mode 100644 index 0000000..c1b7298 --- /dev/null +++ b/.changeset/smooth-pandas-fetch.md @@ -0,0 +1,21 @@ +--- +'medmark-playground': minor +'medmark': minor +--- + +Add ability to init Medmark by executing `medmark init`. + +```bash +medmark init +``` +This will do the following. + +- Create a `.medmark` folder at the root of the execution with the following folder structure. + +```bash +├── .medmark +│ ├── medium-export # Should extract the medium archive here. +│ │ ├── .gitkeep +│ ├── templates # Should contain the templates for Medmark. +│ │ ├── sample-medmark-template.js +``` From f262b0114d56cf384b06676e88f7acb774189fa0 Mon Sep 17 00:00:00 2001 From: Brion Date: Thu, 28 Dec 2023 14:41:57 +0530 Subject: [PATCH 4/5] chore: update package-lock.yaml --- pnpm-lock.yaml | 56 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0564296..54f6c61 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -68,9 +68,6 @@ importers: node-html-parser: specifier: ^6.1.4 version: 6.1.4 - request: - specifier: ^2.88.2 - version: 2.88.2 turndown: specifier: ^4.0.1 version: 4.0.2 @@ -99,9 +96,6 @@ importers: '@rollup/plugin-typescript': specifier: ^11.1.0 version: 11.1.0(rollup@3.20.2)(tslib@2.5.0)(typescript@4.9.5) - '@types/gradient-string': - specifier: ^1.1.5 - version: 1.1.5 '@types/node': specifier: ^18.15.11 version: 18.15.11 @@ -178,9 +172,6 @@ importers: prettier: specifier: ^2.8.1 version: 2.8.1 - request: - specifier: ^2.88.2 - version: 2.88.2 packages: @@ -1252,12 +1243,6 @@ packages: /@types/estree@1.0.0: resolution: {integrity: sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==} - /@types/gradient-string@1.1.5: - resolution: {integrity: sha512-Z2VPQ0q+IhrAO7XjJSjpDsoPc+CsCshRNah1IE9LCo/NzHMHylssvx73i0BAKzuaGj9cdhmgq9rLaietpYAbKQ==} - dependencies: - '@types/tinycolor2': 1.4.6 - dev: true - /@types/hast@2.3.4: resolution: {integrity: sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==} dependencies: @@ -1353,10 +1338,6 @@ packages: resolution: {integrity: sha512-dPWnWsf+kzIG140B8z2w3fr5D03TLWbOAFQl45xUpI3vcizeXriNR5VYkWZ+WTMsUHqZ9Xlt3hrxGNANFyNQfw==} dev: true - /@types/tinycolor2@1.4.6: - resolution: {integrity: sha512-iEN8J0BoMnsWBqjVbWH/c0G0Hh7O21lpR2/+PrvAVgWdzL7eexIFm4JN/Wn10PTcmNdtS6U67r499mlWMXOxNw==} - dev: true - /@types/turndown@5.0.1: resolution: {integrity: sha512-N8Ad4e3oJxh9n9BiZx9cbe/0M3kqDpOTm2wzj13wdDUxDPjfjloWIJaquZzWE1cYTAHpjOH3rcTnXQdpEfS/SQ==} dev: true @@ -1697,10 +1678,12 @@ packages: resolution: {integrity: sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==} dependencies: safer-buffer: 2.1.2 + dev: false /assert-plus@1.0.0: resolution: {integrity: sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==} engines: {node: '>=0.8'} + dev: false /ast-types-flow@0.0.7: resolution: {integrity: sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==} @@ -1717,12 +1700,15 @@ packages: /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + dev: false /aws-sign2@0.7.0: resolution: {integrity: sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==} + dev: false /aws4@1.11.0: resolution: {integrity: sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==} + dev: false /axe-core@4.6.1: resolution: {integrity: sha512-lCZN5XRuOnpG4bpMq8v0khrWtUOn+i8lZSb6wHZH56ZfbIEv6XwJV84AAueh9/zi7qPVJ/E4yz6fmsiyOmXR4w==} @@ -1748,6 +1734,7 @@ packages: resolution: {integrity: sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==} dependencies: tweetnacl: 0.14.5 + dev: false /better-path-resolve@1.0.0: resolution: {integrity: sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==} @@ -1899,6 +1886,7 @@ packages: /caseless@0.12.0: resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==} + dev: false /ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} @@ -2063,6 +2051,7 @@ packages: engines: {node: '>= 0.8'} dependencies: delayed-stream: 1.0.0 + dev: false /comma-separated-tokens@2.0.3: resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} @@ -2114,6 +2103,7 @@ packages: /core-util-is@1.0.2: resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} + dev: false /create-require@1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} @@ -2210,6 +2200,7 @@ packages: engines: {node: '>=0.10'} dependencies: assert-plus: 1.0.0 + dev: false /data-uri-to-buffer@4.0.1: resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==} @@ -2324,6 +2315,7 @@ packages: /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} + dev: false /dequal@2.0.3: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} @@ -2410,6 +2402,7 @@ packages: dependencies: jsbn: 0.1.1 safer-buffer: 2.1.2 + dev: false /electron-to-chromium@1.4.284: resolution: {integrity: sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==} @@ -3150,6 +3143,7 @@ packages: /extsprintf@1.3.0: resolution: {integrity: sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==} engines: {'0': node >=0.6.0} + dev: false /fake-useragent@1.0.1: resolution: {integrity: sha512-BOQh1TM//DhrVaeZ+b3w3s4E40rfYcDTn5aoSM2w1xVsZVGglNOzPR5H8KDO8NmF8sT4ppxyb4/MHGIHfZsVDA==} @@ -3273,6 +3267,7 @@ packages: /forever-agent@0.6.1: resolution: {integrity: sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==} + dev: false /form-data@2.3.3: resolution: {integrity: sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==} @@ -3281,6 +3276,7 @@ packages: asynckit: 0.4.0 combined-stream: 1.0.8 mime-types: 2.1.35 + dev: false /format@0.2.2: resolution: {integrity: sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==} @@ -3388,6 +3384,7 @@ packages: resolution: {integrity: sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==} dependencies: assert-plus: 1.0.0 + dev: false /github-slugger@2.0.0: resolution: {integrity: sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==} @@ -3511,6 +3508,7 @@ packages: /har-schema@2.0.0: resolution: {integrity: sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==} engines: {node: '>=4'} + dev: false /har-validator@5.1.5: resolution: {integrity: sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==} @@ -3519,6 +3517,7 @@ packages: dependencies: ajv: 6.12.6 har-schema: 2.0.0 + dev: false /hard-rejection@2.1.0: resolution: {integrity: sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==} @@ -3702,6 +3701,7 @@ packages: assert-plus: 1.0.0 jsprim: 1.4.2 sshpk: 1.17.0 + dev: false /human-id@1.0.2: resolution: {integrity: sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==} @@ -4053,6 +4053,7 @@ packages: /is-typedarray@1.0.0: resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} + dev: false /is-unicode-supported@1.3.0: resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} @@ -4082,6 +4083,7 @@ packages: /isstream@0.1.2: resolution: {integrity: sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==} + dev: false /jackspeak@2.2.1: resolution: {integrity: sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==} @@ -4118,6 +4120,7 @@ packages: /jsbn@0.1.1: resolution: {integrity: sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==} + dev: false /jsdom@11.12.0: resolution: {integrity: sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==} @@ -4183,6 +4186,7 @@ packages: /json-stringify-safe@5.0.1: resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} + dev: false /json-to-pretty-yaml@1.2.2: resolution: {integrity: sha512-rvm6hunfCcqegwYaG5T4yKJWxc9FXFgBVrcTZ4XfSVRwa5HA/Xs+vB/Eo9treYYHCeNM0nrSUr82V/M31Urc7A==} @@ -4229,6 +4233,7 @@ packages: extsprintf: 1.3.0 json-schema: 0.4.0 verror: 1.10.0 + dev: false /jsx-ast-utils@3.3.3: resolution: {integrity: sha512-fYQHZTZ8jSfmWZ0iyzfwiU4WDX4HpHbMCZ3gPlWYiCl3BoeOTsqKBqnTVfH2rYT7eP5c3sVbeSPHnnJOaTrWiw==} @@ -5036,12 +5041,14 @@ packages: /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} + dev: false /mime-types@2.1.35: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} dependencies: mime-db: 1.52.0 + dev: false /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} @@ -5379,6 +5386,7 @@ packages: /oauth-sign@0.9.0: resolution: {integrity: sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==} + dev: false /object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} @@ -5716,6 +5724,7 @@ packages: /performance-now@2.1.0: resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} + dev: false /periscopic@3.1.0: resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==} @@ -5818,6 +5827,7 @@ packages: /psl@1.9.0: resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} + dev: false /punycode@2.1.1: resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==} @@ -5826,6 +5836,7 @@ packages: /qs@6.5.3: resolution: {integrity: sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==} engines: {node: '>=0.6'} + dev: false /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -6109,6 +6120,7 @@ packages: tough-cookie: 2.5.0 tunnel-agent: 0.6.0 uuid: 3.4.0 + dev: false /require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} @@ -6458,6 +6470,7 @@ packages: jsbn: 0.1.1 safer-buffer: 2.1.2 tweetnacl: 0.14.5 + dev: false /stdin-discarder@0.1.0: resolution: {integrity: sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==} @@ -6732,6 +6745,7 @@ packages: dependencies: psl: 1.9.0 punycode: 2.1.1 + dev: false /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} @@ -6835,6 +6849,7 @@ packages: resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==} dependencies: safe-buffer: 5.2.1 + dev: false /turbo-darwin-64@1.10.3: resolution: {integrity: sha512-IIB9IomJGyD3EdpSscm7Ip1xVWtYb7D0x7oH3vad3gjFcjHJzDz9xZ/iw/qItFEW+wGFcLSRPd+1BNnuLM8AsA==} @@ -6912,6 +6927,7 @@ packages: /tweetnacl@0.14.5: resolution: {integrity: sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==} + dev: false /type-check@0.3.2: resolution: {integrity: sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==} @@ -7138,6 +7154,7 @@ packages: resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==} deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. hasBin: true + dev: false /uvu@0.5.6: resolution: {integrity: sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==} @@ -7166,6 +7183,7 @@ packages: assert-plus: 1.0.0 core-util-is: 1.0.2 extsprintf: 1.3.0 + dev: false /vfile-location@4.1.0: resolution: {integrity: sha512-YF23YMyASIIJXpktBa4vIGLJ5Gs88UB/XePgqPmTa7cDA+JeO3yclbpheQYCHjVHBn/yePzrXuygIL+xbvRYHw==} From 649586b96814d08173cf5c6be0e3333e08800ae9 Mon Sep 17 00:00:00 2001 From: Brion Date: Thu, 28 Dec 2023 14:44:51 +0530 Subject: [PATCH 5/5] chore: fix lint issues --- lib/src/converter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/converter.ts b/lib/src/converter.ts index 62e8967..a65cc6f 100755 --- a/lib/src/converter.ts +++ b/lib/src/converter.ts @@ -28,6 +28,7 @@ import fs, {WriteStream} from 'fs'; import cheerio, {CheerioAPI, Element, Cheerio} from 'cheerio'; import mkdirp from 'mkdirp'; import {join, resolve, basename, extname} from 'path'; +import chalk from 'chalk'; import output from './output'; import {transformHtmlToMarkdown} from './markdown'; import Reporter from './reporter'; @@ -47,7 +48,6 @@ import { } from './models/medmark/template'; import {MediumApolloState, MediumPostMetadata} from './models/medium'; import {MedmarkFrontMatterAuthor} from './models/medmark/front-matter'; -import chalk from 'chalk'; interface Paths { /**