Skip to content

Commit

Permalink
fix(workspace-tools): Update tsup patch to use the logger
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivanpj committed Nov 16, 2023
1 parent f459382 commit 4874960
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 2 additions & 0 deletions packages/workspace-tools/src/executors/tsup/get-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export function modernConfig(
: ["esnext", "node18"],
tsconfig,
outDir: joinPathFragments(outDir, "dist", "modern"),
silent: false,
metafile: true,
minify: false,
bundle,
Expand Down Expand Up @@ -60,6 +61,7 @@ export function legacyConfig(
target: ["es2022", "node18"],
tsconfig,
outDir: joinPathFragments(outDir, "dist", "legacy"),
silent: false,
metafile: true,
shims: true,
minify: false,
Expand Down
20 changes: 11 additions & 9 deletions patches/tsup@7.2.0.patch
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
diff --git a/dist/index.js b/dist/index.js
index 68c197cb2b8dfa928a448475b4020e7301da959e..426559111d4475c7e4fecc69217d037e9ff0c516 100644
index 68c197cb2b8dfa928a448475b4020e7301da959e..7df518683ef812a3bc309f4bfdbcbcbb2bd57ed1 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1605,8 +1605,30 @@ async function runEsbuild(options, {
@@ -1605,8 +1605,32 @@ async function runEsbuild(options, {
buildDependencies,
pluginContainer
}) {
- const pkg = await _chunk52KWB5QBjs.loadPkg.call(void 0, process.cwd());
- const deps = await _chunk52KWB5QBjs.getProductionDeps.call(void 0, process.cwd());
+ logger.info("⚡ Preparing to run ESBuild");
+
+ let pkgPath = options.outDir
+ ? options.outDir
+ : process.cwd();
+ console.error("Original pkgPath: ", pkgPath);
+ logger.error("Original pkgPath: ", pkgPath);
+ if (pkgPath) {
+ const splits = pkgPath.split(_path2.default.sep);
+ console.error("splits: ", splits);
+ logger.error("splits: ", splits);
+ if (splits.length > 0) {
+ const pkgPathIndex = splits.slice(0, splits.length)
+ .findLastIndex(index =>
+ existsSync(_path2.default.join(splits.slice(0, index)
+ .join(_path2.default.sep), "package.json")));
+ console.error("pkgPathIndex: ", pkgPathIndex);
+ logger.error("pkgPathIndex: ", pkgPathIndex);
+ if (pkgPathIndex) {
+ pkgPath = splits.slice(0, pkgPathIndex).join(_path2.default.sep);
+ console.error("Updated pkgPath: ", pkgPath);
+ logger.error("Updated pkgPath: ", pkgPath);
+ }
+ }
+ }
+
+ console.error("Final pkgPath: ", pkgPath);
+ logger.error("Final pkgPath: ", pkgPath);
+ const pkg = await _chunk52KWB5QBjs.loadPkg.call(void 0, pkgPath);
+ console.error("pkg: ", pkg);
+ logger.error("pkg: ", pkg);
+ const deps = await _chunk52KWB5QBjs.getProductionDeps.call(void 0, pkgPath);
const external = [
// Exclude dependencies, e.g. `lodash`, `lodash/get`
...deps.map((dep) => new RegExp(`^${dep}($|\\/|\\\\)`)),
@@ -2052,6 +2074,7 @@ var sizeReporter = () => {
@@ -2052,6 +2076,7 @@ var sizeReporter = () => {
// src/plugins/tree-shaking.ts
var import_rollup_plugin_hashbang = _chunkB7UJSB4Njs.__toESM.call(void 0, _chunk52KWB5QBjs.require_dist.call(void 0, ));
var _rollup = require('rollup');
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4874960

Please sign in to comment.