Skip to content

Commit

Permalink
Merge pull request #493 from marp-team/upgrade-node-and-dependencies
Browse files Browse the repository at this point in the history
Upgrade Node.js and dependencies
  • Loading branch information
yhatt authored Jan 8, 2023
2 parents 03061ff + 0cd537e commit c532e51
Show file tree
Hide file tree
Showing 12 changed files with 801 additions and 650 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
node-version:
- '^14.21.1'
- '^16.18.1'
- '18.12.1'
- '18.13.0'

steps:
# - name: Output concurrency group
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.12.1
18.13.0
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Changed

- Upgrade Node.js and dependent packages ([#493](https://github.com/marp-team/marp-cli/pull/493))

## v2.2.2 - 2022-11-21

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.18.1-alpine
FROM node:18.13.0-alpine
LABEL maintainer "Marp team"

RUN apk update && apk upgrade && \
Expand Down
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @marp-team/marp-cli

[![CircleCI](https://img.shields.io/circleci/project/github/marp-team/marp-cli/main.svg?style=flat-square&logo=circleci)](https://circleci.com/gh/marp-team/marp-cli/)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/marp-team/marp-cli/Test%20for%20Windows/main?style=flat-square&logo=github)](https://github.com/marp-team/marp-cli/actions?query=workflow%3A%22Test+for+Windows%22+branch%3Amain)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/marp-team/marp-cli/test-win.yml?branch=main&style=flat-square&logo=github)](https://github.com/marp-team/marp-cli/actions?query=workflow%3A%22Test+for+Windows%22+branch%3Amain)
[![Codecov](https://img.shields.io/codecov/c/github/marp-team/marp-cli/main.svg?style=flat-square&logo=codecov)](https://codecov.io/gh/marp-team/marp-cli)
[![npm](https://img.shields.io/npm/v/@marp-team/marp-cli.svg?style=flat-square&logo=npm)](https://www.npmjs.com/package/@marp-team/marp-cli)
[![Docker](https://img.shields.io/docker/pulls/marpteam/marp-cli.svg?logo=docker&style=flat-square)](https://hub.docker.com/r/marpteam/marp-cli/)
Expand Down Expand Up @@ -59,23 +59,35 @@ Don't you like installing Node.js and Chrome to local? We have [an official Dock

## Install

Marp CLI is working only in [actively supported Node.js versions](https://endoflife.date/nodejs) so Node.js 14 and later is required to install.

### Use package manager

You can use the package manager to install/update Marp CLI easily.
You can use the package manager to install and update Marp CLI easily.

- **macOS**
- **[Homebrew](https://brew.sh/)**: `brew install marp-cli` ([Refer to the formula...](https://github.com/Homebrew/homebrew-core/blob/master/Formula/marp-cli.rb))
_Disclaimer: Package manifests are maintained by the community, not Marp team._

* **Windows**
- **[Scoop](https://scoop.sh/)**: `scoop install marp` ([Refer to the manifest in Main bucket...](https://github.com/ScoopInstaller/Main/blob/master/bucket/marp.json))
<!-- For contributors: For contributors: This section describes only package managers that Marp manifest has been actively maintained. Each tools are following update within a few days of the latest CLI update. -->

_Disclaimer: Package manifests are maintained by the community, not Marp team._
#### macOS: **[Homebrew](https://brew.sh/)**

```bash
brew install marp-cli
```

<!-- https://github.com/Homebrew/homebrew-core/blob/master/Formula/marp-cli.rb -->

#### Windows: **[Scoop](https://scoop.sh/)**

```cmd
scoop install marp
```

<!-- https://github.com/ScoopInstaller/Main/blob/master/bucket/marp.json -->

### Local installation

We recommend to install Marp CLI into your Node project. You may control the CLI (and engine) version exactly.
We recommend to install Marp CLI into your Node.js project. You may control the CLI version (and engine if you want) exactly.

> :information_source: Marp CLI is working only with [actively supported Node.js versions](https://endoflife.date/nodejs), so Node.js 14 and later is required when installing into your Node.js project.
```bash
npm install --save-dev @marp-team/marp-cli
Expand Down
60 changes: 30 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,42 +69,43 @@
"devDependencies": {
"@babel/preset-env": "^7.20.2",
"@rollup/plugin-alias": "^4.0.2",
"@rollup/plugin-commonjs": "^23.0.2",
"@rollup/plugin-json": "^5.0.1",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.1",
"@rollup/plugin-typescript": "^9.0.2",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-terser": "^0.3.0",
"@rollup/plugin-typescript": "^11.0.0",
"@rollup/plugin-url": "^8.0.1",
"@tsconfig/node14": "^1.0.3",
"@types/cheerio": "^0.22.31",
"@types/express": "^4.17.14",
"@types/jest": "^29.2.3",
"@types/express": "^4.17.15",
"@types/jest": "^29.2.5",
"@types/markdown-it": "^12.2.3",
"@types/node": "~18.11.9",
"@types/node": "~18.11.18",
"@types/pug": "^2.0.6",
"@types/supertest": "^2.0.12",
"@types/ws": "^8.5.3",
"@types/yargs": "^17.0.13",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"@types/ws": "^8.5.4",
"@types/yargs": "^17.0.19",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"autoprefixer": "^10.4.13",
"babel-plugin-transform-rename-import": "^2.3.0",
"bespoke": "bespokejs/bespoke",
"builtin-modules": "^3.3.0",
"chalk": "^5.1.2",
"chalk": "^5.2.0",
"cheerio": "^1.0.0-rc.12",
"chrome-launcher": "^0.15.1",
"cssnano": "^5.1.14",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint": "^8.31.0",
"eslint-config-prettier": "^8.6.0",
"eslint-import-resolver-exports": "^1.0.0-beta.3",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.1.5",
"eslint-plugin-jest": "^27.2.1",
"express": "^4.18.2",
"fast-plist": "^0.1.2",
"fast-plist": "^0.1.3",
"get-stdin": "^9.0.0",
"globby": "^13.1.2",
"globby": "^13.1.3",
"image-size": "^1.0.2",
"is-docker": "^3.0.0",
"jest": "^29.3.1",
Expand All @@ -117,47 +118,46 @@
"pkg": "^5.8.0",
"pkg-up": "^4.0.0",
"portfinder": "1.0.32",
"postcss": "^8.4.19",
"postcss": "^8.4.21",
"postcss-url": "^10.1.3",
"pptxgenjs": "^3.11.0",
"prettier": "^2.7.1",
"prettier": "^2.8.2",
"pug": "^3.0.2",
"rimraf": "^3.0.2",
"rollup": "^3.3.0",
"rollup": "^3.9.1",
"rollup-plugin-license": "^3.0.1",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-pug": "^1.1.1",
"rollup-plugin-terser": "^7.0.2",
"sass": "^1.56.1",
"sass": "^1.57.1",
"strip-ansi": "^7.0.1",
"stylelint": "^14.15.0",
"stylelint": "^14.16.1",
"stylelint-config-prettier": "^9.0.4",
"stylelint-config-standard-scss": "^6.1.0",
"supertest": "^6.3.1",
"tar-stream": "^2.2.0",
"supertest": "^6.3.3",
"tar-stream": "^3.0.0",
"ts-jest": "^29.0.3",
"ts-key-enum": "^3.0.12",
"tslib": "^2.4.1",
"typed-emitter": "^2.1.0",
"typescript": "^4.9.3",
"typescript": "^4.9.4",
"vhtml": "^2.2.0",
"wrap-ansi": "^8.0.1",
"yauzl": "^2.10.0",
"zip-stream": "^4.1.0"
},
"dependencies": {
"@marp-team/marp-core": "^3.4.0",
"@marp-team/marp-core": "^3.4.2",
"@marp-team/marpit": "^2.4.2",
"chokidar": "^3.5.3",
"cosmiconfig": "^7.1.0",
"cosmiconfig": "^8.0.0",
"import-from": "^4.0.0",
"is-wsl": "^2.2.0",
"puppeteer-core": "19.2.2",
"puppeteer-core": "19.4.1",
"remove": "^0.1.5",
"serve-index": "^1.9.1",
"tmp": "^0.2.1",
"v8-compile-cache": "^2.3.0",
"ws": "^8.11.0",
"ws": "^8.12.0",
"yargs": "^17.6.2"
},
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import replace from '@rollup/plugin-replace'
import terser from '@rollup/plugin-terser'
import typescript from '@rollup/plugin-typescript'
import url from '@rollup/plugin-url'
import builtinModules from 'builtin-modules'
import license from 'rollup-plugin-license'
import postcss from 'rollup-plugin-postcss'
import pugPlugin from 'rollup-plugin-pug'
import { terser } from 'rollup-plugin-terser'

const __dirname = path.dirname(fileURLToPath(import.meta.url))
const require = createRequire(import.meta.url)
Expand Down
10 changes: 5 additions & 5 deletions src/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { URL } from 'url'
import type { MarpOptions } from '@marp-team/marp-core'
import { Marpit, Options as MarpitOptions } from '@marp-team/marpit'
import chalk from 'chalk'
import type puppeteer from 'puppeteer-core'
import type { Browser, Page, HTTPRequest } from 'puppeteer-core'
import { silence, warn } from './cli'
import { Engine, ResolvedEngine } from './engine'
import infoPlugin, { engineInfo, EngineInfo } from './engine/info-plugin'
Expand Down Expand Up @@ -533,7 +533,7 @@ export class Converter {

private async usePuppeteer<T>(
baseFile: File,
processer: (page: puppeteer.Page, uri: string) => Promise<T>
processer: (page: Page, uri: string) => Promise<T>
) {
const tmpFile: File.TmpFileInterface | undefined = await (() => {
if (!this.options.allowLocalFiles) return undefined
Expand Down Expand Up @@ -603,14 +603,14 @@ export class Converter {
}
}

private trackFailedLocalFileAccess(page: puppeteer.Page): {
private trackFailedLocalFileAccess(page: Page): {
missingFileSet: Set<string>
failedFileSet: Set<string>
} {
const missingFileSet = new Set<string>()
const failedFileSet = new Set<string>()

page.on('requestfailed', (req: puppeteer.HTTPRequest) => {
page.on('requestfailed', (req: HTTPRequest) => {
try {
const url = new URL(req.url())
if (url.protocol === 'file:') {
Expand All @@ -632,7 +632,7 @@ export class Converter {
if (Converter.browser) await Converter.browser.close()
}

private static browser?: puppeteer.Browser
private static browser?: Browser

private static async runBrowser({ timeout }: { timeout?: number }) {
if (!Converter.browser) {
Expand Down
14 changes: 7 additions & 7 deletions src/preview.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-namespace */
import { EventEmitter } from 'events'
import { nanoid } from 'nanoid'
import type puppeteer from 'puppeteer-core'
import type { Page, Browser, Target } from 'puppeteer-core'
import TypedEmitter from 'typed-emitter'
import macDockIcon from './assets/mac-dock-icon.png'
import { ConvertType, mimeTypes } from './converter'
Expand Down Expand Up @@ -29,7 +29,7 @@ export namespace Preview {
}

export interface Window extends EventEmitter {
page: puppeteer.Page
page: Page
close: () => Promise<void>
load: (uri: string) => Promise<void>
}
Expand All @@ -38,7 +38,7 @@ export namespace Preview {
export class Preview extends (EventEmitter as new () => TypedEmitter<Preview.Events>) {
readonly options: Preview.Options

private puppeteerInternal: puppeteer.Browser | undefined
private puppeteerInternal: Browser | undefined

constructor(opts: Partial<Preview.Options> = {}) {
super()
Expand All @@ -48,7 +48,7 @@ export class Preview extends (EventEmitter as new () => TypedEmitter<Preview.Eve
}
}

get puppeteer(): puppeteer.Browser | undefined {
get puppeteer(): Browser | undefined {
return this.puppeteerInternal
}

Expand All @@ -73,7 +73,7 @@ export class Preview extends (EventEmitter as new () => TypedEmitter<Preview.Eve
}
}

private createWindowObject(page: puppeteer.Page): Preview.Window {
private createWindowObject(page: Page): Preview.Window {
const window = new EventEmitter()

page.on('close', async () => window.emit('close'))
Expand Down Expand Up @@ -106,12 +106,12 @@ export class Preview extends (EventEmitter as new () => TypedEmitter<Preview.Eve
private async createWindow() {
try {
return this.createWindowObject(
await new Promise<puppeteer.Page>((res, rej) => {
await new Promise<Page>((res, rej) => {
const pptr = this.puppeteer
if (!pptr) return rej(false)

const id = nanoid()
const idMatcher = (target: puppeteer.Target) => {
const idMatcher = (target: Target) => {
const url = new URL(target.url())

if (url.searchParams.get('__marp_cli_id') === id) {
Expand Down
2 changes: 1 addition & 1 deletion src/templates/bespoke/presenter/presenter-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const presenterView = (deck) => {

const $cache: { -readonly [T in keyof typeof classes]?: HTMLElement } = {}
const $ = <T extends HTMLElement>(
klass: typeof classes[keyof typeof classes]
klass: (typeof classes)[keyof typeof classes]
): T => {
$cache[klass] = $cache[klass] || document.querySelector<T>(`.${klass}`)

Expand Down
2 changes: 1 addition & 1 deletion src/templates/bespoke/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const generateURLfromParams = (
}

export const getViewMode = () =>
body.dataset.bespokeView as typeof viewModes[number]
body.dataset.bespokeView as (typeof viewModes)[number]

export const readQuery = (name: string) =>
new URLSearchParams(location.search).get(name)
Expand Down
Loading

0 comments on commit c532e51

Please sign in to comment.