Skip to content

Commit

Permalink
Update all dependencies to the latest (#178)
Browse files Browse the repository at this point in the history
* Update all dependencies to the latest

* Split test and lint steps

- The latest eslint requires node.js >= 16 so we need to split the testing step (with older node.js) and lint step

* Drop support for node 12 and add node 20
  • Loading branch information
mskec authored Aug 9, 2023
1 parent 0b22a92 commit 217570b
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 38 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint code

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- run: npm install
- run: npm run lint
4 changes: 2 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
node-version: 16.x
registry-url: https://registry.npmjs.org
- run: |
sudo apt-get update
sudo apt-get install -y graphicsmagick ghostscript
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.x, 20.x]

name: Node.js ${{ matrix.node-version }}

Expand All @@ -32,4 +32,3 @@ jobs:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: npm test

51 changes: 27 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,47 @@
{
"name": "pdf2pic",
"version": "2.2.4",
"description": "A utility for converting pdf to image and base64 format.",
"description": "A utility for converting pdf to image formats. Supports different outputs: directly to file, base64 or buffer.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"dependencies": {
"gm": "^1.23.1"
"gm": "^1.25.0"
},
"devDependencies": {
"@rollup/plugin-alias": "^3.1.2",
"@types/chai": "^4.2.14",
"@types/gm": "^1.18.9",
"@types/mocha": "^8.2.0",
"@types/node": "^15.0.0",
"@types/rimraf": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^4.14.2",
"@typescript-eslint/parser": "^4.14.2",
"chai": "^4.3.0",
"eslint": "^7.19.0",
"mocha": "^9.0.0",
"@rollup/plugin-alias": "^4.0.4",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.2",
"@types/chai": "^4.3.5",
"@types/gm": "^1.25.1",
"@types/mocha": "^10.0.1",
"@types/node": "^16.18.39",
"@types/rimraf": "^4.0.5",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"chai": "^4.3.7",
"eslint": "^8.46.0",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"rimraf": "^3.0.2",
"rollup": "^2.38.5",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"ts-node": "^10.0.0",
"tsconfig-paths": "^3.9.0",
"tslib": "^2.1.0",
"typescript": "^4.1.3"
"rimraf": "^5.0.1",
"rollup": "^3.27.2",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"tslib": "^2.6.1",
"typescript": "^5.1.6"
},
"scripts": {
"mocha": "mocha test/**/*.test.ts",
"test": "npm run lint && nyc --reporter=lcov npm run mocha",
"test:text": "npm run lint && nyc --reporter=text npm run mocha",
"test": "nyc --reporter=lcov npm run mocha",
"test:text": "nyc --reporter=text npm run mocha",
"test:watch": "npm run mocha -- --watch",
"rollup": "rollup -c",
"clean": "rimraf ./dist",
"lint": "eslint . --ext .ts",
"lint": "eslint --ext .ts .",
"build": "npm run test && npm run clean && npm run rollup"
},
"engines": {
"node": ">=14"
},
"repository": {
"type": "git",
"url": "git+https://github.com/yakovmeister/pdf2image.git"
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ A utility for converting pdf to image, base64 or buffer format.
## Prerequisites

* node >= 12.x
* node >= 14.x
* graphicsmagick
* ghostscript

Expand Down
4 changes: 2 additions & 2 deletions rollup.config.js → rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import transpile from "rollup-plugin-typescript2"
import { terser } from "rollup-plugin-terser"
import transpile from "@rollup/plugin-typescript"
import terser from "@rollup/plugin-terser"
import alias from "@rollup/plugin-alias"

const base = {
Expand Down
6 changes: 3 additions & 3 deletions test/graphics.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import chai, { expect } from "chai";
import { Graphics } from "../src/graphics";
import { mkdirSync, createReadStream, writeFileSync } from "fs";
import rimraf from "rimraf";
import { rimrafSync } from "rimraf";
import gm from "gm";
import { Graphics } from "../src/graphics";

describe("graphics", () => {
before(() => {
rimraf.sync("./dump/savefiletest");
rimrafSync("./dump/savefiletest");

mkdirSync("./dump/savefiletest", { recursive: true });
});
Expand Down
9 changes: 5 additions & 4 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import chai, { expect } from "chai";
import { mkdirSync, readFileSync, writeFileSync } from "fs";
import gm from "gm";
import path from 'path';
import { rimrafSync } from "rimraf";
import rimraf from "rimraf";
import { fromBase64, fromBuffer, fromPath } from "../src/index";
import { Graphics } from "../src/graphics";
Expand Down Expand Up @@ -60,9 +61,9 @@ describe("PDF2Pic Core", () => {
}

before(() => {
rimraf.sync("./dump/fromfiletest");
rimraf.sync("./dump/frombuffertest");
rimraf.sync("./dump/frombase64test");
rimrafSync("./dump/fromfiletest");
rimrafSync("./dump/frombuffertest");
rimrafSync("./dump/frombase64test");

mkdirSync("./dump/fromfiletest", { recursive: true });
});
Expand All @@ -79,7 +80,7 @@ describe("PDF2Pic Core", () => {
expect(info.format).to.equal(defaultOptions.format.toUpperCase())
expect(info.size.width).to.equal(defaultOptions.width)
expect(info.size.height).to.equal(defaultOptions.height)
rimraf.sync(defaultFilePath)
rimrafSync(defaultFilePath)
});

it("should convert pdf to pic (file input, first page)", async () => {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"src"
],
"exclude": [
"dist",
"node_modules"
]
}

0 comments on commit 217570b

Please sign in to comment.