From 67f01ea123389f15e9d1b20a6982f82c1d1e11ad Mon Sep 17 00:00:00 2001 From: Matt Swensen Date: Fri, 20 Mar 2020 06:55:34 -0600 Subject: [PATCH] Implement renderInstructions in themer-wallpaper-diamonds --- cli/packages/themer-wallpaper-diamonds/README.md | 1 + .../lib/__snapshots__/index.spec.js.snap | 10 ++++++++++ cli/packages/themer-wallpaper-diamonds/lib/index.js | 6 +++++- .../themer-wallpaper-diamonds/lib/index.spec.js | 7 ++++++- cli/packages/themer-wallpaper-diamonds/package.json | 2 +- 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 cli/packages/themer-wallpaper-diamonds/lib/__snapshots__/index.spec.js.snap diff --git a/cli/packages/themer-wallpaper-diamonds/README.md b/cli/packages/themer-wallpaper-diamonds/README.md index 489408a..1b3c468 100644 --- a/cli/packages/themer-wallpaper-diamonds/README.md +++ b/cli/packages/themer-wallpaper-diamonds/README.md @@ -35,3 +35,4 @@ to which you would pass `x`. 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 `/README.md`. diff --git a/cli/packages/themer-wallpaper-diamonds/lib/__snapshots__/index.spec.js.snap b/cli/packages/themer-wallpaper-diamonds/lib/__snapshots__/index.spec.js.snap new file mode 100644 index 0000000..6e6f14c --- /dev/null +++ b/cli/packages/themer-wallpaper-diamonds/lib/__snapshots__/index.spec.js.snap @@ -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\` +" +`; diff --git a/cli/packages/themer-wallpaper-diamonds/lib/index.js b/cli/packages/themer-wallpaper-diamonds/lib/index.js index 986d492..1da7365 100644 --- a/cli/packages/themer-wallpaper-diamonds/lib/index.js +++ b/cli/packages/themer-wallpaper-diamonds/lib/index.js @@ -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, +}; diff --git a/cli/packages/themer-wallpaper-diamonds/lib/index.spec.js b/cli/packages/themer-wallpaper-diamonds/lib/index.spec.js index 4447187..3e430dc 100644 --- a/cli/packages/themer-wallpaper-diamonds/lib/index.spec.js +++ b/cli/packages/themer-wallpaper-diamonds/lib/index.spec.js @@ -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(); + }); }); diff --git a/cli/packages/themer-wallpaper-diamonds/package.json b/cli/packages/themer-wallpaper-diamonds/package.json index f6f4c76..9e5a22b 100644 --- a/cli/packages/themer-wallpaper-diamonds/package.json +++ b/cli/packages/themer-wallpaper-diamonds/package.json @@ -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"