init
This commit is contained in:
59
node_modules/gherkin/bin/gherkin
generated
vendored
Normal file
59
node_modules/gherkin/bin/gherkin
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict'
|
||||
const Stream = require('stream')
|
||||
const fs = require('fs')
|
||||
const EventStream = require('../lib/gherkin/stream/event_stream')
|
||||
|
||||
const args = process.argv.slice(2)
|
||||
const types = {
|
||||
'source': true,
|
||||
'gherkin-document': true,
|
||||
'pickle': true
|
||||
}
|
||||
|
||||
const paths = []
|
||||
while (args.length > 0) {
|
||||
const arg = args.shift()
|
||||
switch (arg) {
|
||||
case '--no-source':
|
||||
types['source'] = false;
|
||||
break;
|
||||
|
||||
case '--no-ast':
|
||||
types['gherkin-document'] = false;
|
||||
break;
|
||||
|
||||
case '--no-pickles':
|
||||
types['pickle'] = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
paths.push(arg);
|
||||
}
|
||||
}
|
||||
|
||||
const ndjsonStream = new Stream.Transform({
|
||||
objectMode: true,
|
||||
transform: function (event, _, callback) {
|
||||
this.push(JSON.stringify(event) + "\n")
|
||||
callback()
|
||||
}
|
||||
})
|
||||
ndjsonStream.pipe(process.stdout)
|
||||
|
||||
function pipeEventsFor(paths, i, callback) {
|
||||
const path = paths[i++]
|
||||
if (!path) return callback()
|
||||
const stream = eventStream(path)
|
||||
stream.pipe(ndjsonStream, { end: false })
|
||||
stream.on('end', () => pipeEventsFor(paths, i, callback))
|
||||
}
|
||||
|
||||
function eventStream(path) {
|
||||
const fileStream = fs.createReadStream(path, { encoding: 'utf-8' })
|
||||
const eventStream = new EventStream(path, types)
|
||||
fileStream.pipe(eventStream)
|
||||
return eventStream
|
||||
}
|
||||
|
||||
pipeEventsFor(paths, 0, () => ndjsonStream.end())
|
16
node_modules/gherkin/bin/gherkin-generate-tokens
generated
vendored
Normal file
16
node_modules/gherkin/bin/gherkin-generate-tokens
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env node
|
||||
var fs = require('fs');
|
||||
var Gherkin = require('..');
|
||||
|
||||
// We're not exposing this on Gherkin since it's just used for testing
|
||||
// By not doing this it doesn't get included in the browserify build
|
||||
var TokenFormatterBuilder = require('../lib/gherkin/token_formatter_builder');
|
||||
|
||||
var parser = new Gherkin.Parser(new TokenFormatterBuilder());
|
||||
parser.stopAtFirstError = true;
|
||||
var matcher = new Gherkin.TokenMatcher();
|
||||
var files = process.argv.slice(2)
|
||||
files.forEach(function (file) {
|
||||
var scanner = new Gherkin.TokenScanner(fs.readFileSync(file, 'UTF-8'));
|
||||
process.stdout.write(parser.parse(scanner, matcher));
|
||||
});
|
Reference in New Issue
Block a user