mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Allow installing extensions by dist-tag (#3040)
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
e26694d4b6
commit
84cad4b155
@ -313,10 +313,14 @@ export async function attemptInstallByInfo({ name, version, requireConfirmation
|
|||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
if (!json.versions[version]) {
|
if (!json.versions[version]) {
|
||||||
Notifications.error(<p>The <em>{name}</em> extension does not have a v{version}.</p>);
|
if (json["dist-tags"][version]) {
|
||||||
|
version = json["dist-tags"][version];
|
||||||
|
} else {
|
||||||
|
Notifications.error(<p>The <em>{name}</em> extension does not have a version or tag <code>{version}</code>.</p>);
|
||||||
|
|
||||||
return disposer();
|
return disposer();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const versions = Object.keys(json.versions)
|
const versions = Object.keys(json.versions)
|
||||||
.map(version => new SemVer(version, { loose: true, includePrerelease: true }))
|
.map(version => new SemVer(version, { loose: true, includePrerelease: true }))
|
||||||
@ -490,18 +494,12 @@ export class Extensions extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
// TODO: change this after upgrading to mobx6 as that versions' reactions have this functionality
|
|
||||||
let prevSize = ExtensionLoader.getInstance().userExtensions.size;
|
|
||||||
|
|
||||||
disposeOnUnmount(this, [
|
disposeOnUnmount(this, [
|
||||||
reaction(() => ExtensionLoader.getInstance().userExtensions.size, curSize => {
|
reaction(() => ExtensionLoader.getInstance().userExtensions.size, (curSize, prevSize) => {
|
||||||
try {
|
|
||||||
if (curSize > prevSize) {
|
if (curSize > prevSize) {
|
||||||
when(() => !ExtensionInstallationStateStore.anyInstalling)
|
disposeOnUnmount(this, [
|
||||||
.then(() => this.installPath = "");
|
when(() => !ExtensionInstallationStateStore.anyInstalling, () => this.installPath = ""),
|
||||||
}
|
]);
|
||||||
} finally {
|
|
||||||
prevSize = curSize;
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -68,7 +68,7 @@ export const isUrl: InputValidator = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const isExtensionNameInstallRegex = /^(?<name>(@[-\w]+\/)?[-\w]+)(@(?<version>\d\.\d\.\d(-\w+)?))?$/gi;
|
export const isExtensionNameInstallRegex = /^(?<name>(@[-\w]+\/)?[-\w]+)(@(?<version>[a-z0-9-_.]+))?$/gi;
|
||||||
|
|
||||||
export const isExtensionNameInstall: InputValidator = {
|
export const isExtensionNameInstall: InputValidator = {
|
||||||
condition: ({ type }) => type === "text",
|
condition: ({ type }) => type === "text",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user