Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Node and dependent packages to the latest #77

Merged
merged 13 commits into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@ references:
base: &base
working_directory: ~/marp-cli
steps:
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#upgradingdowngrading-yarn
- run:
name: Upgrade yarn
command: |
sudo -E sh -c 'curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \
&& ln -snf /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
&& ln -snf /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \
&& rm yarn-v$YARN_VERSION.tar.gz'
environment:
YARN_VERSION: 1.13.0

- run: node --version
- checkout

- restore_cache:
Expand All @@ -31,13 +20,21 @@ references:
- node_modules
- ~/.cache/yarn

# TODO: Remove workaround if https://github.com/GoogleChrome/puppeteer/issues/3774 was resolved
- run:
name: Workaround for broken Chrome 73 (Use Chromium supported by Puppeteer instead)
command: |
mkdir -p ~/.puppeteer && cd ~/.puppeteer
npm i puppeteer
echo "export CHROME_PATH=$(node -e "console.log(require('puppeteer').executablePath())")" >> $BASH_ENV
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add workaround for broken Chrome 73. We have to use Chromium supported by Puppeteer (Chromium 74) within image.

We have confirmed to work conversion in Chrome 73 with out of container (Windows/macOS/Linux).


- run:
name: Prettier formatting
command: yarn format:check

- run:
name: TypeScript type checking
command: yarn check-ts
command: yarn check:ts

- run:
name: TSLint
Expand All @@ -64,15 +61,15 @@ references:

version: 2
jobs:
'10.15.1':
'10.15.3':
<<: *base
docker:
- image: circleci/node:10.15.0-browsers
- image: circleci/node:10.15.3-browsers

'8.15.0':
carbon:
<<: *base
docker:
- image: circleci/node:8.15.0-browsers
- image: circleci/node:carbon-browsers

docker-image:
docker:
Expand All @@ -96,12 +93,12 @@ workflows:
version: 2
build:
jobs:
- 10.15.1
- 8.15.0
- 10.15.3
- carbon
- docker-image:
requires:
- 10.15.1
- 8.15.0
- 10.15.3
- carbon
filters:
branches:
only: master
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v10.15.1
v10.15.3
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## [Unreleased]

### Added

- [Direction keyword](https://marpit.marp.app/image-syntax?id=direction-keyword) for background images, from [Marpit v0.8.0](https://github.com/marp-team/marpit/releases/v0.8.0) ([#77](https://github.com/marp-team/marp-core/pull/77))

### Changed

- Upgrade to [Marpit v0.8.0](https://github.com/marp-team/marpit/releases/tag/v0.8.0) and [Marp Core v0.7.0](https://github.com/marp-team/marp-core/releases/tag/v0.7.0) ([#77](https://github.com/marp-team/marp-cli/pull/77))
- Upgrade Node and dependent packages to the latest ([#77](https://github.com/marp-team/marp-cli/pull/77))

## v0.6.3 - 2019-03-11

### Changed
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10.15.1-alpine
FROM node:10.15.3-alpine
LABEL maintainer "Marp team"

RUN apk update && apk upgrade && \
Expand Down Expand Up @@ -27,8 +27,8 @@ ENV IS_DOCKER true

WORKDIR /home/marp/.cli
COPY --chown=marp:marp . /home/marp/.cli/
RUN yarn install && yarn add puppeteer-core@chrome-71 && yarn build \
&& rm -rf ./src ./node_modules && yarn install --production && yarn cache clean
RUN yarn install && yarn add puppeteer-core@chrome-$(chromium-browser --version | sed -r 's/^Chromium ([0-9]+).+$/\1/') \
&& yarn build && rm -rf ./src ./node_modules && yarn install --production && yarn cache clean

WORKDIR /home/marp/app
ENTRYPOINT ["node", "/home/marp/.cli/marp-cli.js"]
Expand Down
31 changes: 15 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,43 +29,42 @@
],
"scripts": {
"build": "yarn --silent clean && rollup -c",
"check-audit": "yarn audit",
"check-ts": "tsc --noEmit",
"check:audit": "yarn audit",
"check:ts": "tsc --noEmit",
"clean": "rimraf lib",
"format": "prettier \"**/*.{css,js,json,md,scss,ts,yaml,yml}\"",
"format:check": "yarn --silent format -c",
"format:write": "yarn --silent format --write",
"lint:ts": "tslint \"{src,test}/**/*.ts\"",
"lint:css": "stylelint \"src/**/*.{css,scss}\"",
"prepack": "npm-run-all --npm-path yarn --parallel check-audit check-ts format:check lint:* test:coverage --sequential build",
"preversion": "npm-run-all --npm-path yarn --parallel check-audit check-ts format:check lint:* test:coverage",
"prepack": "npm-run-all --npm-path yarn --parallel check:* format:check lint:* test:coverage --sequential build",
"preversion": "npm-run-all --npm-path yarn --parallel check:* format:check lint:* test:coverage",
"test": "jest",
"test:coverage": "jest --coverage",
"version": "node version.js && git add -A CHANGELOG.md",
"watch": "rollup -w -c"
},
"devDependencies": {
"@types/cheerio": "^0.22.11",
"@types/chokidar": "^2.1.3",
"@types/cosmiconfig": "^5.0.3",
"@types/express": "^4.16.1",
"@types/get-stdin": "^5.0.1",
"@types/jest": "^24.0.11",
"@types/jest-plugin-context": "^2.9.2",
"@types/node": "^11.11.0",
"@types/node": "^11.11.3",
"@types/pug": "^2.0.4",
"@types/puppeteer": "^1.12.2",
"@types/puppeteer": "^1.12.3",
"@types/supertest": "^2.0.7",
"@types/ws": "^6.0.1",
"@types/yargs": "^12.0.9",
"autoprefixer": "^9.4.10",
"@types/yargs": "^12.0.10",
"autoprefixer": "^9.5.0",
"bespoke": "^1.1.0",
"bespoke-forms": "^1.0.0",
"bespoke-keys": "^1.1.0",
"cheerio": "^1.0.0-rc.2",
"codecov": "^3.2.0",
"cssnano": "^4.1.10",
"jest": "^24.3.1",
"jest": "^24.5.0",
"jest-junit": "^6.3.0",
"jest-plugin-context": "^2.9.0",
"node-sass": "^4.11.0",
Expand All @@ -76,31 +75,31 @@
"rimraf": "^2.6.3",
"rollup": "^1.6.0",
"rollup-plugin-commonjs": "^9.2.1",
"rollup-plugin-json": "^3.1.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-postcss": "^2.0.3",
"rollup-plugin-pug": "^1.1.0",
"rollup-plugin-terser": "^4.0.4",
"rollup-plugin-typescript": "^1.0.0",
"rollup-plugin-url": "^2.2.0",
"screenfull": "^4.0.1",
"strip-ansi": "^5.1.0",
"strip-ansi": "^5.2.0",
"stylelint": "^9.10.1",
"stylelint-config-prettier": "^5.0.0",
"stylelint-config-standard": "^18.2.0",
"stylelint-scss": "^3.5.4",
"supertest": "^4.0.0",
"supertest": "^4.0.2",
"ts-jest": "24.0.0",
"ts-keycode-enum": "^1.0.6",
"tslib": "^1.9.3",
"tslint": "^5.13.1",
"tslint": "^5.14.0",
"tslint-config-airbnb": "^5.11.1",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.3.3333"
},
"dependencies": {
"@marp-team/marp-core": "^0.6.2",
"@marp-team/marpit": "^0.7.2",
"@marp-team/marp-core": "^0.7.0",
"@marp-team/marpit": "^0.8.0",
"carlo": "^0.9.43",
"chalk": "^2.4.2",
"chokidar": "^2.1.2",
Expand Down
22 changes: 6 additions & 16 deletions src/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,24 +257,14 @@ export class Converter {

private static async runBrowser() {
if (!Converter.browser) {
// Fix the rendered position of elements in <foreignObject>
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=467484
const args = ['--enable-blink-gen-property-trees']
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puppeteer v1.13.0 no longer works BGPT feature.
puppeteer/puppeteer@ef2251d

It seems to have no critical problems while rendering PDF and images.


let finder: () => string[] = require('is-wsl')
? chromeFinder.wsl
: chromeFinder[process.platform]

if (process.env.IS_DOCKER || process.env.CI)
args.push('--disable-dev-shm-usage')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puppeteer already has --disable-dev-shm-usage option by default.


if (process.env.IS_DOCKER) {
args.push('--no-sandbox')
finder = () => ['/usr/bin/chromium-browser']
}
const finder: () => string[] = (() => {
if (process.env.IS_DOCKER) return () => ['/usr/bin/chromium-browser']
if (require('is-wsl')) return chromeFinder.wsl
return chromeFinder[process.platform]
})()

Converter.browser = await puppeteer.launch({
args,
args: process.env.IS_DOCKER ? ['--no-sandbox'] : [],
executablePath: finder ? finder()[0] : undefined,
})

Expand Down
Loading