Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ let yargsParser = yargs
'fast-exit',
'collect-logs',
'no-prefix',
'name-prefix',
'rewrite-paths',
'bin',
'done-criteria',
Expand Down Expand Up @@ -99,6 +100,12 @@ let yargsParser = yargs
boolean: true,
describe: "Don't prefix output"
},
'name-prefix': {
alias: 'n',
default: false,
boolean: true,
describe: "Prefix output with package name"
},
'rewrite-paths': {
boolean: true,
describe:
Expand Down Expand Up @@ -202,7 +209,8 @@ let runner = new RunGraph(
bin,
fastExit,
collectLogs,
addPrefix,
addPrefix: addPrefix || argv.namePrefix,
linePrefix: argv.namePrefix ? '' : ' | ',
rewritePaths,
mode: mode as any,
recursive,
Expand Down
7 changes: 4 additions & 3 deletions src/run-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ let mkThroat = require('throat')(Bromise) as ((limit: number) => PromiseFnRunner
let passThrough: PromiseFnRunner = f => f()

class Prefixer {
constructor(private wspath: string) {}
constructor(private wspath: string, private linePrefix: string) { }
private currentName = ''
prefixer = (basePath: string, pkg: string, line: string) => {
let l = ''
if (this.currentName != pkg) l += chalk.bold((this.currentName = pkg)) + '\n'
l += ' | ' + line // this.processFilePaths(basePath, line)
l += this.linePrefix + line // this.processFilePaths(basePath, line)
return l
}
}
Expand All @@ -31,6 +31,7 @@ export interface GraphOptions {
fastExit: boolean
collectLogs: boolean
addPrefix: boolean
linePrefix: string;
rewritePaths: boolean
mode: 'parallel' | 'serial' | 'stages'
recursive: boolean
Expand All @@ -52,7 +53,7 @@ export class RunGraph {
private runList = new Set<string>()
private resultMap = new Map<string, Result>()
private throat: PromiseFnRunner = passThrough
prefixer = new Prefixer(this.opts.workspacePath).prefixer
prefixer = new Prefixer(this.opts.workspacePath, this.opts.linePrefix).prefixer
pathRewriter = (pkgPath: string, line: string) => fixPaths(this.opts.workspacePath, pkgPath, line)

constructor(
Expand Down