-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- fixes pipeline to find times recursively - cleans up duplicate code - handles if git is not present - removes the dependency on having a package.json to get name and description - removes the qs module uses native querystring - cleans up stages markup to have the title inlined - adds report tab to show report in JSON - adds times to all pipeline nodes - the end now shows a cumulative time - fixes bug if output is not defined in config - config is now the pipeline parsed - adds an output flag to the CLI that sets the output of the report - adds an browser flag to CLI that allows setting browser to be configured to be open or not - abstracts execution logic from binary and tests it separately - cleans up and rearranges UI - adds story to storybook stories to reflect a full report view - removes babel-minify-webpack-plugin
- Loading branch information
1 parent
0dd382b
commit cc530a0
Showing
91 changed files
with
21,678 additions
and
3,652 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"presets": ["react", "es2015"] | ||
"presets": ["react", "env"] | ||
} |
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 |
---|---|---|
|
@@ -7,3 +7,5 @@ package-lock.json | |
build.json | ||
packed | ||
npm-debug.log | ||
test/fixtures/build | ||
build |
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
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,123 +1,31 @@ | ||
#!/usr/bin/env node | ||
|
||
const program = require('commander'); | ||
const path = require('path'); | ||
|
||
const fs = require('fs'); | ||
const fs = require('fs'); | ||
const yaml = require('js-yaml'); | ||
const open = require('opn'); | ||
const logUpdate = require('log-update'); | ||
const qs = require('qs'); | ||
const execute = require('../lib/execute'); | ||
|
||
const Git = require('../lib/git'); | ||
const Compile = require('../lib/compile'); | ||
const Pipeline = require('../lib/pipeline'); | ||
const { ms, renderAsciiPipe } = require('../lib/util'); | ||
|
||
let refinedSteps = ''; | ||
let runOnly = ''; | ||
|
||
program | ||
.version(require('../package.json').version) | ||
.arguments('<steps>') | ||
.action(function (actions) { | ||
// creates an array of steps allowed | ||
refinedSteps = actions.split(',') | ||
runOnly = actions.split(',') | ||
}) | ||
.option('-c, --config [file]', 'the input file for the build pipeline to run', path.resolve(process.cwd(), 'build.yml')) | ||
.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); | ||
|
||
const { config, debug } = program; | ||
|
||
try { | ||
const pkg = require(path.resolve(process.cwd(), 'package.json')); | ||
const buildFile = fs.readFileSync(config, 'utf8'); | ||
const doc = yaml.safeLoad(buildFile); | ||
const { pipeline, output, env } = doc; | ||
|
||
if(env) { | ||
env.forEach((e) => { | ||
let q = qs.parse(e); | ||
let k = Object.keys(q)[0]; | ||
process.env[k] = q[k]; | ||
}); | ||
} | ||
|
||
const start = process.hrtime(); | ||
const events = Pipeline(pipeline, refinedSteps); | ||
let completed = []; | ||
|
||
events.on('stage:end', (stage) => { | ||
completed.push(stage); | ||
|
||
logUpdate(renderAsciiPipe(pipeline, completed)); | ||
}); | ||
|
||
logUpdate(renderAsciiPipe(pipeline, completed)); | ||
|
||
events.on('end', (results) => { | ||
console.log('Capturing git information'); // eslint-disable-line | ||
|
||
Git() | ||
.then((info) => { | ||
if(debug) { | ||
fs.writeFileSync('build.json', JSON.stringify({ | ||
git: info, | ||
name: pkg.name, | ||
description: pkg.description, | ||
source: pkg.repository.url, | ||
config: buildFile, | ||
environment: { | ||
versions: process.versions, | ||
env: process.env, | ||
arch: process.arch, | ||
platform: process.platform, | ||
release: process.release, | ||
version: process.version, | ||
features: process.features, | ||
config: process.config | ||
}, | ||
pipeline: results | ||
}, null, 4)); | ||
} | ||
|
||
Compile({ | ||
config: { | ||
git: info, | ||
name: pkg.name, | ||
description: pkg.description, | ||
source: pkg.repository.url, | ||
config: buildFile, | ||
environment: { | ||
versions: process.versions, | ||
env: process.env, | ||
arch: process.arch, | ||
platform: process.platform, | ||
release: process.release, | ||
version: process.version, | ||
features: process.features, | ||
config: process.config | ||
}, | ||
pipeline: results | ||
}, | ||
output: path.resolve(output) || process.cwd() + '/build' | ||
}, (error) => { | ||
if(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); | ||
|
||
console.log(`Report compiled [${ms(((end[0] * 1e9) + end[1]) / 1e6)}]\nLocated at ${reportLocation}`); // eslint-disable-line | ||
const { config, debug, output, browser } = program; | ||
|
||
open(reportLocation, { wait: false }); | ||
}); | ||
}) | ||
.catch((error) => { | ||
console.log(`Failed trying to get git information ${error}`); // eslint-disable-line | ||
}) | ||
}); | ||
const buildFile = fs.readFileSync(config, 'utf8'); | ||
const doc = yaml.safeLoad(buildFile); | ||
|
||
} catch (error) { | ||
console.log(`Something went really wrong ${error}`); // eslint-disable-line | ||
} | ||
(async function() { | ||
await execute(Object.assign({ runOnly, debug, output, browser }, doc)); | ||
}()) |
Oops, something went wrong.