Skip to content

Commit

Permalink
[wip]
Browse files Browse the repository at this point in the history
  • Loading branch information
sjchmiela committed Feb 11, 2025
1 parent 5a4e36c commit 1761260
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This is the log of notable changes to EAS CLI and related packages.
### 🐛 Bug fixes

- Fix files deleted in working directory not being removed from the project archive when `requireCommit` is false. ([#2900](https://github.com/expo/eas-cli/pull/2900) by [@sjchmiela](https://github.com/sjchmiela))
- In `EAS_NO_VCS=1`, ask Git for repository root when `EAS_PROJECT_ROOT` is not set. ([#2901](https://github.com/expo/eas-cli/pull/2901) by [@sjchmiela](https://github.com/sjchmiela))

### 🧹 Chores

Expand Down
15 changes: 8 additions & 7 deletions packages/eas-cli/src/vcs/clients/noVcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ export default class NoVcsClient extends Client {
}

public async getRootPathAsync(): Promise<string> {
// If EAS_PROJECT_ROOT is absolute, return it.
// If it is relative or empty, resolve it from Git root or process.cwd().

// Honor `EAS_PROJECT_ROOT` if it is set.
if (process.env.EAS_PROJECT_ROOT) {
const rootPath = process.env.EAS_PROJECT_ROOT;
// `path.resolve()` will return `rootPath` if it is absolute
// (which is what we want).
return path.resolve(process.cwd(), rootPath);
if (process.env.EAS_PROJECT_ROOT && path.isAbsolute(process.env.EAS_PROJECT_ROOT)) {
return path.normalize(process.env.EAS_PROJECT_ROOT);
}

// If `EAS_PROJECT_ROOT` is not set, try to get the root path from Git.
let resolveRoot = process.cwd();
try {
return (
await spawnAsync('git', ['rev-parse', '--show-toplevel'], {
Expand All @@ -35,9 +36,9 @@ export default class NoVcsClient extends Client {
Log.warn(
'You can set `EAS_PROJECT_ROOT` environment variable to let eas-cli know where your project is located.'
);

return process.cwd();
}

return path.resolve(resolveRoot, process.env.EAS_PROJECT_ROOT ?? '.');
}

public async makeShallowCopyAsync(destinationPath: string): Promise<void> {
Expand Down

0 comments on commit 1761260

Please sign in to comment.