From 7187bdb9c3fa23d2ec994e705d0659038269efab Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Mon, 22 Apr 2024 17:45:05 -0700 Subject: [PATCH] wip --- plop/plopfile.ts | 5 ++++- src/util/getApp.ts | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plop/plopfile.ts b/plop/plopfile.ts index 87cedee2..3cb9b513 100644 --- a/plop/plopfile.ts +++ b/plop/plopfile.ts @@ -3,6 +3,7 @@ import { existsSync } from 'fs' import 'node-fetch' import { dirname, join } from 'path' import type { NodePlopAPI } from 'plop' +import { fileURLToPath } from 'url' import { appsRoot } from '../src/util/getApp' import { stringify } from '../src/util/stringify' import { buildCommand } from './commands/buildCommand' @@ -14,8 +15,10 @@ import { publishCommand } from './commands/publishCommand' import { testCommand } from './commands/testCommand' import { updateCommand } from './commands/updateCommand' +const __dirname = dirname(fileURLToPath(import.meta.url)) + const ROOT = findUpSync(`package.json`, { - cwd: dirname(new URL(import.meta.url).pathname), + cwd: __dirname, }) if (!ROOT) { throw new Error(`Can't find package.json in any parent path`) diff --git a/src/util/getApp.ts b/src/util/getApp.ts index 0f676e87..bc947f5d 100644 --- a/src/util/getApp.ts +++ b/src/util/getApp.ts @@ -1,11 +1,12 @@ import { dirname, join } from 'path' +import { fileURLToPath } from 'url' import type { AppInfo } from '../apps/' import { dbge } from './log' import { mkSetting } from './mkSetting' -export const appsRoot = mkSetting( - join(dirname(new URL(import.meta.url).pathname), `apps`), -) +const __dirname = dirname(fileURLToPath(import.meta.url)) + +export const appsRoot = mkSetting(join(__dirname, `..`, `apps`)) export const getApp = async (slug: string) => { try {