Implement renderInstructions in themer-brave

This commit is contained in:
Matt Swensen 2020-03-20 06:44:51 -06:00
parent 34ddc8081a
commit fcaa3bf164
No known key found for this signature in database
GPG Key ID: 3F9E482BFC526F35
5 changed files with 34 additions and 13 deletions

@ -12,14 +12,4 @@ Then pass `themer-brave` as a `-t` (`--template`) arg to `themer`:
themer -c my-colors.js -t themer-brave -o gen
## Output
`themer-brave` will generate a `Themer Dark` or `Themer Light` directory (or both, depending on the color set you passed to `themer`) in your output path.
To install your generated theme:
1. Launch Brave and nagivate to `brave://extensions`.
2. Turn on the "Developer mode" toggle at the top.
3. Click the "Load unpacked extension..." button and choose your `Themer Dark` or `Themer Light` directory.
(To reset or remove your theme, visit `brave://settings` and click "Reset to Default" in the "Appearance" section.)
Installation instructions for the generated theme(s) will be included in `<output dir>/README.md`.

@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Brave theme generator should provide installation instructions 1`] = `
"
1. Launch Brave and go to \`brave://extensions\`.
2. Check the \\"Developer mode\\" checkbox at the top.
3. Click the \\"Load unpacked extension...\\" button and choose the desired theme directory (\`Themer Dark\` or \`Themer Light\`).
(To reset or remove the theme, visit \`brave://settings\` and click \\"Reset to Default\\" in the \\"Appearance\\" section.)
"
`;

@ -1 +1,11 @@
module.exports = require('themer-chrome');
const { render, renderInstructions: renderChromeInstructions } = require('themer-chrome');
const renderInstructions = paths =>
renderChromeInstructions(paths)
.replace(/chrome/g, 'brave')
.replace(/Chrome/g, 'Brave');
module.exports = {
render,
renderInstructions
};

@ -0,0 +1,10 @@
const { render, renderInstructions } = require('./index');
const { colors } = require('../../themer-colors-default');
describe('Brave 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();
});
});

@ -28,7 +28,7 @@
},
"homepage": "https://github.com/mjswensen/themer/tree/master/cli/packages/themer-brave#readme",
"dependencies": {
"themer-chrome": "^1.1.0"
"themer-chrome": "^1.2.0"
},
"devDependencies": {},
"peerDependencies": {