Skip to content

Commit

Permalink
Merge pull request #5 from Shougo/version2
Browse files Browse the repository at this point in the history
Version2
  • Loading branch information
Shougo authored Aug 11, 2024
2 parents a42237b + 98d7c0c commit 4d78ddd
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 20 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/jsr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: jsr

env:
DENO_VERSION: 1.x

on:
push:
tags:
- "v*"

permissions:
contents: read
id-token: write

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: denoland/setup-deno@v1
with:
deno-version: ${{ env.DENO_VERSION }}
- name: Publish
run: |
deno run -A jsr:@david/publish-on-tag@0.1.3
23 changes: 23 additions & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "@shougo/dpp-ext-installer",
"version": "0.0.0",
"exports": {
".": "./denops/@dpp-exts/installer.ts"
},
"publish": {
"include": [
"denops/@dpp-exts/**/*.ts"
]
},
"imports": {
},
"lock": false,
"tasks": {
"check": "deno check denops/**/*.ts",
"lint": "deno lint denops",
"lint-fix": "deno lint --fix denops",
"fmt": "deno fmt denops",
"test": "deno test -A --doc --parallel --shuffle denops/**/*.ts",
"upgrade": "deno run -A jsr:@molt/cli **/*.ts --write"
}
}
48 changes: 28 additions & 20 deletions denops/@dpp-exts/installer.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
import {
Actions,
type Actions,
BaseExt,
Denops,
DppOptions,
Plugin,
Protocol,
ProtocolName,
} from "jsr:@shougo/dpp-vim@1.0.0/types";
type DppOptions,
type Plugin,
type Protocol,
type ProtocolName,
} from "jsr:@shougo/dpp-vim@2.0.0/types";
import {
convert2List,
isDirectory,
printError,
safeStat,
} from "jsr:@shougo/dpp-vim@1.0.0/utils";
} from "jsr:@shougo/dpp-vim@2.0.0/utils";

import * as autocmd from "jsr:@denops/std@7.0.1/autocmd";
import * as op from "jsr:@denops/std@7.0.1/option";
import * as fn from "jsr:@denops/std@7.0.1/function";
import * as vars from "jsr:@denops/std@7.0.1/variable";
import { expandGlob } from "jsr:@std/fs@1.0.0/expand-glob";
import { delay } from "jsr:@std/async@1.0.1/delay";
import type { Denops } from "jsr:@denops/std@~7.0.1";
import * as autocmd from "jsr:@denops/std@7.0.3/autocmd";
import * as op from "jsr:@denops/std@7.0.3/option";
import * as fn from "jsr:@denops/std@7.0.3/function";
import * as vars from "jsr:@denops/std@7.0.3/variable";
import { expandGlob } from "jsr:@std/fs@1.0.1/expand-glob";
import { delay } from "jsr:@std/async@1.0.3/delay";

type Params = {
export type Params = {
checkDiff: boolean;
githubAPIToken: string;
logFilePath: string;
maxProcesses: number;
wait: number;
};

type InstallParams = {
export type Attrs = {
installerBuild?: string;
installerFrozen?: boolean;
};

export type InstallParams = {
names?: string[];
rollback?: string;
};

type CheckNotUpdatedParams = {
export type CheckNotUpdatedParams = {
names?: string[];
force?: boolean;
};
Expand Down Expand Up @@ -776,14 +781,15 @@ export class Ext extends BaseExt<Params> {
extParams: Params,
plugin: Plugin,
) {
if (!plugin.path || !await isDirectory(plugin.path) || !plugin.build) {
const build = (plugin.extAttrs as Attrs)?.installerBuild;
if (!plugin.path || !await isDirectory(plugin.path) || !build) {
return;
}

const proc = new Deno.Command(
await op.shell.getGlobal(denops),
{
args: [await op.shellcmdflag.getGlobal(denops), plugin.build],
args: [await op.shellcmdflag.getGlobal(denops), build],
cwd: plugin.path,
stdout: "piped",
stderr: "piped",
Expand Down Expand Up @@ -1001,7 +1007,9 @@ async function getPlugins(
denops,
"dpp#_plugins",
),
) as Plugin[]).filter((plugin) => !plugin.local && !plugin.frozen);
) as Plugin[]).filter((plugin) =>
!plugin.local && !(plugin.extAttrs as Attrs)?.installerFrozen
);

if (names.length > 0) {
plugins = plugins.filter((plugin) => names.indexOf(plugin.name) >= 0);
Expand Down
20 changes: 20 additions & 0 deletions doc/dpp-ext-installer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Introduction |dpp-ext-installer-introduction|
Install |dpp-ext-installer-install|
Interface |dpp-ext-installer-interface|
Actions |dpp-ext-installer-actions|
Attrs |dpp-ext-installer-attrs|
Params |dpp-ext-installer-params|
Autocmds |dpp-ext-installer-autocmds|
Examples |dpp-ext-installer-examples|
Expand Down Expand Up @@ -173,6 +174,25 @@ update
"latest".
(Default: "")

------------------------------------------------------------------------------
ATTRS *dpp-ext-installer-attrs*

*dpp-ext-installer-attr-installerBuild*
installerBuild (String)
Specify the build script.
This command is executed by 'shell' from the plugin
runtimepath.
NOTE: It must be single command.
NOTE: In previous versions of dpp, build could also be of
type dictionary, but that is now deprecated.
Please use |dpp-plugin-option-hook_post_update| instead.

*dpp-ext-installer-attr-installerFrozen*
installerFrozen (Bool)
If set to v:true, dpp doesn't update it automatically. It is
useful for outdated plugins that can no longer be updated.
The remote branch for git type.

------------------------------------------------------------------------------
PARAMS *dpp-ext-installer-params*

Expand Down

0 comments on commit 4d78ddd

Please sign in to comment.