Implement renderInstructions in themer-wallpaper-block-wave

This commit is contained in:
Matt Swensen 2020-03-20 06:51:46 -06:00
parent fcaa3bf164
commit f593d9e898
No known key found for this signature in database
GPG Key ID: 3F9E482BFC526F35
5 changed files with 22 additions and 2 deletions

@ -33,3 +33,5 @@ By default, `themer-wallpaper-block-wave` will output wallpapers at the followin
to which you would pass `<width>x<height>`. For example, to forego the default resolutions and generate two wallpapers, one 1024 by 768 and one 320 by 960:
themer -c my-colors.js -t themer-wallpaper-block-wave --themer-wallpaper-block-wave-size 1024x768 --themer-wallpaper-block-wave-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 "block wave" wallpaper should list outputfiles 1`] = `
"
Files generated:
* \`themer-wallpaper-block-wave-dark-1000x1000.svg\`
* \`themer-wallpaper-block-wave-light-1000x1000.svg\`
"
`;

@ -2,6 +2,7 @@ const {
getSizesFromOptOrDefault,
colorSets: getColorSets,
deepFlatten,
listOutputFiles,
} = require('themer-utils');
const weightedRandom = require('./weighted-random');
@ -89,4 +90,5 @@ const render = (colors, options) => {
module.exports = {
render,
renderInstructions: listOutputFiles
};

@ -1,4 +1,4 @@
const { render } = require('./index'),
const { render, renderInstructions } = require('./index'),
{ colors } = require('../../themer-colors-default');
describe('themer "block wave" wallpaper', () => {
@ -51,4 +51,10 @@ describe('themer "block wave" wallpaper', () => {
test('when given only a dark theme', { dark: colors.dark }, 2);
test('when given only a light theme', { light: colors.light }, 2);
it('should list outputfiles', async () => {
const files = await Promise.all(render(colors, { 'themer-wallpaper-block-wave-size': '1000x1000' }));
const instructions = renderInstructions(files.map(({ name }) => name));
expect(instructions).toMatchSnapshot();
});
});

@ -28,7 +28,7 @@
},
"homepage": "https://github.com/mjswensen/themer/tree/master/cli/packages/themer-wallpaper-block-wave#readme",
"dependencies": {
"themer-utils": "^1.1.0"
"themer-utils": "^1.2.0"
},
"keywords": [
"themer",