@bilt/build-with-configuration
Advanced tools
Comparing version 9.0.7 to 9.1.0
{ | ||
"name": "@bilt/build-with-configuration", | ||
"version": "9.0.7", | ||
"version": "9.1.0", | ||
"description": "", | ||
@@ -40,4 +40,4 @@ "type": "module", | ||
"devDependencies": { | ||
"@babel/core": "^7.12.16", | ||
"@babel/eslint-parser": "^7.12.16", | ||
"@babel/core": "^7.12.17", | ||
"@babel/eslint-parser": "^7.12.17", | ||
"@babel/plugin-syntax-top-level-await": "^7.12.13", | ||
@@ -48,6 +48,6 @@ "@types/chai": "^4.2.15", | ||
"@types/graphlib": "^2.1.7", | ||
"@types/mocha": "^8.2.0", | ||
"@types/node": "^14.14.27", | ||
"@typescript-eslint/eslint-plugin": "^4.15.0", | ||
"@typescript-eslint/parser": "^4.15.0", | ||
"@types/mocha": "^8.2.1", | ||
"@types/node": "^14.14.30", | ||
"@typescript-eslint/eslint-plugin": "^4.15.1", | ||
"@typescript-eslint/parser": "^4.15.1", | ||
"chai": "^4.3.0", | ||
@@ -66,5 +66,5 @@ "chai-subset": "^1.6.0", | ||
"dependencies": { | ||
"@bilt/scripting-commons": "^2.0.3", | ||
"@bilt/scripting-commons": "^2.0.4", | ||
"constant-case": "^3.0.4" | ||
} | ||
} |
@@ -1,2 +0,8 @@ | ||
import {executeStep, stepInfo, validateStep} from './execute-step.js' | ||
import { | ||
executeCommand, | ||
executeCondition, | ||
executeStep, | ||
stepInfo, | ||
validateStep, | ||
} from './execute-step.js' | ||
@@ -115,2 +121,41 @@ /** | ||
/** | ||
* @typedef {{ | ||
* info: () => import('./execute-step.js').StepInfo | ||
* isEnabled: () => boolean | ||
* shouldSkip: () => Promise<boolean> | ||
* execute: () => Promise<void> | ||
}} StepExecution | ||
*/ | ||
/** | ||
* @param {import('./types').Steps | undefined} steps | ||
* @param {string} directoryToExecuteIn | ||
* @param {Record<string, boolean|string|undefined>} buildOptions | ||
* @param {Record<string, any>} javascriptOptionsParameter | ||
* @returns {StepExecution[]} | ||
*/ | ||
export function getPhaseExecution( | ||
steps, | ||
directoryToExecuteIn, | ||
buildOptions, | ||
javascriptOptionsParameter, | ||
) { | ||
return (steps || []).map((step) => ({ | ||
info: () => stepInfo(step), | ||
isEnabled: () => isStepEnabled(stepInfo(step).enableOptions, buildOptions), | ||
shouldSkip: async () => executeCondition(step.condition, javascriptOptionsParameter), | ||
execute: async () => | ||
executeCommand( | ||
step.name, | ||
step.run, | ||
step.env, | ||
directoryToExecuteIn, | ||
buildOptions, | ||
javascriptOptionsParameter, | ||
), | ||
})) | ||
} | ||
/** | ||
* @param {string[]} enableOptions | ||
@@ -117,0 +162,0 @@ * @param {Record<string, boolean|string|undefined>} buildOptions |
@@ -50,3 +50,3 @@ import module from 'module' | ||
*/ | ||
async function executeCondition(condition, javascriptOptionsParameter) { | ||
export async function executeCondition(condition, javascriptOptionsParameter) { | ||
if (condition == null) { | ||
@@ -66,3 +66,10 @@ return true | ||
*/ | ||
async function executeCommand(name, command, env, cwd, buildOptions, javascriptOptionsParameter) { | ||
export async function executeCommand( | ||
name, | ||
command, | ||
env, | ||
cwd, | ||
buildOptions, | ||
javascriptOptionsParameter, | ||
) { | ||
if (!command) throw new Error(`Step ${name} must have a command`) | ||
@@ -69,0 +76,0 @@ |
@@ -35,2 +35,18 @@ /** | ||
/** | ||
* @typedef {{ | ||
* info: () => import('./execute-step.js').StepInfo | ||
* isEnabled: () => boolean | ||
* shouldSkip: () => Promise<boolean> | ||
* execute: () => Promise<void> | ||
}} StepExecution | ||
*/ | ||
/** | ||
* @param {import('./types').Steps | undefined} steps | ||
* @param {string} directoryToExecuteIn | ||
* @param {Record<string, boolean|string|undefined>} buildOptions | ||
* @param {Record<string, any>} javascriptOptionsParameter | ||
* @returns {StepExecution[]} | ||
*/ | ||
export function getPhaseExecution(steps: import('./types').Steps | undefined, directoryToExecuteIn: string, buildOptions: Record<string, boolean | string | undefined>, javascriptOptionsParameter: Record<string, any>): StepExecution[]; | ||
/** | ||
* | ||
@@ -51,2 +67,8 @@ * @param {import('./types').BuildConfiguration} buildConfiguration | ||
}; | ||
export type StepExecution = { | ||
info: () => import('./execute-step.js').StepInfo; | ||
isEnabled: () => boolean; | ||
shouldSkip: () => Promise<boolean>; | ||
execute: () => Promise<void>; | ||
}; | ||
//# sourceMappingURL=build-with-configuration.d.ts.map |
@@ -22,2 +22,21 @@ /** | ||
/** | ||
* @param {import('./types').BooleanValueOrFunctionText | undefined} condition | ||
* @param {{[x: string]: any}} javascriptOptionsParameter | ||
* @returns {Promise<boolean>} | ||
*/ | ||
export function executeCondition(condition: import('./types').BooleanValueOrFunctionText | undefined, javascriptOptionsParameter: { | ||
[x: string]: any; | ||
}): Promise<boolean>; | ||
/** | ||
* @param {string} name | ||
* @param {string} command | ||
* @param {import('./types').EnvVars | undefined} env | ||
* @param {string} cwd | ||
* @param {{[x: string]: any}} javascriptOptionsParameter | ||
* @param {any} buildOptions | ||
*/ | ||
export function executeCommand(name: string, command: string, env: import('./types').EnvVars | undefined, cwd: string, buildOptions: any, javascriptOptionsParameter: { | ||
[x: string]: any; | ||
}): Promise<void>; | ||
/** | ||
* @param {import('./types').Step} step | ||
@@ -24,0 +43,0 @@ * @param {number} i |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
24478
24
611