Files
eas-cli/packages/steps/src/BuildTemporaryFiles.ts
Stanisław Chmiela 789cf62bd6 [chore] Add eas-build packages (#3290)
## Consolidate eas-build packages into eas-cli monorepo

This PR completes the migration of packages from the `eas-build` repository into `eas-cli`, consolidating all EAS Build tooling into a single monorepo.

### Background

Previously, the EAS Build libraries lived in a separate `expo/eas-build` repository. This made development and releases more complex, requiring coordination between two repos. By consolidating into `eas-cli`, we can:

- Develop and test changes across CLI and build tools in a single PR
- Simplify the release process
- Reduce dependency version drift between packages

### Migrated Packages

The following packages have been moved from `eas-build`:

| Package | npm Name | License |
|---------|----------|---------|
| `build-tools` | `@expo/build-tools` | BUSL-1.1 |
| `eas-build-job` | `@expo/eas-build-job` | MIT |
| `steps` | `@expo/steps` | BUSL-1.1 |
| `logger` | `@expo/logger` | BUSL-1.1 |
| `downloader` | `@expo/downloader` | BUSL-1.1 |
| `turtle-spawn` | `@expo/turtle-spawn` | BUSL-1.1 |
| `template-file` | `@expo/template-file` | BUSL-1.1 |
| `local-build-plugin` | `eas-cli-local-build-plugin` | BUSL-1.1 |
| `create-eas-build-function` | `create-eas-build-function` | MIT |

### Changes

**Package Configuration:**
- Updated `repository` and `bugs` URLs in all migrated package.json files to point to `expo/eas-cli`
- Updated README repository links
- Aligned dependency versions across `eas-cli`, `eas-json`, and `worker` to use workspace packages

**Documentation:**
- Expanded `CLAUDE.md` with comprehensive documentation covering all packages, architectural patterns, and development workflows
- Added `AGENTS.md` for AI agent guidance

**Licensing:**
- Added `LICENSE-BUSL` for BUSL-1.1 licensed packages
- Added `LICENSE-eas-build-job` for MIT licensed packages

**Build Infrastructure:**
- Added `.gitignore` entries for build artifacts: `dist`, `*.tsbuildinfo` (needed for `tsconfig.json` and `tsconfig.build.json`), vim swap files
- Added `bin/eas-cli-local-build-plugin` symlink for local build testing

**Dependency Cleanup:**
- Removed stale npm registry entries from `yarn.lock` - workspace packages now resolve locally

### Testing

- [x] `yarn install` completes successfully
- [x] `yarn build` builds all packages
- [x] `yarn test` passes
- [x] Worker builds and runs correctly against workspace packages

### Follow-up

After this PR is merged:
- Archive or deprecate the `expo/eas-build` repository
- Update any CI/CD pipelines that referenced the old repo
- Update internal documentation pointing to eas-build
2026-02-03 14:30:15 +01:00

46 lines
1.6 KiB
TypeScript

import fs from 'fs/promises';
import path from 'path';
import { v4 as uuidv4 } from 'uuid';
import { BuildStepGlobalContext } from './BuildStepContext';
export async function saveScriptToTemporaryFileAsync(
ctx: BuildStepGlobalContext,
stepId: string,
scriptContents: string
): Promise<string> {
const scriptsDir = getTemporaryScriptsDirPath(ctx, stepId);
await fs.mkdir(scriptsDir, { recursive: true });
const temporaryScriptPath = path.join(scriptsDir, `${uuidv4()}.sh`);
await fs.writeFile(temporaryScriptPath, scriptContents);
return temporaryScriptPath;
}
export async function cleanUpStepTemporaryDirectoriesAsync(
ctx: BuildStepGlobalContext,
stepId: string
): Promise<void> {
if (ctx.skipCleanup) {
return;
}
const stepTemporaryDirectory = getTemporaryStepDirPath(ctx, stepId);
await fs.rm(stepTemporaryDirectory, { recursive: true, force: true });
ctx.baseLogger.debug({ stepTemporaryDirectory }, 'Removed step temporary directory');
}
function getTemporaryStepDirPath(ctx: BuildStepGlobalContext, stepId: string): string {
return path.join(ctx.stepsInternalBuildDirectory, 'steps', stepId);
}
function getTemporaryScriptsDirPath(ctx: BuildStepGlobalContext, stepId: string): string {
return path.join(getTemporaryStepDirPath(ctx, stepId), 'scripts');
}
export function getTemporaryOutputsDirPath(ctx: BuildStepGlobalContext, stepId: string): string {
return path.join(getTemporaryStepDirPath(ctx, stepId), 'outputs');
}
export function getTemporaryEnvsDirPath(ctx: BuildStepGlobalContext, stepId: string): string {
return path.join(getTemporaryStepDirPath(ctx, stepId), 'envs');
}