From 1bff39f9b26072f27c2af6469d79cf4014b8f67d Mon Sep 17 00:00:00 2001 From: Ivan Kiral Date: Tue, 22 Oct 2024 09:05:34 +0200 Subject: [PATCH] fix syncDiff as public version used wrong directory path --- package.json | 4 ++-- src/modules/sync/diffEnvironments.ts | 6 ++---- .../sync/utils/{diffTemplate.html => diffTemplateHtml.ts} | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) rename src/modules/sync/utils/{diffTemplate.html => diffTemplateHtml.ts} (99%) diff --git a/package.json b/package.json index b666273a..0d5c1a1d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "type": "module", "scripts": { - "build": "tsc && cp ./src/modules/sync/utils/diffTemplate.html build/src/modules/sync/utils/diffTemplate.html", + "build": "tsc", "checkTests": "tsc --project tsconfig.tests.jsonc", "lint": "eslint . --ext ts,tsx", "fmt": "dprint fmt", @@ -70,4 +70,4 @@ "uuid": "^10.0.0", "vitest": "^2.1.2" } -} +} \ No newline at end of file diff --git a/src/modules/sync/diffEnvironments.ts b/src/modules/sync/diffEnvironments.ts index 6a53a0eb..a82f216b 100644 --- a/src/modules/sync/diffEnvironments.ts +++ b/src/modules/sync/diffEnvironments.ts @@ -1,12 +1,11 @@ import chalk from "chalk"; -import { resolve } from "path"; import { logInfo, LogOptions } from "../../log.js"; import { createClient } from "../../utils/client.js"; import { Replace } from "../../utils/types.js"; import { syncEntityChoices, syncEntityDependencies, SyncEntityName } from "./constants/entities.js"; import { diff } from "./diff.js"; -import { readHtmlFile } from "./utils/fileUtils.js"; +import { diffHtmlTemplate } from "./utils/diffTemplateHtml.js"; import { fetchSourceSyncModel, getSourceItemAndAssetCodenames, @@ -40,9 +39,8 @@ export type SyncDiffParamsIntenal = Replace { const resolvedParams = { ...params, entities: params.entities ?? syncEntityChoices }; const diffModel = await syncDiffInternal(resolvedParams, "diff-API"); - const templateString = readHtmlFile(resolve(import.meta.dirname, "./utils/diffTemplate.html")); - return resolveHtmlTemplate(templateString, { ...diffModel, ...resolvedParams }); + return resolveHtmlTemplate(diffHtmlTemplate, { ...diffModel, ...resolvedParams }); }; export const syncDiffInternal = async (params: SyncDiffParamsIntenal, commandName: string) => { diff --git a/src/modules/sync/utils/diffTemplate.html b/src/modules/sync/utils/diffTemplateHtml.ts similarity index 99% rename from src/modules/sync/utils/diffTemplate.html rename to src/modules/sync/utils/diffTemplateHtml.ts index 11d3a74b..5c6ce110 100644 --- a/src/modules/sync/utils/diffTemplate.html +++ b/src/modules/sync/utils/diffTemplateHtml.ts @@ -1,4 +1,4 @@ - +export const diffHtmlTemplate = ` @@ -372,4 +372,4 @@

Modified entities

}; - +`;