Implement renderInstructions in themer-wallpaper-diamonds

This commit is contained in:
Matt Swensen 2020-03-20 06:55:34 -06:00
parent f593d9e898
commit 67f01ea123
No known key found for this signature in database
GPG Key ID: 3F9E482BFC526F35
5 changed files with 23 additions and 3 deletions

@ -35,3 +35,4 @@ to which you would pass `<width>x<height>`. For example, to forego the default r
themer -c my-colors.js -t themer-wallpaper-diamonds --themer-wallpaper-diamonds-size 1024x768 --themer-wallpaper-diamonds-size 320x960 -o gen
The generated files will be listed in `<output dir>/README.md`.

@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`themer "diamonds" wallpaper should list outputfiles 1`] = `
"
Files generated:
* \`themer-wallpaper-diamonds-dark-1000x1000.svg\`
* \`themer-wallpaper-diamonds-light-1000x1000.svg\`
"
`;

@ -2,6 +2,7 @@ const {
getSizesFromOptOrDefault,
deepFlatten,
colorSets: getColorSets,
listOutputFiles,
} = require('themer-utils');
const SIZE = 100;
@ -127,4 +128,7 @@ const render = (colors, options) => {
);
}
module.exports = { render };
module.exports = {
render,
renderInstructions: listOutputFiles,
};

@ -1,4 +1,4 @@
const { render } = require('./index');
const { render, renderInstructions } = require('./index');
const { colors } = require('../../themer-colors-default');
describe('themer "diamonds" wallpaper', () => {
@ -8,4 +8,9 @@ describe('themer "diamonds" wallpaper', () => {
expect(file.contents.toString('utf8')).not.toContain('undefined');
});
});
it('should list outputfiles', async () => {
const files = await Promise.all(render(colors, { 'themer-wallpaper-diamonds-size': '1000x1000' }));
const instructions = renderInstructions(files.map(({ name }) => name));
expect(instructions).toMatchSnapshot();
});
});

@ -23,7 +23,7 @@
},
"homepage": "https://github.com/mjswensen/themer/tree/master/cli/packages/themer-wallpaper-diamonds#readme",
"dependencies": {
"themer-utils": "^1.0.0"
"themer-utils": "^1.2.0"
},
"peerDependencies": {
"themer": "^3"