From dee2f5267d1f89ab33f8108933268568292b9d40 Mon Sep 17 00:00:00 2001 From: Patrick Rodgers Date: Wed, 20 Dec 2023 14:22:56 -0500 Subject: [PATCH] more build system :) --- .gitignore | 1 - tools/buildsystem/bin/buildsystem.ts | 4 +- tools/buildsystem/package-lock.json | 233 ++---------------- tools/buildsystem/package.json | 3 +- .../src/behaviors/copy-asset-files.ts | 2 +- .../src/behaviors/copy-package-files.ts | 2 +- .../src/behaviors/replace-version.ts | 22 +- tools/buildsystem/tsconfig.json | 3 +- tools/local-module-resolver/esm.ts | 4 +- 9 files changed, 43 insertions(+), 231 deletions(-) diff --git a/.gitignore b/.gitignore index 268f0b5eb..96b9ce18a 100644 --- a/.gitignore +++ b/.gitignore @@ -55,4 +55,3 @@ settings.js # don't save the locally produced .js of the buildsystem config buildsystem-config.js -buildsystem-config2.js diff --git a/tools/buildsystem/bin/buildsystem.ts b/tools/buildsystem/bin/buildsystem.ts index 2cb413644..0503573b5 100644 --- a/tools/buildsystem/bin/buildsystem.ts +++ b/tools/buildsystem/bin/buildsystem.ts @@ -1,6 +1,6 @@ #!/usr/bin/env node -import Liftoff from "liftoff"; +import * as Liftoff from "liftoff"; import yargs from "yargs"; import { hideBin } from "yargs/helpers"; import { dirname, join, resolve } from "path"; @@ -15,7 +15,7 @@ const context: Partial = { resolvedProjectRoot: join(cwd(), "package.json"), }; -const BuildSystem = new Liftoff({ +const BuildSystem = new (Liftoff).default({ configName: "buildsystem-config", name: "buildsystem", }); diff --git a/tools/buildsystem/package-lock.json b/tools/buildsystem/package-lock.json index 8f90fe7c3..54fe8ced9 100644 --- a/tools/buildsystem/package-lock.json +++ b/tools/buildsystem/package-lock.json @@ -1,18 +1,17 @@ { "name": "@pnp/buildsystem", - "version": "4.0.0-beta0", + "version": "4.0.0-beta3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@pnp/buildsystem", - "version": "4.0.0-beta0", + "version": "4.0.0-beta3", "license": "MIT", "dependencies": { "@pnp/core": "^3.21.0", "globby": "^14.0.0", "liftoff": "^4.0.0", - "replace-in-file": "^7.0.2", "webpack": "^5.89.0", "yargs": "^17.7.2" }, @@ -505,15 +504,8 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dependencies": { - "balanced-match": "^1.0.0" - } + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true }, "node_modules/braces": { "version": "3.0.2", @@ -1070,7 +1062,8 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true }, "node_modules/function-bind": { "version": "1.1.2", @@ -1088,24 +1081,6 @@ "node": "6.* || 8.* || >= 10.*" } }, - "node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -1261,6 +1236,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -1269,7 +1245,8 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "node_modules/ini": { "version": "1.3.8", @@ -1652,17 +1629,6 @@ "node": ">=4" } }, - "node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/minimist-options": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", @@ -1743,6 +1709,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "dependencies": { "wrappy": "1" } @@ -2009,86 +1976,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/replace-in-file": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/replace-in-file/-/replace-in-file-7.0.2.tgz", - "integrity": "sha512-tPG+Qmqf+x2Rf1WVdb/9B5tFIf6KJ5hs3fgxh1OTzPRUugPPvyAva7NvCJtnSpmyq6r+ABYcuUOqZkm6yzGSUw==", - "dependencies": { - "chalk": "^4.1.2", - "glob": "^8.1.0", - "yargs": "^17.7.2" - }, - "bin": { - "replace-in-file": "bin/cli.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/replace-in-file/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/replace-in-file/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/replace-in-file/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/replace-in-file/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "node_modules/replace-in-file/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/replace-in-file/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -2703,7 +2590,8 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true }, "node_modules/y18n": { "version": "5.0.8", @@ -3164,15 +3052,8 @@ "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "requires": { - "balanced-match": "^1.0.0" - } + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true }, "braces": { "version": "3.0.2", @@ -3566,7 +3447,8 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true }, "function-bind": { "version": "1.1.2", @@ -3578,18 +3460,6 @@ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" }, - "glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - } - }, "glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -3702,6 +3572,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -3710,7 +3581,8 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "ini": { "version": "1.3.8", @@ -3984,14 +3856,6 @@ "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", "dev": true }, - "minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "requires": { - "brace-expansion": "^2.0.1" - } - }, "minimist-options": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", @@ -4057,6 +3921,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "requires": { "wrappy": "1" } @@ -4225,61 +4090,6 @@ "strip-indent": "^4.0.0" } }, - "replace-in-file": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/replace-in-file/-/replace-in-file-7.0.2.tgz", - "integrity": "sha512-tPG+Qmqf+x2Rf1WVdb/9B5tFIf6KJ5hs3fgxh1OTzPRUugPPvyAva7NvCJtnSpmyq6r+ABYcuUOqZkm6yzGSUw==", - "requires": { - "chalk": "^4.1.2", - "glob": "^8.1.0", - "yargs": "^17.7.2" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -4676,7 +4486,8 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true }, "y18n": { "version": "5.0.8", diff --git a/tools/buildsystem/package.json b/tools/buildsystem/package.json index b3cb7cb69..49de56bc4 100644 --- a/tools/buildsystem/package.json +++ b/tools/buildsystem/package.json @@ -1,6 +1,6 @@ { "name": "@pnp/buildsystem", - "version": "4.0.0-beta3", + "version": "4.0.0-beta4", "bin": { "pnpbuild": "bin/buildsystem.js" }, @@ -12,7 +12,6 @@ "@pnp/core": "^3.21.0", "globby": "^14.0.0", "liftoff": "^4.0.0", - "replace-in-file": "^7.0.2", "webpack": "^5.89.0", "yargs": "^17.7.2" }, diff --git a/tools/buildsystem/src/behaviors/copy-asset-files.ts b/tools/buildsystem/src/behaviors/copy-asset-files.ts index 15181e5ee..071a21482 100644 --- a/tools/buildsystem/src/behaviors/copy-asset-files.ts +++ b/tools/buildsystem/src/behaviors/copy-asset-files.ts @@ -1,6 +1,6 @@ import { TimelinePipe } from "@pnp/core"; import { BuildTimeline } from "../build-timeline.js"; -import globby from "globby"; +import { globby } from "globby"; import { resolve } from "path"; import buildCopyFile from "../lib/copy-file.js"; diff --git a/tools/buildsystem/src/behaviors/copy-package-files.ts b/tools/buildsystem/src/behaviors/copy-package-files.ts index 6767e7904..492fe7f0f 100644 --- a/tools/buildsystem/src/behaviors/copy-package-files.ts +++ b/tools/buildsystem/src/behaviors/copy-package-files.ts @@ -1,6 +1,6 @@ import { TimelinePipe } from "@pnp/core"; import { BuildTimeline } from "../build-timeline.js"; -import globby from "globby"; +import { globby } from "globby"; import { resolve } from "path"; import buildCopyFile from "../lib/copy-file.js"; diff --git a/tools/buildsystem/src/behaviors/replace-version.ts b/tools/buildsystem/src/behaviors/replace-version.ts index e8fd4cad0..c958cd1b5 100644 --- a/tools/buildsystem/src/behaviors/replace-version.ts +++ b/tools/buildsystem/src/behaviors/replace-version.ts @@ -1,7 +1,8 @@ import { TimelinePipe } from "@pnp/core"; +import { BuildTimeline } from "../build-timeline.js"; +import { readFile } from "fs/promises"; +import buildWriteFile from "src/lib/write-file.js"; import { resolve } from "path"; -import { BuildTimeline } from "src/build-timeline"; -import replace from "replace-in-file"; export function ReplaceVersion(paths: string[], versionMask = /\$\$Version\$\$/ig): TimelinePipe { @@ -13,13 +14,16 @@ export function ReplaceVersion(paths: string[], versionMask = /\$\$Version\$\$/i this.log(`Replacing package version for target "${target.tsconfigPath}"`, 1); - const options = { - files: paths.map(p => resolve(target.resolvedOutDir, p)), - from: versionMask, - to: version, - }; - - return (replace)(options); + paths.forEach(async (path) => { + + const file = await readFile(resolve(path)); + + const txt = file.toString(); + + txt.replace(versionMask, version); + + await buildWriteFile(path, txt); + }); }); return instance; diff --git a/tools/buildsystem/tsconfig.json b/tools/buildsystem/tsconfig.json index 8f1826622..a06704fd4 100644 --- a/tools/buildsystem/tsconfig.json +++ b/tools/buildsystem/tsconfig.json @@ -29,8 +29,7 @@ "strictNullChecks": false, "preserveConstEnums": true, "importHelpers": true, - "resolveJsonModule": true, - "allowSyntheticDefaultImports": true + "resolveJsonModule": true }, "include": [ "./index.ts", diff --git a/tools/local-module-resolver/esm.ts b/tools/local-module-resolver/esm.ts index 4e2c3c8ae..2c60f7e49 100644 --- a/tools/local-module-resolver/esm.ts +++ b/tools/local-module-resolver/esm.ts @@ -3,7 +3,7 @@ import { existsSync } from "fs"; import findup from "findup-sync"; // give ourselves a single reference to the projectRoot -const projectRoot = resolve(dirname(findup("package.json"))); +const projectRoot = resolve(dirname(findup("package.json")!)); function log(_message: string) { // console.log(`PnP Node Local Module Loader: ${message}`); @@ -23,7 +23,7 @@ export function createResolve(innerPath: string): ResolverFunc { const modulePath = specifier.substring(4); if (cache.has(modulePath)) { - return cache.get(modulePath); + return cache.get(modulePath)!; } let candidate = join(projectRoot, innerPath, modulePath);