Skip to content

Commit

Permalink
feat(babel): add a forced keyword to babel plugins
Browse files Browse the repository at this point in the history
This is useful for the babel repl which will be visible [here](https://deploy-preview-1518--babel.netlify.com/repl (Yarn search change isn't visible yet, but live coded it with @xtuc)
  • Loading branch information
Haroenv committed Feb 1, 2018
1 parent 0a0a748 commit 440f344
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/formatPkg.js
Expand Up @@ -210,15 +210,21 @@ function getVersions(cleaned) {
}

function getKeywords(cleaned) {
const babelPlugins =
cleaned.name.startsWith('@babel/plugin') ||
cleaned.name.startsWith('babel-plugin-')
? ['babel-plugin']
: [];

if (cleaned.keywords) {
if (Array.isArray(cleaned.keywords)) {
return [...cleaned.keywords];
return [...cleaned.keywords, ...babelPlugins];
}
if (typeof cleaned.keywords === 'string') {
return [cleaned.keywords];
return [cleaned.keywords, ...babelPlugins];
}
}
return [];
return [...babelPlugins];
}

function getGitHubRepoInfo({ repository, gitHead = 'master' }) {
Expand Down

0 comments on commit 440f344

Please sign in to comment.