Skip to content

Commit 0f8a23f

Browse files
committed
Fixes link/unlink script for worktrees
1 parent 998f1e9 commit 0f8a23f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

scripts/linkComponents.mjs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function findComponentsPaths() {
5555
const mainRoot = join(parentRoot, 'GitKrakenComponents');
5656
if (existsSync(join(mainRoot, 'package.json'))) {
5757
results.push({
58-
path: '../GitKrakenComponents',
58+
path: relative(root, mainRoot).replace(/\\/g, '/'),
5959
description: `${getCurrentBranch(mainRoot)} (default)`,
6060
abs: mainRoot,
6161
});
@@ -68,9 +68,8 @@ function findComponentsPaths() {
6868
const pkgs = globSync('**/package.json', { cwd: worktreesRoot, ignore: ['**/node_modules/**'] });
6969
for (const pkg of pkgs) {
7070
const dir = join(worktreesRoot, dirname(pkg));
71-
const rel = relative(worktreesRoot, dir).replace(/\\/g, '/');
7271
results.push({
73-
path: `../GitKrakenComponents.worktrees/${rel}`,
72+
path: relative(root, dir).replace(/\\/g, '/'),
7473
description: `${getCurrentBranch(dir)} (worktree)`,
7574
abs: dir,
7675
});
@@ -103,8 +102,7 @@ async function promptForPath() {
103102
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
104103

105104
const availablePaths = findComponentsPaths();
106-
107-
if (availablePaths.length === 0) {
105+
if (!availablePaths.length) {
108106
console.log('\n⚠️ No GitKrakenComponents directories found.');
109107
const customPath = await rl.question('Enter path to GitKrakenComponents: ');
110108
rl.close();

0 commit comments

Comments
 (0)