Skip to content

Commit 77077ee

Browse files
committed
[eas-cli] Add eas preview:go command
1 parent 4d04463 commit 77077ee

3 files changed

Lines changed: 53 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import EasCommand from '../../commandUtils/EasCommand';
2+
import omit from '../../utils/expodash/omit';
3+
import UpdatePublish from '../update';
4+
5+
export default class PreviewGo extends EasCommand {
6+
static override description = 'Publish an update that is compatible with Expo Go';
7+
8+
static override flags = omit(UpdatePublish.flags, ['source-maps', 'no-bytecode']);
9+
10+
static override args = UpdatePublish.args;
11+
12+
static override contextDefinition = UpdatePublish.contextDefinition;
13+
14+
static override hidden = true; // hidden for now until feature is settled
15+
16+
override async runAsync(): Promise<void> {
17+
await this.parse(PreviewGo); // validation only
18+
19+
const newArgv = [...this.argv, '--source-maps', 'inline', '--no-bytecode'];
20+
await UpdatePublish.run(newArgv, this.config);
21+
}
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import omit from '../omit';
2+
3+
describe(omit, () => {
4+
it('omits specified keys from an object', () => {
5+
const original = { a: 1, b: 2, c: 3 };
6+
const result = omit(original, ['b', 'c']);
7+
expect(result).toEqual({ a: 1 });
8+
});
9+
10+
it('returns the same object if no keys are specified', () => {
11+
const original = { a: 1, b: 2, c: 3 };
12+
const result = omit(original, []);
13+
expect(result).toEqual(original);
14+
});
15+
16+
it('handles non-existent keys gracefully', () => {
17+
const original = { a: 1, b: 2, c: 3 };
18+
const result = omit(original, ['d', 'e'] as any);
19+
expect(result).toEqual(original);
20+
});
21+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default function omit<T extends object, K extends keyof T>(
2+
obj: T,
3+
keys: readonly K[]
4+
): Omit<T, K> {
5+
const newObj = { ...obj };
6+
for (const key of keys) {
7+
delete newObj[key];
8+
}
9+
return newObj as Omit<T, K>;
10+
}

0 commit comments

Comments
 (0)