Skip to content

Commit

Permalink
1.0.2
Browse files Browse the repository at this point in the history
- uses ascii-pipeline to generate an ascii pipeline!
- updates dependencies
  • Loading branch information
gabrielcsapo committed Jan 1, 2018
1 parent 2c8b0f4 commit 3b9f661
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 1,144 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.0.2 (01/01/2018)

- uses ascii-pipeline to generate an ascii pipeline!
- updates dependencies

# 1.0.1 (12/04/2017)

- adds timestamp to all logs
Expand Down
182 changes: 0 additions & 182 deletions docs/code/module-lib_util.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,188 +64,6 @@ <h3 class="subsection-title">Methods</h3>



<h4 class="name" id=".renderAsciiPipe"><span class="type-signature">(static) </span>renderAsciiPipe<span class="signature">(names, completed)</span><span class="type-signature"> &rarr; {String}</span></h4>






<div class="description">
<p>renders an ascii pipline from the given pipeline object</p>
</div>









<h5>Parameters:</h5>


<table class="params">
<thead>
<tr>

<th>Name</th>


<th>Type</th>





<th class="last">Description</th>
</tr>
</thead>

<tbody>


<tr>

<td class="name"><code>names</code></td>


<td class="type">


<span class="param-type">Array</span>



</td>





<td class="description last"><p>an array of pipeline strings</p></td>
</tr>



<tr>

<td class="name"><code>completed</code></td>


<td class="type">


<span class="param-type">Array</span>



</td>





<td class="description last"><p>an array of completed stage objects</p></td>
</tr>


</tbody>
</table>






<dl class="details">


























<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="util.js.html">util.js</a>, <a href="util.js.html#line39">line 39</a>
</li></ul></dd>







</dl>













<h5>Returns:</h5>


<div class="param-desc">
<ul>
<li>a pipeline string</li>
</ul>
</div>



<dl>
<dt>
Type
</dt>
<dd>

<span class="param-type">String</span>


</dd>
</dl>













<h4 class="name" id="~ms"><span class="type-signature">(inner) </span>ms<span class="signature">(ms)</span><span class="type-signature"> &rarr; {String}</span></h4>


Expand Down
33 changes: 0 additions & 33 deletions docs/code/util.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,39 +56,6 @@ <h1 class="page-title">Source: util.js</h1>
}
return ms + 'ms';
}

/**
* renders an ascii pipline from the given pipeline object
* @method
* @param {Array} names - an array of pipeline strings
* @param {Array} completed - an array of completed stage objects
* @return {String} - a pipeline string
*/
module.exports.renderAsciiPipe = function(names, completed) {
var pipe = [];
function renderColor(name, state) {
if(state === 'success') {
return `\x1b[32m${name}\x1b[39m`;
}
if(state === 'fail') {
return `\x1b[31m${name}\x1b[39m`;
}
if(state === 'unknown') {
return `\x1b[33m${name}\x1b[39m`;
}
return `\x1b[90m${name}\x1b[39m`;
}

names.forEach((d) => {
let stage = completed.filter((f) => {
return f.path == d;
})[0];
let name = stage ? renderColor(stage.path, stage.state) : renderColor(d, '')
pipe.push(' ', '─', '─', ' ', name);
});

return pipe.join('');
}
</code></pre>
</article>
</section>
Expand Down
880 changes: 46 additions & 834 deletions docs/example/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html

Large diffs are not rendered by default.

22 changes: 19 additions & 3 deletions lib/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,25 @@ const qs = require('querystring');
const Git = require('../lib/git');
const Compile = require('../lib/compile');
const Pipeline = require('../lib/pipeline');
const { ms, renderAsciiPipe } = require('../lib/util');
const { ms } = require('../lib/util');
const AsciiPipeline = require('ascii-pipeline');

module.exports = async function({ pipeline, output, env, runOnly, browser=true, debug=false }) {
function convertToAsciiPipeline(tasks) {
let raw = tasks.map((t) => {
return {
name: t.name,
status: t.state,
children: t.tasks.map((s) => {
return {
name: s.name || s.command,
status: s.state
}
})
}
});
return new AsciiPipeline(raw).toString()
}
try {
const derivedOutput = path.resolve(output ? path.resolve(output) : process.cwd() + '/build');
const reportLocation = derivedOutput + '/index.html';
Expand All @@ -30,10 +46,10 @@ module.exports = async function({ pipeline, output, env, runOnly, browser=true,

pipe.events.on('end', (stage) => {
completed.push(stage);
logUpdate(renderAsciiPipe(pipe.paths, completed));
logUpdate(convertToAsciiPipeline(pipe.tasks));
});

logUpdate(renderAsciiPipe(pipe.paths, completed));
logUpdate(convertToAsciiPipeline(pipe.tasks));

pipe.run((async() => {
let git = {}
Expand Down
33 changes: 0 additions & 33 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,3 @@ module.exports.ms = function ms(ms) {
}
return ms + 'ms';
}

/**
* renders an ascii pipline from the given pipeline object
* @method
* @param {Array} names - an array of pipeline strings
* @param {Array} completed - an array of completed stage objects
* @return {String} - a pipeline string
*/
module.exports.renderAsciiPipe = function(names, completed) {
var pipe = [];
function renderColor(name, state) {
if(state === 'success') {
return `\x1b[32m${name}\x1b[39m`;
}
if(state === 'fail') {
return `\x1b[31m${name}\x1b[39m`;
}
if(state === 'unknown') {
return `\x1b[33m${name}\x1b[39m`;
}
return `\x1b[90m${name}\x1b[39m`;
}

names.forEach((d) => {
let stage = completed.filter((f) => {
return f.path == d;
})[0];
let name = stage ? renderColor(stage.path, stage.state) : renderColor(d, '')
pipe.push(' ', '─', '─', ' ', name);
});

return pipe.join('');
}
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build.sh",
"version": "1.0.1",
"version": "1.0.2",
"description": "🔨 run and visualize the build process",
"repository": {
"type": "https",
Expand All @@ -26,6 +26,7 @@
"author": "Gabriel J. Csapo <[email protected]>",
"license": "ISC",
"dependencies": {
"ascii-pipeline": "0.0.2",
"async": "^2.6.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
Expand All @@ -42,20 +43,20 @@
"psychic.css": "0.0.1",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"style-loader": "^0.19.0",
"style-loader": "^0.19.1",
"webpack": "^3.9.1"
},
"devDependencies": {
"@storybook/addon-actions": "^3.2.16",
"@storybook/react": "^3.2.16",
"@storybook/addon-actions": "^3.3.3",
"@storybook/react": "^3.3.3",
"docdash": "^0.4.0",
"eslint": "^4.12.1",
"eslint": "^4.14.0",
"eslint-plugin-react": "^7.5.1",
"jsdoc": "^3.5.5",
"pkg": "^4.2.6",
"tap": "^11.0.0",
"tap": "^11.0.1",
"tape": "^4.8.0",
"tryitout": "^1.2.0"
"tryitout": "^1.2.3"
},
"pkg": {
"scripts": [
Expand Down
Loading

0 comments on commit 3b9f661

Please sign in to comment.