From 0434be67acfe8380114361747d1bce9a4ab211c8 Mon Sep 17 00:00:00 2001 From: Matt Swensen Date: Fri, 20 Mar 2020 07:01:27 -0600 Subject: [PATCH] Implement renderInstructions in themer-wallpaper-shirts --- cli/packages/themer-wallpaper-shirts/README.md | 2 ++ .../lib/__snapshots__/index.spec.js.snap | 9 +++++++++ cli/packages/themer-wallpaper-shirts/lib/index.js | 2 ++ cli/packages/themer-wallpaper-shirts/lib/index.spec.js | 9 +++++++-- cli/packages/themer-wallpaper-shirts/package.json | 2 +- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/cli/packages/themer-wallpaper-shirts/README.md b/cli/packages/themer-wallpaper-shirts/README.md index a8380e9..2c5bae3 100644 --- a/cli/packages/themer-wallpaper-shirts/README.md +++ b/cli/packages/themer-wallpaper-shirts/README.md @@ -33,3 +33,5 @@ By default, `themer-wallpaper-shirts` will output wallpapers at the following si to which you would pass `x`. 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 `/README.md`. diff --git a/cli/packages/themer-wallpaper-shirts/lib/__snapshots__/index.spec.js.snap b/cli/packages/themer-wallpaper-shirts/lib/__snapshots__/index.spec.js.snap index 8e7025d..6b068dd 100644 --- a/cli/packages/themer-wallpaper-shirts/lib/__snapshots__/index.spec.js.snap +++ b/cli/packages/themer-wallpaper-shirts/lib/__snapshots__/index.spec.js.snap @@ -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`] = ` " diff --git a/cli/packages/themer-wallpaper-shirts/lib/index.js b/cli/packages/themer-wallpaper-shirts/lib/index.js index ab0a993..3fe8bf4 100644 --- a/cli/packages/themer-wallpaper-shirts/lib/index.js +++ b/cli/packages/themer-wallpaper-shirts/lib/index.js @@ -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, }; diff --git a/cli/packages/themer-wallpaper-shirts/lib/index.spec.js b/cli/packages/themer-wallpaper-shirts/lib/index.spec.js index 701bdb5..5f378aa 100644 --- a/cli/packages/themer-wallpaper-shirts/lib/index.spec.js +++ b/cli/packages/themer-wallpaper-shirts/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 "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(); + }); }); diff --git a/cli/packages/themer-wallpaper-shirts/package.json b/cli/packages/themer-wallpaper-shirts/package.json index bdce478..c611cff 100644 --- a/cli/packages/themer-wallpaper-shirts/package.json +++ b/cli/packages/themer-wallpaper-shirts/package.json @@ -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"