From 9d912f66182f40281b3f25587291decaf1fa258d Mon Sep 17 00:00:00 2001 From: Thijs Louisse Date: Wed, 23 Nov 2022 15:50:06 +0100 Subject: [PATCH] chore: apply types-correct in ui pkg --- package-lock.json | 5 ++--- package.json | 5 ++--- packages/ui/package.json | 5 +++-- .../ui/scripts/types-correct-after-build.js | 4 ++-- packages/ui/tsconfig-check-only.json | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) rename scripts/types-correct-after-build.mjs => packages/ui/scripts/types-correct-after-build.js (87%) diff --git a/package-lock.json b/package-lock.json index 2076d2278..8388a002e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11518,9 +11518,8 @@ "node_modules/globby": { "version": "13.1.2", "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.2.tgz", - "integrity": "sha1-KQRxBVgkJ6tuyk+QUgBmewVtpRU=", + "integrity": "sha512-LKSDZXToac40u8Q1PQtZihbNdTYSNMuWe+K5l+oa6KgDzSvVrHXlJy40hUP522RjAIoNLJYBJi7ow+rbFpIhHQ==", "dev": true, - "license": "MIT", "dependencies": { "dir-glob": "^3.0.1", "fast-glob": "^3.2.11", @@ -32529,7 +32528,7 @@ "globby": { "version": "13.1.2", "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.2.tgz", - "integrity": "sha1-KQRxBVgkJ6tuyk+QUgBmewVtpRU=", + "integrity": "sha512-LKSDZXToac40u8Q1PQtZihbNdTYSNMuWe+K5l+oa6KgDzSvVrHXlJy40hUP522RjAIoNLJYBJi7ow+rbFpIhHQ==", "dev": true, "requires": { "dir-glob": "^3.0.1", diff --git a/package.json b/package.json index 173aea8e7..9c02c9186 100644 --- a/package.json +++ b/package.json @@ -31,9 +31,8 @@ "test:node": "npm run test:node --workspaces --if-present", "test:screenshots": "rimraf screenshots/.diff/ && rimraf screenshots/.current/ && mocha --require scripts/screenshots/bootstrap.js --exit --timeout 10000 \"packages/**/test/*.screenshots-test.js\"", "test:screenshots:update": "cross-env UPDATE_SCREENSHOTS=true npm run test:screenshots", - "types": "npm run types --workspaces --if-present && npm run types-correct-after-build", - "types-check-only": "npm run types-check-only --workspaces --if-present", - "types-correct-after-build": "node ./scripts/types-correct-after-build.mjs" + "types": "npm run types --workspaces --if-present", + "types-check-only": "npm run types-check-only --workspaces --if-present" }, "workspaces": [ "packages/*", diff --git a/packages/ui/package.json b/packages/ui/package.json index afc6dd9d1..9900bf992 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -42,7 +42,8 @@ "prepublishOnly": "npm run types && npm run publish-docs && npm run custom-elements-manifest", "test": "cd ../../ && npm run test:browser", "types": "wireit", - "types-check-only": "tsc --project tsconfig-check-only.json" + "types-check-only": "tsc --project tsconfig-check-only.json", + "types-correct-after-build": "node ./scripts/types-correct-after-build.js" }, "dependencies": { "@bundled-es-modules/message-format": "^6.0.4", @@ -65,7 +66,7 @@ "customElements": "custom-elements.json", "wireit": { "types": { - "command": "tsc --build --pretty", + "command": "tsc --build --pretty && npm run types-correct-after-build", "dependencies": [ "../singleton-manager:types" ], diff --git a/scripts/types-correct-after-build.mjs b/packages/ui/scripts/types-correct-after-build.js similarity index 87% rename from scripts/types-correct-after-build.mjs rename to packages/ui/scripts/types-correct-after-build.js index 56f902cb0..7c1385229 100644 --- a/scripts/types-correct-after-build.mjs +++ b/packages/ui/scripts/types-correct-after-build.js @@ -15,10 +15,10 @@ import fs from 'fs'; import { globby } from 'globby'; import { fileURLToPath } from 'url'; -const monorepoRootPath = fileURLToPath(new URL('../', import.meta.url)); +const packageRoot = fileURLToPath(new URL('../', import.meta.url)); async function alignLitImports() { - const fileNames = await globby([`${monorepoRootPath}/packages/ui/dist-types`]); + const fileNames = await globby([`${packageRoot}/dist-types`]); for (const fileName of fileNames) { // eslint-disable-next-line no-await-in-loop const contents = await fs.promises.readFile(fileName, 'utf-8'); diff --git a/packages/ui/tsconfig-check-only.json b/packages/ui/tsconfig-check-only.json index 67de05504..c83dd16ca 100644 --- a/packages/ui/tsconfig-check-only.json +++ b/packages/ui/tsconfig-check-only.json @@ -1,5 +1,5 @@ { - "//": "this runs after 'scripts/types-correct-after-build.mjs' has been applied", + "//": "this runs after 'scripts/types-correct-after-build.js' has been applied", "extends": "./tsconfig.json", "compilerOptions": { "emitDeclarationOnly": false,