From 7c60412aa6b7a3a7772ca360b99065c1e3534395 Mon Sep 17 00:00:00 2001 From: Matt Swensen Date: Fri, 20 Mar 2020 06:58:46 -0600 Subject: [PATCH] Implement renderInstructions in themer-wallpaper-octagon --- cli/packages/themer-wallpaper-octagon/README.md | 2 ++ .../lib/__snapshots__/index.spec.js.snap | 10 ++++++++++ cli/packages/themer-wallpaper-octagon/lib/index.js | 4 +++- .../themer-wallpaper-octagon/lib/index.spec.js | 8 +++++++- cli/packages/themer-wallpaper-octagon/package.json | 2 +- 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 cli/packages/themer-wallpaper-octagon/lib/__snapshots__/index.spec.js.snap diff --git a/cli/packages/themer-wallpaper-octagon/README.md b/cli/packages/themer-wallpaper-octagon/README.md index e2f5079..552313e 100644 --- a/cli/packages/themer-wallpaper-octagon/README.md +++ b/cli/packages/themer-wallpaper-octagon/README.md @@ -33,3 +33,5 @@ By default, `themer-wallpaper-octagon` will output wallpapers at the following s 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-octagon --themer-wallpaper-octagon-size 1024x768 --themer-wallpaper-octagon-size 320x960 -o gen + +The generated files will be listed in `/README.md`. diff --git a/cli/packages/themer-wallpaper-octagon/lib/__snapshots__/index.spec.js.snap b/cli/packages/themer-wallpaper-octagon/lib/__snapshots__/index.spec.js.snap new file mode 100644 index 0000000..850bc61 --- /dev/null +++ b/cli/packages/themer-wallpaper-octagon/lib/__snapshots__/index.spec.js.snap @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`themer "octagon" wallpaper should list outputfiles 1`] = ` +" +Files generated: + +* \`themer-wallpaper-octagon-dark-1000x1000.svg\` +* \`themer-wallpaper-octagon-light-1000x1000.svg\` +" +`; diff --git a/cli/packages/themer-wallpaper-octagon/lib/index.js b/cli/packages/themer-wallpaper-octagon/lib/index.js index 8f2fe6e..98aec63 100644 --- a/cli/packages/themer-wallpaper-octagon/lib/index.js +++ b/cli/packages/themer-wallpaper-octagon/lib/index.js @@ -1,7 +1,8 @@ const { getSizesFromOptOrDefault, colorSets: getColorSets, - deepFlatten + deepFlatten, + listOutputFiles, } = require('themer-utils'); const render = (colors, options) => { @@ -90,4 +91,5 @@ const render = (colors, options) => { module.exports = { render, + renderInstructions: listOutputFiles, }; diff --git a/cli/packages/themer-wallpaper-octagon/lib/index.spec.js b/cli/packages/themer-wallpaper-octagon/lib/index.spec.js index f1a11d8..71448ef 100644 --- a/cli/packages/themer-wallpaper-octagon/lib/index.spec.js +++ b/cli/packages/themer-wallpaper-octagon/lib/index.spec.js @@ -1,4 +1,4 @@ -const { render } = require('./index'), +const { render, renderInstructions } = require('./index'), { colors } = require('../../themer-colors-default'); describe('themer "octagon" wallpaper', () => { @@ -51,4 +51,10 @@ describe('themer "octagon" 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-octagon-size': '1000x1000' })); + const instructions = renderInstructions(files.map(({ name }) => name)); + expect(instructions).toMatchSnapshot(); + }); + }); diff --git a/cli/packages/themer-wallpaper-octagon/package.json b/cli/packages/themer-wallpaper-octagon/package.json index fc25f57..03ae57d 100644 --- a/cli/packages/themer-wallpaper-octagon/package.json +++ b/cli/packages/themer-wallpaper-octagon/package.json @@ -27,7 +27,7 @@ }, "homepage": "https://github.com/mjswensen/themer/tree/master/cli/packages/themer-wallpaper-octagon#readme", "dependencies": { - "themer-utils": "^1.1.0" + "themer-utils": "^1.2.0" }, "keywords": [ "themer",