From d1baa20aad2988f70d36832eabbf834ca0da80e6 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sat, 12 Mar 2022 21:59:14 +0100 Subject: [PATCH] fix(core): update --- ts/index.ts | 11 +++++------ ts/plugins.ts | 4 +++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ts/index.ts b/ts/index.ts index a6d2661..c404f81 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,11 +1,10 @@ import * as plugins from './plugins.js'; +const __dirname = plugins.path.dirname(plugins.url.fileURLToPath(import.meta.url)); -import { dirname } from 'path'; -import { fileURLToPath } from 'url'; - -const __dirname = dirname(fileURLToPath(import.meta.url)); - -export const runPath = async (pathArg: string) => { +export const runPath = async (pathArg: string, fromFileUrl?: string) => { + pathArg = fromFileUrl + ? plugins.path.join(plugins.path.dirname(plugins.url.fileURLToPath(fromFileUrl)), pathArg) + : pathArg; await runCli(pathArg); }; diff --git a/ts/plugins.ts b/ts/plugins.ts index 42072b1..5d0bbb9 100644 --- a/ts/plugins.ts +++ b/ts/plugins.ts @@ -1,8 +1,10 @@ // node native import * as path from 'path'; +import * as url from 'url'; export { - path + path, + url } // @pushrocks scope