Skip to content

Commit d31a9df

Browse files
committed
feat: Allow beta plugins to be auto-magically be added when codify version is beta
1 parent c56b4d7 commit d31a9df

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

src/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export const VERSION = (await import("../package.json", { assert: { type: "json" } })).default.version;
2+
13
export const config = {
24
loginServerPort: 51_039,
35
connectServerPort: 51_040,
@@ -10,4 +12,6 @@ export const config = {
1012

1113
dashboardUrl: 'https://dashboard.codifycli.com',
1214
supabaseUrl: 'https://kdctbvqvqjfquplxhqrm.supabase.co',
15+
16+
isBeta: VERSION.includes('beta'),
1317
}

src/entities/project.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ ${JSON.stringify(projectConfigs, null, 2)}`);
175175
const invalidConfigs = this.resourceConfigs.filter((c) => {
176176
const operatingSystems = resourceDefinitions.get(c.type)?.operatingSystems;
177177
if (!operatingSystems) {
178-
return true;
178+
return false;
179179
}
180180

181-
return operatingSystems.includes(os.type() as OS);
181+
return !operatingSystems.includes(os.type() as OS);
182182
});
183183

184184
if (invalidConfigs.length > 0) {
@@ -194,10 +194,10 @@ ${JSON.stringify(projectConfigs, null, 2)}`);
194194
this.resourceConfigs.filter((c) => {
195195
const distros = resourceDefinitions.get(c.type)?.linuxDistros;
196196
if (!distros) {
197-
return true;
197+
return false;
198198
}
199199

200-
return distros.includes(currentDistro);
200+
return !distros.includes(currentDistro);
201201
});
202202

203203
if (invalidConfigs.length > 0) {

src/plugins/plugin-manager.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
} from 'codify-schemas';
66

77
import { InternalError } from '../common/errors.js';
8+
import { config } from '../config.js';
89
import { Plan, ResourcePlan } from '../entities/plan.js';
910
import { Project } from '../entities/project.js';
1011
import { ResourceConfig } from '../entities/resource-config.js';
@@ -23,6 +24,10 @@ const DEFAULT_PLUGINS = {
2324
'default': 'latest',
2425
}
2526

27+
const BETA_DEFAULT_PLUGINS = {
28+
'default': 'beta',
29+
}
30+
2631
export class PluginManager {
2732

2833
private plugins = new Map<PluginName, Plugin>()
@@ -159,8 +164,12 @@ export class PluginManager {
159164
}
160165

161166
private async resolvePlugins(project: Project | null): Promise<Plugin[]> {
167+
const { isBeta } = config;
168+
169+
// We handle beta plugins auto-magically currently. It will check that the version "beta" does not exist locally and
170+
// download every time (the intended behavior).
162171
const pluginDefinitions: Record<string, string> = {
163-
...DEFAULT_PLUGINS,
172+
...isBeta ? BETA_DEFAULT_PLUGINS : DEFAULT_PLUGINS,
164173
...project?.projectConfig?.plugins,
165174
};
166175

0 commit comments

Comments
 (0)