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 4ff94c5
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Vendor
run: deno task vendor

- name: Publish package
run: npx jsr 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
7 changes: 4 additions & 3 deletions deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
},
"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/"
}
}
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 4ff94c5

Please sign in to comment.