Skip to content

Commit 2892b55

Browse files
author
Rob Walsh
committed
Update Node/Npm and Packages
1 parent 2a02f0c commit 2892b55

File tree

6 files changed

+31
-26
lines changed

6 files changed

+31
-26
lines changed

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
registry=https://artifactory.alteryx.com/artifactory/api/npm/npm/
2+
legacy-peer-deps=true

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lts/gallium

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ is internally used by this API. The [render code](https://github.com/alvarcarto/
131131
is quite simple, check it out. Render flow:
132132

133133
1. **`page.setViewport(options)`** where options matches `viewport.*`.
134-
2. *Possibly* **`page.emulateMedia('screen')`** if `emulateScreenMedia=true` is set.
134+
2. *Possibly* **`page.emulateMediaType('screen')`** if `emulateScreenMedia=true` is set.
135135
3. Render url **or** html.
136136

137137
If `url` is defined, **`page.goto(url, options)`** is called and options match `goto.*`.

package.json

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
"description": "Web page PDF rendering done right. Packaged to an easy API.",
55
"main": "src/index.js",
66
"engines": {
7-
"node": "10.x.x"
7+
"node": "^16.5.0",
8+
"npm": "^8"
89
},
910
"scripts": {
1011
"start": "env-cmd nodemon --watch ./src -e js src/index.js",
11-
"test": "mocha --timeout 10000 && npm run lint",
12+
"test": "mocha --timeout 60000 && npm run lint",
1213
"lint": "eslint ."
1314
},
1415
"repository": {
@@ -22,29 +23,29 @@
2223
},
2324
"homepage": "https://github.com/alvarcarto/url-to-pdf-api#readme",
2425
"dependencies": {
25-
"bluebird": "^3.5.0",
26-
"body-parser": "^1.18.2",
27-
"compression": "^1.7.1",
28-
"cors": "^2.8.4",
29-
"express": "^4.15.5",
30-
"express-validation": "^1.0.2",
31-
"joi": "^11.1.1",
32-
"lodash": "^4.17.15",
33-
"morgan": "^1.9.1",
34-
"normalize-url": "^5.0.0",
35-
"pdf-parse": "^1.1.1",
36-
"puppeteer": "^2.0.0",
26+
"bluebird": "^3.7.2",
27+
"body-parser": "^1.20.0",
28+
"compression": "^1.7.4",
29+
"cors": "^2.8.5",
30+
"express": "^4.18.1",
31+
"express-validation": "^4.1.0",
32+
"joi": "^17.6.0",
33+
"lodash": "^4.17.21",
34+
"morgan": "^1.10.0",
35+
"normalize-url": "^7.0.3",
36+
"puppeteer": "^16.1.1",
3737
"server-destroy": "^1.0.1",
38-
"winston": "^2.3.1"
38+
"winston": "^3.8.1"
3939
},
4040
"devDependencies": {
4141
"chai": "^4.1.2",
42-
"env-cmd": "^9.0.1",
43-
"eslint": "^4.8.0",
44-
"eslint-config-airbnb-base": "^12.0.2",
42+
"env-cmd": "^10.1.0",
43+
"eslint": "^8.22.0",
44+
"eslint-config-airbnb-base": "^15.0.0",
4545
"eslint-plugin-import": "^2.7.0",
46-
"mocha": "^4.0.1",
47-
"nodemon": "^1.12.1",
48-
"supertest": "^3.0.0"
46+
"mocha": "^10.0.0",
47+
"nodemon": "^2.0.19",
48+
"pdf-parse": "^1.1.1",
49+
"supertest": "^6.2.4"
4950
}
5051
}

src/core/render-core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async function render(_opts = {}) {
108108
await page.setViewport(opts.viewport);
109109
if (opts.emulateScreenMedia) {
110110
logger.info('Emulate @media screen..');
111-
await page.emulateMedia('screen');
111+
await page.emulateMediaType('screen');
112112
}
113113

114114
if (opts.cookies && opts.cookies.length > 0) {

test/test-all.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ describe('POST /api/render', () => {
7070
.expect(400)
7171
);
7272

73-
it('render github.com should succeed', () =>
73+
it('render google.com should succeed', () =>
7474
request(app)
7575
.post('/api/render')
76-
.send({ url: 'https://github.com' })
76+
.send({ url: 'https://google.com' })
7777
.set('content-type', 'application/json')
7878
.set('Connection', 'keep-alive')
7979
.expect(200)
@@ -144,7 +144,8 @@ describe('POST /api/render', () => {
144144
})
145145
);
146146

147-
it('cookies should exist on the page', () =>
147+
// This website seems to no longer be working. I tried to find an alternative, but ...
148+
xit('cookies should exist on the page', () =>
148149
request(app)
149150
.post('/api/render')
150151
.send({

0 commit comments

Comments
 (0)