Implement renderInstructions in themer-wallpaper-shirts

This commit is contained in:
Matt Swensen 2020-03-20 07:01:27 -06:00
parent 7c60412aa6
commit 0434be67ac
No known key found for this signature in database
GPG Key ID: 3F9E482BFC526F35
5 changed files with 21 additions and 3 deletions

@ -33,3 +33,5 @@ By default, `themer-wallpaper-shirts` will output wallpapers at the following si
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-shirts --themer-wallpaper-shirts-size 1024x768 --themer-wallpaper-shirts-size 320x960 -o gen
The generated files will be listed in `<output dir>/README.md`.

@ -1,5 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`themer "shirts" wallpaper should list outputfiles 1`] = `
"
Files generated:
* \`themer-wallpaper-shirts-dark-1000-1000.svg\`
* \`themer-wallpaper-shirts-light-1000-1000.svg\`
"
`;
exports[`themer "shirts" wallpaper should render valid SVG 1`] = `
"
<svg width=\\"2880\\" height=\\"1800\\" viewBox=\\"0 0 2880 1800\\" fill=\\"none\\" xmlns=\\"http://www.w3.org/2000/svg\\">

@ -2,6 +2,7 @@ const {
getSizesFromOptOrDefault,
deepFlatten,
colorSets: getColorSets,
listOutputFiles,
} = require('themer-utils');
const CELL_WIDTH = 676;
@ -698,4 +699,5 @@ const render = (colors, options) => {
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 "shirts" wallpaper', () => {
@ -9,5 +9,10 @@ describe('themer "shirts" wallpaper', () => {
});
done();
});
})
});
it('should list outputfiles', async () => {
const files = await Promise.all(render(colors, { 'themer-wallpaper-shirts-size': '1000x1000' }));
const instructions = renderInstructions(files.map(({ name }) => name));
expect(instructions).toMatchSnapshot();
});
});

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