Skip to content

Commit 477d96d

Browse files
committed
refactor: remove unused specificVersion configuration
- Remove specificVersion field from PluginVersionConfig interface - Remove specificVersion from VersionOverrides interface - Remove specificVersion file mapping from PLUGIN_FILES - Remove specificVersion processing in setupPluginVersions - Update all examples in sample config file - Cleanup validatePluginFiles, listPluginFiles and cleanPluginFiles
1 parent e429aa6 commit 477d96d

File tree

3 files changed

+5
-50
lines changed

3 files changed

+5
-50
lines changed

config/plugin.config.sample.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,6 @@ export interface PluginVersionConfig {
3232
*/
3333
newRelease: string;
3434

35-
/**
36-
* Specific version for rollback/upgrade tests (currently 3.10.9).
37-
* This version is used for specific test scenarios.
38-
*
39-
* Can be:
40-
* - A version number (e.g., '3.10.9') - will download from WP Rocket releases
41-
* - A GitHub branch name prefixed with 'branch:' (e.g., 'branch:release/3.10.9')
42-
* - A GitHub tag prefixed with 'tag:' (e.g., 'tag:3.10.9')
43-
* - A URL pointing to a zip file
44-
*/
45-
specificVersion?: string;
46-
4735
/**
4836
* GitHub repository information for building from branches.
4937
* Only required if using branch: or tag: prefixes.
@@ -67,15 +55,13 @@ export interface PluginVersionConfig {
6755
* export const pluginConfig: PluginVersionConfig = {
6856
* previousStable: '3.16.0',
6957
* newRelease: '3.16.1',
70-
* specificVersion: '3.10.9',
7158
* };
7259
*
7360
* @example
7461
* // Using GitHub branches
7562
* export const pluginConfig: PluginVersionConfig = {
7663
* previousStable: 'branch:release/3.16.0',
7764
* newRelease: 'branch:develop',
78-
* specificVersion: '3.10.9',
7965
* repository: {
8066
* owner: 'wp-media',
8167
* name: 'wp-rocket',
@@ -88,7 +74,6 @@ export interface PluginVersionConfig {
8874
* export const pluginConfig: PluginVersionConfig = {
8975
* previousStable: 'https://example.com/wp-rocket-3.16.0.zip',
9076
* newRelease: 'https://example.com/wp-rocket-3.16.1.zip',
91-
* specificVersion: '3.10.9',
9277
* };
9378
*/
9479
export const pluginConfig: PluginVersionConfig = {
@@ -102,8 +87,6 @@ export const pluginConfig: PluginVersionConfig = {
10287
specificVersion: '3.10.9', // Specific version for rollback tests
10388

10489
// Optional: Configure GitHub repository for branch-based builds
105-
repository: {
106-
owner: 'wp-media',
10790
name: 'wp-rocket',
10891
token: process.env.GITHUB_TOKEN,
10992
}

utils/plugin-manager.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ function getActivePluginConfig(overrides?: VersionOverrides): PluginVersionConfi
6868
const PLUGIN_FILES: Record<string, string> = {
6969
previousStable: 'previous_stable.zip',
7070
newRelease: 'new_release.zip',
71-
specificVersion: 'wp-rocket_3.10.9.zip',
7271
};
7372

7473
/**
@@ -395,15 +394,7 @@ export async function setupPluginVersions(force: boolean = false, overrides?: Ve
395394
'new_release'
396395
);
397396

398-
if (pluginConfig.specificVersion) {
399-
await processVersion(
400-
pluginConfig.specificVersion,
401-
PLUGIN_FILES.specificVersion,
402-
pluginConfig.repository,
403-
'specific_version'
404-
);
405-
}
406-
397+
407398
console.log('\n✅ Plugin setup completed successfully!\n');
408399
} catch (error) {
409400
const errorMessage = error instanceof Error ? error.message : String(error);
@@ -423,10 +414,6 @@ export async function validatePluginFiles(): Promise<boolean> {
423414
PLUGIN_FILES.newRelease,
424415
];
425416

426-
if (basePluginConfig?.specificVersion) {
427-
requiredFiles.push(PLUGIN_FILES.specificVersion);
428-
}
429-
430417
const missingFiles = requiredFiles.filter(file => !pluginFileExists(file));
431418

432419
if (missingFiles.length > 0) {
@@ -460,7 +447,6 @@ export async function listPluginFiles(overrides?: VersionOverrides): Promise<voi
460447
const files = [
461448
{ name: PLUGIN_FILES.previousStable, config: pluginConfig.previousStable },
462449
{ name: PLUGIN_FILES.newRelease, config: pluginConfig.newRelease },
463-
{ name: PLUGIN_FILES.specificVersion, config: pluginConfig.specificVersion },
464450
];
465451

466452
for (const file of files) {
@@ -487,7 +473,6 @@ export async function cleanPluginFiles(): Promise<void> {
487473
const files = [
488474
PLUGIN_FILES.previousStable,
489475
PLUGIN_FILES.newRelease,
490-
PLUGIN_FILES.specificVersion,
491476
];
492477

493478
for (const file of files) {

utils/version-override.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
export interface VersionOverrides {
2323
previousStable?: string;
2424
newRelease?: string;
25-
specificVersion?: string;
2625
}
2726

2827
/**
@@ -31,7 +30,6 @@ export interface VersionOverrides {
3130
export interface PluginVersionConfig {
3231
previousStable: string;
3332
newRelease: string;
34-
specificVersion?: string;
3533
repository?: {
3634
owner: string;
3735
name: string;
@@ -53,9 +51,6 @@ function extractFromNpmConfig(overrides: VersionOverrides): void {
5351
overrides.newRelease = process.env.npm_config_new_release;
5452
}
5553
if (process.env.npm_config_specific_version) {
56-
overrides.specificVersion = process.env.npm_config_specific_version;
57-
}
58-
}
5954

6055
/**
6156
* Extracts version overrides from direct environment variables.
@@ -73,9 +68,6 @@ function extractFromEnv(overrides: VersionOverrides): void {
7368
if (process.env.SPECIFIC_VERSION) {
7469
overrides.specificVersion = process.env.SPECIFIC_VERSION;
7570
}
76-
}
77-
78-
/**
7971
* Parses a command line argument in --key=value or --key value format.
8072
*
8173
* @param {string} arg - The argument to parse
@@ -118,10 +110,7 @@ function parseArgument(arg: string, args: string[], index: number, overrides: Ve
118110
}
119111

120112
return 0;
121-
}
122-
123-
/**
124-
* Extracts version overrides from process.argv command line arguments.
113+
}tracts version overrides from process.argv command line arguments.
125114
*
126115
* @param {VersionOverrides} overrides - Overrides object to populate
127116
* @return {void}
@@ -179,8 +168,7 @@ export function applyVersionOverrides(
179168

180169
/**
181170
* Checks if any version overrides are present.
182-
*
183-
* @param {VersionOverrides} overrides - Version overrides to check
171+
* param {VersionOverrides} overrides - Version overrides to check
184172
* @return {boolean} True if any overrides are present
185173
*/
186174
export function hasVersionOverrides(overrides: VersionOverrides): boolean {
@@ -193,8 +181,7 @@ export function hasVersionOverrides(overrides: VersionOverrides): boolean {
193181

194182
/**
195183
* Formats version overrides for display.
196-
*
197-
* @param {VersionOverrides} overrides - Version overrides to format
184+
* rides - Version overrides to format
198185
* @return {string} Formatted string of overrides
199186
*/
200187
export function formatVersionOverrides(overrides: VersionOverrides): string {
@@ -211,4 +198,4 @@ export function formatVersionOverrides(overrides: VersionOverrides): string {
211198
}
212199

213200
return lines.length > 0 ? lines.join('\n') : ' (none)';
214-
}
201+
}

0 commit comments

Comments
 (0)