Skip to content

Commit 1145c4d

Browse files
committed
fix: handle case where yarn links directory does not exist
1 parent 3b1294c commit 1145c4d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/find-addons.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default function findAddons(isLocal: boolean): AddonSummary[] {
3737
return finalizeAddons(addons);
3838
}
3939

40-
let addons;
40+
let addons: PluginSummary[] = [];
4141

4242
// Because yarn stores it's global modules separately, and doesn't yet support the `root` command,
4343
// we have to double check yarn's global installs for any denali addons. The easiest way of
@@ -50,9 +50,9 @@ export default function findAddons(isLocal: boolean): AddonSummary[] {
5050
let yarnGlobalInstalls = path.join(yarnGlobal, 'node_modules');
5151
debug(`searching for addons globally in yarn global installs: ${ yarnGlobalInstalls }`);
5252
if (fs.existsSync(yarnGlobalInstalls)) {
53-
addons = findPlugins(merge({
53+
addons = addons.concat(findPlugins(merge({
5454
dir: yarnGlobalInstalls
55-
}, findOptions));
55+
}, findOptions)));
5656
} else {
5757
debug(`Tried to load globally installed addons from yarn, but ${ yarnGlobalInstalls } doesn't exist, skipping ...`);
5858
}
@@ -69,10 +69,10 @@ export default function findAddons(isLocal: boolean): AddonSummary[] {
6969
} else {
7070
let npmRoot = execSync('npm root -g').toString().trim();
7171
debug(`searching for addons globally in npm root: ${ npmRoot }`);
72-
addons = findPlugins(merge({
72+
addons = addons.concat(findPlugins(merge({
7373
dir: npmRoot,
7474
scanAllDirs: true
75-
}, findOptions));
75+
}, findOptions)));
7676
}
7777

7878
return finalizeAddons(addons);

0 commit comments

Comments
 (0)