@expo/steps
Advanced tools
Comparing version
@@ -0,9 +1,14 @@ | ||
import { BuildArtifacts } from './BuildArtifacts.js'; | ||
import { BuildStep } from './BuildStep.js'; | ||
import { BuildStepContext } from './BuildStepContext.js'; | ||
import { BuildStepEnv } from './BuildStepEnv.js'; | ||
export declare class BuildWorkflow { | ||
private readonly ctx; | ||
readonly buildSteps: BuildStep[]; | ||
constructor({ buildSteps }: { | ||
constructor(ctx: BuildStepContext, { buildSteps }: { | ||
buildSteps: BuildStep[]; | ||
}); | ||
executeAsync(env?: BuildStepEnv): Promise<void>; | ||
collectArtifactsAsync(): Promise<BuildArtifacts>; | ||
cleanUpAsync(): Promise<void>; | ||
} |
@@ -0,2 +1,3 @@ | ||
export { BuildArtifactType } from './BuildArtifacts.js'; | ||
export { BuildConfigParser } from './BuildConfigParser.js'; | ||
export { BuildStepContext } from './BuildStepContext.js'; |
@@ -1,2 +0,2 @@ | ||
import fs from 'fs'; | ||
import fs from 'fs/promises'; | ||
import path from 'path'; | ||
@@ -20,3 +20,3 @@ import { v4 as uuidv4 } from 'uuid'; | ||
const steps = config.build.steps.map((stepConfig) => this.createBuildStepFromConfig(stepConfig)); | ||
const workflow = new BuildWorkflow({ buildSteps: steps }); | ||
const workflow = new BuildWorkflow(this.ctx, { buildSteps: steps }); | ||
new BuildWorkflowValidator(workflow).validate(); | ||
@@ -26,3 +26,3 @@ return workflow; | ||
async readRawConfigAsync() { | ||
const contents = await fs.promises.readFile(this.configPath, 'utf-8'); | ||
const contents = await fs.readFile(this.configPath, 'utf-8'); | ||
return YAML.parse(contents); | ||
@@ -29,0 +29,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import fs from 'fs'; | ||
import fs from 'fs/promises'; | ||
import path from 'path'; | ||
@@ -6,3 +6,3 @@ import { v4 as uuidv4 } from 'uuid'; | ||
import { getDefaultShell, getShellCommandAndArgs } from './utils/shell/command.js'; | ||
import { cleanUpTemporaryDirectoriesAsync, createTemporaryOutputsDirectoryAsync, saveScriptToTemporaryFileAsync, } from './utils/shell/temporaryFiles.js'; | ||
import { cleanUpStepTemporaryDirectoriesAsync, createTemporaryOutputsDirectoryAsync, saveScriptToTemporaryFileAsync, } from './BuildTemporaryFiles.js'; | ||
import { spawnAsync } from './utils/shell/spawn.js'; | ||
@@ -84,3 +84,3 @@ import { interpolateWithInputs } from './utils/template.js'; | ||
this.executed = true; | ||
await cleanUpTemporaryDirectoriesAsync(this.ctx, this.id); | ||
await cleanUpStepTemporaryDirectoriesAsync(this.ctx, this.id); | ||
} | ||
@@ -113,3 +113,3 @@ } | ||
var _a; | ||
const files = await fs.promises.readdir(outputsDir); | ||
const files = await fs.readdir(outputsDir); | ||
const nonDefinedOutputIds = []; | ||
@@ -122,3 +122,3 @@ for (const outputId of files) { | ||
const file = path.join(outputsDir, outputId); | ||
const rawContents = await fs.promises.readFile(file, 'utf-8'); | ||
const rawContents = await fs.readFile(file, 'utf-8'); | ||
const value = rawContents.trim(); | ||
@@ -154,3 +154,5 @@ this.outputById[outputId].set(value); | ||
...env, | ||
__EXPO_STEPS_BUILD_ID: this.ctx.buildId, | ||
__EXPO_STEPS_OUTPUTS_DIR: outputsDir, | ||
__EXPO_STEPS_WORKING_DIRECTORY: this.ctx.workingDirectory, | ||
PATH: newPath, | ||
@@ -157,0 +159,0 @@ }; |
@@ -0,9 +1,14 @@ | ||
import { BuildArtifacts } from './BuildArtifacts.js'; | ||
import { BuildStep } from './BuildStep.js'; | ||
import { BuildStepContext } from './BuildStepContext.js'; | ||
import { BuildStepEnv } from './BuildStepEnv.js'; | ||
export declare class BuildWorkflow { | ||
private readonly ctx; | ||
readonly buildSteps: BuildStep[]; | ||
constructor({ buildSteps }: { | ||
constructor(ctx: BuildStepContext, { buildSteps }: { | ||
buildSteps: BuildStep[]; | ||
}); | ||
executeAsync(env?: BuildStepEnv): Promise<void>; | ||
collectArtifactsAsync(): Promise<BuildArtifacts>; | ||
cleanUpAsync(): Promise<void>; | ||
} |
@@ -0,3 +1,6 @@ | ||
import { BuildArtifactType } from './BuildArtifacts.js'; | ||
import { cleanUpWorkflowTemporaryDirectoriesAsync, findArtifactsByTypeAsync, } from './BuildTemporaryFiles.js'; | ||
export class BuildWorkflow { | ||
constructor({ buildSteps }) { | ||
constructor(ctx, { buildSteps }) { | ||
this.ctx = ctx; | ||
this.buildSteps = buildSteps; | ||
@@ -10,3 +13,14 @@ } | ||
} | ||
async collectArtifactsAsync() { | ||
const applicationArchives = await findArtifactsByTypeAsync(this.ctx, BuildArtifactType.APPLICATION_ARCHIVE); | ||
const buildArtifacts = await findArtifactsByTypeAsync(this.ctx, BuildArtifactType.BUILD_ARTIFACT); | ||
return { | ||
[BuildArtifactType.APPLICATION_ARCHIVE]: applicationArchives, | ||
[BuildArtifactType.BUILD_ARTIFACT]: buildArtifacts, | ||
}; | ||
} | ||
async cleanUpAsync() { | ||
await cleanUpWorkflowTemporaryDirectoriesAsync(this.ctx); | ||
} | ||
} | ||
//# sourceMappingURL=BuildWorkflow.js.map |
@@ -16,2 +16,6 @@ import path from 'path'; | ||
await workflow.executeAsync(); | ||
const artifacts = await workflow.collectArtifactsAsync(); | ||
if (Object.keys(artifacts).length > 0) { | ||
logger.info({ artifacts }, 'The workflow produced artifacts'); | ||
} | ||
} | ||
@@ -18,0 +22,0 @@ const relativeConfigPath = process.argv[2]; |
@@ -0,2 +1,3 @@ | ||
export { BuildArtifactType } from './BuildArtifacts.js'; | ||
export { BuildConfigParser } from './BuildConfigParser.js'; | ||
export { BuildStepContext } from './BuildStepContext.js'; |
@@ -0,3 +1,4 @@ | ||
export { BuildArtifactType } from './BuildArtifacts.js'; | ||
export { BuildConfigParser } from './BuildConfigParser.js'; | ||
export { BuildStepContext } from './BuildStepContext.js'; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@expo/steps", | ||
"type": "module", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"main": "./dist_commonjs/index.cjs", | ||
@@ -49,2 +49,3 @@ "types": "./dist_esm/index.d.ts", | ||
"@expo/spawn-async": "^1.7.0", | ||
"arg": "^5.0.2", | ||
"joi": "^17.7.0", | ||
@@ -51,0 +52,0 @@ "this-file": "^2.0.3", |
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
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
224708
18.3%154
14.07%2070
14.87%7
16.67%17
54.55%+ Added
+ Added