Add exception for Yarn to copy/paste the .gitignore file in each plugin

This commit is contained in:
Aurelsicoko 2018-01-05 18:09:18 +01:00
parent 565cfda087
commit c4763d173f

View File

@ -77,7 +77,11 @@ module.exports = function (plugin, cliArguments) {
fs.accessSync(path.join(pluginPath, '.gitignore')) fs.accessSync(path.join(pluginPath, '.gitignore'))
} catch (err) { } catch (err) {
if (err.code === 'ENOENT') { 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'));
}
} }
} }