From 4e5e97cd7ac784a05b00d45155944934a5602230 Mon Sep 17 00:00:00 2001 From: Grant Heaslip Date: Wed, 13 Aug 2025 18:46:39 -0400 Subject: [PATCH 1/2] Remove @asl-19/shared-package-configs, update configs, misc. cleanup: - Removed remaining references to obsolete types directory (types now come from .d.ts files in dist) - tsconfig.json no longer extends from @asl-19/shared-package-configs/tsconfig-base.json. Inlined the content of @asl-19/shared-package-configs/tsconfig-base.json and modernized some configs. Also note that tsconfig-esm.json was renamed to tsconfig-dist.json, and it extends our tsconfig.json. - rm-dist now removes all files in dist (rather than the directory itself), causing less disruption during builds - Added new dev-build-update script for development - Typed prettier.config.js --- .prettierignore | 1 - .vscode/settings.json | 5 +++-- README.markdown | 2 +- api-extractor.json | 19 +------------------ api-extractor/js-utils.api.json | 24 ++++++++++++------------ eslint.config.js | 9 ++++----- package-lock.json | 8 -------- package.json | 14 +++++++------- prettier.config.js | 1 + tsconfig-esm.json => tsconfig-dist.json | 2 +- tsconfig.json | 10 ++++++++-- 11 files changed, 38 insertions(+), 57 deletions(-) rename tsconfig-esm.json => tsconfig-dist.json (58%) diff --git a/.prettierignore b/.prettierignore index 683a4ac..db9a348 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,4 +2,3 @@ api-extractor/**/* dist/**/* docs/**/* temp/**/* -types/**/* diff --git a/.vscode/settings.json b/.vscode/settings.json index 03449b7..bcb49d4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,7 @@ "cSpell.words": [ "destructure", "heaslip", + "nodenext", "Perso", "rushstack", "tsdoc", @@ -42,8 +43,8 @@ "api-extractor/**/*": true, "CHANGELOG": true, "docs/**/*": true, - "LICENSE": true, - "types/**/*": true + "package-lock.json": true, + "LICENSE": true }, "typescript.tsdk": "node_modules/typescript/lib" } diff --git a/README.markdown b/README.markdown index 1002cda..97f2740 100644 --- a/README.markdown +++ b/README.markdown @@ -24,7 +24,7 @@ npm run dev If you add a new function or making a change to the arguments of an existing function (without this TypeScript won’t be aware of the changes, and the `build-lint-test` script will fail): ```sh -# Update api-extractor/* (metadata about code generated by api-extractor), docs/* (Markdown documentation generated by api-documenter using api-extractor metadata) and types/js-utils.d.ts (types generated by api-extractor) +# Update api-extractor/* (metadata about code generated by api-extractor) and docs/* (Markdown documentation generated by api-documenter using api-extractor metadata) npm run api-extractor-update ``` diff --git a/api-extractor.json b/api-extractor.json index 7c64bb0..d2c0797 100644 --- a/api-extractor.json +++ b/api-extractor.json @@ -9,7 +9,7 @@ "reportFolder": "/api-extractor" }, "compiler": { - "tsconfigFilePath": "tsconfig.json" + "tsconfigFilePath": "tsconfig-dist.json" }, "docModel": { "enabled": true, @@ -18,23 +18,6 @@ "dtsRollup": { "enabled": false }, - "messages": { - "compilerMessageReporting": { - "default": { - "logLevel": "warning" - } - }, - "extractorMessageReporting": { - "default": { - "logLevel": "warning" - } - }, - "tsdocMessageReporting": { - "default": { - "logLevel": "warning" - } - } - }, "tsdocMetadata": { "enabled": false } diff --git a/api-extractor/js-utils.api.json b/api-extractor/js-utils.api.json index c1b227a..7c2c558 100644 --- a/api-extractor/js-utils.api.json +++ b/api-extractor/js-utils.api.json @@ -194,7 +194,7 @@ "text": "T" } ], - "fileUrlPath": "src/asType.ts", + "fileUrlPath": "dist/asType.d.ts", "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 @@ -248,7 +248,7 @@ "text": "string" } ], - "fileUrlPath": "src/cleanUrlQueryString.ts", + "fileUrlPath": "dist/cleanUrlQueryString.d.ts", "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 @@ -316,7 +316,7 @@ "text": "`/${string}`" } ], - "fileUrlPath": "src/constructUrl.ts", + "fileUrlPath": "dist/constructUrl.d.ts", "returnTypeTokenRange": { "startIndex": 9, "endIndex": 10 @@ -357,7 +357,7 @@ "text": "string" } ], - "fileUrlPath": "src/getAbsoluteUrl.ts", + "fileUrlPath": "dist/getAbsoluteUrl.d.ts", "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 @@ -403,7 +403,7 @@ "text": "string | undefined" } ], - "fileUrlPath": "src/getFirstStringOrString.ts", + "fileUrlPath": "dist/getFirstStringOrString.d.ts", "returnTypeTokenRange": { "startIndex": 4, "endIndex": 5 @@ -498,7 +498,7 @@ "text": "NormalizedQueryType" } ], - "fileUrlPath": "src/getNormalizedQuery.ts", + "fileUrlPath": "dist/getNormalizedQuery.d.ts", "returnTypeTokenRange": { "startIndex": 15, "endIndex": 16 @@ -566,7 +566,7 @@ "text": "" } ], - "fileUrlPath": "src/getObjectValueByDotSeparatedKey.ts", + "fileUrlPath": "dist/getObjectValueByDotSeparatedKey.d.ts", "returnTypeTokenRange": { "startIndex": 5, "endIndex": 7 @@ -620,7 +620,7 @@ "text": "string" } ], - "fileUrlPath": "src/getRootRelativeUrl.ts", + "fileUrlPath": "dist/getRootRelativeUrl.d.ts", "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 @@ -661,7 +661,7 @@ "text": "boolean" } ], - "fileUrlPath": "src/isNullOrWhitespace.ts", + "fileUrlPath": "dist/isNullOrWhitespace.d.ts", "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 @@ -702,7 +702,7 @@ "text": "string" } ], - "fileUrlPath": "src/replaceArabicNumeralsWithPersianNumerals.ts", + "fileUrlPath": "dist/replaceArabicNumeralsWithPersianNumerals.d.ts", "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 @@ -743,7 +743,7 @@ "text": "void" } ], - "fileUrlPath": "src/serverLog.ts", + "fileUrlPath": "dist/serverLog.d.ts", "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 @@ -784,7 +784,7 @@ "text": "string" } ], - "fileUrlPath": "src/underscoreCaseToCamelCase.ts", + "fileUrlPath": "dist/underscoreCaseToCamelCase.d.ts", "returnTypeTokenRange": { "startIndex": 3, "endIndex": 4 diff --git a/eslint.config.js b/eslint.config.js index 169a20a..2079472 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,17 +1,16 @@ // We should be able to remove the @ts-expect-error and eslint-disable-next-line // once we fix the typing of @asl-19/eslint-config -// @ts-expect-error (TODO: why is this happening?) import asl19 from "@asl-19/eslint-config"; import { defineConfig } from "eslint/config"; -// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -const typedAsl19 = - /** @type {import("@asl-19/eslint-config/types/index")["default"]} */ (asl19); +const typedAsl19 = /** @type {import("@asl-19/eslint-config")["default"]} */ ( + asl19 +); const eslintConfig = defineConfig([ { - ignores: ["dist/", "types/", ".yalc/"], + ignores: ["dist/", ".yalc/"], }, { extends: [ diff --git a/package-lock.json b/package-lock.json index ee03ba0..d510085 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,6 @@ }, "devDependencies": { "@asl-19/eslint-config": "^0.9.0", - "@asl-19/shared-package-configs": "^0.3.0", "@microsoft/api-documenter": "^7.26.29", "@microsoft/api-extractor": "^7.52.8", "@types/node": "^22.16.4", @@ -68,13 +67,6 @@ "eslint": "^9.22.0" } }, - "node_modules/@asl-19/shared-package-configs": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@asl-19/shared-package-configs/-/shared-package-configs-0.3.0.tgz", - "integrity": "sha512-yNU5cHCTIWSfgyBAKRQlRL8rwwmNGnVLjLDKDSnAnmTH31BeSio+3NcBbVx403ND+9vNxZX64FmIjmn+YVRr+g==", - "dev": true, - "license": "GPL-3.0-or-later" - }, "node_modules/@eslint-community/eslint-utils": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", diff --git a/package.json b/package.json index ab54a1b..ffa51a1 100644 --- a/package.json +++ b/package.json @@ -41,27 +41,27 @@ "api-extractor-check": "api-extractor run --verbose", "api-extractor-update": "api-extractor run --local --verbose && api-documenter markdown --input-folder ./api-extractor --output-folder ./docs", "build-lint-test": "npm-run-all -l -p tsc -s lint-test", - "rm-dist": "rm -rf dist", + "rm-dist": "rm -rf dist/*", "dev": "npm-run-all -l -s package-changed -p tsc-watch", + "dev-build-update": "npm-run-all -l -p package-changed rm-dist -s tsc api-extractor-update", "dev-lint-test": "run-s package-changed lint-test", "eslint-check": "eslint . --ext='js,ts,tsx'", "eslint-fix": "eslint . --ext='js,ts,tsx' --fix", "lint-test": "run-p -l api-extractor-check eslint-check prettier-check tsc-check", "package-changed": "package-changed", "prepublishOnly": "run-s rm-dist build-lint-test", - "prettier-check": "prettier --config prettier.config.js --check .", - "prettier-fix": "prettier --config prettier.config.js --write .", + "prettier-check": "prettier --check .", + "prettier-fix": "prettier --write .", "npm-check-updates": "npm-check-updates", - "tsc": "tsc --project tsconfig-esm.json", - "tsc-watch": "tsc --project tsconfig-esm.json --watch", - "tsc-check": "tsc --noEmit" + "tsc": "tsc --project tsconfig-dist.json", + "tsc-watch": "tsc --project tsconfig-dist.json --watch", + "tsc-check": "tsc --project tsconfig-dist.json --noEmit" }, "dependencies": { "ts-pattern": "^5.7.1" }, "devDependencies": { "@asl-19/eslint-config": "^0.9.0", - "@asl-19/shared-package-configs": "^0.3.0", "@microsoft/api-documenter": "^7.26.29", "@microsoft/api-extractor": "^7.52.8", "@types/node": "^22.16.4", diff --git a/prettier.config.js b/prettier.config.js index f93b56a..6e26202 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -1,3 +1,4 @@ +/** @type {import("prettier").Config} */ const prettierConfig = { overrides: [ { diff --git a/tsconfig-esm.json b/tsconfig-dist.json similarity index 58% rename from tsconfig-esm.json rename to tsconfig-dist.json index 5d6100a..4ceb573 100644 --- a/tsconfig-esm.json +++ b/tsconfig-dist.json @@ -1,5 +1,5 @@ { - "extends": "@asl-19/shared-package-configs/tsconfig-esm.json", + "extends": "./tsconfig.json", "compilerOptions": { "outDir": "dist" }, diff --git a/tsconfig.json b/tsconfig.json index 5c59cd3..462e513 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,13 @@ { - "extends": "@asl-19/shared-package-configs/tsconfig-base.json", "compilerOptions": { - "outDir": "dist" + "allowJs": true, + "checkJs": true, + "declaration": true, + "incremental": true, + "module": "nodenext", + "outDir": "dist", + "strict": true, + "target": "es2021" }, "include": [ "*.mjs", From 37405ae5b35e23059b9f81f4dc45e942c5b7b6f4 Mon Sep 17 00:00:00 2001 From: Grant Heaslip Date: Thu, 14 Aug 2025 12:49:54 -0400 Subject: [PATCH 2/2] Use module: "preserve" (safe as long as consuming packages are ESM) --- tsconfig-dist.json | 3 --- tsconfig.json | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tsconfig-dist.json b/tsconfig-dist.json index 4ceb573..dd4b3c2 100644 --- a/tsconfig-dist.json +++ b/tsconfig-dist.json @@ -1,8 +1,5 @@ { "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "dist" - }, "include": [ "src/**/*.ts*" ] diff --git a/tsconfig.json b/tsconfig.json index 462e513..bb20822 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "checkJs": true, "declaration": true, "incremental": true, - "module": "nodenext", + "module": "preserve", "outDir": "dist", "strict": true, "target": "es2021"