From c4763d173fbf356d7370029ab52bd3ecc9e2b2ab Mon Sep 17 00:00:00 2001 From: Aurelsicoko Date: Fri, 5 Jan 2018 18:09:18 +0100 Subject: [PATCH] Add exception for Yarn to copy/paste the .gitignore file in each plugin --- packages/strapi/bin/strapi-install.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/strapi/bin/strapi-install.js b/packages/strapi/bin/strapi-install.js index 91b8f3da77..94b4d901e9 100755 --- a/packages/strapi/bin/strapi-install.js +++ b/packages/strapi/bin/strapi-install.js @@ -77,7 +77,11 @@ module.exports = function (plugin, cliArguments) { fs.accessSync(path.join(pluginPath, '.gitignore')) } catch (err) { if (err.code === 'ENOENT') { - fs.copySync(path.resolve(__dirname, '..', 'node_modules', 'strapi-generate-plugin', 'templates', 'gitignore'), path.join(pluginPath, '.gitignore')); + if (process.mainModule.filename.indexOf('yarn') !== -1) { + fs.copySync(path.resolve(__dirname, '..', '..', 'strapi-generate-plugin', 'templates', 'gitignore'), path.join(pluginPath, '.gitignore')); + } else { + fs.copySync(path.resolve(__dirname, '..', 'node_modules', 'strapi-generate-plugin', 'templates', 'gitignore'), path.join(pluginPath, '.gitignore')); + } } }