Skip to content

Commit

Permalink
0.2.4
Browse files Browse the repository at this point in the history
- generates a similar pipeline view in the console
  • Loading branch information
gabrielcsapo committed Sep 16, 2017
1 parent 606a97d commit b592c81
Show file tree
Hide file tree
Showing 18 changed files with 24,933 additions and 91 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.2.4 (09/16/2017)

- generates a similar pipeline view in the console

# 0.2.3 (09/13/2017)

- adds arrow to show opened stages
Expand Down
7 changes: 6 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
- [ ] capture any changes that weren't committed to git
- [ ] document and test using build.sh as a module
- [ ] generate a similar pipeline view in the console
- [ ] add prop types
- [ ] add the option to to take in a build.json file and generate a report from that
- [ ] generate a multi line pipeline
```
─┬─install─┬─lint─┬─coverage─┬─test──docs
| | | |
└──npm────┘ └──upload──┘
```
36 changes: 14 additions & 22 deletions bin/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ const path = require('path');

const fs = require('fs');
const yaml = require('js-yaml');
const ora = require('ora');
const open = require('opn');
const logUpdate = require('log-update');

const Git = require('../lib/git');
const Compile = require('../lib/compile');
const Pipeline = require('../lib/pipeline');
const { ms } = require('../lib/util');
const { ms, renderAsciiPipe } = require('../lib/util');

program
.version(require('../package.json').version)
Expand All @@ -21,39 +21,29 @@ program

const { config, debug } = program;

const spinner = ora('Parsing build.yml').start();

try {
const pkg = require(path.resolve(process.cwd(), 'package.json'));
const buildFile = fs.readFileSync(config, 'utf8');
const doc = yaml.safeLoad(buildFile);
const { pipeline, output } = doc;

spinner.text = 'Running pipeline';

const events = Pipeline(pipeline);
const start = process.hrtime();
let completed = [];

events.on('stage:start', (stage) => {
spinner.text = `Starting stage ${stage}`;
});
events.on('stage:end', (stage) => {
completed.push(stage);

events.on('stage:start:command', (stage, command) => {
spinner.text = `Running command ${command} on stage ${stage}`;
logUpdate(renderAsciiPipe(pipeline, completed));
});

events.on('error', (error) => {
spinner.fail(`pipeline failed with error ${error}`);
});
logUpdate(renderAsciiPipe(pipeline, completed));

events.on('end', (results) => {

spinner.text = 'Capturing git information';
console.log('Capturing git information'); // eslint-disable-line

Git()
.then((info) => {
spinner.text = 'Compiling report';

if(debug) {
fs.writeFileSync('build.json', JSON.stringify({
git: info,
Expand Down Expand Up @@ -97,19 +87,21 @@ try {
output: path.resolve(output) || process.cwd() + '/build'
}, (error) => {
if(error) {
return spinner.fail(`Compile has failed with the following error:\n${error}`);
return console.log(`Compile has failed with the following error:\n${error}`); // eslint-disable-line
}
const reportLocation = path.resolve((path.resolve(output) || process.cwd() + '/build'), 'index.html');
const end = process.hrtime(start);
spinner.succeed(`Report compiled [${ms(((end[0] * 1e9) + end[1]) / 1e6)}]\nLocated at ${reportLocation}`);

console.log(`Report compiled [${ms(((end[0] * 1e9) + end[1]) / 1e6)}]\nLocated at ${reportLocation}`); // eslint-disable-line

open(reportLocation, { wait: false });
});
})
.catch((error) => {
spinner.fail(`Failed trying to get git information ${error}`)
console.log(`Failed trying to get git information ${error}`); // eslint-disable-line
})
});

} catch (error) {
spinner.fail(`Something went really wrong ${error}`);
console.log(`Something went really wrong ${error}`); // eslint-disable-line
}
17 changes: 2 additions & 15 deletions docs/code/compile.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<label for="nav-trigger" class="overlay"></label>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-lib_compile.html">lib/compile</a></li><li><a href="module-lib_git.html">lib/git</a></li><li><a href="module-lib_pipeline.html">lib/pipeline</a></li><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~ms">ms</a></li></ul></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-lib_compile.html">lib/compile</a></li><li><a href="module-lib_git.html">lib/git</a></li><li><a href="module-lib_pipeline.html">lib/pipeline</a></li><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#.renderAsciiPipe">renderAsciiPipe</a></li><li data-type='method'><a href="module-lib_util.html#~ms">ms</a></li></ul></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -93,19 +93,6 @@ <h1 class="page-title">compile.js</h1>
config: JSON.stringify(config)
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.UglifyJsPlugin({
comments: false,
compress: {
unused: true,
dead_code: true,
warnings: false,
drop_debugger: true,
conditionals: true,
evaluate: true,
sequences: true,
booleans: true,
}
}),
new webpack.optimize.AggressiveMergingPlugin()
]
}, function(err, stats) {
Expand All @@ -131,7 +118,7 @@ <h1 class="page-title">compile.js</h1>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Fri Sep 15 2017 14:32:57 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sat Sep 16 2017 12:36:17 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/code/git.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<label for="nav-trigger" class="overlay"></label>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-lib_compile.html">lib/compile</a></li><li><a href="module-lib_git.html">lib/git</a></li><li><a href="module-lib_pipeline.html">lib/pipeline</a></li><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~ms">ms</a></li></ul></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-lib_compile.html">lib/compile</a></li><li><a href="module-lib_git.html">lib/git</a></li><li><a href="module-lib_pipeline.html">lib/pipeline</a></li><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#.renderAsciiPipe">renderAsciiPipe</a></li><li data-type='method'><a href="module-lib_util.html#~ms">ms</a></li></ul></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -138,7 +138,7 @@ <h1 class="page-title">git.js</h1>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Fri Sep 15 2017 14:32:57 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sat Sep 16 2017 12:36:17 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/code/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<label for="nav-trigger" class="overlay"></label>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-lib_compile.html">lib/compile</a></li><li><a href="module-lib_git.html">lib/git</a></li><li><a href="module-lib_pipeline.html">lib/pipeline</a></li><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~ms">ms</a></li></ul></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-lib_compile.html">lib/compile</a></li><li><a href="module-lib_git.html">lib/git</a></li><li><a href="module-lib_pipeline.html">lib/pipeline</a></li><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#.renderAsciiPipe">renderAsciiPipe</a></li><li data-type='method'><a href="module-lib_util.html#~ms">ms</a></li></ul></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -109,7 +109,7 @@ <h2>Installation</h2><p>This module can be installed via npm, or for those who d
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Fri Sep 15 2017 14:32:57 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sat Sep 16 2017 12:36:17 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/code/module-lib_compile.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<label for="nav-trigger" class="overlay"></label>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-lib_compile.html">lib/compile</a></li><li><a href="module-lib_git.html">lib/git</a></li><li><a href="module-lib_pipeline.html">lib/pipeline</a></li><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~ms">ms</a></li></ul></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-lib_compile.html">lib/compile</a></li><li><a href="module-lib_git.html">lib/git</a></li><li><a href="module-lib_pipeline.html">lib/pipeline</a></li><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#.renderAsciiPipe">renderAsciiPipe</a></li><li data-type='method'><a href="module-lib_util.html#~ms">ms</a></li></ul></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -311,7 +311,7 @@ <h6>Properties</h6>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Fri Sep 15 2017 14:32:57 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sat Sep 16 2017 12:36:17 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/code/module-lib_git.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<label for="nav-trigger" class="overlay"></label>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-lib_compile.html">lib/compile</a></li><li><a href="module-lib_git.html">lib/git</a></li><li><a href="module-lib_pipeline.html">lib/pipeline</a></li><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~ms">ms</a></li></ul></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-lib_compile.html">lib/compile</a></li><li><a href="module-lib_git.html">lib/git</a></li><li><a href="module-lib_pipeline.html">lib/pipeline</a></li><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#.renderAsciiPipe">renderAsciiPipe</a></li><li data-type='method'><a href="module-lib_util.html#~ms">ms</a></li></ul></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -307,7 +307,7 @@ <h5>Returns:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Fri Sep 15 2017 14:32:57 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sat Sep 16 2017 12:36:17 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/code/module-lib_pipeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<label for="nav-trigger" class="overlay"></label>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-lib_compile.html">lib/compile</a></li><li><a href="module-lib_git.html">lib/git</a></li><li><a href="module-lib_pipeline.html">lib/pipeline</a></li><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~ms">ms</a></li></ul></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-lib_compile.html">lib/compile</a></li><li><a href="module-lib_git.html">lib/git</a></li><li><a href="module-lib_pipeline.html">lib/pipeline</a></li><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#.renderAsciiPipe">renderAsciiPipe</a></li><li data-type='method'><a href="module-lib_util.html#~ms">ms</a></li></ul></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -234,7 +234,7 @@ <h5>Returns:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.4</a> on Fri Sep 15 2017 14:32:57 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sat Sep 16 2017 12:36:17 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
Loading

0 comments on commit b592c81

Please sign in to comment.