Skip to content

Commit

Permalink
1.1.0
Browse files Browse the repository at this point in the history
- updates docs
- moves eslint -> standard
- migrates to git functionality to async function
- migrates (command|pipeline) run to async function instead of a callback
- moves out convertToAsciiPipeline to util file
  • Loading branch information
gabrielcsapo committed Nov 27, 2018
1 parent e6a399c commit abfd455
Show file tree
Hide file tree
Showing 56 changed files with 2,101 additions and 10,072 deletions.
11 changes: 10 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{
"presets": ["react", "env"]
"presets": [
["@babel/env", {
"targets": {
"browsers": "last 2 Chrome versions",
"node": "current"
},
"modules": "commonjs"
}],
"@babel/react"
],
}
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

28 changes: 0 additions & 28 deletions .eslintrc

This file was deleted.

12 changes: 12 additions & 0 deletions .storybook/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
["@babel/env", {
"targets": {
"browsers": "last 2 Chrome versions",
"node": "current"
},
"modules": "commonjs"
}],
"@babel/react"
],
}
5 changes: 4 additions & 1 deletion .storybook/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { configure } from '@storybook/react';
import '../src/style.css';

function loadStories() {
require('../stories');
// automatically import all story ts files that end with *.stories.js
const req = require.context('../stories', true, /\.stories\.js/);

req.keys().forEach(filename => req(filename));
}

configure(loadStories, module);
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ script:
node_js:
- "6"
- "8"
- "10"
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 1.1.0 (11/27/2018)

- updates docs
- moves `eslint` -> `standard`
- migrates to git functionality to async function
- migrates (command|pipeline) run to async function instead of a callback
- moves out convertToAsciiPipeline to util file

# 1.0.3 (01/12/2018)

- updates dependencies
Expand Down
24 changes: 12 additions & 12 deletions bin/build.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
#!/usr/bin/env node

const program = require('commander');
const program = require('commander')

const fs = require('fs');
const yaml = require('js-yaml');
const execute = require('../lib/execute');
const fs = require('fs')
const yaml = require('js-yaml')
const { execute } = require('../lib/execute')

let runOnly = '';
let runOnly = ''

program
.version(require('../package.json').version)
.arguments('<steps>')
.action(function (actions) {
// creates an array of steps allowed
runOnly = actions.split(',')
// creates an array of steps allowed
runOnly = actions.split(',')
})
.option('-c, --config [file]', 'the input file for the build pipeline to run', process.cwd() + '/build.yml')
.option('-d, --debug', 'outputs a debug file of the build process and data captured', false)
.option('-o, --output [output]', 'set the output path for the build artifact')
.option('-b, --browser', 'doesn\'t open browser')
.parse(process.argv);
.parse(process.argv)

const { config, debug, output, browser } = program;
const { config, debug, output, browser } = program

const buildFile = fs.readFileSync(config, 'utf8');
const buildFile = fs.readFileSync(config, 'utf8')
const doc = yaml.safeLoad(buildFile);

(async function() {
await execute(Object.assign({ runOnly, debug, output, browser }, doc));
(async function () {
await execute(Object.assign({ runOnly, debug, output, browser }, doc))
}())
22 changes: 17 additions & 5 deletions docs/code/Command.html
Original file line number Diff line number Diff line change
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#line77">line 77</a>
<a href="command.js.html">command.js</a>, <a href="command.js.html#line82">line 82</a>
</li></ul></dd>


Expand Down Expand Up @@ -759,7 +759,7 @@ <h5>Returns:</h5>



<h4 class="name" id=".run"><span class="type-signature">(static) </span>run<span class="signature">(callback)</span><span class="type-signature"></span></h4>
<h4 class="name" id=".run"><span class="type-signature">(static) </span>run<span class="signature">(description<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>



Expand Down Expand Up @@ -791,6 +791,8 @@ <h5>Parameters:</h5>
<th>Type</th>


<th>Attributes</th>




Expand All @@ -803,23 +805,33 @@ <h5>Parameters:</h5>

<tr>

<td class="name"><code>callback</code></td>
<td class="name"><code>description</code></td>


<td class="type">


<span class="param-type">function</span>
<span class="param-type">Promise</span>



</td>


<td class="attributes">

&lt;optional><br>





</td>


<td class="description last"><p>[description]</p></td>


<td class="description last"></td>
</tr>


Expand Down
2 changes: 1 addition & 1 deletion docs/code/Git.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ <h6>Properties</h6>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="git.js.html">git.js</a>, <a href="git.js.html#line5">line 5</a>
<a href="git.js.html">git.js</a>, <a href="git.js.html#line8">line 8</a>
</li></ul></dd>


Expand Down
2 changes: 1 addition & 1 deletion docs/code/Pipeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,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="pipeline.js.html">pipeline.js</a>, <a href="pipeline.js.html#line97">line 97</a>
<a href="pipeline.js.html">pipeline.js</a>, <a href="pipeline.js.html#line88">line 88</a>
</li></ul></dd>


Expand Down
85 changes: 45 additions & 40 deletions docs/code/command.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h1 class="page-title">Source: command.js</h1>

<section>
<article>
<pre class="prettyprint source linenums"><code>const { spawn } = require('child_process');
<pre class="prettyprint source linenums"><code>const { spawn } = require('child_process')

class Command {
/**
Expand All @@ -35,92 +35,97 @@ <h1 class="page-title">Source: command.js</h1>
* @param {Pipeline} parent [description]
* @param {String} command [description]
*/
constructor(parent, command) {
constructor (parent, command) {
/**
* The parent pipeline this command belongs too
* @type {Pipline}
*/
this.parent = parent;
this.parent = parent
/**
* The shell command that this command will execute
* @type {String}
*/
this.command = command;
this.command = command
/**
* The output from the running a sub-process with the shell command
* @type {Array&lt;Object>}
*/
this.output = [];
this.output = []
/**
* The state of the command (unknown, skipped, fail, success)
* @type {String}
*/
this.state = 'unknown';
this.state = 'unknown'
/**
* The time in MS that the command took to execute
* @type {String}
*/
this.time = 0;
this.time = 0
/**
* A unique identifier
* @type {Number}
*/
this.id = Date.now() + Math.random().toString(36).substr(2, 10);
this.id = Date.now() + Math.random().toString(36).substr(2, 10)
}
/**
* Runs the command using the passed in shell script as the command to run
* @memberof Command
* @method run
* @param {Function} callback [description]
* @param {Promise} [description]
*/
run(callback) {
const self = this;
const start = process.hrtime();
let child = spawn(self.command, {
cwd: process.cwd(),
shell: '/bin/bash'
});
child.stdout.on('data', (m) => {
self.output.push({
type: 'stdout',
content: m.toString('utf8'),
date: new Date()
});
});
child.stderr.on('data', (m) => {
self.output.push({
type: 'stderr',
content: m.toString('utf8'),
date: new Date()
});
});
child.on('exit', (code) => {
const end = process.hrtime(start);

self.state = code === 0 ? 'success' : 'fail';
self.time = ((end[0] * 1e9) + end[1]) / 1e6;
callback(self.state);
});
run () {
return new Promise((resolve, reject) => {
const start = process.hrtime()

const child = spawn(this.command, {
cwd: process.cwd(),
shell: '/bin/bash'
})

child.stdout.on('data', (m) => {
this.output.push({
type: 'stdout',
content: m.toString('utf8'),
date: new Date()
})
})

child.stderr.on('data', (m) => {
this.output.push({
type: 'stderr',
content: m.toString('utf8'),
date: new Date()
})
})

child.on('exit', (code) => {
const end = process.hrtime(start)

this.state = code === 0 ? 'success' : 'fail'
this.time = ((end[0] * 1e9) + end[1]) / 1e6
resolve(this.state)
})
})
}
/**
* returns information pertaining to the command
* @memberof Command
* @method getReport
* @return {Object}
*/
getReport() {
getReport () {
return {
type: 'command',
command: this.command,
output: this.output,
state: this.state,
time: this.time,
id: this.id
};
}
}
}

module.exports = Command;
module.exports = Command
</code></pre>
</article>
</section>
Expand Down
Loading

0 comments on commit abfd455

Please sign in to comment.