@emeryld/rrroutes-export 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1800,10 +1800,28 @@ async function loadChangelogInput(modulePath, exportName) {
1800
1800
  }
1801
1801
  return value;
1802
1802
  }
1803
+ async function ensureWorktreeDependencies(repoRoot, worktreeDir) {
1804
+ const rootNodeModules = path4.join(repoRoot, "node_modules");
1805
+ const worktreeNodeModules = path4.join(worktreeDir, "node_modules");
1806
+ try {
1807
+ await fs2.access(rootNodeModules);
1808
+ } catch {
1809
+ throw new Error(
1810
+ `Missing dependencies at ${rootNodeModules}. Run install in the repository root before changelog export.`
1811
+ );
1812
+ }
1813
+ try {
1814
+ await fs2.lstat(worktreeNodeModules);
1815
+ return;
1816
+ } catch {
1817
+ }
1818
+ await fs2.symlink(rootNodeModules, worktreeNodeModules, "junction");
1819
+ }
1803
1820
  async function createSnapshot(repoRoot, moduleRel, exportName, commit, tempRoot, tsconfigRel, exportOptions) {
1804
1821
  const worktreeDir = path4.join(tempRoot, `wt-${commit.sha.slice(0, 12)}`);
1805
1822
  await runGit(repoRoot, ["worktree", "add", "--detach", worktreeDir, commit.sha]);
1806
1823
  try {
1824
+ await ensureWorktreeDependencies(repoRoot, worktreeDir);
1807
1825
  const modulePath = path4.resolve(worktreeDir, moduleRel);
1808
1826
  const tsconfigPath = tsconfigRel ? path4.resolve(worktreeDir, tsconfigRel) : void 0;
1809
1827
  const input = await loadChangelogInput(modulePath, exportName);