Skip to content

Commit c6f5e2d

Browse files
fix broken test
1 parent 537bb9e commit c6f5e2d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.github/workflows/samples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
--allow-read --allow-write --allow-net
5050
deno-slack-api/scripts/src/imports/update.ts
5151
--import-file "./sample/import_map.json"
52-
--api "../deno-slack-api"
52+
--api "./deno-slack-api/"
5353
5454
- name: Deno check **/*.ts
5555
working-directory: ./sample

scripts/src/imports/update.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { parseArgs } from "@std/cli/parse-args";
22
import { createHttpError } from "@std/http/http-errors";
3-
import { join } from "@std/path";
3+
import { dirname, join, relative } from "@std/path";
44

55
// Regex for https://deno.land/x/deno_slack_api@x.x.x/
66
const API_REGEX =
@@ -15,15 +15,22 @@ async function main() {
1515
},
1616
});
1717

18-
const importFileJsonIn = await Deno.readTextFile(flags["import-file"]);
18+
const importFilePath = await Deno.realPath(flags["import-file"]);
19+
const importFileDir = dirname(importFilePath);
20+
const apiDir = await Deno.realPath(flags.api);
21+
22+
const importFileJsonIn = await Deno.readTextFile(importFilePath);
1923
console.log("`import_map.json` in content:", importFileJsonIn);
2024

2125
const importFile = JSON.parse(importFileJsonIn);
2226
const denoSlackSdkValue = importFile["imports"]["deno-slack-sdk/"];
2327

2428
const apiDepsInSdk = await apiDepsIn(denoSlackSdkValue);
2529

26-
const apiPackageSpecifier = join(flags.api, "/src/");
30+
const apiPackageSpecifier = join(
31+
relative(importFileDir, apiDir),
32+
"/src/",
33+
);
2734

2835
importFile["imports"]["deno-slack-api/"] = apiPackageSpecifier;
2936
importFile["scopes"] = {
@@ -39,7 +46,7 @@ async function main() {
3946
};
4047

4148
const parentFileJsonIn = await Deno.readTextFile(
42-
join(flags.api, "/deno.jsonc"),
49+
join(apiDir, "/deno.jsonc"),
4350
);
4451
console.log("parent `import file` in content:", parentFileJsonIn);
4552
const parentImportFile = JSON.parse(parentFileJsonIn);

0 commit comments

Comments
 (0)