@translation-cms/sync 1.2.25 → 1.2.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -16
- package/package.json +3 -2
- package/dist/api.d.ts +0 -105
- package/dist/api.d.ts.map +0 -1
- package/dist/api.js +0 -208
- package/dist/api.js.map +0 -1
- package/dist/bin.d.ts +0 -25
- package/dist/bin.d.ts.map +0 -1
- package/dist/bin.js +0 -208
- package/dist/bin.js.map +0 -1
- package/dist/commands/init.d.ts +0 -10
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -89
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/pull.d.ts +0 -10
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js +0 -35
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/status.d.ts +0 -15
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -62
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/sync.d.ts +0 -24
- package/dist/commands/sync.d.ts.map +0 -1
- package/dist/commands/sync.js +0 -131
- package/dist/commands/sync.js.map +0 -1
- package/dist/commands/watch.d.ts +0 -18
- package/dist/commands/watch.d.ts.map +0 -1
- package/dist/commands/watch.js +0 -71
- package/dist/commands/watch.js.map +0 -1
- package/dist/config/config-internals/args.d.ts +0 -11
- package/dist/config/config-internals/args.d.ts.map +0 -1
- package/dist/config/config-internals/args.js +0 -22
- package/dist/config/config-internals/args.js.map +0 -1
- package/dist/config/config-internals/env.d.ts +0 -10
- package/dist/config/config-internals/env.d.ts.map +0 -1
- package/dist/config/config-internals/env.js +0 -35
- package/dist/config/config-internals/env.js.map +0 -1
- package/dist/config/config-internals/file.d.ts +0 -11
- package/dist/config/config-internals/file.d.ts.map +0 -1
- package/dist/config/config-internals/file.js +0 -28
- package/dist/config/config-internals/file.js.map +0 -1
- package/dist/config/config-internals/resolve.d.ts +0 -21
- package/dist/config/config-internals/resolve.d.ts.map +0 -1
- package/dist/config/config-internals/resolve.js +0 -73
- package/dist/config/config-internals/resolve.js.map +0 -1
- package/dist/config/config-internals/root.d.ts +0 -9
- package/dist/config/config-internals/root.d.ts.map +0 -1
- package/dist/config/config-internals/root.js +0 -22
- package/dist/config/config-internals/root.js.map +0 -1
- package/dist/config/config-internals/types.d.ts +0 -91
- package/dist/config/config-internals/types.d.ts.map +0 -1
- package/dist/config/config-internals/types.js +0 -9
- package/dist/config/config-internals/types.js.map +0 -1
- package/dist/config/resolve-config.d.ts +0 -11
- package/dist/config/resolve-config.d.ts.map +0 -1
- package/dist/config/resolve-config.js +0 -10
- package/dist/config/resolve-config.js.map +0 -1
- package/dist/core/api-internals/helpers.d.ts +0 -9
- package/dist/core/api-internals/helpers.d.ts.map +0 -1
- package/dist/core/api-internals/helpers.js +0 -14
- package/dist/core/api-internals/helpers.js.map +0 -1
- package/dist/core/api-internals/pull.d.ts +0 -19
- package/dist/core/api-internals/pull.d.ts.map +0 -1
- package/dist/core/api-internals/pull.js +0 -269
- package/dist/core/api-internals/pull.js.map +0 -1
- package/dist/core/api-internals/route-config.d.ts +0 -13
- package/dist/core/api-internals/route-config.d.ts.map +0 -1
- package/dist/core/api-internals/route-config.js +0 -34
- package/dist/core/api-internals/route-config.js.map +0 -1
- package/dist/core/api-internals/sync.d.ts +0 -19
- package/dist/core/api-internals/sync.d.ts.map +0 -1
- package/dist/core/api-internals/sync.js +0 -139
- package/dist/core/api-internals/sync.js.map +0 -1
- package/dist/core/api-internals/types.d.ts +0 -33
- package/dist/core/api-internals/types.d.ts.map +0 -1
- package/dist/core/api-internals/types.js +0 -5
- package/dist/core/api-internals/types.js.map +0 -1
- package/dist/core/api.d.ts +0 -11
- package/dist/core/api.d.ts.map +0 -1
- package/dist/core/api.js +0 -11
- package/dist/core/api.js.map +0 -1
- package/dist/core/cache-internals/format.d.ts +0 -20
- package/dist/core/cache-internals/format.d.ts.map +0 -1
- package/dist/core/cache-internals/format.js +0 -33
- package/dist/core/cache-internals/format.js.map +0 -1
- package/dist/core/cache-internals/params.d.ts +0 -33
- package/dist/core/cache-internals/params.d.ts.map +0 -1
- package/dist/core/cache-internals/params.js +0 -155
- package/dist/core/cache-internals/params.js.map +0 -1
- package/dist/core/cache-internals/pull.d.ts +0 -17
- package/dist/core/cache-internals/pull.d.ts.map +0 -1
- package/dist/core/cache-internals/pull.js +0 -34
- package/dist/core/cache-internals/pull.js.map +0 -1
- package/dist/core/cache-internals/sync.d.ts +0 -29
- package/dist/core/cache-internals/sync.d.ts.map +0 -1
- package/dist/core/cache-internals/sync.js +0 -104
- package/dist/core/cache-internals/sync.js.map +0 -1
- package/dist/core/cache-internals/types.d.ts +0 -48
- package/dist/core/cache-internals/types.d.ts.map +0 -1
- package/dist/core/cache-internals/types.js +0 -2
- package/dist/core/cache-internals/types.js.map +0 -1
- package/dist/core/cache.d.ts +0 -13
- package/dist/core/cache.d.ts.map +0 -1
- package/dist/core/cache.js +0 -33
- package/dist/core/cache.js.map +0 -1
- package/dist/core/scanner-internals/ast.d.ts +0 -40
- package/dist/core/scanner-internals/ast.d.ts.map +0 -1
- package/dist/core/scanner-internals/ast.js +0 -100
- package/dist/core/scanner-internals/ast.js.map +0 -1
- package/dist/core/scanner-internals/file-walker.d.ts +0 -10
- package/dist/core/scanner-internals/file-walker.d.ts.map +0 -1
- package/dist/core/scanner-internals/file-walker.js +0 -23
- package/dist/core/scanner-internals/file-walker.js.map +0 -1
- package/dist/core/scanner-internals/import-resolver.d.ts +0 -21
- package/dist/core/scanner-internals/import-resolver.d.ts.map +0 -1
- package/dist/core/scanner-internals/import-resolver.js +0 -119
- package/dist/core/scanner-internals/import-resolver.js.map +0 -1
- package/dist/core/scanner-internals/key-extractor.d.ts +0 -20
- package/dist/core/scanner-internals/key-extractor.d.ts.map +0 -1
- package/dist/core/scanner-internals/key-extractor.js +0 -274
- package/dist/core/scanner-internals/key-extractor.js.map +0 -1
- package/dist/core/scanner-internals/nav-config-scanner.d.ts +0 -30
- package/dist/core/scanner-internals/nav-config-scanner.d.ts.map +0 -1
- package/dist/core/scanner-internals/nav-config-scanner.js +0 -170
- package/dist/core/scanner-internals/nav-config-scanner.js.map +0 -1
- package/dist/core/scanner-internals/route-detector.d.ts +0 -27
- package/dist/core/scanner-internals/route-detector.d.ts.map +0 -1
- package/dist/core/scanner-internals/route-detector.js +0 -78
- package/dist/core/scanner-internals/route-detector.js.map +0 -1
- package/dist/core/scanner-internals/types.d.ts +0 -60
- package/dist/core/scanner-internals/types.d.ts.map +0 -1
- package/dist/core/scanner-internals/types.js +0 -29
- package/dist/core/scanner-internals/types.js.map +0 -1
- package/dist/core/scanner.d.ts +0 -21
- package/dist/core/scanner.d.ts.map +0 -1
- package/dist/core/scanner.js +0 -162
- package/dist/core/scanner.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -1
- package/dist/next.d.ts +0 -33
- package/dist/next.d.ts.map +0 -1
- package/dist/next.js +0 -110
- package/dist/next.js.map +0 -1
- package/dist/preview/index.d.ts +0 -39
- package/dist/preview/index.d.ts.map +0 -1
- package/dist/preview/index.js +0 -123
- package/dist/preview/index.js.map +0 -1
- package/dist/preview/internals/highlight.d.ts +0 -31
- package/dist/preview/internals/highlight.d.ts.map +0 -1
- package/dist/preview/internals/highlight.js +0 -184
- package/dist/preview/internals/highlight.js.map +0 -1
- package/dist/preview/internals/interactions.d.ts +0 -15
- package/dist/preview/internals/interactions.d.ts.map +0 -1
- package/dist/preview/internals/interactions.js +0 -38
- package/dist/preview/internals/interactions.js.map +0 -1
- package/dist/preview/internals/interactive.d.ts +0 -14
- package/dist/preview/internals/interactive.d.ts.map +0 -1
- package/dist/preview/internals/interactive.js +0 -122
- package/dist/preview/internals/interactive.js.map +0 -1
- package/dist/preview/internals/locales.d.ts +0 -9
- package/dist/preview/internals/locales.d.ts.map +0 -1
- package/dist/preview/internals/locales.js +0 -24
- package/dist/preview/internals/locales.js.map +0 -1
- package/dist/preview/internals/state.d.ts +0 -37
- package/dist/preview/internals/state.d.ts.map +0 -1
- package/dist/preview/internals/state.js +0 -74
- package/dist/preview/internals/state.js.map +0 -1
- package/dist/preview/internals/styles.d.ts +0 -8
- package/dist/preview/internals/styles.d.ts.map +0 -1
- package/dist/preview/internals/styles.js +0 -28
- package/dist/preview/internals/styles.js.map +0 -1
- package/dist/preview/internals/types.d.ts +0 -74
- package/dist/preview/internals/types.d.ts.map +0 -1
- package/dist/preview/internals/types.js +0 -5
- package/dist/preview/internals/types.js.map +0 -1
- package/dist/preview/internals/ui-indicators.d.ts +0 -15
- package/dist/preview/internals/ui-indicators.d.ts.map +0 -1
- package/dist/preview/internals/ui-indicators.js +0 -92
- package/dist/preview/internals/ui-indicators.js.map +0 -1
- package/dist/scaffold/index.d.ts +0 -3
- package/dist/scaffold/index.d.ts.map +0 -1
- package/dist/scaffold/index.js +0 -3
- package/dist/scaffold/index.js.map +0 -1
- package/dist/scaffold/intenrals/scaffold.d.ts +0 -24
- package/dist/scaffold/intenrals/scaffold.d.ts.map +0 -1
- package/dist/scaffold/intenrals/scaffold.js +0 -53
- package/dist/scaffold/intenrals/scaffold.js.map +0 -1
- package/dist/scaffold/intenrals/templates.d.ts +0 -10
- package/dist/scaffold/intenrals/templates.d.ts.map +0 -1
- package/dist/scaffold/intenrals/templates.js +0 -344
- package/dist/scaffold/intenrals/templates.js.map +0 -1
- package/dist/scaffold/intenrals/types.d.ts +0 -14
- package/dist/scaffold/intenrals/types.d.ts.map +0 -1
- package/dist/scaffold/intenrals/types.js +0 -5
- package/dist/scaffold/intenrals/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -25,13 +25,16 @@ export default withTranslationsCMS(
|
|
|
25
25
|
// your Next.js config
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
|
-
pullOnBuild: true, // auto pull on build
|
|
29
|
-
pullOnDev: true, // auto pull on dev startup
|
|
28
|
+
pullOnBuild: true, // auto pull on `next build`
|
|
29
|
+
pullOnDev: true, // auto pull on `next dev` startup
|
|
30
|
+
watchInterval: 10000, // poll CMS for updates every 10s in dev (0 to disable)
|
|
30
31
|
}
|
|
31
32
|
);
|
|
32
33
|
```
|
|
33
34
|
|
|
34
|
-
Your translations sync automatically
|
|
35
|
+
Your translations sync automatically — and in dev mode, the JSON files are
|
|
36
|
+
re-pulled automatically whenever you publish new translations in the CMS. No
|
|
37
|
+
extra commands needed.
|
|
35
38
|
|
|
36
39
|
### Method 2: CLI (Manual)
|
|
37
40
|
|
|
@@ -51,24 +54,49 @@ pnpm sync-translations init
|
|
|
51
54
|
|
|
52
55
|
### Method 3: Programmatic API
|
|
53
56
|
|
|
54
|
-
Use in scripts, build tools, or
|
|
57
|
+
Use in scripts, build tools, or a custom `next.config.ts`:
|
|
55
58
|
|
|
56
59
|
```ts
|
|
57
|
-
import {
|
|
60
|
+
import type { NextConfig } from 'next';
|
|
61
|
+
import {
|
|
62
|
+
PHASE_DEVELOPMENT_SERVER,
|
|
63
|
+
PHASE_PRODUCTION_BUILD,
|
|
64
|
+
} from 'next/constants';
|
|
65
|
+
import {
|
|
66
|
+
syncTranslations,
|
|
67
|
+
pullTranslations,
|
|
68
|
+
watchTranslations,
|
|
69
|
+
} from '@translation-cms/sync/api';
|
|
70
|
+
|
|
71
|
+
const pathMappings = { '@/*': ['src/*'] }; // mirror your tsconfig paths
|
|
72
|
+
|
|
73
|
+
export default async function config(phase: string): Promise<NextConfig> {
|
|
74
|
+
if (phase === PHASE_DEVELOPMENT_SERVER) {
|
|
75
|
+
// Scan keys and upload, then pull translations
|
|
76
|
+
await syncTranslations({
|
|
77
|
+
projectRoot: '.',
|
|
78
|
+
pathMappings,
|
|
79
|
+
verbose: true,
|
|
80
|
+
});
|
|
81
|
+
await pullTranslations({ projectRoot: '.', verbose: true });
|
|
82
|
+
// Poll the CMS in the background — re-pulls whenever you publish
|
|
83
|
+
watchTranslations({ projectRoot: '.' });
|
|
84
|
+
}
|
|
58
85
|
|
|
59
|
-
|
|
60
|
-
await syncTranslations({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
86
|
+
if (phase === PHASE_PRODUCTION_BUILD) {
|
|
87
|
+
await syncTranslations({ projectRoot: '.', pathMappings });
|
|
88
|
+
await pullTranslations({ projectRoot: '.' });
|
|
89
|
+
}
|
|
64
90
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
91
|
+
return {
|
|
92
|
+
// ... your Next.js config
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
```
|
|
70
96
|
|
|
71
|
-
|
|
97
|
+
Or use `syncAndPull` in scripts / CI:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
72
100
|
import { syncAndPull } from '@translation-cms/sync/api';
|
|
73
101
|
await syncAndPull({ projectRoot: './my-app' });
|
|
74
102
|
```
|
|
@@ -140,6 +168,24 @@ const result = await pullTranslations({
|
|
|
140
168
|
});
|
|
141
169
|
```
|
|
142
170
|
|
|
171
|
+
### `watchTranslations(options?)`
|
|
172
|
+
|
|
173
|
+
Starts a polling loop that detects CMS publishes and re-pulls automatically.
|
|
174
|
+
Non-blocking — call it after `pullTranslations` and it runs in the background.
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
import { watchTranslations } from '@translation-cms/sync/api';
|
|
178
|
+
|
|
179
|
+
watchTranslations({
|
|
180
|
+
projectRoot: './apps/web', // auto-detect if omitted
|
|
181
|
+
outputDir: './src/i18n/locales', // must match pull outputDir
|
|
182
|
+
interval: 10000, // poll every 10s (default)
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
When you publish translations in the CMS, the JSON files are updated within
|
|
187
|
+
`interval` milliseconds — no manual pull needed.
|
|
188
|
+
|
|
143
189
|
### `syncAndPull(options?)`
|
|
144
190
|
|
|
145
191
|
Convenience function: sync keys then pull translations in one call.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@translation-cms/sync",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.28",
|
|
4
4
|
"description": "Scan translation keys in your codebase and sync them to the Translations CMS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"next.d.ts"
|
|
34
34
|
],
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "tsc",
|
|
36
|
+
"build": "tsc && tsc-alias",
|
|
37
37
|
"dev": "tsc --watch",
|
|
38
38
|
"typecheck": "tsc --noEmit",
|
|
39
39
|
"release": "rm -rf dist && pnpm build && npm version patch && npm publish"
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/react": "^18",
|
|
63
|
+
"tsc-alias": "^1.8.10",
|
|
63
64
|
"typescript": "^5.9.3"
|
|
64
65
|
},
|
|
65
66
|
"dependencies": {
|
package/dist/api.d.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Programmatic API for translation sync
|
|
3
|
-
*
|
|
4
|
-
* Use this if you want to integrate sync into your own tooling, CI/CD,
|
|
5
|
-
* or custom workflows.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* import { syncTranslations, pullTranslations } from '@translation-cms/sync/api';
|
|
9
|
-
*
|
|
10
|
-
* // Scan and sync keys to CMS
|
|
11
|
-
* await syncTranslations({ projectRoot: './my-project' });
|
|
12
|
-
*
|
|
13
|
-
* // Fetch translations from CMS
|
|
14
|
-
* await pullTranslations({ projectRoot: './my-project' });
|
|
15
|
-
*/
|
|
16
|
-
export interface SyncOptions {
|
|
17
|
-
/** Project root directory. If omitted, searches up from cwd */
|
|
18
|
-
projectRoot?: string;
|
|
19
|
-
/** Dry run: show changes without uploading */
|
|
20
|
-
dryRun?: boolean;
|
|
21
|
-
/** Force refresh: ignore cache */
|
|
22
|
-
force?: boolean;
|
|
23
|
-
/** Write sync report to this file path */
|
|
24
|
-
reportPath?: string;
|
|
25
|
-
/** Show verbose output */
|
|
26
|
-
verbose?: boolean;
|
|
27
|
-
/** Path alias mappings (mirrors tsconfig `paths`). Used to resolve @/ imports. */
|
|
28
|
-
pathMappings?: Record<string, string[]>;
|
|
29
|
-
}
|
|
30
|
-
export interface PullOptions {
|
|
31
|
-
/** Project root directory. If omitted, searches up from cwd */
|
|
32
|
-
projectRoot?: string;
|
|
33
|
-
/** Custom output directory for JSON files */
|
|
34
|
-
outputDir?: string;
|
|
35
|
-
/** Force refresh: ignore cache */
|
|
36
|
-
force?: boolean;
|
|
37
|
-
/** Override cache TTL in milliseconds */
|
|
38
|
-
ttl?: number;
|
|
39
|
-
/** Pull from specific environment */
|
|
40
|
-
environment?: string;
|
|
41
|
-
/** Show verbose output */
|
|
42
|
-
verbose?: boolean;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Scans codebase for translation keys and syncs them to the CMS.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* const result = await syncTranslations({
|
|
49
|
-
* projectRoot: './apps/web',
|
|
50
|
-
* dryRun: false,
|
|
51
|
-
* verbose: true,
|
|
52
|
-
* });
|
|
53
|
-
*
|
|
54
|
-
* console.log(`Synced ${result.keysAdded} new keys`);
|
|
55
|
-
*/
|
|
56
|
-
export declare function syncTranslations(options?: SyncOptions): Promise<{
|
|
57
|
-
keysAdded: number;
|
|
58
|
-
keysUpdated: number;
|
|
59
|
-
}>;
|
|
60
|
-
/**
|
|
61
|
-
* Fetches translations from the CMS and writes them as local JSON files.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* await pullTranslations({
|
|
65
|
-
* projectRoot: './apps/web',
|
|
66
|
-
* outputDir: './src/i18n/locales',
|
|
67
|
-
* force: true,
|
|
68
|
-
* });
|
|
69
|
-
*/
|
|
70
|
-
export declare function pullTranslations(options?: PullOptions): Promise<{
|
|
71
|
-
locales: string[];
|
|
72
|
-
fileCount: number;
|
|
73
|
-
}>;
|
|
74
|
-
export interface WatchOptions {
|
|
75
|
-
/** Project root directory. If omitted, searches up from cwd */
|
|
76
|
-
projectRoot?: string;
|
|
77
|
-
/** Custom output directory to watch (must match the pull outputDir) */
|
|
78
|
-
outputDir?: string;
|
|
79
|
-
/**
|
|
80
|
-
* How often (in ms) to poll the CMS for new translations.
|
|
81
|
-
* Default: 10000 (10 seconds). Set to 0 to disable.
|
|
82
|
-
*/
|
|
83
|
-
interval?: number;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Starts a polling loop that detects new CMS publishes and automatically
|
|
87
|
-
* re-pulls translations to local JSON files. Non-blocking — returns immediately.
|
|
88
|
-
*
|
|
89
|
-
* Call this once in dev mode after the initial pull:
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* if (phase === PHASE_DEVELOPMENT_SERVER) {
|
|
93
|
-
* await pullTranslations({ projectRoot: '.' });
|
|
94
|
-
* watchTranslations({ projectRoot: '.' });
|
|
95
|
-
* }
|
|
96
|
-
*/
|
|
97
|
-
export declare function watchTranslations(options?: WatchOptions): void;
|
|
98
|
-
/**
|
|
99
|
-
* Sync and pull in one operation (equivalent to CLI `sync` command)
|
|
100
|
-
*/
|
|
101
|
-
export declare function syncAndPull(options?: SyncOptions & PullOptions): Promise<{
|
|
102
|
-
synced: boolean;
|
|
103
|
-
pulled: boolean;
|
|
104
|
-
}>;
|
|
105
|
-
//# sourceMappingURL=api.d.ts.map
|
package/dist/api.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAeH,MAAM,WAAW,WAAW;IACxB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kCA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AE,WAAW,GAAG,WAAgB,GACxC,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,CAQ/C"}
|
package/dist/api.js
DELETED
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Programmatic API for translation sync
|
|
3
|
-
*
|
|
4
|
-
* Use this if you want to integrate sync into your own tooling, CI/CD,
|
|
5
|
-
* or custom workflows.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* import { syncTranslations, pullTranslations } from '@translation-cms/sync/api';
|
|
9
|
-
*
|
|
10
|
-
* // Scan and sync keys to CMS
|
|
11
|
-
* await syncTranslations({ projectRoot: './my-project' });
|
|
12
|
-
*
|
|
13
|
-
* // Fetch translations from CMS
|
|
14
|
-
* await pullTranslations({ projectRoot: './my-project' });
|
|
15
|
-
*/
|
|
16
|
-
import path from 'path';
|
|
17
|
-
import { resolveConfig, resolveRouteParams, findProjectRoot as findProjectRootHelper, loadConfigFile, } from './config/resolve-config.js';
|
|
18
|
-
import { fetchRouteParams } from './core/api.js';
|
|
19
|
-
import { runSync } from './commands/sync.js';
|
|
20
|
-
import { runPull } from './commands/pull.js';
|
|
21
|
-
import { getLastPulledTime } from './core/cache.js';
|
|
22
|
-
/**
|
|
23
|
-
* Scans codebase for translation keys and syncs them to the CMS.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* const result = await syncTranslations({
|
|
27
|
-
* projectRoot: './apps/web',
|
|
28
|
-
* dryRun: false,
|
|
29
|
-
* verbose: true,
|
|
30
|
-
* });
|
|
31
|
-
*
|
|
32
|
-
* console.log(`Synced ${result.keysAdded} new keys`);
|
|
33
|
-
*/
|
|
34
|
-
export async function syncTranslations(options = {}) {
|
|
35
|
-
const { projectRoot = findProjectRootHelper(), dryRun = false, force = false, reportPath, verbose = false, pathMappings, } = options;
|
|
36
|
-
if (verbose) {
|
|
37
|
-
// eslint-disable-next-line no-console
|
|
38
|
-
console.log(`[sync-translations] Syncing from ${projectRoot}...`);
|
|
39
|
-
}
|
|
40
|
-
const fileConfig = loadConfigFile(projectRoot);
|
|
41
|
-
const config = resolveConfig(projectRoot, fileConfig);
|
|
42
|
-
if (!config.cmsUrl || !config.projectId || !config.apiKey) {
|
|
43
|
-
throw new Error('Missing CMS configuration. Set NEXT_PUBLIC_CMS_URL, NEXT_PUBLIC_CMS_PROJECT_ID, and CMS_SYNC_API_KEY.');
|
|
44
|
-
}
|
|
45
|
-
// Fetch route params from CMS and merge with local config
|
|
46
|
-
const cmsRouteParams = await fetchRouteParams(config);
|
|
47
|
-
const userRouteParams = resolveRouteParams(projectRoot, fileConfig);
|
|
48
|
-
const scanOpts = {
|
|
49
|
-
excludedDirs: fileConfig.excludedDirs,
|
|
50
|
-
sourceExtensions: fileConfig.sourceExtensions,
|
|
51
|
-
routeParams: { ...cmsRouteParams, ...userRouteParams },
|
|
52
|
-
projectRoot,
|
|
53
|
-
includeNavRoutes: fileConfig.includeNavRoutes,
|
|
54
|
-
pathMappings,
|
|
55
|
-
};
|
|
56
|
-
const outputDir = fileConfig.outputDir ?? path.join(projectRoot, 'public', 'locales');
|
|
57
|
-
try {
|
|
58
|
-
await runSync(projectRoot, config, scanOpts, {
|
|
59
|
-
outputDir,
|
|
60
|
-
dryRun,
|
|
61
|
-
force,
|
|
62
|
-
reportPath,
|
|
63
|
-
mockDataPath: fileConfig.mockDataPath,
|
|
64
|
-
userRouteParams,
|
|
65
|
-
});
|
|
66
|
-
if (verbose) {
|
|
67
|
-
// eslint-disable-next-line no-console
|
|
68
|
-
console.log(`[sync-translations] Sync complete`);
|
|
69
|
-
}
|
|
70
|
-
// Return placeholder stats (actual stats are logged by runSync)
|
|
71
|
-
return {
|
|
72
|
-
keysAdded: 0,
|
|
73
|
-
keysUpdated: 0,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
if (verbose && error instanceof Error) {
|
|
78
|
-
// eslint-disable-next-line no-console
|
|
79
|
-
console.error('[sync-translations] Sync failed:', error.message);
|
|
80
|
-
}
|
|
81
|
-
throw error;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Fetches translations from the CMS and writes them as local JSON files.
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* await pullTranslations({
|
|
89
|
-
* projectRoot: './apps/web',
|
|
90
|
-
* outputDir: './src/i18n/locales',
|
|
91
|
-
* force: true,
|
|
92
|
-
* });
|
|
93
|
-
*/
|
|
94
|
-
export async function pullTranslations(options = {}) {
|
|
95
|
-
const { projectRoot = findProjectRootHelper(), outputDir, force = false, ttl, environment, verbose = false, } = options;
|
|
96
|
-
if (verbose) {
|
|
97
|
-
// eslint-disable-next-line no-console
|
|
98
|
-
console.log(`[sync-translations] Pulling to ${projectRoot}...`);
|
|
99
|
-
}
|
|
100
|
-
const fileConfig = loadConfigFile(projectRoot);
|
|
101
|
-
const config = resolveConfig(projectRoot, fileConfig);
|
|
102
|
-
if (!config.cmsUrl || !config.projectId || !config.apiKey) {
|
|
103
|
-
throw new Error('Missing CMS configuration. Set NEXT_PUBLIC_CMS_URL, NEXT_PUBLIC_CMS_PROJECT_ID, and CMS_SYNC_API_KEY.');
|
|
104
|
-
}
|
|
105
|
-
// Build args array for runPull
|
|
106
|
-
const args = [];
|
|
107
|
-
if (force)
|
|
108
|
-
args.push('--force');
|
|
109
|
-
if (environment) {
|
|
110
|
-
args.push('--env');
|
|
111
|
-
args.push(environment);
|
|
112
|
-
}
|
|
113
|
-
if (ttl) {
|
|
114
|
-
args.push('--ttl');
|
|
115
|
-
args.push(String(ttl));
|
|
116
|
-
}
|
|
117
|
-
if (outputDir) {
|
|
118
|
-
args.push('--output');
|
|
119
|
-
args.push(outputDir);
|
|
120
|
-
}
|
|
121
|
-
try {
|
|
122
|
-
await runPull(projectRoot, config, fileConfig, args);
|
|
123
|
-
if (verbose) {
|
|
124
|
-
// eslint-disable-next-line no-console
|
|
125
|
-
console.log(`[sync-translations] Pull complete`);
|
|
126
|
-
}
|
|
127
|
-
// Return placeholder stats
|
|
128
|
-
return {
|
|
129
|
-
locales: [],
|
|
130
|
-
fileCount: 0,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
if (verbose && error instanceof Error) {
|
|
135
|
-
// eslint-disable-next-line no-console
|
|
136
|
-
console.error('[sync-translations] Pull failed:', error.message);
|
|
137
|
-
}
|
|
138
|
-
throw error;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Starts a polling loop that detects new CMS publishes and automatically
|
|
143
|
-
* re-pulls translations to local JSON files. Non-blocking — returns immediately.
|
|
144
|
-
*
|
|
145
|
-
* Call this once in dev mode after the initial pull:
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* if (phase === PHASE_DEVELOPMENT_SERVER) {
|
|
149
|
-
* await pullTranslations({ projectRoot: '.' });
|
|
150
|
-
* watchTranslations({ projectRoot: '.' });
|
|
151
|
-
* }
|
|
152
|
-
*/
|
|
153
|
-
export function watchTranslations(options = {}) {
|
|
154
|
-
const { projectRoot = findProjectRootHelper(), interval = 10_000 } = options;
|
|
155
|
-
if (interval <= 0)
|
|
156
|
-
return;
|
|
157
|
-
const fileConfig = loadConfigFile(projectRoot);
|
|
158
|
-
const config = resolveConfig(projectRoot, fileConfig);
|
|
159
|
-
if (!config.cmsUrl || !config.projectId || !config.apiKey) {
|
|
160
|
-
// eslint-disable-next-line no-console
|
|
161
|
-
console.warn('[CMS] Missing config — watch disabled');
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
const resolvedOutputDir = options.outputDir ??
|
|
165
|
-
fileConfig.outputDir ??
|
|
166
|
-
path.join(projectRoot, 'public', 'locales');
|
|
167
|
-
const statusUrl = `${config.cmsUrl.replace(/\/$/, '')}/api/sync/${config.projectId}/status`;
|
|
168
|
-
const poll = async () => {
|
|
169
|
-
try {
|
|
170
|
-
const res = await fetch(statusUrl, {
|
|
171
|
-
headers: { 'x-api-key': config.apiKey },
|
|
172
|
-
signal: AbortSignal.timeout(5000),
|
|
173
|
-
});
|
|
174
|
-
if (!res.ok)
|
|
175
|
-
return;
|
|
176
|
-
const { lastPublishedAt } = (await res.json());
|
|
177
|
-
if (!lastPublishedAt)
|
|
178
|
-
return;
|
|
179
|
-
const lastPulled = getLastPulledTime(resolvedOutputDir);
|
|
180
|
-
const publishedMs = new Date(lastPublishedAt).getTime();
|
|
181
|
-
if (lastPulled === null || publishedMs > lastPulled) {
|
|
182
|
-
// eslint-disable-next-line no-console
|
|
183
|
-
console.log('[CMS] New translations detected — pulling...');
|
|
184
|
-
await runPull(projectRoot, config, fileConfig, ['--force']);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
catch {
|
|
188
|
-
// Silently ignore — CMS may be unreachable or dev server starting up
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
setInterval(poll, interval);
|
|
192
|
-
// eslint-disable-next-line no-console
|
|
193
|
-
console.log(`[CMS] Watching for translation updates every ${interval / 1000}s`);
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Sync and pull in one operation (equivalent to CLI `sync` command)
|
|
197
|
-
*/
|
|
198
|
-
export async function syncAndPull(options = {}) {
|
|
199
|
-
try {
|
|
200
|
-
await syncTranslations(options);
|
|
201
|
-
await pullTranslations(options);
|
|
202
|
-
return { synced: true, pulled: true };
|
|
203
|
-
}
|
|
204
|
-
catch {
|
|
205
|
-
return { synced: false, pulled: false };
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAC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,IAAI,EAAE,CAE5C,CAAC;YACF,IAAI,CAAC,eAAe;gBAAE,OAAO;YAE7B,MAAM,UAAU,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;YACxD,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE,CAAC;YAExD,IAAI,UAAU,KAAK,IAAI,IAAI,WAAW,GAAG,UAAU,EAAE,CAAC;gBAClD,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;gBAC5D,MAAM,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;YAChE,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACL,qEAAqE;QACzE,CAAC;IACL,CAAC,CAAC;IAEF,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC5B,sCAAsC;IACtC,OAAO,CAAC,GAAG,CACP,gDAAgD,QAAQ,GAAG,IAAI,GAAG,CACrE,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC7B,UAAqC,EAAE;IAEvC,IAAI,CAAC;QACD,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAChC,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAChC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC5C,CAAC;AACL,CAAC"}
|
package/dist/bin.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* sync-translations CLI
|
|
4
|
-
*
|
|
5
|
-
* Subcommands:
|
|
6
|
-
* sync (default) Scan codebase and sync translation keys to the CMS.
|
|
7
|
-
* pull Fetch translations from CMS and write local JSON files.
|
|
8
|
-
* status Show what would change on next sync (no network calls).
|
|
9
|
-
* watch Watch for file changes and auto-sync on save.
|
|
10
|
-
* init Interactive setup — creates .translationsrc.json.
|
|
11
|
-
*
|
|
12
|
-
* Usage:
|
|
13
|
-
* sync-translations # sync keys + pull
|
|
14
|
-
* sync-translations sync --dry-run # preview changes only
|
|
15
|
-
* sync-translations sync --report scan.json # write JSON report
|
|
16
|
-
* sync-translations pull --output ./locales # custom output dir
|
|
17
|
-
* sync-translations pull --force # ignore TTL cache
|
|
18
|
-
* sync-translations pull --env staging # pull staging env
|
|
19
|
-
* sync-translations pull --ttl 600000 # custom TTL (ms)
|
|
20
|
-
* sync-translations status # diff vs last sync cache
|
|
21
|
-
* sync-translations watch # watch + auto-sync
|
|
22
|
-
* sync-translations init # interactive setup
|
|
23
|
-
*/
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=bin.d.ts.map
|
package/dist/bin.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG"}
|