diff --git a/cli/packages/themer/lib/index.js b/cli/packages/themer/lib/index.js index bc3375c..e1fb569 100644 --- a/cli/packages/themer/lib/index.js +++ b/cli/packages/themer/lib/index.js @@ -47,7 +47,13 @@ const path = require('path'), ), ); console.log('rendering templates...'); - const outputs = await themer(colors, templates, args); + const outputs = await themer( + colors, + templates, + args, + path.sep, + '# themer - theme installation instructions', + ); console.log('writing files...'); for (const output of outputs) { const outputFilePath = path.resolve(args.out, output.name); diff --git a/cli/packages/themer/lib/themer.js b/cli/packages/themer/lib/themer.js index 66fa079..eea226b 100644 --- a/cli/packages/themer/lib/themer.js +++ b/cli/packages/themer/lib/themer.js @@ -1,11 +1,17 @@ -module.exports = async function themer (colors, templates, extraArgs) { +module.exports = async function themer( + colors, + templates, + extraArgs, + pathSeparator, + instructionsHead, +) { const files = []; const instructions = []; for (const template of templates) { const outputs = (await Promise.all(template.render(colors, extraArgs))) .map(file => ({ ...file, - name: `${template.name}/${file.name}`, + name: `${template.name}${pathSeparator}${file.name}`, })); files.push(...outputs); if (template.renderInstructions) { @@ -18,7 +24,7 @@ module.exports = async function themer (colors, templates, extraArgs) { files.push({ name: 'README.md', contents: Buffer.from( - `# themer - theme installation instructions\n\n${instructions.join('\n\n')}`, + `${instructionsHead}\n\n${instructions.join('\n\n')}`, 'utf8' ) }) diff --git a/cli/packages/themer/lib/themer.spec.js b/cli/packages/themer/lib/themer.spec.js index c2ccb98..51c8bbd 100644 --- a/cli/packages/themer/lib/themer.spec.js +++ b/cli/packages/themer/lib/themer.spec.js @@ -1,4 +1,5 @@ -const themer = require('./themer'); +const themer = require('./themer'), + path = require('path'); describe('themer core', () => { it('should produce a list of files from colors + templates', async () => { @@ -34,6 +35,8 @@ describe('themer core', () => { }, ], {}, + path.sep, + '# test', ); expect(outputs.length).toBe(2); });