From f8d8a654b2610dd3be1f77cee9606110c6368c86 Mon Sep 17 00:00:00 2001 From: Joshua Date: Wed, 12 Jul 2023 13:03:14 -0700 Subject: [PATCH] chore(deps): Replace / prune various dependencies. --- nr.config.ts | 4 +-- package-lock.json | 39 ++++++--------------- package.json | 6 ++-- src/lib/configuration/strategies/esbuild.ts | 23 ++++++------ 4 files changed, 26 insertions(+), 46 deletions(-) diff --git a/nr.config.ts b/nr.config.ts index c74fbc6..cc269c5 100644 --- a/nr.config.ts +++ b/nr.config.ts @@ -1,7 +1,7 @@ -import { nr } from '@darkobits/ts'; +import { withDefaultPackageScripts } from '@darkobits/ts'; -export default nr(({ script, command, isCI }) => { +export default withDefaultPackageScripts(({ script, command, isCI }) => { script('test.smoke', [[ // ----- [Smoke Tests] CJS Host Package -------------------------------- diff --git a/package-lock.json b/package-lock.json index 766737d..7bed0b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,14 +18,12 @@ "deepmerge": "^4.3.1", "esbuild": "^0.18.11", "esbuild-node-externals": "^1.8.0", - "fs-extra": "^11.1.1", + "get-tsconfig": "^4.6.2", "read-pkg-up": "^10.0.0", - "tsconfck": "^2.1.1", "yargs": "^17.7.2" }, "devDependencies": { - "@darkobits/ts": "~0.18.8", - "@types/fs-extra": "^11.0.1" + "@darkobits/ts": "~0.18.8" }, "engines": { "node": ">=16" @@ -2479,16 +2477,6 @@ "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==", "dev": true }, - "node_modules/@types/fs-extra": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.1.tgz", - "integrity": "sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA==", - "dev": true, - "dependencies": { - "@types/jsonfile": "*", - "@types/node": "*" - } - }, "node_modules/@types/http-cache-semantics": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", @@ -2526,15 +2514,6 @@ "dev": true, "peer": true }, - "node_modules/@types/jsonfile": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.1.tgz", - "integrity": "sha512-GSgiRCVeapDN+3pqA35IkQwasaCh/0YFH5dEF6S88iDvEn901DjOeH3/QPY+XYP1DFzDZPvIvfeEgk+7br5png==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/lodash": { "version": "4.14.195", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.195.tgz", @@ -2551,7 +2530,8 @@ "version": "20.4.1", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.1.tgz", "integrity": "sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==", - "dev": true + "dev": true, + "peer": true }, "node_modules/@types/normalize-package-data": { "version": "2.4.1", @@ -7093,6 +7073,7 @@ "version": "11.1.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", + "dev": true, "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -7444,8 +7425,6 @@ "version": "4.6.2", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.6.2.tgz", "integrity": "sha512-E5XrT4CbbXcXWy+1jChlZmrmCwd5KGx502kDCXJJ7y898TtWW9FwoG5HfOLVRKmlmDGkWN2HM9Ho+/Y8F0sJDg==", - "dev": true, - "peer": true, "dependencies": { "resolve-pkg-maps": "^1.0.0" }, @@ -7723,7 +7702,8 @@ "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true }, "node_modules/grapheme-splitter": { "version": "1.0.4", @@ -8960,6 +8940,7 @@ "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, "dependencies": { "universalify": "^2.0.0" }, @@ -15837,8 +15818,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", - "dev": true, - "peer": true, "funding": { "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } @@ -17649,6 +17628,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-2.1.1.tgz", "integrity": "sha512-ZPCkJBKASZBmBUNqGHmRhdhM8pJYDdOXp4nRgj/O0JwUwsMq50lCDRQP/M5GBNAA0elPrq4gAeu4dkaVCuKWww==", + "dev": true, "bin": { "tsconfck": "bin/tsconfck.js" }, @@ -17892,6 +17872,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true, "engines": { "node": ">= 10.0.0" } diff --git a/package.json b/package.json index dfbef9a..a42d044 100644 --- a/package.json +++ b/package.json @@ -33,13 +33,11 @@ "deepmerge": "^4.3.1", "esbuild": "^0.18.11", "esbuild-node-externals": "^1.8.0", - "fs-extra": "^11.1.1", + "get-tsconfig": "^4.6.2", "read-pkg-up": "^10.0.0", - "tsconfck": "^2.1.1", "yargs": "^17.7.2" }, "devDependencies": { - "@darkobits/ts": "~0.18.8", - "@types/fs-extra": "^11.0.1" + "@darkobits/ts": "~0.18.8" } } diff --git a/src/lib/configuration/strategies/esbuild.ts b/src/lib/configuration/strategies/esbuild.ts index f2ed0b7..ee8c1f3 100644 --- a/src/lib/configuration/strategies/esbuild.ts +++ b/src/lib/configuration/strategies/esbuild.ts @@ -1,10 +1,11 @@ +import fs from 'fs/promises'; import path from 'path'; import { TsconfigPathsPlugin } from '@esbuild-plugins/tsconfig-paths'; import * as esbuild from 'esbuild'; import { nodeExternalsPlugin } from 'esbuild-node-externals'; -import fs from 'fs-extra'; -import * as tsConfck from 'tsconfck'; +import { getTsconfig } from 'get-tsconfig'; + import log from 'lib/log'; @@ -83,14 +84,13 @@ export async function esbuildStrategy(filePath: string, pkgInfo: Packag // If the user has a TypeScript configuration file, enable TypeScript // features. - const tsConfigFilePath = await tsConfck.find(filePath); - - if (tsConfigFilePath) { - log.verbose(prefix, 'Using TypeScript configuration:', log.chalk.green(tsConfigFilePath)); - buildOptions.tsconfig = tsConfigFilePath; - buildOptions.plugins?.push(TsconfigPathsPlugin({ - tsconfig: tsConfigFilePath - })); + const tsConfigResult = getTsconfig(filePath); + + if (tsConfigResult) { + const tsconfig = tsConfigResult.path; + log.verbose(prefix, 'Using TypeScript configuration:', log.chalk.green(tsconfig)); + buildOptions.tsconfig = tsconfig; + buildOptions.plugins?.push(TsconfigPathsPlugin({ tsconfig })); } // Transpile the input file. @@ -114,6 +114,7 @@ export async function esbuildStrategy(filePath: string, pkgInfo: Packag ); } finally { // Remove the temporary file. - if (await fs.exists(tempFilePath)) await fs.remove(tempFilePath); + await fs.access(tempFilePath, fs.constants.F_OK) + .then(() => fs.unlink(tempFilePath)); } }