@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.cjs CHANGED
@@ -1854,10 +1854,28 @@ async function loadChangelogInput(modulePath, exportName) {
1854
1854
  }
1855
1855
  return value;
1856
1856
  }
1857
+ async function ensureWorktreeDependencies(repoRoot, worktreeDir) {
1858
+ const rootNodeModules = import_node_path4.default.join(repoRoot, "node_modules");
1859
+ const worktreeNodeModules = import_node_path4.default.join(worktreeDir, "node_modules");
1860
+ try {
1861
+ await import_promises2.default.access(rootNodeModules);
1862
+ } catch {
1863
+ throw new Error(
1864
+ `Missing dependencies at ${rootNodeModules}. Run install in the repository root before changelog export.`
1865
+ );
1866
+ }
1867
+ try {
1868
+ await import_promises2.default.lstat(worktreeNodeModules);
1869
+ return;
1870
+ } catch {
1871
+ }
1872
+ await import_promises2.default.symlink(rootNodeModules, worktreeNodeModules, "junction");
1873
+ }
1857
1874
  async function createSnapshot(repoRoot, moduleRel, exportName, commit, tempRoot, tsconfigRel, exportOptions) {
1858
1875
  const worktreeDir = import_node_path4.default.join(tempRoot, `wt-${commit.sha.slice(0, 12)}`);
1859
1876
  await runGit(repoRoot, ["worktree", "add", "--detach", worktreeDir, commit.sha]);
1860
1877
  try {
1878
+ await ensureWorktreeDependencies(repoRoot, worktreeDir);
1861
1879
  const modulePath = import_node_path4.default.resolve(worktreeDir, moduleRel);
1862
1880
  const tsconfigPath = tsconfigRel ? import_node_path4.default.resolve(worktreeDir, tsconfigRel) : void 0;
1863
1881
  const input = await loadChangelogInput(modulePath, exportName);