Skip to content

Commit 50dd94b

Browse files
committed
chore(transloco): 🤖 sync schematics-core
1 parent 369bb61 commit 50dd94b

File tree

12 files changed

+78
-16
lines changed

12 files changed

+78
-16
lines changed

libs/schematics-core/index.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,33 @@
11
export { stringifyList, coerceArray } from './utils/collections';
2-
export { getProject, setEnvironments } from './utils/workspace';
3-
export { createTranslocoConfig } from './utils/transloco';
2+
export { addScriptToPackageJson } from './utils/package';
3+
export {
4+
getProject,
5+
setEnvironments,
6+
getWorkspace,
7+
setWorkspace,
8+
} from './utils/workspace';
9+
export {
10+
createGlobalConfig,
11+
getGlobalConfig,
12+
updateGlobalConfig,
13+
} from './utils/transloco';
414
export {
515
createTranslateFiles,
616
checkIfTranslationFilesExist,
717
} from './utils/translation';
18+
19+
export {
20+
getTranslationEntryPaths,
21+
getTranslationFiles,
22+
getTranslationKey,
23+
getTranslationsRoot,
24+
createTranslateFilesFromOptions,
25+
} from './utils/translation';
26+
export {
27+
hasFiles,
28+
hasSubdirs,
29+
getJsonFileContent,
30+
writeToJson,
31+
} from './utils/file';
32+
export { NAMES } from './utils/schematic';
33+
export { findModuleFromOptions } from './utils/find-module';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './create-workspace';
2+
export * from './mocks';
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const translationMocks = {
2+
en: { hello: 'hello' },
3+
es: { hello: 'hola' },
4+
scopeEn: { hello: 'hello scope' },
5+
scopeEs: { hello: 'hola scope' },
6+
};

libs/schematics-core/utils/file.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { DirEntry, Tree } from '@angular-devkit/schematics';
55

66
export function getJsonFileContent(fileName: PathFragment, dir: DirEntry) {
77
const content = dir.file(fileName)!.content.toString('utf-8');
8+
89
return JSON.parse(content);
910
}
1011

File renamed without changes.

libs/schematics-core/utils/transloco.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function getGlobalConfig(): TranslocoGlobalConfig {
1616
return config;
1717
}
1818

19-
export function createTranslocoConfig(
19+
export function createGlobalConfig(
2020
host: Tree,
2121
langs: string[],
2222
rootTranslationsPath = 'assets/i18n/',
@@ -33,13 +33,10 @@ export function createTranslocoConfig(
3333
}
3434
}
3535

36-
export function updateTranslocoConfig(
37-
host: Tree,
38-
config: TranslocoGlobalConfig,
39-
) {
36+
export function updateGlobalConfig(host: Tree, config: TranslocoGlobalConfig) {
4037
const originalConfig = getGlobalConfig();
4138
if (!originalConfig || Object.keys(originalConfig).length === 0) {
42-
return createTranslocoConfig(
39+
return createGlobalConfig(
4340
host,
4441
config.langs || [],
4542
config.rootTranslationsPath,
Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,33 @@
11
export { stringifyList, coerceArray } from './utils/collections';
2-
export { getProject, setEnvironments } from './utils/workspace';
3-
export { createTranslocoConfig } from './utils/transloco';
2+
export { addScriptToPackageJson } from './utils/package';
3+
export {
4+
getProject,
5+
setEnvironments,
6+
getWorkspace,
7+
setWorkspace,
8+
} from './utils/workspace';
9+
export {
10+
createGlobalConfig,
11+
getGlobalConfig,
12+
updateGlobalConfig,
13+
} from './utils/transloco';
414
export {
515
createTranslateFiles,
616
checkIfTranslationFilesExist,
717
} from './utils/translation';
18+
19+
export {
20+
getTranslationEntryPaths,
21+
getTranslationFiles,
22+
getTranslationKey,
23+
getTranslationsRoot,
24+
createTranslateFilesFromOptions,
25+
} from './utils/translation';
26+
export {
27+
hasFiles,
28+
hasSubdirs,
29+
getJsonFileContent,
30+
writeToJson,
31+
} from './utils/file';
32+
export { NAMES } from './utils/schematic';
33+
export { findModuleFromOptions } from './utils/find-module';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './create-workspace';
2+
export * from './mocks';
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const translationMocks = {
2+
en: { hello: 'hello' },
3+
es: { hello: 'hola' },
4+
scopeEn: { hello: 'hello scope' },
5+
scopeEs: { hello: 'hola scope' },
6+
};

libs/transloco/schematics-core/utils/file.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { DirEntry, Tree } from '@angular-devkit/schematics';
55

66
export function getJsonFileContent(fileName: PathFragment, dir: DirEntry) {
77
const content = dir.file(fileName)!.content.toString('utf-8');
8+
89
return JSON.parse(content);
910
}
1011

0 commit comments

Comments
 (0)