File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ } ) ;
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments