@expo/steps
Advanced tools
Comparing version 1.0.30 to 1.0.31
@@ -6,4 +6,6 @@ import { BuildFunction } from './BuildFunction.js'; | ||
private readonly ctx; | ||
private readonly configPath; | ||
private readonly externalFunctions?; | ||
constructor(ctx: BuildStepGlobalContext, { externalFunctions }: { | ||
constructor(ctx: BuildStepGlobalContext, { configPath, externalFunctions }: { | ||
configPath: string; | ||
externalFunctions?: BuildFunction[]; | ||
@@ -10,0 +12,0 @@ }); |
@@ -28,3 +28,2 @@ import { bunyan } from '@expo/logger'; | ||
skipCleanup: boolean; | ||
configPath: string; | ||
} | ||
@@ -34,3 +33,2 @@ export declare class BuildStepGlobalContext { | ||
readonly skipCleanup: boolean; | ||
readonly configPath: string; | ||
stepsInternalBuildDirectory: string; | ||
@@ -40,3 +38,3 @@ readonly runtimePlatform: BuildRuntimePlatform; | ||
private stepById; | ||
constructor(provider: ExternalBuildContextProvider, skipCleanup: boolean, configPath: string); | ||
constructor(provider: ExternalBuildContextProvider, skipCleanup: boolean); | ||
get projectSourceDirectory(): string; | ||
@@ -43,0 +41,0 @@ get projectTargetDirectory(): string; |
@@ -133,2 +133,8 @@ import assert from 'assert'; | ||
const config = validateConfig(BuildConfigSchema, rawConfig); | ||
for (const functionName in config.functions) { | ||
const customFunctionPath = config.functions[functionName].path; | ||
if (customFunctionPath) { | ||
config.functions[functionName].path = maybeResolveCustomFunctionRelativePath(path.dirname(configPath), customFunctionPath); | ||
} | ||
} | ||
const importedFunctions = await importFunctionsAsync(configPath, config.configFilesToImport); | ||
@@ -158,9 +164,13 @@ mergeConfigWithImportedFunctions(config, importedFunctions); | ||
const childConfig = await readAndValidateBuildFunctionsConfigFileAsync(childConfigPath); | ||
const childDir = path.dirname(childConfigPath); | ||
for (const functionName in childConfig.functions) { | ||
if (!(functionName in importedFunctions)) { | ||
importedFunctions[functionName] = childConfig.functions[functionName]; | ||
const f = childConfig.functions[functionName]; | ||
if (f.path) { | ||
f.path = maybeResolveCustomFunctionRelativePath(childDir, f.path); | ||
} | ||
importedFunctions[functionName] = f; | ||
} | ||
} | ||
if (childConfig.configFilesToImport) { | ||
const childDir = path.dirname(childConfigPath); | ||
configFilesToVisit.push(...childConfig.configFilesToImport.map((relativePath) => path.resolve(childDir, relativePath))); | ||
@@ -254,2 +264,8 @@ } | ||
} | ||
function maybeResolveCustomFunctionRelativePath(dir, customFunctionPath) { | ||
if (!path.isAbsolute(customFunctionPath)) { | ||
return path.resolve(dir, customFunctionPath); | ||
} | ||
return customFunctionPath; | ||
} | ||
//# sourceMappingURL=BuildConfig.js.map |
@@ -6,4 +6,6 @@ import { BuildFunction } from './BuildFunction.js'; | ||
private readonly ctx; | ||
private readonly configPath; | ||
private readonly externalFunctions?; | ||
constructor(ctx: BuildStepGlobalContext, { externalFunctions }: { | ||
constructor(ctx: BuildStepGlobalContext, { configPath, externalFunctions }: { | ||
configPath: string; | ||
externalFunctions?: BuildFunction[]; | ||
@@ -10,0 +12,0 @@ }); |
import assert from 'assert'; | ||
import path from 'path'; | ||
import { isBuildStepBareCommandRun, isBuildStepBareFunctionCall, isBuildStepCommandRun, readAndValidateBuildConfigAsync, } from './BuildConfig.js'; | ||
@@ -14,9 +13,10 @@ import { BuildFunction } from './BuildFunction.js'; | ||
export class BuildConfigParser { | ||
constructor(ctx, { externalFunctions }) { | ||
constructor(ctx, { configPath, externalFunctions }) { | ||
this.ctx = ctx; | ||
this.validateExternalFunctions(externalFunctions); | ||
this.configPath = configPath; | ||
this.externalFunctions = externalFunctions; | ||
} | ||
async parseAsync() { | ||
const config = await readAndValidateBuildConfigAsync(this.ctx.configPath, { | ||
const config = await readAndValidateBuildConfigAsync(this.configPath, { | ||
externalFunctionIds: this.getExternalFunctionFullIds(), | ||
@@ -105,10 +105,5 @@ }); | ||
} | ||
createBuildFunctionFromConfig({ id, name, inputs: inputsConfig, outputs: outputsConfig, shell, command, supportedRuntimePlatforms, path: relativeCustomFunctionModulePath, }) { | ||
createBuildFunctionFromConfig({ id, name, inputs: inputsConfig, outputs: outputsConfig, shell, command, supportedRuntimePlatforms, path: customFunctionModulePath, }) { | ||
const inputProviders = inputsConfig && this.createBuildStepInputProvidersFromBuildFunctionInputs(inputsConfig); | ||
const outputProviders = outputsConfig && this.createBuildStepOutputProvidersFromBuildFunctionOutputs(outputsConfig); | ||
let customFunctionModulePath = relativeCustomFunctionModulePath; | ||
if (relativeCustomFunctionModulePath) { | ||
const baseConfigDir = path.dirname(this.ctx.configPath); | ||
customFunctionModulePath = path.resolve(baseConfigDir, relativeCustomFunctionModulePath); | ||
} | ||
return new BuildFunction({ | ||
@@ -115,0 +110,0 @@ id, |
@@ -28,3 +28,2 @@ import { bunyan } from '@expo/logger'; | ||
skipCleanup: boolean; | ||
configPath: string; | ||
} | ||
@@ -34,3 +33,2 @@ export declare class BuildStepGlobalContext { | ||
readonly skipCleanup: boolean; | ||
readonly configPath: string; | ||
stepsInternalBuildDirectory: string; | ||
@@ -40,3 +38,3 @@ readonly runtimePlatform: BuildRuntimePlatform; | ||
private stepById; | ||
constructor(provider: ExternalBuildContextProvider, skipCleanup: boolean, configPath: string); | ||
constructor(provider: ExternalBuildContextProvider, skipCleanup: boolean); | ||
get projectSourceDirectory(): string; | ||
@@ -43,0 +41,0 @@ get projectTargetDirectory(): string; |
@@ -8,6 +8,5 @@ import os from 'os'; | ||
export class BuildStepGlobalContext { | ||
constructor(provider, skipCleanup, configPath) { | ||
constructor(provider, skipCleanup) { | ||
this.provider = provider; | ||
this.skipCleanup = skipCleanup; | ||
this.configPath = configPath; | ||
this.stepById = {}; | ||
@@ -73,3 +72,2 @@ this.stepsInternalBuildDirectory = path.join(os.tmpdir(), 'eas-build', uuidv4()); | ||
skipCleanup: this.skipCleanup, | ||
configPath: this.configPath, | ||
}; | ||
@@ -88,3 +86,3 @@ } | ||
}; | ||
const ctx = new BuildStepGlobalContext(deserializedProvider, serialized.skipCleanup, serialized.configPath); | ||
const ctx = new BuildStepGlobalContext(deserializedProvider, serialized.skipCleanup); | ||
for (const [id, stepOutputAccessor] of Object.entries(serialized.stepById)) { | ||
@@ -91,0 +89,0 @@ ctx.stepById[id] = BuildStepOutputAccessor.deserialize(stepOutputAccessor); |
@@ -31,4 +31,6 @@ var _a; | ||
async function runAsync(configPath, relativeProjectDirectory, runtimePlatform) { | ||
const ctx = new BuildStepGlobalContext(new CliContextProvider(logger, runtimePlatform, relativeProjectDirectory, relativeProjectDirectory, relativeProjectDirectory), false, configPath); | ||
const parser = new BuildConfigParser(ctx, {}); | ||
const ctx = new BuildStepGlobalContext(new CliContextProvider(logger, runtimePlatform, relativeProjectDirectory, relativeProjectDirectory, relativeProjectDirectory), false); | ||
const parser = new BuildConfigParser(ctx, { | ||
configPath, | ||
}); | ||
const workflow = await parser.parseAsync(); | ||
@@ -35,0 +37,0 @@ await workflow.executeAsync(); |
{ | ||
"name": "@expo/steps", | ||
"type": "module", | ||
"version": "1.0.30", | ||
"version": "1.0.31", | ||
"main": "./dist_commonjs/index.cjs", | ||
@@ -66,3 +66,3 @@ "types": "./dist_esm/index.d.ts", | ||
}, | ||
"gitHead": "21dfc7673402b263d1a0af8df91cad411603d21d" | ||
"gitHead": "349e6f330c97977009cf501992f141aefbc01317" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
524077
4594