Skip to content

Commit

Permalink
fix(optimize): 🐛 fixed file resolution on windows (#687)
Browse files Browse the repository at this point in the history
* fix(optimize): 🐛 fixed file resolution on windows

* style(optimize): 💄 change line endings back to original
  • Loading branch information
philippdrebes authored Aug 13, 2023
1 parent 6daa2ea commit 5260127
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libs/transloco-optimize/src/lib/transloco-optimize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { flatten } from 'flat';

type Translation = Record<string, any>;

const isWindows = process.platform === "win32";

function removeComments(translation: Translation, commentsKey = 'comment') {
return Object.keys(translation).reduce((acc, key) => {
const lastKey = key.split('.').pop();
Expand All @@ -25,7 +27,7 @@ export function getTranslationsFolder(dist: string) {
export function getTranslationFiles(dist: string) {
const filesMatcher = path.resolve(getTranslationsFolder(dist), '**/*.json');

return glob(filesMatcher, {});
return glob(filesMatcher, {windowsPathsNoEscape: isWindows});
}

export function optimizeFiles(translationPaths: string[], commentsKey: string) {
Expand Down

0 comments on commit 5260127

Please sign in to comment.