Skip to content

chore: delete plugin variables service #4521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/common/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1242,11 +1242,6 @@ interface IResourceLoader {
readJson(path: string): any;
}

interface IPluginVariablesHelper {
getPluginVariableFromVarOption(variableName: string, configuration?: string): any;
simplifyYargsObject(obj: any, configuration?: string): any;
}

/**
* Used for getting strings for informational/error messages.
*/
Expand Down
90 changes: 0 additions & 90 deletions lib/common/plugin-variables-helper.ts

This file was deleted.

47 changes: 0 additions & 47 deletions lib/definitions/plugins.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,53 +44,6 @@ interface IPluginPlatformsData {
android: string;
}

interface IPluginVariablesService {
/**
* Saves plugin variables in project package.json file.
* @param {IPluginData} pluginData for the plugin.
* @param {string} projectDir: Specifies the directory of the project.
* @return {Promise<void>}
*/
savePluginVariablesInProjectFile(pluginData: IPluginData, projectDir: string): Promise<void>;

/**
* Removes plugin variables from project package.json file.
* @param {string} pluginName Name of the plugin.
* @param {string} projectDir: Specifies the directory of the project.
* @return {void}
*/
removePluginVariablesFromProjectFile(pluginName: string, projectDir: string): void;

/**
* Replaces all plugin variables with their corresponding values.
* @param {IPluginData} pluginData for the plugin.
* @param {pluginConfigurationFilePath} pluginConfigurationFilePath for the plugin.
* @param {string} projectDir: Specifies the directory of the project.
* @return {Promise<void>}
*/
interpolatePluginVariables(pluginData: IPluginData, pluginConfigurationFilePath: string, projectDir: string): Promise<void>;

/**
* Replaces {nativescript.id} expression with the application identifier from package.json.
* @param {pluginConfigurationFilePath} pluginConfigurationFilePath for the plugin.
* @return {void}
*/
interpolateAppIdentifier(pluginConfigurationFilePath: string, projectIdentifier: string): void;

/**
* Replaces both plugin variables and appIdentifier
*/
interpolate(pluginData: IPluginData, pluginConfigurationFilePath: string, projectDir: string, projectIdentifier: string): Promise<void>;

/**
* Returns the
* @param {string} pluginName for the plugin.
* @return {Promise<string>} returns the changed plugin configuration file content.
*/
getPluginVariablePropertyName(pluginName: string): string;

}

interface IPluginVariableData {
defaultValue?: string;
name?: string;
Expand Down
6 changes: 0 additions & 6 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
private $devicesService: Mobile.IDevicesService,
private $mobileHelper: Mobile.IMobileHelper,
private $hostInfo: IHostInfo,
private $pluginVariablesService: IPluginVariablesService,
private $xcprojService: IXcprojService,
private $iOSProvisionService: IOSProvisionService,
private $pbxprojDomXcode: IPbxprojDomXcode,
Expand Down Expand Up @@ -800,11 +799,6 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
await this.mergeInfoPlists(projectData, opts);
await this.$iOSEntitlementsService.merge(projectData);
await this.mergeProjectXcconfigFiles(projectData, opts);
for (const pluginData of await this.getAllInstalledPlugins(projectData)) {
await this.$pluginVariablesService.interpolatePluginVariables(pluginData, this.getPlatformData(projectData).configurationFilePath, projectData.projectDir);
}

this.$pluginVariablesService.interpolateAppIdentifier(this.getPlatformData(projectData).configurationFilePath, projectData.projectIdentifiers.ios);
}

private getInfoPlistPath(projectData: IProjectData): string {
Expand Down
104 changes: 0 additions & 104 deletions lib/services/plugin-variables-service.ts

This file was deleted.

14 changes: 0 additions & 14 deletions lib/services/plugins-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ export class PluginsService implements IPluginsService {
private get $platformsData(): IPlatformsData {
return this.$injector.resolve("platformsData");
}
private get $pluginVariablesService(): IPluginVariablesService {
return this.$injector.resolve("pluginVariablesService");
}
private get $projectDataService(): IProjectDataService {
return this.$injector.resolve("projectDataService");
}
Expand Down Expand Up @@ -57,16 +54,6 @@ export class PluginsService implements IPluginsService {

await this.executeForAllInstalledPlatforms(action, projectData);

try {
await this.$pluginVariablesService.savePluginVariablesInProjectFile(pluginData, projectData.projectDir);
} catch (err) {
// Revert package.json
this.$projectDataService.removeNSProperty(projectData.projectDir, this.$pluginVariablesService.getPluginVariablePropertyName(pluginData.name));
await this.$packageManager.uninstall(plugin, PluginsService.NPM_CONFIG, projectData.projectDir);

throw err;
}

this.$logger.out(`Successfully installed plugin ${realNpmPackageJson.name}.`);
} else {
await this.$packageManager.uninstall(realNpmPackageJson.name, { save: true }, projectData.projectDir);
Expand All @@ -81,7 +68,6 @@ export class PluginsService implements IPluginsService {
await platformData.platformProjectService.removePluginNativeCode(pluginData, projectData);
};

this.$pluginVariablesService.removePluginVariablesFromProjectFile(pluginName.toLowerCase(), projectData.projectDir);
await this.executeForAllInstalledPlatforms(removePluginNativeCodeAction, projectData);

await this.executeNpmCommand(PluginsService.UNINSTALL_COMMAND_NAME, pluginName, projectData);
Expand Down
4 changes: 0 additions & 4 deletions test/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import { LoggingLevels } from "../lib/common/mobile/logging-levels";
import { DeviceDiscovery } from "../lib/common/mobile/mobile-core/device-discovery";
import { IOSDeviceDiscovery } from "../lib/common/mobile/mobile-core/ios-device-discovery";
import { AndroidDeviceDiscovery } from "../lib/common/mobile/mobile-core/android-device-discovery";
import { PluginVariablesService } from "../lib/services/plugin-variables-service";
import { PluginVariablesHelper } from "../lib/common/plugin-variables-helper";
import { Utils } from "../lib/common/utils";
import { CocoaPodsService } from "../lib/services/cocoapods-service";
import { PackageManager } from "../lib/package-manager";
Expand Down Expand Up @@ -113,8 +111,6 @@ function createTestInjector(projectPath: string, projectName: string, xCode?: IX
checkIfXcodeprojIsRequired: () => ({})
});
testInjector.register("iosDeviceOperations", {});
testInjector.register("pluginVariablesService", PluginVariablesService);
testInjector.register("pluginVariablesHelper", PluginVariablesHelper);
testInjector.register("pluginsService", {
getAllInstalledPlugins: (): string[] => []
});
Expand Down
Loading