Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
Closes #34
  • Loading branch information
thetutlage committed May 3, 2022
1 parent 302b28c commit 9a1c258
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"mrm": "mrm --preset=@adonisjs/mrm-preset",
"pretest": "npm run lint",
"test": "node -r ts-node/register/transpile-only bin/test.ts",
"test": "node -r @adonisjs/require-ts/build/register bin/test.ts",
"lint": "eslint . --ext=.ts",
"clean": "del-cli build",
"compile": "npm run lint && npm run clean && tsc",
Expand Down Expand Up @@ -41,14 +41,14 @@
"@poppinss/dev-utils": "^2.0.3",
"@types/fs-extra": "^9.0.13",
"@types/ini": "^1.3.31",
"@types/marked": "^2.0.4",
"@types/node": "^17.0.24",
"@types/marked": "^4.0.3",
"@types/node": "^17.0.31",
"@types/yaml": "^1.9.7",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "^3.3.0",
"del-cli": "^4.0.1",
"endent": "^2.1.0",
"eslint": "^8.13.0",
"eslint": "^8.14.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-adonis": "^2.1.0",
"eslint-plugin-prettier": "^4.0.0",
Expand All @@ -58,8 +58,8 @@
"mrm": "^4.0.0",
"np": "^7.6.1",
"prettier": "^2.6.2",
"typescript": "^4.6.3",
"yaml": "^2.0.0"
"typescript": "^4.6.4",
"yaml": "^2.0.1"
},
"nyc": {
"exclude": [
Expand All @@ -79,9 +79,10 @@
"@poppinss/prompts": "^2.0.2",
"@poppinss/utils": "^4.0.4",
"cp-file": "^9.1.0",
"fs-extra": "^10.0.1",
"marked": "^2.1.3",
"marked-terminal": "^4.1.1",
"fs-extra": "^10.1.0",
"inclusion": "^1.0.1",
"marked": "^4.0.15",
"marked-terminal": "^5.1.1",
"mrm-core": "^7.0.0",
"mustache": "^4.2.0",
"open": "^8.4.0"
Expand Down
9 changes: 6 additions & 3 deletions src/Tasks/MarkdownRenderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
*/

import open from 'open'
import marked from 'marked'
import { join } from 'path'
import { tmpdir } from 'os'
import TerminalRenderer from 'marked-terminal'
import inclusion from 'inclusion'
import { readFile, outputFile } from 'fs-extra'

import { css } from './Styles'
Expand Down Expand Up @@ -56,10 +55,12 @@ export class MarkdownRenderer {
* Converts markdown to HTML and opens it up inside the browser
*/
public async renderInBrowser() {
const { marked, Renderer } = await inclusion('marked')

try {
const contents = await readFile(this.mdFileAbsPath, 'utf-8')
const html = this.generateHtml(
marked.setOptions({ renderer: new marked.Renderer() })(contents.trim())
marked.setOptions({ renderer: new Renderer() })(contents.trim())
)
await this.openContentsInBrowser(html)
} catch (error) {}
Expand All @@ -69,6 +70,8 @@ export class MarkdownRenderer {
* Writes markdown in the terminal
*/
public async renderInTerminal() {
const { marked } = await inclusion('marked')
const { TerminalRenderer } = await inclusion('marked-terminal')
try {
const contents = await readFile(this.mdFileAbsPath, 'utf-8')
console.log(marked.setOptions({ renderer: new TerminalRenderer() })(contents.trim()).trim())
Expand Down
2 changes: 1 addition & 1 deletion test/render-markdown.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* file that was distributed with this source code.
*/

import { test } from '@japa/runner'
import { join } from 'path'
import { test } from '@japa/runner'
import { Filesystem } from '@poppinss/dev-utils'
import { MarkdownRenderer } from '../src/Tasks/MarkdownRenderer'

Expand Down

0 comments on commit 9a1c258

Please sign in to comment.