From 46458ab517aebe8fe9573250c62ee814bf2f67ff Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Tue, 13 Jun 2023 16:22:53 -0700 Subject: [PATCH] build: update typescript-generator and docs-parser (#38747) * build: update typescript-generator and docs-parser * again... * build: handle more specific pageSize types --- package.json | 4 ++-- spec/api-web-contents-spec.ts | 28 +++++++++++++++------------- yarn.lock | 16 ++++++++-------- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index e835f7d52e..cda8388fc2 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,11 @@ "devDependencies": { "@azure/storage-blob": "^12.9.0", "@electron/asar": "^3.2.1", - "@electron/docs-parser": "^1.1.0", + "@electron/docs-parser": "^1.1.1", "@electron/fiddle-core": "^1.0.4", "@electron/github-app-auth": "^2.0.0", "@electron/lint-roller": "^1.5.0", - "@electron/typescript-definitions": "^8.14.0", + "@electron/typescript-definitions": "^8.14.5", "@octokit/rest": "^19.0.7", "@primer/octicons": "^10.0.0", "@types/basic-auth": "^1.1.3", diff --git a/spec/api-web-contents-spec.ts b/spec/api-web-contents-spec.ts index 176f200ef2..22831b7947 100644 --- a/spec/api-web-contents-spec.ts +++ b/spec/api-web-contents-spec.ts @@ -1976,24 +1976,26 @@ describe('webContents module', () => { expect(data).to.be.an.instanceof(Buffer).that.is.not.empty(); }); + type PageSizeString = Exclude['pageSize'], Electron.Size>; + it('with custom page sizes', async () => { - const paperFormats: Record = { - letter: { width: 8.5, height: 11 }, - legal: { width: 8.5, height: 14 }, - tabloid: { width: 11, height: 17 }, - ledger: { width: 17, height: 11 }, - a0: { width: 33.1, height: 46.8 }, - a1: { width: 23.4, height: 33.1 }, - a2: { width: 16.54, height: 23.4 }, - a3: { width: 11.7, height: 16.54 }, - a4: { width: 8.27, height: 11.7 }, - a5: { width: 5.83, height: 8.27 }, - a6: { width: 4.13, height: 5.83 } + const paperFormats: Record = { + Letter: { width: 8.5, height: 11 }, + Legal: { width: 8.5, height: 14 }, + Tabloid: { width: 11, height: 17 }, + Ledger: { width: 17, height: 11 }, + A0: { width: 33.1, height: 46.8 }, + A1: { width: 23.4, height: 33.1 }, + A2: { width: 16.54, height: 23.4 }, + A3: { width: 11.7, height: 16.54 }, + A4: { width: 8.27, height: 11.7 }, + A5: { width: 5.83, height: 8.27 }, + A6: { width: 4.13, height: 5.83 } }; await w.loadFile(path.join(__dirname, 'fixtures', 'api', 'print-to-pdf-small.html')); - for (const format of Object.keys(paperFormats)) { + for (const format of Object.keys(paperFormats) as PageSizeString[]) { const data = await w.webContents.printToPDF({ pageSize: format }); const doc = await pdfjs.getDocument(data).promise; diff --git a/yarn.lock b/yarn.lock index d95a8b2971..6cc2cc1d5e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -141,10 +141,10 @@ optionalDependencies: "@types/glob" "^7.1.1" -"@electron/docs-parser@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@electron/docs-parser/-/docs-parser-1.1.0.tgz#ba095def41746bde56bee731feaf22272bf0b765" - integrity sha512-qrjIKJk8t4/xAYldDVNQgcF8zdAAuG260bzPxdh/xI3p/yddm61bftoct+Tx2crnWFnOfOkr6nGERsDknNiT8A== +"@electron/docs-parser@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@electron/docs-parser/-/docs-parser-1.1.1.tgz#14bec2940f81f4debb95a2b0f186f7f00d682899" + integrity sha512-IB6XCDaNTHqm7h0Joa1LUtZhmBvItRWp0KUNuNtuXLEv/6q6ZYw9wn89QzlFYxgH8ZTleF9dWpJby0mIpsX0Ng== dependencies: "@types/markdown-it" "^12.0.0" chai "^4.2.0" @@ -213,10 +213,10 @@ vscode-languageserver-textdocument "^1.0.8" vscode-uri "^3.0.7" -"@electron/typescript-definitions@^8.14.0": - version "8.14.0" - resolved "https://registry.yarnpkg.com/@electron/typescript-definitions/-/typescript-definitions-8.14.0.tgz#a88f74e915317ba943b57ffe499b319d04f01ee3" - integrity sha512-J3b4is6L0NB4+r+7s1Hl1YlzaveKnQt1gswadRyMRwb4gFU3VAe2oBMJLOhFRJMs/9PK/Xp+y9QwyC92Tyqe6A== +"@electron/typescript-definitions@^8.14.5": + version "8.14.5" + resolved "https://registry.yarnpkg.com/@electron/typescript-definitions/-/typescript-definitions-8.14.5.tgz#07ffc7dac6008e0f659215e3b88bc0d7c6bc6ece" + integrity sha512-68JfMTcj6X7B0dhjhj8lGGnnOlfuiR4f+2UBEtQDYRHfeSuFriKErno3Lh+jAolGSqhw39qr4lLO+FGToVdCew== dependencies: "@types/node" "^11.13.7" chalk "^2.4.2"