Skip to content

Commit

Permalink
1.0.1
Browse files Browse the repository at this point in the history
- adds timestamp to all logs
  - adds the ability to toggle them on and off
  • Loading branch information
gabrielcsapo committed Dec 5, 2017
1 parent cc530a0 commit 2c8b0f4
Show file tree
Hide file tree
Showing 18 changed files with 1,190 additions and 123 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.1 (12/04/2017)

- adds timestamp to all logs
- adds the ability to toggle them on and off

# 1.0.0 (11/29/2017)

- fixes pipeline to find times recursively
Expand Down
6 changes: 3 additions & 3 deletions docs/code/Command.html
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ <h5>Type:</h5>



<h4 class="name" id="output"><span class="type-signature"></span>output<span class="type-signature"> :String</span></h4>
<h4 class="name" id="output"><span class="type-signature"></span>output<span class="type-signature"> :Array.&lt;Object></span></h4>



Expand All @@ -372,7 +372,7 @@ <h5>Type:</h5>
<ul>
<li>

<span class="param-type">String</span>
<span class="param-type">Array.&lt;Object></span>


</li>
Expand Down Expand Up @@ -707,7 +707,7 @@ <h4 class="name" id=".getReport"><span class="type-signature">(static) </span>ge

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="command.js.html">command.js</a>, <a href="command.js.html#line69">line 69</a>
<a href="command.js.html">command.js</a>, <a href="command.js.html#line77">line 77</a>
</li></ul></dd>


Expand Down
16 changes: 12 additions & 4 deletions docs/code/command.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ <h1 class="page-title">Source: command.js</h1>
this.command = command;
/**
* The output from the running a sub-process with the shell command
* @type {String}
* @type {Array&lt;Object>}
*/
this.output = '';
this.output = [];
/**
* The state of the command (unknown, skipped, fail, success)
* @type {String}
Expand Down Expand Up @@ -81,10 +81,18 @@ <h1 class="page-title">Source: command.js</h1>
shell: '/bin/bash'
});
child.stdout.on('data', (m) => {
self.output += m.toString('utf8');
self.output.push({
type: 'stdout',
content: m.toString('utf8'),
date: new Date()
});
});
child.stderr.on('data', (m) => {
self.output += m.toString('utf8');
self.output.push({
type: 'stderr',
content: m.toString('utf8'),
date: new Date()
});
});
child.on('exit', (code) => {
const end = process.hrtime(start);
Expand Down
4 changes: 2 additions & 2 deletions docs/code/compile.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ <h1 class="page-title">Source: compile.js</h1>
query: {
presets: ['env', 'react']
}
},
],
}
]
},
resolve: {
modules: [path.resolve(__dirname, 'node_modules'), 'node_modules']
Expand Down
900 changes: 855 additions & 45 deletions docs/example/index.html

Large diffs are not rendered by default.

Binary file modified docs/fail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/storybook/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<body>
<div id="root"></div>
<div id="error-display"></div>
<script src="static/preview.bf56930d85814dc6bc4f.bundle.js"></script>
<script src="static/preview.ad691f5e3f94fe1411af.bundle.js"></script>
</body>
</html>

4 changes: 2 additions & 2 deletions docs/storybook/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="storybook-version" content="3.2.16">
<meta name="storybook-version" content="3.2.17">
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
<title>Storybook</title>
<style>
Expand Down Expand Up @@ -40,7 +40,7 @@
</head>
<body style="margin: 0;">
<div id="root"></div>
<script src="static/manager.773224cc9ca9121a0171.bundle.js"></script>
<script src="static/manager.f833652b1623899ee196.bundle.js"></script>
</body>
</html>

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

16 changes: 12 additions & 4 deletions lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class Command {
this.command = command;
/**
* The output from the running a sub-process with the shell command
* @type {String}
* @type {Array<Object>}
*/
this.output = '';
this.output = [];
/**
* The state of the command (unknown, skipped, fail, success)
* @type {String}
Expand Down Expand Up @@ -53,10 +53,18 @@ class Command {
shell: '/bin/bash'
});
child.stdout.on('data', (m) => {
self.output += m.toString('utf8');
self.output.push({
type: 'stdout',
content: m.toString('utf8'),
date: new Date()
});
});
child.stderr.on('data', (m) => {
self.output += m.toString('utf8');
self.output.push({
type: 'stderr',
content: m.toString('utf8'),
date: new Date()
});
});
child.on('exit', (code) => {
const end = process.hrtime(start);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build.sh",
"version": "1.0.0",
"version": "1.0.1",
"description": "🔨 run and visualize the build process",
"repository": {
"type": "https",
Expand Down
29 changes: 25 additions & 4 deletions src/stage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ class Stage extends React.Component {
const { selected } = this.state;

this.setState({
selected: !selected
selected: !selected,
showTimestamp: true
});
}
toggleTimestamp(e) {
this.setState({
showTimestamp: e.target.checked
});
}
render() {
const { command, time, output, state } = this.props;
const { selected } = this.state;
const { id, command, time, output, state } = this.props;
const { selected, showTimestamp } = this.state;

return (
<div>
Expand All @@ -39,7 +45,22 @@ class Stage extends React.Component {
<div className="stage-time"> { ms(time || 0) } </div>
</div>
{ selected ?
<pre> { output } </pre>
<pre>
<div style={{ float: 'right' }}>
<input type="checkbox" id={`${id}-showTimestamp`} checked={ showTimestamp ? true : false } style={{ display: 'inline-block', width: 'auto' }} onChange={this.toggleTimestamp.bind(this)}/>&nbsp;
<label htmlFor={`${id}-showTimestamp`} style={{ display: 'inline-block' }}>Show Timestamp</label>
</div>
<table style={{ width: '100%' }}>
{ output.map((l) => {
const date = new Date(l.date);

return <tr>
{showTimestamp ? <td style={{ borderRight: '1px solid #dedede', paddingRight: '2px', width: '100px' }}><b>{date.getHours()}:{date.getMinutes()}:{date.getSeconds()}:{date.getMilliseconds()}</b></td> : '' }
<td style={{ paddingLeft: showTimestamp ? '3px' : '0px' }}><span>{ l.content }</span></td>
</tr>
}) }
</table>
</pre>
: '' }
</div>
)
Expand Down
55 changes: 46 additions & 9 deletions stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,36 @@ storiesOf('Stages', module)
.add('success', () => {
const stages = [
{
"command": "npm run coverage",
"type": "command",
"command": "npm run build",
"state": "success",
"output": `\n> build.sh@0.1.0 coverage /Users/gabrielcsapo/Documents/build.sh\n> tap test --coverage --coverage-report=lcov --no-browser \n\nTAP version 13\n# Subtest: test/git.js\n # git\n # should fail because directory is not a git directory\n ok 1 error is not undefined\n ok 2 should be truthy\n # should return the correct data\n # should fail when no remote is present\n Initialized empty Git repository in /Users/gabrielcsapo/Documents/build.sh/test/fixtures/sample-module/.git/\n [master (root-commit) 14fbfbd] testtest\n 1 file changed, 1 insertion(+)\n create mode 100644 README.md\n ok 3 should be equivalent\n # should cleanup git directory\n ok 4 should be equal\n \n 1..4\n # tests 4\n # pass 4\n \n # ok\n \nok 1 - test/git.js # time=1066.821ms\n\n# Subtest: test/index.js\n # build.sh\n \n 1..0\n # tests 0\n # pass 0\n \n # ok\n \nok 2 - test/index.js # SKIP\n\n1..2\n# skip: 1\n# time=1297.796ms\n`,
"output": [
{
"type": "stdout",
"content": " \u001b[2K\u001b[1A\u001b[2K\u001b[G ── \u001b[32mfoo\u001b[39m ── \u001b[90minstall\u001b[39m ── \u001b[90mextra:install\u001b[39m ── \u001b[90mdirectory\u001b[39m ── \u001b[90mlist:directory\u001b[39m\n",
"date": "2017-12-04T22:16:40.456Z"
},
{
"type": "stdout",
"content": " \u001b[2K\u001b[1A\u001b[2K\u001b[G ── \u001b[32mfoo\u001b[39m ── \u001b[90minstall\u001b[39m ── \u001b[32mextra:install\u001b[39m ── \u001b[90mdirectory\u001b[39m ── \u001b[90mlist:directory\u001b[39m\n \u001b[2K\u001b[1A\u001b[2K\u001b[G ── \u001b[32mfoo\u001b[39m ── \u001b[32minstall\u001b[39m ── \u001b[32mextra:install\u001b[39m ── \u001b[90mdirectory\u001b[39m ── \u001b[90mlist:directory\u001b[39m\n",
"date": "2017-12-04T22:16:40.456Z"
},
{
"type": "stdout",
"content": " \u001b[2K\u001b[1A\u001b[2K\u001b[G ── \u001b[32mfoo\u001b[39m ── \u001b[32minstall\u001b[39m ── \u001b[32mextra:install\u001b[39m ── \u001b[90mdirectory\u001b[39m ── \u001b[32mlist:directory\u001b[39m\n",
"date": "2017-12-04T22:16:40.456Z"
},
{
"type": "stdout",
"content": " \u001b[2K\u001b[1A\u001b[2K\u001b[G ── \u001b[32mfoo\u001b[39m ── \u001b[32minstall\u001b[39m ── \u001b[32mextra:install\u001b[39m ── \u001b[32mdirectory\u001b[39m ── \u001b[32mlist:directory\u001b[39m\n",
"date": "2017-12-04T22:16:40.457Z"
},
{
"type": "stdout",
"content": " Report compiled [2s]\n",
"date": "2017-12-04T22:16:40.457Z"
}
],
"id": "1504231277790k1l211gqkc",
"time": 2620.514874
}
Expand All @@ -83,7 +110,11 @@ storiesOf('Stages', module)
"type": "command",
"command": "npm run coverage",
"state": "fail",
"output": `\n> build.sh@0.1.0 coverage /Users/gabrielcsapo/Documents/build.sh\n> tap test --coverage --coverage-report=lcov --no-browser \n\nTAP version 13\n# Subtest: test/git.js\n # git\n # should fail because directory is not a git directory\n ok 1 error is not undefined\n ok 2 should be truthy\n # should return the correct data\n # should fail when no remote is present\n Initialized empty Git repository in /Users/gabrielcsapo/Documents/build.sh/test/fixtures/sample-module/.git/\n [master (root-commit) 14fbfbd] testtest\n 1 file changed, 1 insertion(+)\n create mode 100644 README.md\n ok 3 should be equivalent\n # should cleanup git directory\n ok 4 should be equal\n \n 1..4\n # tests 4\n # pass 4\n \n # ok\n \nok 1 - test/git.js # time=1066.821ms\n\n# Subtest: test/index.js\n # build.sh\n \n 1..0\n # tests 0\n # pass 0\n \n # ok\n \nok 2 - test/index.js # SKIP\n\n1..2\n# skip: 1\n# time=1297.796ms\n`,
"output": [{
type: 'stdout',
content: `\n> build.sh@0.1.0 coverage /Users/gabrielcsapo/Documents/build.sh\n> tap test --coverage --coverage-report=lcov --no-browser \n\nTAP version 13\n# Subtest: test/git.js\n # git\n # should fail because directory is not a git directory\n ok 1 error is not undefined\n ok 2 should be truthy\n # should return the correct data\n # should fail when no remote is present\n Initialized empty Git repository in /Users/gabrielcsapo/Documents/build.sh/test/fixtures/sample-module/.git/\n [master (root-commit) 14fbfbd] testtest\n 1 file changed, 1 insertion(+)\n create mode 100644 README.md\n ok 3 should be equivalent\n # should cleanup git directory\n ok 4 should be equal\n \n 1..4\n # tests 4\n # pass 4\n \n # ok\n \nok 1 - test/git.js # time=1066.821ms\n\n# Subtest: test/index.js\n # build.sh\n \n 1..0\n # tests 0\n # pass 0\n \n # ok\n \nok 2 - test/index.js # SKIP\n\n1..2\n# skip: 1\n# time=1297.796ms\n`,
date: "2017-12-04T22:16:40.457Z"
}],
"id": "1504231277790k1l211gqkc",
"time": 2620.514874
}
Expand All @@ -96,8 +127,7 @@ storiesOf('Stages', module)
"type": "command",
"command": "npm run coverage",
"state": "unknown",
"output": `\n> build.sh@0.1.0 coverage /Users/gabrielcsapo/Documents/build.sh\n> tap test --coverage --coverage-report=lcov --no-browser \n\nTAP version 13\n# Subtest: test/git.js\n # git\n # should fail because directory is not a git directory\n ok 1 error is not undefined\n ok 2 should be truthy\n # should return the correct data\n # should fail when no remote is present\n Initialized empty Git repository in /Users/gabrielcsapo/Documents/build.sh/test/fixtures/sample-module/.git/\n [master (root-commit) 14fbfbd] testtest\n 1 file changed, 1 insertion(+)\n create mode 100644 README.md\n ok 3 should be equivalent\n # should cleanup git directory\n ok 4 should be equal\n \n 1..4\n # tests 4\n # pass 4\n \n # ok\n \nok 1 - test/git.js # time=1066.821ms\n\n# Subtest: test/index.js\n # build.sh\n \n 1..0\n # tests 0\n # pass 0\n \n # ok\n \nok 2 - test/index.js # SKIP\n\n1..2\n# skip: 1\n# time=1297.796ms\n`,
"id": "1504231277790k1l211gqkc",
"output": [],
"time": 2620.514874
}
];
Expand All @@ -109,23 +139,30 @@ storiesOf('Stages', module)
"type": "command",
"command": "npm run coverage",
"state": "success",
"output": `\n> build.sh@0.1.0 coverage /Users/gabrielcsapo/Documents/build.sh\n> tap test --coverage --coverage-report=lcov --no-browser \n\nTAP version 13\n# Subtest: test/git.js\n # git\n # should fail because directory is not a git directory\n ok 1 error is not undefined\n ok 2 should be truthy\n # should return the correct data\n # should fail when no remote is present\n Initialized empty Git repository in /Users/gabrielcsapo/Documents/build.sh/test/fixtures/sample-module/.git/\n [master (root-commit) 14fbfbd] testtest\n 1 file changed, 1 insertion(+)\n create mode 100644 README.md\n ok 3 should be equivalent\n # should cleanup git directory\n ok 4 should be equal\n \n 1..4\n # tests 4\n # pass 4\n \n # ok\n \nok 1 - test/git.js # time=1066.821ms\n\n# Subtest: test/index.js\n # build.sh\n \n 1..0\n # tests 0\n # pass 0\n \n # ok\n \nok 2 - test/index.js # SKIP\n\n1..2\n# skip: 1\n# time=1297.796ms\n`,
"id": "1504231277790k1l211gqkc",
"output": [{
type: 'stdout',
content: `\n> build.sh@0.1.0 coverage /Users/gabrielcsapo/Documents/build.sh\n> tap test --coverage --coverage-report=lcov --no-browser \n\nTAP version 13\n# Subtest: test/git.js\n # git\n # should fail because directory is not a git directory\n ok 1 error is not undefined\n ok 2 should be truthy\n # should return the correct data\n # should fail when no remote is present\n Initialized empty Git repository in /Users/gabrielcsapo/Documents/build.sh/test/fixtures/sample-module/.git/\n [master (root-commit) 14fbfbd] testtest\n 1 file changed, 1 insertion(+)\n create mode 100644 README.md\n ok 3 should be equivalent\n # should cleanup git directory\n ok 4 should be equal\n \n 1..4\n # tests 4\n # pass 4\n \n # ok\n \nok 1 - test/git.js # time=1066.821ms\n\n# Subtest: test/index.js\n # build.sh\n \n 1..0\n # tests 0\n # pass 0\n \n # ok\n \nok 2 - test/index.js # SKIP\n\n1..2\n# skip: 1\n# time=1297.796ms\n`,
date: "2017-12-04T22:16:40.457Z"
}],
"time": 2000
},
{
"type": "command",
"command": "npm build",
"state": "fail",
"output": "build not a command",
"output": [{
type: 'stdout',
content: "build not a command",
date: "2017-12-04T22:16:40.457Z"
}],
"id": "1504231277790k15d11gqkc",
"time": 300
},
{
"type": "command",
"command": "neverrun -r",
"state": "unknown",
"output": "\n",
"output": [],
"id": "1504231277790k15d11ge3kc",
"time": 300
}
Expand Down
Loading

0 comments on commit 2c8b0f4

Please sign in to comment.