-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: export collect as function for programmatic use
- Loading branch information
Showing
7 changed files
with
68 additions
and
37 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {RcJsonAsArgv} from "../../types"; | ||
|
||
import {logVerbose} from "../../core/loggin"; | ||
import {readBudgets} from "./utils/budgets"; | ||
|
||
export async function runAssertCommand(argv: RcJsonAsArgv) { | ||
logVerbose(readBudgets()); | ||
return Promise.resolve(); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {RcJson, RcJsonAsArgv} from "../../types"; | ||
import {getCollectCommandOptionsFromArgv} from "./utils/params"; | ||
import {logVerbose} from "../../core/loggin"; | ||
import {run} from "../../core/processing/behaviors"; | ||
import {collectRcJson} from "../init/processes/collect-rc-json"; | ||
import {startServerIfNeededAndExecute} from "./utils/serve-command"; | ||
import {collectReports} from "./processes/collect-reports"; | ||
|
||
export async function runCollectCommand(argv: RcJsonAsArgv) { | ||
const cfg = getCollectCommandOptionsFromArgv(argv); | ||
logVerbose('Collect options: ', cfg); | ||
await run([ | ||
collectRcJson, | ||
(cfg: RcJson) => | ||
startServerIfNeededAndExecute(() => collectReports(cfg) | ||
.then() | ||
, cfg.collect) | ||
])(cfg); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {RcJsonAsArgv} from "../../types"; | ||
|
||
import {log, logVerbose} from "../../core/loggin"; | ||
import {run} from "../../core/processing/behaviors"; | ||
import {collectRcJson} from "../init/processes/collect-rc-json"; | ||
import {getGlobalOptionsFromArgv} from "../../global/utils"; | ||
import {getInitCommandOptionsFromArgv} from "./utils"; | ||
import {updateRcJson} from "./processes/update-rc-json"; | ||
import {handleFlowGeneration} from "./processes/generate-userflow"; | ||
import {handleGhWorkflowGeneration} from "./processes/generate-workflow"; | ||
import {handleBudgetsGeneration} from "./processes/generate-lh-budgets"; | ||
import {SETUP_CONFIRM_MESSAGE} from "./constants"; | ||
|
||
export async function runInitCommand(argv: RcJsonAsArgv) { | ||
const { interactive } = getGlobalOptionsFromArgv(argv); | ||
const { generateFlow, generateGhWorkflow, generateBudgets, lhr, ...cfg } = getInitCommandOptionsFromArgv(argv); | ||
logVerbose('Init options: ', { interactive, generateFlow, generateGhWorkflow, generateBudgets,lhr, ...cfg }); | ||
|
||
await run([ | ||
collectRcJson, | ||
updateRcJson, | ||
handleFlowGeneration({ interactive: !!interactive, generateFlow }), | ||
handleGhWorkflowGeneration({ generateGhWorkflow }), | ||
handleBudgetsGeneration({ generateBudgets, lhr }), | ||
])(cfg ); | ||
log(SETUP_CONFIRM_MESSAGE); | ||
// @TODO move to constants | ||
log('To execute a user flow run `npx user-flow` or `npx user-flow collect`'); | ||
} |
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