Implement renderInstructions in themer-wallpaper-triangles
This commit is contained in:
parent
0434be67ac
commit
926d99a2d2
@ -32,3 +32,5 @@ By default, `themer-wallpaper-triangles` will output wallpapers at the following
|
|||||||
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:
|
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-triangles --themer-wallpaper-triangles-size 1024x768 --themer-wallpaper-triangles-size 320x960 -o gen
|
themer -c my-colors.js -t themer-wallpaper-triangles --themer-wallpaper-triangles-size 1024x768 --themer-wallpaper-triangles-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
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`themer "triangles" wallpaper should list outputfiles 1`] = `
|
||||||
|
"
|
||||||
|
Files generated:
|
||||||
|
|
||||||
|
* \`themer-wallpaper-triangles-dark-1000x1000.svg\`
|
||||||
|
* \`themer-wallpaper-triangles-light-1000x1000.svg\`
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`themer "triangles" wallpaper when given both a light and a dark theme and when rendering a given resolution should render valid SVG 1`] = `
|
exports[`themer "triangles" wallpaper when given both a light and a dark theme and when rendering a given resolution should render valid SVG 1`] = `
|
||||||
"
|
"
|
||||||
<svg width=\\"600\\" height=\\"600\\" viewBox=\\"0 0 600 600\\" xmlns=\\"http://www.w3.org/2000/svg\\">
|
<svg width=\\"600\\" height=\\"600\\" viewBox=\\"0 0 600 600\\" xmlns=\\"http://www.w3.org/2000/svg\\">
|
||||||
|
@ -2,6 +2,7 @@ const {
|
|||||||
getSizesFromOptOrDefault,
|
getSizesFromOptOrDefault,
|
||||||
colorSets: getColorSets,
|
colorSets: getColorSets,
|
||||||
deepFlatten,
|
deepFlatten,
|
||||||
|
listOutputFiles,
|
||||||
} = require('themer-utils');
|
} = require('themer-utils');
|
||||||
|
|
||||||
const render = (colors, options) => {
|
const render = (colors, options) => {
|
||||||
@ -91,4 +92,5 @@ const render = (colors, options) => {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
render,
|
render,
|
||||||
|
renderInstructions: listOutputFiles,
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const {render} = require('./index');
|
const {render, renderInstructions} = require('./index');
|
||||||
const {colors} = require('../../themer-colors-default');
|
const {colors} = require('../../themer-colors-default');
|
||||||
|
|
||||||
describe('themer "triangles" wallpaper', () => {
|
describe('themer "triangles" wallpaper', () => {
|
||||||
@ -57,4 +57,10 @@ describe('themer "triangles" wallpaper', () => {
|
|||||||
test('when given both a light and a dark theme', colors, 4);
|
test('when given both a light and a dark theme', colors, 4);
|
||||||
test('when given only a dark theme', {dark: colors.dark}, 2);
|
test('when given only a dark theme', {dark: colors.dark}, 2);
|
||||||
test('when given only a light theme', {light: colors.light}, 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-triangles-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-triangles#readme",
|
"homepage": "https://github.com/mjswensen/themer/tree/master/cli/packages/themer-wallpaper-triangles#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"themer-utils": "^1.1.0"
|
"themer-utils": "^1.2.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"themer": "^1.0.2||^2||^3"
|
"themer": "^1.0.2||^2||^3"
|
||||||
|
Loading…
Reference in New Issue
Block a user