From 5aa267dd7539369cfc6eec50a5a611610a56c72d Mon Sep 17 00:00:00 2001 From: Adrien Thiery Date: Thu, 30 Aug 2018 10:38:58 -0400 Subject: [PATCH] Add yarn global path --- __tests__/command_helpers/checkSTDERR.ts | 2 +- __tests__/index.ts | 4 ++-- src/index.ts | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/__tests__/command_helpers/checkSTDERR.ts b/__tests__/command_helpers/checkSTDERR.ts index 4ac88a0..1064609 100644 --- a/__tests__/command_helpers/checkSTDERR.ts +++ b/__tests__/command_helpers/checkSTDERR.ts @@ -10,4 +10,4 @@ describe('checkSTDERR', () => { expect(typeof output).toBe('string') expect(output.length).toBeGreaterThan(normal.length) }) -} +}) diff --git a/__tests__/index.ts b/__tests__/index.ts index 88ef58d..f84d60e 100644 --- a/__tests__/index.ts +++ b/__tests__/index.ts @@ -22,8 +22,8 @@ test('ensure build', async () => { expect(build().brand.mock.calls.length).toBe(1) expect(build().brand.mock.calls[0][0]).toBe('solidarity') expect(build().src.mock.calls.length).toBe(1) - // Check local and globals for Windows/Darwin === 3 checks - expect(build().plugins.mock.calls.length).toBe(3) + // Check local and globals for Windows/Darwin + Yarn === 4 checks + expect(build().plugins.mock.calls.length).toBe(4) expect(build().create.mock.calls.length).toBe(1) expect(build().run.mock.calls.length).toBe(1) }) diff --git a/src/index.ts b/src/index.ts index 93b8282..1ffb3ef 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,5 @@ import { build } from 'gluegun' +const os = require('os') module.exports = async (): Promise => { // setup the runtime @@ -9,6 +10,7 @@ module.exports = async (): Promise => { .plugins('./node_modules', { matching: 'solidarity-*', hidden: true }) // global installs .plugins('/usr/local/lib/node_modules', { matching: 'solidarity-*', hidden: true }) // Darwin + .plugins(`${os.homedir()}/.config/yarn/global/node_modules`, { matching: 'solidarity-*', hidden: true }) // Yarn/Darwin .plugins(`${process.env.appdata}/npm/node_modules`, { matching: 'solidarity-*', hidden: true }) // Windows // for testing - force load a local plugin // .plugin('../solidarity-react-native')