Implement renderInstructions for themer-sublime-text

This commit is contained in:
Matt Swensen 2020-03-13 07:24:15 -06:00
parent f20a812c8e
commit 058b7876ba
No known key found for this signature in database
GPG Key ID: 3F9E482BFC526F35
4 changed files with 22 additions and 6 deletions

@ -12,8 +12,4 @@ Then pass `themer-sublime-text` as a `-t` (`--template`) arg to `themer`:
themer -c my-colors.js -t themer-sublime-text -o gen
## Output
`themer-sublime-text` will generate a `themer-sublime-text-dark.tmTheme` or a `themer-sublime-text-light.tmTheme` (or both), depending on the color set you passed to `themer`.
Finally, copy (or symlink) your new theme file(s) to the `User/` packages folder (you can see where this folder is by choosing the "Browse Packages..." menu option in Sublime Text). You'll then be able to choose the theme from the list of available color themes.
Installation instructions for the generated theme file(s) will be included in `<output dir>/README.md`.

@ -0,0 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`themer Sublime Text theme generator should provide installation instructions 1`] = `
"
1. Copy (or symlink) the generated theme files (\`themer-sublime-text-dark.tmTheme\` or \`themer-sublime-text-light.tmTheme\`) to the \`User/\` packages folder (you can see where this folder is located by choosing the \\"Browse Packages...\\" menu option in Sublime Text).
2. Choose the theme from the list of available color themes.
"
`;

@ -151,6 +151,12 @@ const render = (colors) => {
});
};
const renderInstructions = paths => `
1. Copy (or symlink) the generated theme files (${paths.map(p => `\`${p}\``).join(' or ')}) to the \`User/\` packages folder (you can see where this folder is located by choosing the "Browse Packages..." menu option in Sublime Text).
2. Choose the theme from the list of available color themes.
`;
module.exports = {
render,
renderInstructions,
};

@ -1,5 +1,5 @@
const { colors } = require('../../themer-colors-default'),
{ render } = require('./index'),
{ render, renderInstructions } = require('./index'),
plist = require('plist');
describe('themer Sublime Text theme generator', () => {
@ -21,4 +21,10 @@ describe('themer Sublime Text theme generator', () => {
});
});
it('should provide installation instructions', async () => {
const files = await Promise.all(render(colors));
const instructions = renderInstructions(files.map(({ name }) => name));
expect(instructions).toMatchSnapshot();
});
});