Skip to content

Commit

Permalink
add vendor task for https imports
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanThatOneKid committed Oct 26, 2024
1 parent 8249690 commit 0862785
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 4 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- name: Vendor
run: deno task vendor

- name: Publish package
run: npx jsr publish
run: deno publish
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
vendor
13 changes: 10 additions & 3 deletions deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,21 @@
},
"lock": false,
"tasks": {
"dev": "deno test --watch -A"
"dev": "deno test --watch -A",
"vendor": "deno run -A vendor.ts"
},
"imports": {
"#/": "./",
"@sinclair/typebox": "npm:@sinclair/typebox@^0.33.14",
"@sinclair/typebox-codegen": "npm:@sinclair/typebox-codegen@^0.10.5",
"@std/assert": "jsr:@std/assert@^1.0.6",
"common-tree-sitter-languages/": "https://github.com/jeff-hykin/common_tree_sitter_languages/raw/e0395e3a6e552b0fa73500d5b724735a52936067/main/",
"deno-tree-sitter/": "https://deno.land/x/[email protected]/"
"deno-tree-sitter/": "./vendor/deno.land/x/tree_sitter/vendor/deno.land/x/[email protected]/",
"common-tree-sitter-languages/": "./vendor/raw.githubusercontent.com/jeff-hykin/common_tree_sitter_languages/#e0395e3a6e552b0fa735_8bb8d/main/"
},
"fmt": {
"exclude": ["vendor/", "node_modules/"]
},
"lint": {
"exclude": ["vendor/", "node_modules/"]
}
}
30 changes: 30 additions & 0 deletions vendor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
if (import.meta.main) {
const cacheSubcommand = makeCacheSubcommand({
"https://deno.land/x/[email protected]/": [
"tree_sitter.js",
"main.js",
],
"https://github.com/jeff-hykin/common_tree_sitter_languages/raw/e0395e3a6e552b0fa73500d5b724735a52936067/main/":
["typescript.js"],
});

const cacheSubcommandOutput = await cacheSubcommand.output();
if (!cacheSubcommandOutput.success) {
Deno.exit(1);
}
}

export function makeCacheSubcommand(
httpsImports: Record<string, string[]>,
): Deno.Command {
return new Deno.Command(
Deno.execPath(),
{
args: [
"cache",
...Object.entries(httpsImports)
.flatMap(([url, paths]) => paths.map((path) => `${url}${path}`)),
],
},
);
}

0 comments on commit 0862785

Please sign in to comment.