Skip to content

Commit

Permalink
fix syncDiff as public version used wrong directory path
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanKiral committed Oct 23, 2024
1 parent 1aaf670 commit 1bff39f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -70,4 +70,4 @@
"uuid": "^10.0.0",
"vitest": "^2.1.2"
}
}
}
6 changes: 2 additions & 4 deletions src/modules/sync/diffEnvironments.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -40,9 +39,8 @@ export type SyncDiffParamsIntenal = Replace<SyncDiffParams, { entities: Readonly
export const syncDiff = async (params: SyncDiffParams) => {
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) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
export const diffHtmlTemplate = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
Expand Down Expand Up @@ -372,4 +372,4 @@ <h2>Modified entities</h2>
};
</script>
</body>
</html>
</html>`;

0 comments on commit 1bff39f

Please sign in to comment.