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 dependent packages to the latest version #371

Merged
merged 4 commits into from
Aug 11, 2021
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
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
'import/resolver': {
node: { extensions: ['.mjs', '.js', '.jsx', '.json', '.ts', '.tsx'] },
},
'import/ignore': ['@rollup/plugin-node-resolve'],
},
overrides: [
{
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
- `--pdf-notes` option to add presenter notes into PDF as annotations ([#261](https://github.com/marp-team/marp-cli/issues/261), [#369](https://github.com/marp-team/marp-cli/pull/369))
- `author` and `keywords` metadata options / global directives ([#367](https://github.com/marp-team/marp-cli/issues/367), [#370](https://github.com/marp-team/marp-cli/pull/370))

### Changed

- Upgrade dependent packages to the latest version ([#371](https://github.com/marp-team/marp-cli/pull/371))

## v1.2.0 - 2021-07-22

### Added
Expand Down
9 changes: 8 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
const { jsWithBabel } = require('ts-jest/presets')

const esModules = ['ansi-regex', 'array-union', 'globby', 'slash', 'strip-ansi']
const esModules = [
'ansi-regex',
'array-union',
'globby',
'os-locale',
'slash',
'strip-ansi',
]

module.exports = {
collectCoverageFrom: ['src/**/*.ts', 'src/**/*.tsx'],
Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,35 +63,35 @@
"watch": "rollup -w -c"
},
"devDependencies": {
"@babel/preset-env": "^7.14.8",
"@rollup/plugin-alias": "^3.1.4",
"@rollup/plugin-commonjs": "^19.0.1",
"@babel/preset-env": "^7.15.0",
"@rollup/plugin-alias": "^3.1.5",
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.2",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-replace": "^3.0.0",
"@rollup/plugin-typescript": "^8.2.3",
"@rollup/plugin-url": "^6.0.0",
"@rollup/plugin-typescript": "^8.2.5",
"@rollup/plugin-url": "^6.1.0",
"@types/cheerio": "^0.22.30",
"@types/express": "^4.17.13",
"@types/jest": "^26.0.24",
"@types/jest": "^27.0.0",
"@types/node": "~14.17.5",
"@types/pug": "^2.0.5",
"@types/supertest": "^2.0.11",
"@types/ws": "^7.4.7",
"@types/yargs": "^17.0.2",
"@typescript-eslint/eslint-plugin": "^4.28.4",
"@typescript-eslint/parser": "^4.28.4",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"autoprefixer": "^10.3.1",
"babel-plugin-transform-rename-import": "^2.3.0",
"bespoke": "bespokejs/bespoke",
"builtin-modules": "^3.2.0",
"chalk": "^4.1.1",
"chalk": "^4.1.2",
"cheerio": "^1.0.0-rc.10",
"codecov": "^3.8.3",
"cssnano": "^5.0.7",
"eslint": "^7.31.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-import": "^2.24.0",
"eslint-plugin-jest": "^24.4.0",
"get-stdin": "^9.0.0",
"globby": "^12.0.0",
Expand All @@ -101,7 +101,7 @@
"jest-junit": "^12.2.0",
"nanoid": "^3.1.23",
"npm-run-all": "^4.1.5",
"os-locale": "^5.0.0",
"os-locale": "^6.0.0",
"pkg": "^5.3.1",
"pkg-up": "^3.1.0",
"portfinder": "^1.0.28",
Expand All @@ -110,12 +110,12 @@
"prettier": "^2.3.2",
"pug": "^3.0.2",
"rimraf": "^3.0.2",
"rollup": "^2.53.3",
"rollup": "^2.56.2",
"rollup-plugin-license": "^2.5.0",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-pug": "^1.1.1",
"rollup-plugin-terser": "^7.0.2",
"sass": "^1.35.2",
"sass": "^1.37.5",
"screenfull": "^5.1.0",
"strip-ansi": "^7.0.0",
"stylelint": "^13.13.1",
Expand Down Expand Up @@ -143,12 +143,12 @@
"import-from": "^4.0.0",
"pdf-lib": "^1.16.0",
"pptxgenjs": "^3.7.1",
"puppeteer-core": "10.1.0",
"puppeteer-core": "10.2.0",
"serve-index": "^1.9.1",
"tmp": "^0.2.1",
"v8-compile-cache": "^2.3.0",
"ws": "^7.5.3",
"yargs": "^17.0.1"
"ws": "^8.0.0",
"yargs": "^17.1.0"
},
"resolutions": {
"cssnano": "^5.0.7",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path'
import alias from '@rollup/plugin-alias'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import nodeResolve from '@rollup/plugin-node-resolve'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import replace from '@rollup/plugin-replace'
import typescript from '@rollup/plugin-typescript'
import url from '@rollup/plugin-url'
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from 'path'
import { Marp } from '@marp-team/marp-core'
import chalk from 'chalk'
import { cosmiconfig } from 'cosmiconfig'
import osLocale from 'os-locale'
import { osLocale } from 'os-locale'
import { info, warn } from './cli'
import { ConverterOption, ConvertType } from './converter'
import resolveEngine, { ResolvableEngine, ResolvedEngine } from './engine'
Expand Down
3 changes: 1 addition & 2 deletions src/marp-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,8 @@ export const marpCli = async (

return e.errorCode
} finally {
notifier.stop()

await Promise.all([
notifier.stop(),
Converter.closeBrowser(),
server?.stop(),
watcherInstance?.chokidar.close(),
Expand Down
20 changes: 15 additions & 5 deletions src/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,21 @@ export class WatchNotifier {
})
}

stop() {
if (this.wss !== undefined) {
this.wss.close()
this.wss = undefined
}
async stop() {
return new Promise<boolean>((resolve) => {
if (this.wss !== undefined) {
const { wss } = this

wss.close(() => {
for (const ws of wss.clients) ws.terminate()
resolve(true)
})

this.wss = undefined
} else {
resolve(false)
}
})
}

static sha256(fn: string) {
Expand Down
3 changes: 3 additions & 0 deletions test/templates/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ describe('Watch mode notifier on browser context', () => {
await new Promise((res) => {
clientSocket.addEventListener('close', res)
server.close()

// ws v8 requires closing the connections manually.
for (const ws of server.clients) ws.terminate()
})

server = await createWSServer()
Expand Down
7 changes: 4 additions & 3 deletions test/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jest.mock('chokidar', () => ({
}))
jest.mock('ws', () => ({
Server: jest.fn(() => ({
close: jest.fn(),
clients: [],
close: jest.fn((callback) => callback()),
on: mockWsOn,
})),
}))
Expand Down Expand Up @@ -228,8 +229,8 @@ describe('WatchNotifier', () => {
expect(socketB.send).toHaveBeenCalledWith('command')
})

it('returns false when WebSocket server is stopped', () => {
instance.stop()
it('returns false when WebSocket server is stopped', async () => {
await instance.stop()
expect(instance.sendTo('test', 'command')).toBe(false)
expect(socketA.send).not.toHaveBeenCalled()
expect(socketB.send).not.toHaveBeenCalled()
Expand Down
Loading