Skip to content

Commit bfb7a4c

Browse files
authored
feat: add skipNative option to PrepareData and Options classes (#6033)
1 parent c1b7378 commit bfb7a4c

6 files changed

Lines changed: 77 additions & 68 deletions

File tree

lib/commands/prepare.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ export class PrepareCommand
2222
hasSensitiveValue: false,
2323
},
2424
hmr: { type: OptionType.Boolean, default: false, hasSensitiveValue: false },
25-
25+
skipNative: {
26+
type: OptionType.Boolean,
27+
default: false,
28+
hasSensitiveValue: false,
29+
},
2630
whatever: {
2731
type: OptionType.Boolean,
2832
default: false,
@@ -38,13 +42,13 @@ export class PrepareCommand
3842
public $platformCommandParameter: ICommandParameter,
3943
public $platformsDataService: IPlatformsDataService,
4044
public $prepareDataService: PrepareDataService,
41-
public $migrateController: IMigrateController
45+
public $migrateController: IMigrateController,
4246
) {
4347
super(
4448
$options,
4549
$platformsDataService,
4650
$platformValidationService,
47-
$projectData
51+
$projectData,
4852
);
4953
this.$projectData.initializeProjectData();
5054
}
@@ -55,7 +59,7 @@ export class PrepareCommand
5559
const prepareData = this.$prepareDataService.getPrepareData(
5660
this.$projectData.projectDir,
5761
platform,
58-
this.$options
62+
this.$options,
5963
);
6064
await this.$prepareController.prepare(prepareData);
6165
}
@@ -68,7 +72,7 @@ export class PrepareCommand
6872
this.$options.provision,
6973
this.$options.teamId,
7074
this.$projectData,
71-
platform
75+
platform,
7276
));
7377

7478
if (!this.$options.force) {

lib/data/prepare-data.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class PrepareData extends ControllerDataBase {
1414
constructor(
1515
public projectDir: string,
1616
public platform: string,
17-
data: IOptions
17+
data: IOptions,
1818
) {
1919
super(projectDir, platform, data);
2020

@@ -45,6 +45,11 @@ export class PrepareData extends ControllerDataBase {
4545
}
4646
this.hostProjectPath = data.hostProjectPath;
4747

48+
if (data.skipNative) {
49+
this.nativePrepare = { skipNativePrepare: true };
50+
this.watchNative = false;
51+
}
52+
4853
this.uniqueBundle = !this.watch && data.uniqueBundle ? Date.now() : 0;
4954
}
5055
}

lib/declarations.d.ts

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface INodePackageManager {
3131
install(
3232
packageName: string,
3333
pathToSave: string,
34-
config: INodePackageManagerInstallOptions
34+
config: INodePackageManagerInstallOptions,
3535
): Promise<INpmInstallResultInfo>;
3636

3737
/**
@@ -44,7 +44,7 @@ interface INodePackageManager {
4444
uninstall(
4545
packageName: string,
4646
config?: IDictionary<string | boolean>,
47-
path?: string
47+
path?: string,
4848
): Promise<string>;
4949

5050
/**
@@ -84,7 +84,7 @@ interface INodePackageManager {
8484
*/
8585
search(
8686
filter: string[],
87-
config: IDictionary<string | boolean>
87+
config: IDictionary<string | boolean>,
8888
): Promise<string>;
8989

9090
/**
@@ -130,7 +130,7 @@ interface IPerformanceService {
130130
methodInfo: string,
131131
startTime: number,
132132
endTime: number,
133-
args: any[]
133+
args: any[],
134134
): void;
135135

136136
// Will return a reference time in milliseconds
@@ -141,48 +141,47 @@ interface IPackageInstallationManager {
141141
install(
142142
packageName: string,
143143
packageDir: string,
144-
options?: INpmInstallOptions
144+
options?: INpmInstallOptions,
145145
): Promise<any>;
146146
uninstall(
147147
packageName: string,
148148
packageDir: string,
149-
options?: IDictionary<string | boolean>
149+
options?: IDictionary<string | boolean>,
150150
): Promise<any>;
151151
getLatestVersion(packageName: string): Promise<string>;
152152
getNextVersion(packageName: string): Promise<string>;
153153
getLatestCompatibleVersion(
154154
packageName: string,
155-
referenceVersion?: string
155+
referenceVersion?: string,
156156
): Promise<string>;
157157
getMaxSatisfyingVersion(
158158
packageName: string,
159-
versionRange: string
159+
versionRange: string,
160160
): Promise<string>;
161161
getLatestCompatibleVersionSafe(
162162
packageName: string,
163-
referenceVersion?: string
163+
referenceVersion?: string,
164164
): Promise<string>;
165165
getInspectorFromCache(
166166
inspectorNpmPackageName: string,
167-
projectDir: string
167+
projectDir: string,
168168
): Promise<string>;
169169
clearInspectorCache(): void;
170170
getInstalledDependencyVersion(
171171
packageName: string,
172-
projectDir?: string
172+
projectDir?: string,
173173
): Promise<string>;
174174
getMaxSatisfyingVersionSafe(
175175
packageName: string,
176-
versionIdentifier: string
176+
versionIdentifier: string,
177177
): Promise<string>;
178178
}
179179

180180
/**
181181
* Describes options that can be passed to manipulate package installation.
182182
*/
183183
interface INodePackageManagerInstallOptions
184-
extends INpmInstallConfigurationOptions,
185-
IDictionary<string | boolean> {
184+
extends INpmInstallConfigurationOptions, IDictionary<string | boolean> {
186185
/**
187186
* Destination of the installation.
188187
* @type {string}
@@ -266,7 +265,7 @@ interface INpmPeerDependencyInfo {
266265
* @type {string}
267266
*/
268267
requires: string;
269-
}
268+
},
270269
];
271270
/**
272271
* Dependencies of the dependency.
@@ -550,8 +549,7 @@ interface INpmInstallConfigurationOptionsBase {
550549
ignoreScripts: boolean; //npm flag
551550
}
552551

553-
interface INpmInstallConfigurationOptions
554-
extends INpmInstallConfigurationOptionsBase {
552+
interface INpmInstallConfigurationOptions extends INpmInstallConfigurationOptionsBase {
555553
disableNpmInstall: boolean;
556554
}
557555

@@ -597,7 +595,8 @@ interface ITypingsOptions {
597595
}
598596

599597
interface IOptions
600-
extends IRelease,
598+
extends
599+
IRelease,
601600
IDeviceIdentifier,
602601
IJustLaunch,
603602
IAvd,
@@ -622,7 +621,7 @@ interface IOptions
622621
argv: IYargArgv;
623622
validateOptions(
624623
commandSpecificDashedOptions?: IDictionary<IDashedOption>,
625-
projectData?: IProjectData
624+
projectData?: IProjectData,
626625
): void;
627626
options: IDictionary<IDashedOption>;
628627
shorthands: string[];
@@ -709,6 +708,7 @@ interface IOptions
709708
dryRun: boolean;
710709

711710
platformOverride: string;
711+
skipNative: boolean;
712712
uniqueBundle: boolean;
713713
// allow arbitrary options
714714
[optionName: string]: any;
@@ -719,26 +719,22 @@ interface IEnvOptions {
719719
}
720720

721721
interface IAndroidBuildOptionsSettings
722-
extends IAndroidReleaseOptions,
723-
IRelease,
724-
Partial<IHasAndroidBundle> {}
722+
extends IAndroidReleaseOptions, IRelease, Partial<IHasAndroidBundle> {}
725723

726724
interface IHasAndroidBundle {
727725
androidBundle: boolean;
728726
}
729727

730728
interface IPlatformBuildData
731-
extends IRelease,
732-
IHasUseHotModuleReloadOption,
733-
IBuildConfig,
734-
IEnvOptions {}
729+
extends IRelease, IHasUseHotModuleReloadOption, IBuildConfig, IEnvOptions {}
735730

736731
interface IDeviceEmulator extends IHasEmulatorOption, IDeviceIdentifier {}
737732

738733
interface IRunPlatformOptions extends IJustLaunch, IDeviceEmulator {}
739734

740735
interface IDeployPlatformOptions
741-
extends IAndroidReleaseOptions,
736+
extends
737+
IAndroidReleaseOptions,
742738
IRelease,
743739
IClean,
744740
IDeviceEmulator,
@@ -834,7 +830,7 @@ interface IAndroidToolsInfo {
834830
*/
835831
validateJavacVersion(
836832
installedJavaVersion: string,
837-
options?: IAndroidToolsInfoOptions
833+
options?: IAndroidToolsInfoOptions,
838834
): boolean;
839835

840836
/**
@@ -913,14 +909,14 @@ interface IAppDebugSocketProxyFactory extends NodeJS.EventEmitter {
913909
device: Mobile.IiOSDevice,
914910
appId: string,
915911
projectName: string,
916-
projectDir: string
912+
projectDir: string,
917913
): Promise<any>;
918914

919915
ensureWebSocketProxy(
920916
device: Mobile.IiOSDevice,
921917
appId: string,
922918
projectName: string,
923-
projectDir: string
919+
projectDir: string,
924920
): Promise<any>;
925921

926922
removeAllProxies(): void;
@@ -939,12 +935,12 @@ interface IiOSSocketRequestExecutor {
939935
executeAttachRequest(
940936
device: Mobile.IiOSDevice,
941937
timeout: number,
942-
projectId: string
938+
projectId: string,
943939
): Promise<void>;
944940
executeRefreshRequest(
945941
device: Mobile.IiOSDevice,
946942
timeout: number,
947-
appId: string
943+
appId: string,
948944
): Promise<boolean>;
949945
}
950946

@@ -995,7 +991,7 @@ interface IProjectNameService {
995991
*/
996992
ensureValidName(
997993
projectName: string,
998-
validateOptions?: { force: boolean }
994+
validateOptions?: { force: boolean },
999995
): Promise<string>;
1000996
}
1001997

@@ -1089,7 +1085,7 @@ interface IBundleValidatorHelper {
10891085
*/
10901086
getBundlerDependencyVersion(
10911087
projectData: IProjectData,
1092-
bundlerName?: string
1088+
bundlerName?: string,
10931089
): string;
10941090
}
10951091

@@ -1171,7 +1167,7 @@ interface IAssetsGenerationService {
11711167
* @returns {Promise<void>}
11721168
*/
11731169
generateSplashScreens(
1174-
splashesGenerationData: IResourceGenerationData
1170+
splashesGenerationData: IResourceGenerationData,
11751171
): Promise<void>;
11761172
}
11771173

@@ -1207,7 +1203,7 @@ interface IPlatformValidationService {
12071203
provision: true | string,
12081204
teamId: true | string,
12091205
projectData: IProjectData,
1210-
platform?: string
1206+
platform?: string,
12111207
): Promise<boolean>;
12121208

12131209
validatePlatformInstalled(platform: string, projectData: IProjectData): void;
@@ -1220,35 +1216,35 @@ interface IPlatformValidationService {
12201216
*/
12211217
isPlatformSupportedForOS(
12221218
platform: string,
1223-
projectData: IProjectData
1219+
projectData: IProjectData,
12241220
): boolean;
12251221
}
12261222

12271223
interface IPlatformCommandHelper {
12281224
addPlatforms(
12291225
platforms: string[],
12301226
projectData: IProjectData,
1231-
frameworkPath?: string
1227+
frameworkPath?: string,
12321228
): Promise<void>;
12331229
cleanPlatforms(
12341230
platforms: string[],
12351231
projectData: IProjectData,
1236-
frameworkPath: string
1232+
frameworkPath: string,
12371233
): Promise<void>;
12381234
removePlatforms(
12391235
platforms: string[],
1240-
projectData: IProjectData
1236+
projectData: IProjectData,
12411237
): Promise<void>;
12421238
updatePlatforms(
12431239
platforms: string[],
1244-
projectData: IProjectData
1240+
projectData: IProjectData,
12451241
): Promise<void>;
12461242
getInstalledPlatforms(projectData: IProjectData): string[];
12471243
getAvailablePlatforms(projectData: IProjectData): string[];
12481244
getPreparedPlatforms(projectData: IProjectData): string[];
12491245
getCurrentPlatformVersion(
12501246
platform: string,
1251-
projectData: IProjectData
1247+
projectData: IProjectData,
12521248
): string;
12531249
}
12541250

0 commit comments

Comments
 (0)