From d9ca5ff3ff2f304a6d75f2b7a296bd900431d41f Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Thu, 5 Oct 2023 01:48:08 -0500 Subject: [PATCH] fix: multiple bugs (#119) --- package-lock.json | 184 +++++++++++++------------- package.json | 2 +- src/commands/build.ts | 38 +++--- src/commands/publish.ts | 2 +- src/create-publish.mts | 39 +++++- src/utilities/defaultEsbuildConfig.ts | 4 +- tsup.config.ts | 9 +- 7 files changed, 156 insertions(+), 122 deletions(-) diff --git a/package-lock.json b/package-lock.json index 05bfd95..a7e6bf3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,7 @@ "@favware/npm-deprecate": "1.0.7", "@types/prompts": "2.4.4", "prettier": "2.8.8", - "tsup": "6.7.0", + "tsup": "^6.7.0", "typescript": "5.2.2" }, "engines": { @@ -443,9 +443,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.2.tgz", - "integrity": "sha512-tM8yLeYVe7pRyAu9VMi/Q7aunpLwD139EY1S99xbQkT4/q2qa6eA4ige/WJQYdJ8GBL1K33pPFhPfPdJ/WzT8Q==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.1.tgz", + "integrity": "sha512-yjTucwcOua52z14RL30JMwmCdylsQ5WrErGkAb6VL0MWPbnwJyLejydaRcUqkPO6g0MowlzavdxrR7AcfCW+yA==", "cpu": [ "arm" ], @@ -458,9 +458,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.2.tgz", - "integrity": "sha512-lsB65vAbe90I/Qe10OjkmrdxSX4UJDjosDgb8sZUKcg3oefEuW2OT2Vozz8ef7wrJbMcmhvCC+hciF8jY/uAkw==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.1.tgz", + "integrity": "sha512-CqhrKvDSt76I0so/5afqgKrMv41FjbfUKFrcZddMnrZKqJU70I1MWLVJrImJuYMaY4Yb9rn4UKfF7oZ0BOleVw==", "cpu": [ "arm64" ], @@ -473,9 +473,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.2.tgz", - "integrity": "sha512-qK/TpmHt2M/Hg82WXHRc/W/2SGo/l1thtDHZWqFq7oi24AjZ4O/CpPSu6ZuYKFkEgmZlFoa7CooAyYmuvnaG8w==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.1.tgz", + "integrity": "sha512-VA29h01MrPkymIL1bFtvL2L4WPogiMGW2N/M+vXZHHOv6LgA9vjzVskTt0v5LjeCjx1PFDcR0ASKy8Y7Gm+iIA==", "cpu": [ "x64" ], @@ -488,9 +488,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.2.tgz", - "integrity": "sha512-Ora8JokrvrzEPEpZO18ZYXkH4asCdc1DLdcVy8TGf5eWtPO1Ie4WroEJzwI52ZGtpODy3+m0a2yEX9l+KUn0tA==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.1.tgz", + "integrity": "sha512-Be4Cf6WDH7QkLHEpfzQOlBOFdqmqYTSqw2yG3SVmzB3++wy3K7wiNGedezL+q6Jb4weqT9tchO5kkLDC08Jnzg==", "cpu": [ "arm64" ], @@ -503,9 +503,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.2.tgz", - "integrity": "sha512-tP+B5UuIbbFMj2hQaUr6EALlHOIOmlLM2FK7jeFBobPy2ERdohI4Ka6ZFjZ1ZYsrHE/hZimGuU90jusRE0pwDw==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.1.tgz", + "integrity": "sha512-SewtenJi6zCEfZRSUchb+LgJ/IQw8QvnKECPu/qHII1fLQKnVPUVR+VH2IuS03DD9WWnAi3yfOvBNwtrp3WXtg==", "cpu": [ "x64" ], @@ -518,9 +518,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.2.tgz", - "integrity": "sha512-YbPY2kc0acfzL1VPVK6EnAlig4f+l8xmq36OZkU0jzBVHcOTyQDhnKQaLzZudNJQyymd9OqQezeaBgkTGdTGeQ==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.1.tgz", + "integrity": "sha512-TadKO0AaTDAPV2RyGZQ0AaiDTVYg7RsgNaA6OJjXXmoLbTs++NwHtzAmVFBq8Q/P9A11wgkv36HeyAYhWHbW1w==", "cpu": [ "arm64" ], @@ -533,9 +533,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.2.tgz", - "integrity": "sha512-nSO5uZT2clM6hosjWHAsS15hLrwCvIWx+b2e3lZ3MwbYSaXwvfO528OF+dLjas1g3bZonciivI8qKR/Hm7IWGw==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.1.tgz", + "integrity": "sha512-DrFMGLF0/aAcZgwhtZr1cby7aHlalpFjLCe5CiI8mm0Kqhhc8gyNZKreaZzvir8CQe0H17p9xx6M9ben5R3r0g==", "cpu": [ "x64" ], @@ -548,9 +548,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.2.tgz", - "integrity": "sha512-Odalh8hICg7SOD7XCj0YLpYCEc+6mkoq63UnExDCiRA2wXEmGlK5JVrW50vZR9Qz4qkvqnHcpH+OFEggO3PgTg==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.1.tgz", + "integrity": "sha512-lCWDVPpQO/Dt5MEqctKujgtUVmwQx7J2Q83EqX/9BejN7BIX4fGJ0QKMiIyy21PFh+/64ArN+Ovh1tzYkTt2wg==", "cpu": [ "arm" ], @@ -563,9 +563,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.2.tgz", - "integrity": "sha512-ig2P7GeG//zWlU0AggA3pV1h5gdix0MA3wgB+NsnBXViwiGgY77fuN9Wr5uoCrs2YzaYfogXgsWZbm+HGr09xg==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.1.tgz", + "integrity": "sha512-6ku/R2EzsdjyBaqQn+xGOPbv+BBYBXQYzlA04/46YQLmXkdApi0GYyUwiCXYBxm578iyywzGmM0rep1/q8tuFQ==", "cpu": [ "arm64" ], @@ -578,9 +578,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.2.tgz", - "integrity": "sha512-mLfp0ziRPOLSTek0Gd9T5B8AtzKAkoZE70fneiiyPlSnUKKI4lp+mGEnQXcQEHLJAcIYDPSyBvsUbKUG2ri/XQ==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.1.tgz", + "integrity": "sha512-8AKFBk9v/zBDsADvK/0BWZUxkjEc0QDwO8rvbHJKqAZx6DF/VSeBxTRmqWeecrJmx+n3kemEwML9z0eD9IHweQ==", "cpu": [ "ia32" ], @@ -593,9 +593,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.2.tgz", - "integrity": "sha512-hn28+JNDTxxCpnYjdDYVMNTR3SKavyLlCHHkufHV91fkewpIyQchS1d8wSbmXhs1fiYDpNww8KTFlJ1dHsxeSw==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.1.tgz", + "integrity": "sha512-6mOS5CxTGD8qOymp2y4KoM4ir+/REgjdJQFYpwP+WqjrWBo+PUevDGeHHjzCdw/R19PkFqS1bRzv8cTCmB/5kA==", "cpu": [ "loong64" ], @@ -608,9 +608,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.2.tgz", - "integrity": "sha512-KbXaC0Sejt7vD2fEgPoIKb6nxkfYW9OmFUK9XQE4//PvGIxNIfPk1NmlHmMg6f25x57rpmEFrn1OotASYIAaTg==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.1.tgz", + "integrity": "sha512-Bzmv6rRMzR4ErG2k/jwfj5jKNzVMVEI1tThuirFdAoE+duUv+jlDnlwxsN3s1eqMzADTOV2sSIcUUOfgv++Dgg==", "cpu": [ "mips64el" ], @@ -623,9 +623,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.2.tgz", - "integrity": "sha512-dJ0kE8KTqbiHtA3Fc/zn7lCd7pqVr4JcT0JqOnbj4LLzYnp+7h8Qi4yjfq42ZlHfhOCM42rBh0EwHYLL6LEzcw==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.1.tgz", + "integrity": "sha512-mPOxA7bd3nmx8TkuO/9M/tE0fnvmuX0wlpwnTL6DPLgkb/Z/KkupexSIw4cLfznn/fPzD89y17VWBjlVNyrpCQ==", "cpu": [ "ppc64" ], @@ -638,9 +638,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.2.tgz", - "integrity": "sha512-7Z/jKNFufZ/bbu4INqqCN6DDlrmOTmdw6D0gH+6Y7auok2r02Ur661qPuXidPOJ+FSgbEeQnnAGgsVynfLuOEw==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.1.tgz", + "integrity": "sha512-znYb2Mhe9xKIDeIYuTD6vCcUltvYzRT5Yq6sVcdhPrGu8DRdsNZS04B2tSeM+j7T03jL4yY+7/G/jxSJJ9LX2A==", "cpu": [ "riscv64" ], @@ -653,9 +653,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.2.tgz", - "integrity": "sha512-U+RinR6aXXABFCcAY4gSlv4CL1oOVvSSCdseQmGO66H+XyuQGZIUdhG56SZaDJQcLmrSfRmx5XZOWyCJPRqS7g==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.1.tgz", + "integrity": "sha512-BBIE32cyqAYhMOQ42/jnecoF5P/S5lMob2vXSUiFpD3xCFbXOFkjP1OjfFKnalSO9+B5emvPTQFfNQXuLeVGEw==", "cpu": [ "s390x" ], @@ -668,9 +668,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.2.tgz", - "integrity": "sha512-oxzHTEv6VPm3XXNaHPyUTTte+3wGv7qVQtqaZCrgstI16gCuhNOtBXLEBkBREP57YTd68P0VgDgG73jSD8bwXQ==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.1.tgz", + "integrity": "sha512-PoCvKdHTIbnHmVJ5OEdewGMSw40HDFRTrC/imwh8vrp695RbSUpOqBqNBT45neK0FQleGFbSE/A9X6HlXPDhqA==", "cpu": [ "x64" ], @@ -683,9 +683,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.2.tgz", - "integrity": "sha512-WNa5zZk1XpTTwMDompZmvQLHszDDDN7lYjEHCUmAGB83Bgs20EMs7ICD+oKeT6xt4phV4NDdSi/8OfjPbSbZfQ==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.1.tgz", + "integrity": "sha512-4OrGMPorHCq9h52VLtyyyAmPjC2ZlANx54VDYyCrqXUOi+k0qxnPKXKKprVES67w2mE7TZJx9qZmT+jHeiZbHQ==", "cpu": [ "x64" ], @@ -698,9 +698,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.2.tgz", - "integrity": "sha512-S6kI1aT3S++Dedb7vxIuUOb3oAxqxk2Rh5rOXOTYnzN8JzW1VzBd+IqPiSpgitu45042SYD3HCoEyhLKQcDFDw==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.1.tgz", + "integrity": "sha512-3a7ZYMjBC4P3FKdTmUZHJw7Mhzp71m+iSFFhX1PnLZ03qmyaB2K+vJZCk4PjRjAvm5lSupJQQtM/AFMyLgKlxQ==", "cpu": [ "x64" ], @@ -713,9 +713,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.2.tgz", - "integrity": "sha512-VXSSMsmb+Z8LbsQGcBMiM+fYObDNRm8p7tkUDMPG/g4fhFX5DEFmjxIEa3N8Zr96SjsJ1woAhF0DUnS3MF3ARw==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.1.tgz", + "integrity": "sha512-29yWBN5XfEjXT8yoeVb8cXfN1jAQLB+uskog1vBMhFR+YWOYvsrwPnh4hspETC/JnF95J+iETrvxgOUlICTWIw==", "cpu": [ "x64" ], @@ -728,9 +728,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.2.tgz", - "integrity": "sha512-5NayUlSAyb5PQYFAU9x3bHdsqB88RC3aM9lKDAz4X1mo/EchMIT1Q+pSeBXNgkfNmRecLXA0O8xP+x8V+g/LKg==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.1.tgz", + "integrity": "sha512-9Hb/WUXgyXlL55w3iNVyLkN9gq9x+agv3kk80foWbfpOwe7Qw4Vx6JGB+XQdsIfvvP1kShVQPIvBgVj0TxLlVw==", "cpu": [ "arm64" ], @@ -743,9 +743,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.2.tgz", - "integrity": "sha512-47gL/ek1v36iN0wL9L4Q2MFdujR0poLZMJwhO2/N3gA89jgHp4MR8DKCmwYtGNksbfJb9JoTtbkoe6sDhg2QTA==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.1.tgz", + "integrity": "sha512-VGdtEcXX/f01NgoM8emDnpdOyrZCQ7VTwLv89MOl3mvJ5fbCOBMNCa8t7RZS4lf12RS87qOuJFX7Bh9aLTbSxg==", "cpu": [ "ia32" ], @@ -758,9 +758,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.2.tgz", - "integrity": "sha512-tcuhV7ncXBqbt/Ybf0IyrMcwVOAPDckMK9rXNHtF17UTK18OKLpg08glminN06pt2WCoALhXdLfSPbVvK/6fxw==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.1.tgz", + "integrity": "sha512-H6u8OHmJkKJubLbukVOyi9yA5lzK8VE4TFEkZj2vgusTUPvFeMQ8YnWviVc9F6PuKS6ZIpOvi2/sfiW8tQZQ2g==", "cpu": [ "x64" ], @@ -1447,9 +1447,9 @@ "dev": true }, "node_modules/esbuild": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.2.tgz", - "integrity": "sha512-G6hPax8UbFakEj3hWO0Vs52LQ8k3lnBhxZWomUJDxfz3rZTLqF5k/FCzuNdLx2RbpBiQQF9H9onlDDH1lZsnjg==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.1.tgz", + "integrity": "sha512-IknHHwV4B/H4imOAu+416fuCvPfRjdncoyGi7eunhSvHuHkdNs50sLWan2LEG2Mym07TuW6gJUIyRS9G1miHEg==", "hasInstallScript": true, "bin": { "esbuild": "bin/esbuild" @@ -1458,28 +1458,28 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.19.2", - "@esbuild/android-arm64": "0.19.2", - "@esbuild/android-x64": "0.19.2", - "@esbuild/darwin-arm64": "0.19.2", - "@esbuild/darwin-x64": "0.19.2", - "@esbuild/freebsd-arm64": "0.19.2", - "@esbuild/freebsd-x64": "0.19.2", - "@esbuild/linux-arm": "0.19.2", - "@esbuild/linux-arm64": "0.19.2", - "@esbuild/linux-ia32": "0.19.2", - "@esbuild/linux-loong64": "0.19.2", - "@esbuild/linux-mips64el": "0.19.2", - "@esbuild/linux-ppc64": "0.19.2", - "@esbuild/linux-riscv64": "0.19.2", - "@esbuild/linux-s390x": "0.19.2", - "@esbuild/linux-x64": "0.19.2", - "@esbuild/netbsd-x64": "0.19.2", - "@esbuild/openbsd-x64": "0.19.2", - "@esbuild/sunos-x64": "0.19.2", - "@esbuild/win32-arm64": "0.19.2", - "@esbuild/win32-ia32": "0.19.2", - "@esbuild/win32-x64": "0.19.2" + "@esbuild/android-arm": "0.19.1", + "@esbuild/android-arm64": "0.19.1", + "@esbuild/android-x64": "0.19.1", + "@esbuild/darwin-arm64": "0.19.1", + "@esbuild/darwin-x64": "0.19.1", + "@esbuild/freebsd-arm64": "0.19.1", + "@esbuild/freebsd-x64": "0.19.1", + "@esbuild/linux-arm": "0.19.1", + "@esbuild/linux-arm64": "0.19.1", + "@esbuild/linux-ia32": "0.19.1", + "@esbuild/linux-loong64": "0.19.1", + "@esbuild/linux-mips64el": "0.19.1", + "@esbuild/linux-ppc64": "0.19.1", + "@esbuild/linux-riscv64": "0.19.1", + "@esbuild/linux-s390x": "0.19.1", + "@esbuild/linux-x64": "0.19.1", + "@esbuild/netbsd-x64": "0.19.1", + "@esbuild/openbsd-x64": "0.19.1", + "@esbuild/sunos-x64": "0.19.1", + "@esbuild/win32-arm64": "0.19.1", + "@esbuild/win32-ia32": "0.19.1", + "@esbuild/win32-x64": "0.19.1" } }, "node_modules/execa": { diff --git a/package.json b/package.json index e240a5c..df3d20c 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "@favware/npm-deprecate": "1.0.7", "@types/prompts": "2.4.4", "prettier": "2.8.8", - "tsup": "6.7.0", + "tsup": "^6.7.0", "typescript": "5.2.2" }, "engines": { diff --git a/src/commands/build.ts b/src/commands/build.ts index 5db56c6..88539f7 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -61,14 +61,18 @@ export async function build(options: Record) { }, }); const buildConfigPath = resolve(options.project ?? 'sern.build.js'); - + const resolveBuildConfig = (path: string|undefined, language: string) => { + if(language === 'javascript') { + return path ?? resolve('jsconfig.json') + } + return path ?? resolve('tsconfig.json') + } const defaultBuildConfig = { defineVersion: true, format: options.format ?? 'esm', mode: options.mode ?? 'development', dropLabels: [], - tsconfig: options.tsconfig ?? resolve('tsconfig.json'), - + tsconfig: resolveBuildConfig(options.tsconfig, sernConfig.language), env: options.env ?? resolve('.env'), }; if (pathExistsSync(buildConfigPath)) { @@ -100,20 +104,24 @@ export async function build(options: Record) { buildConfig.mode = env.NODE_ENV as 'production' | 'development'; console.log(magentaBright('NODE_ENV:'), 'Found NODE_ENV variable, setting `mode` to this.'); } + assert(buildConfig.mode === 'development' || buildConfig.mode === 'production', 'Mode is not `production` or `development`'); - const defaultTsConfig = { - extends: './.sern/tsconfig.json', - }; - !buildConfig.tsconfig && console.log('Using default options for tsconfig', defaultTsConfig); - const tsconfigRaw = require(buildConfig.tsconfig!); - sernConfig.language === 'typescript' && - tsconfigRaw && - !tsconfigRaw.extends && - (console.warn('tsconfig does not contain an "extends". Will not use sern automatic path aliasing'), - console.warn('For projects that predate sern build and want to fully integrate, extend the tsconfig generated in .sern'), - console.warn('Extend preexisting tsconfig with top level: "extends": "./.sern/tsconfig.json"')); + try { + let config = require(buildConfig.tsconfig!); + config.extends && console.warn("Please ensure to extend the generated tsconfig") + } catch(e) { + console.warn("no tsconfig / jsconfig found"); + console.warn(`Please create a ${sernConfig.language === 'javascript' ? 'jsconfig.json' : 'tsconfig.json' }`); + console.warn("It should have at least extend the generated one sern makes.") + console.warn(` + { + "extends": "./.sern/tsconfig.json", + }`.trim()) + throw e; + } + console.log(bold('Building with:')); console.log(' ', magentaBright('defineVersion'), buildConfig.defineVersion); console.log(' ', magentaBright('format'), buildConfig.format); @@ -150,7 +158,7 @@ export async function build(options: Record) { await esbuild.build({ entryPoints, plugins: [imageLoader, ...(buildConfig.esbuildPlugins ?? [])], - ...defaultEsbuild(buildConfig.format!, tsconfigRaw), + ...defaultEsbuild(buildConfig.format!, buildConfig.tsconfig), define, dropLabels: [buildConfig.mode === 'production' ? '__DEV__' : '__PROD__', ...buildConfig.dropLabels!], }); diff --git a/src/commands/publish.ts b/src/commands/publish.ts index d29b82c..781c662 100644 --- a/src/commands/publish.ts +++ b/src/commands/publish.ts @@ -14,7 +14,7 @@ export async function publish(commandDir: string | undefined, args: Partial { } return desc; }; +const serialize = (permissions: unknown) => { + if(typeof permissions === 'bigint' || typeof permissions === 'number') { + return permissions.toString(); + } + + if(Array.isArray(permissions)) { + return permissions + .reduce((acc, cur) => acc | cur, BigInt(0)) + .toString() + } + return null; +} const makePublishData = ({ commandModule, config }: Record>) => { const applicationType = intoApplicationType(commandModule.type as number); @@ -137,7 +151,7 @@ const makePublishData = ({ commandModule, config }: Record +export default (format: 'cjs' | 'esm', tsconfig: string|undefined) => ({ platform: 'node', format, - tsconfigRaw: tsconfigRaw as esbuild.TsconfigRaw, + tsconfig: tsconfig, logLevel: 'info', minify: false, outdir: resolve('dist'), diff --git a/tsup.config.ts b/tsup.config.ts index 1945fba..b9eb246 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,7 +1,11 @@ import { defineConfig } from 'tsup'; import { createRequire } from 'node:module'; const shared = { - entry: ['src/index.ts', 'src/create-publish.mts', 'src/commands/**', 'sern-tsconfig.json'], + entry: [ + 'src/index.ts', + 'src/create-publish.mts', + 'src/commands/**', + ], clean: true, sourcemap: true, }; @@ -18,8 +22,5 @@ export default defineConfig({ define: { __VERSION__: `"${createRequire(import.meta.url)('./package.json').version}"`, }, - loader: { - '.json': 'file', - }, ...shared, });