Files
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

118 lines
3.5 KiB
JavaScript

#!/usr/bin/env node
import chalk from 'chalk';
import fs from 'fs';
import path from 'path';
import { Log } from './log';
import {
PackageManagerName,
installDependenciesAsync,
resolvePackageManager,
} from './resolvePackageManager';
import { assertFolderEmpty, assertValidName, resolveProjectRootAsync } from './resolveProjectRoot';
import { extractAndPrepareTemplateFunctionModuleAsync, promptTemplateAsync } from './templates';
import { withSectionLog } from './utils/log';
export type Options = {
install: boolean;
template?: string | true;
};
export async function createAsync(inputPath: string, options: Options): Promise<void> {
let resolvedTemplate: string;
if (options.template === true) {
resolvedTemplate = await promptTemplateAsync();
} else {
resolvedTemplate = options.template ?? 'typescript';
}
const projectRoot = await resolveProjectRootArgAsync(inputPath);
await fs.promises.mkdir(projectRoot, { recursive: true });
await withSectionLog(
() => extractAndPrepareTemplateFunctionModuleAsync(projectRoot, resolvedTemplate),
{
pending: chalk.bold('Locating project files...'),
success: 'Successfully extracted custom build function template files.',
error: error =>
`Something went wrong when extracting the custom build function template files: ${error.message}`,
}
);
await setupDependenciesAsync(projectRoot, options);
}
async function resolveProjectRootArgAsync(inputPath: string): Promise<string> {
if (!inputPath) {
const projectRoot = path.resolve(process.cwd());
const folderName = path.basename(projectRoot);
assertValidName(folderName);
assertFolderEmpty(projectRoot, folderName);
return projectRoot;
} else {
return await resolveProjectRootAsync(inputPath);
}
}
async function setupDependenciesAsync(
projectRoot: string,
props: Pick<Options, 'install'>
): Promise<void> {
// Install dependencies
const shouldInstall = props.install;
const packageManager = resolvePackageManager();
if (shouldInstall) {
await installNodeDependenciesAsync(projectRoot, packageManager);
}
const cdPath = getChangeDirectoryPath(projectRoot);
Log.log();
logProjectReady({ cdPath });
if (!shouldInstall) {
logNodeInstallWarning(cdPath, packageManager);
}
}
async function installNodeDependenciesAsync(
projectRoot: string,
packageManager: PackageManagerName
): Promise<void> {
try {
await installDependenciesAsync(projectRoot, packageManager, { silent: false });
} catch (error: any) {
Log.error(
`Something went wrong installing JavaScript dependencies. Check your ${packageManager} logs. Continuing to create the app.`
);
Log.exception(error);
}
}
function getChangeDirectoryPath(projectRoot: string): string {
const cdPath = path.relative(process.cwd(), projectRoot);
if (cdPath.length <= projectRoot.length) {
return cdPath;
}
return projectRoot;
}
function logNodeInstallWarning(cdPath: string, packageManager: PackageManagerName): void {
Log.log(
`\n⚠️ Before you start to work on your function, make sure you have modules installed:\n`
);
Log.log(` cd ${cdPath || '.'}${path.sep}`);
Log.log(` ${packageManager} install`);
Log.log();
}
export function logProjectReady({ cdPath }: { cdPath: string }): void {
Log.log(chalk.bold(`✅ Your function is ready!`));
Log.log();
// empty string if project was created in current directory
if (cdPath) {
Log.log(`To start working on your function, navigate to the directory.`);
Log.log();
Log.log(`- ${chalk.bold('cd ' + cdPath)}`);
}
}