Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/deno-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
name: deno_tests_windows

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
workflow_dispatch:

permissions:
contents: read
Expand Down
18 changes: 5 additions & 13 deletions src/modules/runner/deno-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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`);
Expand All @@ -43,7 +43,7 @@ export class DenoRunner implements IRunner {
}
}

async #findScript(name: string): Promise<string | undefined> {
async #findScript(name: string): Promise<URL | undefined> {
const target = await this.#targetHandler.current();
if (!target) {
logger.error('Target not found');
Expand All @@ -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);
}
}

Expand All @@ -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;
}
}