Skip to content

Commit

Permalink
Merge pull request #591 from marp-team/upgrade-node-and-dependencies
Browse files Browse the repository at this point in the history
Upgrade Node.js and dependent packages
  • Loading branch information
yhatt authored Sep 15, 2024
2 parents 37cd008 + d7160da commit 78e74b8
Show file tree
Hide file tree
Showing 51 changed files with 3,301 additions and 3,469 deletions.
50 changes: 32 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: 2.1

orbs:
browser-tools: circleci/browser-tools@1.2.4
codecov: codecov/codecov@3.2.4
browser-tools: circleci/browser-tools@1.4.8
codecov: codecov/codecov@4.1.0

executors:
node:
Expand All @@ -12,7 +12,7 @@ executors:
default: false
version:
type: string
default: '18.18.0' # Specify LTS major and minor for development
default: '20.17.0' # Specify LTS major and minor for development
docker:
- image: cimg/node:<< parameters.version >><<# parameters.browser >>-browsers<</ parameters.browser >>
working_directory: ~/marp-cli
Expand All @@ -36,7 +36,7 @@ commands:
default: []
yarn:
type: string
default: '^1.22.17'
default: '^1.22.22'
steps:
- run:
name: Upgrade yarn for current user
Expand All @@ -48,7 +48,10 @@ commands:
- v2.4-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}-
- v2.4-dependencies-{{ .Environment.CIRCLE_JOB }}-

- run: yarn install --frozen-lockfile <<# parameters.force >>--ignore-engines<</ parameters.force >>
- run: |
yarn install --frozen-lockfile <<# parameters.force >>--ignore-engines<</ parameters.force >>
yarn patch-package
- steps: << parameters.postinstall >>

- save_cache:
Expand All @@ -63,7 +66,7 @@ commands:
postinstall:
- run: yarn -s check:audit

test:
prepare:
parameters:
browser:
type: boolean
Expand All @@ -83,6 +86,8 @@ commands:
steps:
- browser-tools/install-chrome

lint:
steps:
- run:
name: Prettier formatting
command: yarn check:format
Expand All @@ -99,6 +104,8 @@ commands:
name: stylelint
command: yarn lint:css

test:
steps:
- run:
name: Jest
command: yarn test:coverage --ci -i --reporters=default --reporters=jest-junit
Expand Down Expand Up @@ -185,33 +192,40 @@ jobs:
steps:
- audit

test-node16:
test-node18:
executor:
name: node
browser: true
version: '16.18'
version: '18.20'
steps:
- test:
- prepare:
force: true
browser: true
- lint
- test

test-node18:
test-node20:
executor:
name: node
browser: true
steps:
- test:
- prepare:
browser: true
- lint
- test

test-node20:
test-node22:
executor:
name: node
browser: true
version: '20.9'
version: '22.8'
steps:
- test:
- prepare:
browser: true
- lint
- test

# Docker
docker-build-latest:
executor: node
steps:
Expand Down Expand Up @@ -241,22 +255,22 @@ workflows:
jobs:
# Test
- audit
- test-node16:
requires:
- audit
- test-node18:
requires:
- audit
- test-node20:
requires:
- audit
- test-node22:
requires:
- audit

# Docker (latest)
- docker-build-latest:
requires:
- test-node16
- test-node18
- test-node20
- test-node22
filters:
branches:
only: main
Expand Down
14 changes: 8 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ module.exports = {
es6: true,
node: true,
},
extends: ['eslint:recommended', 'plugin:import/recommended', 'prettier'],
extends: ['eslint:recommended', 'plugin:import-x/recommended', 'prettier'],
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
},
plugins: ['unicorn'],
rules: {
'import/no-unresolved': ['error', { ignore: ['ts-key-enum'] }],
'import/order': ['error', { alphabetize: { order: 'asc' } }],
'import-x/no-unresolved': ['error', { ignore: ['ts-key-enum'] }],
'import-x/order': ['error', { alphabetize: { order: 'asc' } }],
'unicorn/prefer-node-protocol': 'error',
},
settings: {
'import/resolver': {
'import-x/resolver': {
node: { extensions: ['.mjs', '.js', '.jsx', '.json', '.ts', '.tsx'] },
},
'import/ignore': ['@rollup/plugin-node-resolve'],
'import-x/ignore': ['@rollup/plugin-node-resolve'],
},
overrides: [
{
Expand All @@ -28,7 +30,7 @@ module.exports = {
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
'plugin:import/typescript',
'plugin:import-x/typescript',
'prettier',
],
rules: {
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:

env:
YARN_VERSION: '^1.22.17'
YARN_VERSION: '^1.22.22'

jobs:
github-release:
Expand Down Expand Up @@ -51,9 +51,9 @@ jobs:
run: yarn standalone:pack
env:
MATRIX_OS: ${{ matrix.os }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: assets
name: assets-${{ matrix.os }}
path: dist
- name: Upload created asset to GitHub Release
uses: marp-team/actions@v1
Expand Down
41 changes: 14 additions & 27 deletions .github/workflows/test-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
# cancel-in-progress: true

env:
YARN_VERSION: '^1.22.19'
YARN_VERSION: '^1.22.22'

jobs:
win-test:
Expand All @@ -19,11 +19,11 @@ jobs:
fail-fast: false
matrix:
node-version:
- '^16.18.1'
- '18.18.0'
- '^20.9.0'
- '^18.20.4'
- '20.17.0'
- '^22.8.0'
include:
- node-version: '^16.18.1'
- node-version: '^18.20.4'
force: true

steps:
Expand All @@ -36,42 +36,29 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install yarn
id: yarn
shell: bash
run: |
cd $HOME && yarn policies set-version $YARN_VERSION
echo "cache_dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache yarn
uses: actions/cache@v3
with:
path: ${{ steps.yarn.outputs.cache_dir }}
key: yarn_cache-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn_cache-${{ runner.os }}-${{ matrix.node-version }}-
yarn_cache-${{ runner.os }}-
cache: yarn

- name: Install dependencies with yarn
run: yarn install --frozen-lockfile ${{ matrix.force && '--ignore-engines' || '' }}
run: |
yarn install --frozen-lockfile ${{ matrix.force && '--ignore-engines' || '' }}
yarn patch-package
# Retry tests up to 3 times due to flaky tests on Windows CI
# https://stackoverflow.com/a/59365905
- name: Jest
env:
CI: true
run: >-
yarn test:coverage --ci -i --reporters=default --reporters=jest-junit --forceExit ||
yarn test:coverage --ci -i --reporters=default --reporters=jest-junit --forceExit --no-cache ||
yarn test:coverage --ci -i --reporters=default --reporters=jest-junit --forceExit --no-cache
env:
CI: true
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: coverage
name: coverage-${{ matrix.node-version }}
path: coverage

- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: windows
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.18.0
20.17.0
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

## [Unreleased]

### Breaking

- End-of-Lifed Node.js 16 is no longer supported, and required Node.js 18 and later ([#591](https://github.com/marp-team/marp-cli/pull/591))
- Upgrade Marp Core to [v4.0.0](https://github.com/marp-team/marp-core/releases/v4.0.0) ([#591](https://github.com/marp-team/marp-cli/pull/591))
- The slide container of built-in themes became the block element and adopted safe centering
- Relax HTML allowlist: Allowed a lot of HTML elements and attributes by default

### Added

- CI testing against Node.js v22 ([#591](https://github.com/marp-team/marp-cli/pull/591))

### Changed

- Upgrade Marpit to [v3.1.1](https://github.com/marp-team/marpit/releases/tag/v3.1.1) ([#591](https://github.com/marp-team/marp-cli/pull/591))
- Support for CSS nesting
- Upgrade development Node.js LTS to v20.17.0 ([#591](https://github.com/marp-team/marp-cli/pull/591))
- Upgrade dependent packages to the latest versions ([#591](https://github.com/marp-team/marp-cli/pull/591))

### Fixed

- The browser sometimes cannot launch due to profile's singleton lock ([#589](https://github.com/marp-team/marp-cli/issues/589), [#591](https://github.com/marp-team/marp-cli/pull/591))
- Make silence some deprecation warnings in Node.js v22 ([#574](https://github.com/marp-team/marp-cli/issues/574), [#576](https://github.com/marp-team/marp-cli/issues/576), [#591](https://github.com/marp-team/marp-cli/pull/591))

## v3.4.0 - 2023-10-28

### Changed
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:18.17.0-alpine
FROM node:20.17.0-alpine
LABEL maintainer "Marp team"

RUN apk update && apk upgrade && \
Expand Down
11 changes: 0 additions & 11 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
// This setting is used only to transform ESM while running Jest.
module.exports = {
presets: [['@babel/env', { targets: { node: 'current' } }]],
plugins: [
[
'transform-rename-import',
{
replacements: [
{ original: '^node:(.+)$', replacement: '$1' },
{ original: '^#(.+)$', replacement: '$1' }, // "#"" prefix is used by chalk
],
},
],
],
}
14 changes: 7 additions & 7 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
const { jsWithBabel } = require('ts-jest/presets')
const { createJsWithBabelPreset } = require('ts-jest')

const jsWithBabel = createJsWithBabelPreset()

const esModules = [
'@sindresorhus/merge-streams',
'ansi-regex',
'array-union',
'chalk',
'chrome-launcher',
'find-up',
'globby',
'import-meta-resolve',
'is-inside-container',
'is-docker',
'is-inside-container',
'is-wsl',
'lighthouse-logger',
'locate-path',
Expand All @@ -18,9 +21,11 @@ const esModules = [
'p-limit',
'p-locate',
'path-exists',
'path-type',
'pkg-up',
'slash',
'strip-ansi',
'unicorn-magic',
'yocto-queue',
]

Expand All @@ -36,11 +41,6 @@ module.exports = {
'\\.s?css$': '<rootDir>/test/_transformers/css.js',
'\\.png$': '<rootDir>/test/_transformers/png.js',
'\\.pug$': '<rootDir>/test/_transformers/pug.js',

// TODO: Remove if Jest did not fail on ESM dynamic imports
'custom-engine\\.mjs$': 'babel-jest',
'config\\.mjs$': 'babel-jest',
'esm-project/marp\\.config\\.js$': 'babel-jest',
},
transformIgnorePatterns: [`/node_modules/(?!${esModules.join('|')})`],
testEnvironment: 'node',
Expand Down
Loading

0 comments on commit 78e74b8

Please sign in to comment.