Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Pittman committed Oct 17, 2019
1 parent 227582a commit 2268b35
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 32 deletions.
4 changes: 4 additions & 0 deletions cli.js
Expand Up @@ -8,6 +8,7 @@ const createPage = require('./lib/createPage');
const createComponent = require('./lib/createComponent');
const createLayout = require('./lib/createLayout');
const createTemplate = require('./lib/createTemplate');
const deleteReadme = require('./lib/deleteReadme');
const cli = meow(`
Usage
Expand Down Expand Up @@ -69,6 +70,9 @@ if (cli.flags.component && cli.flags.component.length > 0) {
createComponent(pascalcase(cli.flags.component));
}

if (cli.flags.deleteReadme) {
deleteReadme();
}

if (Object.keys(cli.flags).length === 2) {
cli.showHelp();
Expand Down
12 changes: 12 additions & 0 deletions lib/deleteReadme.js
@@ -0,0 +1,12 @@
const del = require('del');
const chalk = require('chalk');

module.exports = async () => {
const deletedPaths = await del(['src/{pages,components,layouts,templates}/README.md', '!./README.md']);

if (deletedPaths.length > 0) {
console.log(chalk.green('Deleted files:\n', deletedPaths.join('\n')));
} else {
console.log(chalk.yellow('No files to delete.'));
}
};

0 comments on commit 2268b35

Please sign in to comment.