diff --git a/package.json b/package.json index ab41b16..07fdeac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "isolate-package", - "version": "1.17.0", + "version": "1.18.0-0", "description": "Isolate a monorepo package with its shared dependencies to form a self-contained directory, compatible with Firebase deploy", "author": "Thijs Koerselman", "license": "MIT", diff --git a/src/isolate.ts b/src/isolate.ts index b04ba6f..451c100 100644 --- a/src/isolate.ts +++ b/src/isolate.ts @@ -213,7 +213,7 @@ export async function isolate( log.debug("Generating pnpm-workspace.yaml for Rush workspace"); log.debug("Packages folder names:", packagesFolderNames); - const packages = packagesFolderNames.map((x) => x + "/*"); + const packages = packagesFolderNames.map((x) => path.join(x, "/*")); await writeTypedYamlSync(path.join(isolateDir, "pnpm-workspace.yaml"), { packages, diff --git a/src/lib/registry/create-packages-registry.ts b/src/lib/registry/create-packages-registry.ts index 4209f79..8e321a9 100644 --- a/src/lib/registry/create-packages-registry.ts +++ b/src/lib/registry/create-packages-registry.ts @@ -36,11 +36,11 @@ export async function createPackagesRegistry( if (!fs.existsSync(manifestPath)) { log.warn( - `Ignoring directory ./${rootRelativeDir} because it does not contain a package.json file` + `Ignoring directory ${rootRelativeDir} because it does not contain a package.json file` ); return; } else { - log.debug(`Registering package ./${rootRelativeDir}`); + log.debug(`Registering package ${rootRelativeDir}`); const manifest = await readTypedJson( path.join(absoluteDir, "package.json") diff --git a/src/lib/utils/get-relative-path.ts b/src/lib/utils/get-relative-path.ts index ab6e70a..78bb5cb 100644 --- a/src/lib/utils/get-relative-path.ts +++ b/src/lib/utils/get-relative-path.ts @@ -1,15 +1,13 @@ +import { join } from "node:path"; + export function getRootRelativePath(path: string, rootPath: string) { const strippedPath = path.replace(rootPath, ""); - return strippedPath.startsWith("/") - ? `(root)${strippedPath}` - : `(root)/${strippedPath}`; + return join("(root)", strippedPath); } export function getIsolateRelativePath(path: string, isolatePath: string) { const strippedPath = path.replace(isolatePath, ""); - return strippedPath.startsWith("/") - ? `(isolate)${strippedPath}` - : `(isolate)/${strippedPath}`; + return join("(isolate)", strippedPath); }