Skip to content

Commit

Permalink
feat(keywords): add webpack-scaffold (#296)
Browse files Browse the repository at this point in the history
* chore: add webpack-scaffold

* chore: add test

* Delete package-lock.json

* chore: format

* chore: lint
  • Loading branch information
evenstensberg authored and Haroenv committed Dec 7, 2018
1 parent 5016106 commit d4e57a7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/__tests__/formatPkg.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,25 @@ describe('adds yeoman generators', () => {
});
});

describe('adds webpack scaffolds', () => {
it('should add if matches the criterions', () => {
const dogs = {
name: 'webpack-scaffold-cats',
lastPublisher: { name: 'unknown' },
};
const formattedDogs = formatPkg(dogs);
expect(formattedDogs.computedKeywords).toEqual(['webpack-scaffold']);
});
it('should not add if does not start with generator-', () => {
const dogs = {
name: 'foo-dogs',
lastPublisher: { name: 'unknown' },
};
const formattedDogs = formatPkg(dogs);
expect(formattedDogs.computedKeywords).toEqual([]);
});
});

describe('test getRepositoryInfo', () => {
const getRepositoryInfo = formatPkg.__RewireAPI__.__get__(
'getRepositoryInfo'
Expand Down
5 changes: 5 additions & 0 deletions src/formatPkg.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ const registrySubsetRules = [
include: schematics.length > 0,
metadata: { schematics },
}),

({ name }) => ({
name: 'webpack-scaffold',
include: name.startsWith('webpack-scaffold-'),
}),
];

function getComputedData(cleaned) {
Expand Down

0 comments on commit d4e57a7

Please sign in to comment.