-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c4855e
commit 1688276
Showing
5 changed files
with
94 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
const { formatLine } = require('../output'); | ||
const chalk = require('chalk'); | ||
const fs = require('fs'); | ||
|
||
const logSuccess = msg => { | ||
console.log(formatLine(chalk.green(msg))); | ||
}; | ||
|
||
exports.command = 'init'; | ||
exports.desc = 'Create a statickit.json file in the current directory'; | ||
exports.builder = {}; | ||
exports.handler = function(args) { | ||
console.log('init called'); | ||
fs.writeFile('statickit.json', '{}', { flag: 'wx' }, function(err) { | ||
if (err) { | ||
logSuccess('statickit.json already exists'); | ||
} else { | ||
logSuccess('statickit.json created'); | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const chalk = require('chalk'); | ||
|
||
const formatLine = str => { | ||
return `${chalk.gray('>')} ${str}`; | ||
}; | ||
|
||
const formatError = msg => { | ||
return formatLine(chalk.red(msg)); | ||
}; | ||
|
||
module.exports = { formatLine, formatError }; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters