Skip to content

Commit

Permalink
fix(optimize): 🐛 wrong path resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
shaharkazaz committed Oct 25, 2021
1 parent e5ec3d0 commit 974b169
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions libs/transloco-optimize/src/lib/transloco-optimize.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'fs';
import glob from 'glob';
import path from 'path';
import { promisify } from 'util';
import { flatten } from 'flat';

type Translation = Record<string, any>;
Expand All @@ -22,17 +23,9 @@ export function getTranslationsFolder(dist: string) {
}

export function getTranslationFiles(dist: string) {
const filesMatcher = path.resolve(getTranslationsFolder(dist), '/**/*.json');

return new Promise<string[]>((resolve, reject) => {
glob(filesMatcher, {}, function (err, translationFilesPaths) {
if (err) {
reject(err);
} else {
resolve(translationFilesPaths);
}
});
});
const filesMatcher = path.resolve(getTranslationsFolder(dist), '**/*.json');

return promisify(glob)(filesMatcher, {});
}

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

0 comments on commit 974b169

Please sign in to comment.