From d1d53869c79c9c534d095243a3d1366f843a4b71 Mon Sep 17 00:00:00 2001 From: David Pires Date: Mon, 12 Dec 2022 17:53:22 +0000 Subject: [PATCH 1/2] Use file protocol in imports --- src/modules/runner/deno-runner.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/modules/runner/deno-runner.ts b/src/modules/runner/deno-runner.ts index c658764..94c65e6 100644 --- a/src/modules/runner/deno-runner.ts +++ b/src/modules/runner/deno-runner.ts @@ -2,8 +2,8 @@ import type { IScriptManager } from '../../core/model.ts'; import { IRunnable, IRunner } from "./models.ts"; import { logger } from '../logger.ts'; import { ITargetHandler } from "../targets.ts"; -import { join, parse } from 'deno/path/mod.ts'; -import { getFileInfo, findPathTo } from '../utils/file.ts'; +import { join, toFileUrl } from 'deno/path/mod.ts'; +import { getFileInfo } from '../utils/file.ts'; export class DenoRunner implements IRunner { #targetHandler: ITargetHandler; @@ -18,7 +18,7 @@ export class DenoRunner implements IRunner { if (!scriptPath) { return false; } logger.debug(`Importing script from: ${scriptPath}`); - const { main } = await import(scriptPath); + const { main } = await import(scriptPath.toString()); if (typeof main !== 'function') { logger.error(`Script ${name} does not export a main function`); @@ -43,7 +43,7 @@ export class DenoRunner implements IRunner { } } - async #findScript(name: string): Promise { + async #findScript(name: string): Promise { const target = await this.#targetHandler.current(); if (!target) { logger.error('Target not found'); @@ -58,9 +58,7 @@ export class DenoRunner implements IRunner { const fileInfo = await getFileInfo(scriptPath); if (fileInfo && fileInfo.isFile) { logger.debug(`Found script at: ${scriptPath}`); - const src = this.#getCurrentPath(); - logger.debug(`Current path: ${src}`); - return findPathTo(scriptPath, src); + return toFileUrl(scriptPath); } } @@ -72,10 +70,4 @@ export class DenoRunner implements IRunner { const args = Deno.args.slice(index + 1); return args[0] === '--' ? args.slice(1) : args; } - - #getCurrentPath(): string { - const scriptUrl = import.meta.url; - const scriptPath = parse(new URL(scriptUrl).pathname).dir; - return scriptPath; - } } From a8dd379364c160d2d368c30d7529b82acd7400b6 Mon Sep 17 00:00:00 2001 From: David Pires Date: Mon, 12 Dec 2022 17:58:21 +0000 Subject: [PATCH 2/2] Change windows test to on request --- .github/workflows/deno-test-windows.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/deno-test-windows.yml b/.github/workflows/deno-test-windows.yml index b0a6f25..bba855c 100644 --- a/.github/workflows/deno-test-windows.yml +++ b/.github/workflows/deno-test-windows.yml @@ -9,10 +9,7 @@ name: deno_tests_windows on: - push: - branches: ["master"] - pull_request: - branches: ["master"] + workflow_dispatch: permissions: contents: read