Skip to content

Commit a0bb1e4

Browse files
committed
chore: add additional performance tracking decorators
1 parent 83c63f5 commit a0bb1e4

File tree

6 files changed

+17
-0
lines changed

6 files changed

+17
-0
lines changed

lib/commands/debug.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { cache } from "../common/decorators";
44
import { DebugCommandErrors } from "../constants";
55
import { ValidatePlatformCommandBase } from "./command-base";
66
import { LiveSyncCommandHelper } from "../helpers/livesync-command-helper";
7+
import { performanceLog } from "../common/decorators";
78

89
export class DebugPlatformCommand extends ValidatePlatformCommandBase implements ICommand {
910
public allowedParameters: ICommandParameter[] = [];
@@ -55,6 +56,7 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements
5556
});
5657
}
5758

59+
@performanceLog()
5860
public async getDeviceForDebug(): Promise<Mobile.IDevice> {
5961
if (this.$options.forDevice && this.$options.emulator) {
6062
this.$errors.fail(DebugCommandErrors.UNABLE_TO_USE_FOR_DEVICE_AND_EMULATOR);

lib/package-manager.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
import { cache, exported, invokeInit } from './common/decorators';
3+
import { performanceLog } from "./common/decorators";
34
export class PackageManager implements INodePackageManager {
45
private packageManager: INodePackageManager;
56

@@ -17,6 +18,7 @@ export class PackageManager implements INodePackageManager {
1718
}
1819

1920
@exported("packageManager")
21+
@performanceLog()
2022
@invokeInit()
2123
public install(packageName: string, pathToSave: string, config: INodePackageManagerInstallOptions): Promise<INpmInstallResultInfo> {
2224
return this.packageManager.install(packageName, pathToSave, config);

lib/services/livesync/playground/preview-app-livesync-service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { PreviewAppLiveSyncEvents } from "./preview-app-constants";
55
import { HmrConstants } from "../../../common/constants";
66
import { stringify } from "../../../common/helpers";
77
import { EventEmitter } from "events";
8+
import { performanceLog } from "../../../common/decorators";
89

910
export class PreviewAppLiveSyncService extends EventEmitter implements IPreviewAppLiveSyncService {
1011

@@ -24,6 +25,7 @@ export class PreviewAppLiveSyncService extends EventEmitter implements IPreviewA
2425
super();
2526
}
2627

28+
@performanceLog()
2729
public async initialize(data: IPreviewAppLiveSyncData): Promise<void> {
2830
await this.$previewSdkService.initialize(async (device: Device) => {
2931
try {
@@ -54,6 +56,7 @@ export class PreviewAppLiveSyncService extends EventEmitter implements IPreviewA
5456
});
5557
}
5658

59+
@performanceLog()
5760
public async syncFiles(data: IPreviewAppLiveSyncData, filesToSync: string[], filesToRemove: string[]): Promise<void> {
5861
this.showWarningsForNativeFiles(filesToSync);
5962

@@ -140,6 +143,7 @@ export class PreviewAppLiveSyncService extends EventEmitter implements IPreviewA
140143
}
141144
}
142145

146+
@performanceLog()
143147
private async onWebpackCompilationComplete(data: IPreviewAppLiveSyncData, hmrData: IDictionary<IPlatformHmrData>, filesToSyncMap: IDictionary<string[]>, promise: Promise<void>, platform: string) {
144148
await promise
145149
.then(async () => {

lib/services/platform-service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
308308

309309
/* Hooks are expected to use "filesToSync" parameter, as to give plugin authors additional information about the sync process.*/
310310
@helpers.hook('prepare')
311+
@performanceLog()
311312
private async preparePlatformCore(platform: string,
312313
appFilesUpdaterOptions: IAppFilesUpdaterOptions,
313314
projectData: IProjectData,

lib/services/project-service.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { format } from "util";
55
import { exported } from "../common/decorators";
66
import { Hooks, TemplatesV2PackageJsonKeysToRemove } from "../constants";
77
import * as temp from "temp";
8+
import { performanceLog } from "../common/decorators";
89

910
export class ProjectService implements IProjectService {
1011

@@ -37,6 +38,7 @@ export class ProjectService implements IProjectService {
3738
}
3839

3940
@exported("projectService")
41+
@performanceLog()
4042
public async createProject(projectOptions: IProjectSettings): Promise<ICreateProjectData> {
4143
const projectName = await this.validateProjectName({ projectName: projectOptions.projectName, force: projectOptions.force, pathToProject: projectOptions.pathToProject });
4244
const projectDir = this.getValidProjectDir(projectOptions.pathToProject, projectName);
@@ -120,6 +122,7 @@ export class ProjectService implements IProjectService {
120122
return { projectName, projectDir };
121123
}
122124

125+
@performanceLog()
123126
private async extractTemplate(projectDir: string, templateData: ITemplateData): Promise<void> {
124127
this.$fs.ensureDirectoryExists(projectDir);
125128

@@ -142,6 +145,7 @@ export class ProjectService implements IProjectService {
142145
}
143146
}
144147

148+
@performanceLog()
145149
private async ensureAppResourcesExist(projectDir: string): Promise<void> {
146150
const projectData = this.$projectDataService.getProjectData(projectDir);
147151
const appResourcesDestinationPath = projectData.getAppResourcesDirectoryPath(projectDir);
@@ -221,6 +225,7 @@ export class ProjectService implements IProjectService {
221225
};
222226
}
223227

228+
@performanceLog()
224229
private alterPackageJsonData(projectDir: string, projectId: string): void {
225230
const projectFilePath = path.join(projectDir, this.$staticConfig.PROJECT_FILE_NAME);
226231

@@ -242,6 +247,7 @@ export class ProjectService implements IProjectService {
242247
this.$projectDataService.setNSValue(projectDir, "id", projectId);
243248
}
244249

250+
@performanceLog()
245251
private async addTnsCoreModules(projectDir: string): Promise<void> {
246252
const projectFilePath = path.join(projectDir, this.$staticConfig.PROJECT_FILE_NAME);
247253
const packageJsonData = this.$fs.readJson(projectFilePath);

lib/services/project-templates-service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as path from "path";
22
import * as temp from "temp";
33
import * as constants from "../constants";
44
import { format } from "util";
5+
import { performanceLog } from "../common/decorators";
56
temp.track();
67

78
export class ProjectTemplatesService implements IProjectTemplatesService {
@@ -15,6 +16,7 @@ export class ProjectTemplatesService implements IProjectTemplatesService {
1516
private $errors: IErrors,
1617
private $packageManager: INodePackageManager) { }
1718

19+
@performanceLog()
1820
public async prepareTemplate(templateValue: string, projectDir: string): Promise<ITemplateData> {
1921
if (!templateValue) {
2022
templateValue = constants.RESERVED_TEMPLATE_NAMES["default"];

0 commit comments

Comments
 (0)