Skip to content

Commit

Permalink
Fix for the latest dpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Aug 14, 2024
1 parent 4d78ddd commit a88ba85
Showing 1 changed file with 39 additions and 22 deletions.
61 changes: 39 additions & 22 deletions denops/@dpp-exts/installer.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import {
type Action,
type Actions,
type BaseActionParams,
BaseExt,
type DppOptions,
type Plugin,
type Protocol,
type ProtocolName,
} from "jsr:@shougo/dpp-vim@2.0.0/types";
} from "jsr:@shougo/dpp-vim@2.2.0/types";
import {
convert2List,
isDirectory,
printError,
safeStat,
} from "jsr:@shougo/dpp-vim@2.0.0/utils";
} from "jsr:@shougo/dpp-vim@2.2.0/utils";

import type { Denops } from "jsr:@denops/std@~7.0.1";
import * as autocmd from "jsr:@denops/std@7.0.3/autocmd";
Expand Down Expand Up @@ -54,6 +56,21 @@ type UpdatedPlugin = {

type Rollbacks = Record<string, string>;

export interface ExtActions<Params extends BaseActionParams>
extends Actions<Params> {
build: Action<Params, void>;
checkNotUpdated: Action<Params, void>;
denoCache: Action<Params, void>;
getNotInstalled: Action<Params, Plugin[]>;
getFailed: Action<Params, Plugin[]>;
getLogs: Action<Params, string[]>;
getUpdateLogs: Action<Params, string[]>;
getUpdated: Action<Params, Plugin[]>;
install: Action<Params, void>;
reinstall: Action<Params, void>;
update: Action<Params, void>;
}

export class Ext extends BaseExt<Params> {
#failedPlugins: Plugin[] = [];
#logs: string[] = [];
Expand All @@ -72,7 +89,7 @@ export class Ext extends BaseExt<Params> {
});
}

override actions: Actions<Params> = {
override actions: ExtActions<Params> = {
build: {
description: "Build plugins",
callback: async (args: {
Expand Down Expand Up @@ -262,25 +279,6 @@ export class Ext extends BaseExt<Params> {
);
},
},
update: {
description: "Update plugins",
callback: async (args: {
denops: Denops;
options: DppOptions;
protocols: Record<ProtocolName, Protocol>;
extParams: Params;
actionParams: unknown;
}) => {
const params = args.actionParams as InstallParams;
const plugins = await getPlugins(args.denops, params.names ?? []);

const revisions = params.rollback
? await loadRollbackFile(args.denops, params.rollback)
: {};

await this.#updatePlugins(args, plugins, revisions);
},
},
reinstall: {
description: "Reinstall plugins",
callback: async (args: {
Expand Down Expand Up @@ -313,6 +311,25 @@ export class Ext extends BaseExt<Params> {
}
}

await this.#updatePlugins(args, plugins, revisions);
},
},
update: {
description: "Update plugins",
callback: async (args: {
denops: Denops;
options: DppOptions;
protocols: Record<ProtocolName, Protocol>;
extParams: Params;
actionParams: unknown;
}) => {
const params = args.actionParams as InstallParams;
const plugins = await getPlugins(args.denops, params.names ?? []);

const revisions = params.rollback
? await loadRollbackFile(args.denops, params.rollback)
: {};

await this.#updatePlugins(args, plugins, revisions);
},
},
Expand Down

0 comments on commit a88ba85

Please sign in to comment.