mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add support for customizing the extension install registry URL (#4503)
This commit is contained in:
1 parent
a711499bb6
commit
78678bdf2f
8 files changed
+208
-32
No files matched your search
@@ -306,6 +306,36 @@ const updateChannel: PreferenceDescription<string> = {
|
||||
},
|
||||
};
|
||||
|
||||
export enum ExtensionRegistryLocation {
|
||||
DEFAULT = "default",
|
||||
NPMRC = "npmrc",
|
||||
CUSTOM = "custom",
|
||||
}
|
||||
export type ExtensionRegistry = {
|
||||
location: ExtensionRegistryLocation.DEFAULT | ExtensionRegistryLocation.NPMRC;
|
||||
customUrl?: undefined;
|
||||
} | {
|
||||
location: ExtensionRegistryLocation.CUSTOM,
|
||||
customUrl: string;
|
||||
};
|
||||
|
||||
export const defaultExtensionRegistryUrl = "https://registry.npmjs.org";
|
||||
|
||||
const extensionRegistryUrl: PreferenceDescription<ExtensionRegistry> = {
|
||||
fromStore(val) {
|
||||
return val ?? {
|
||||
location: ExtensionRegistryLocation.DEFAULT,
|
||||
};
|
||||
},
|
||||
toStore(val) {
|
||||
if (val.location === ExtensionRegistryLocation.DEFAULT) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return val;
|
||||
},
|
||||
};
|
||||
|
||||
type PreferencesModelType<field extends keyof typeof DESCRIPTORS> = typeof DESCRIPTORS[field] extends PreferenceDescription<infer T, any> ? T : never;
|
||||
type UserStoreModelType<field extends keyof typeof DESCRIPTORS> = typeof DESCRIPTORS[field] extends PreferenceDescription<any, infer T> ? T : never;
|
||||
|
||||
@@ -335,6 +365,7 @@ export const DESCRIPTORS = {
|
||||
editorConfiguration,
|
||||
terminalCopyOnSelect,
|
||||
updateChannel,
|
||||
extensionRegistryUrl,
|
||||
};
|
||||
|
||||
export const CONSTANTS = {
|
||||
|
||||
Reference in new issue
Block a user