lexisync 0.2.0 → 1.0.0

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.
@@ -0,0 +1,490 @@
1
+ import { describe, it, expect, vi, afterEach } from 'vitest';
2
+ import { createRequire } from 'node:module';
3
+
4
+ const require = createRequire(import.meta.url);
5
+ const client = require('./client.js');
6
+ const {
7
+ MISSING_API_URL,
8
+ resolveApiUrl,
9
+ resolveCdnBase,
10
+ rowsToResource,
11
+ cdnUrl,
12
+ getTranslations,
13
+ postSync,
14
+ upsertTranslation,
15
+ publishVersion,
16
+ listVersions,
17
+ discoverApi,
18
+ getMe,
19
+ listLanguages,
20
+ addLanguage,
21
+ downloadCatalog,
22
+ reportMissing,
23
+ } = client;
24
+
25
+ describe('resolveApiUrl / resolveCdnBase', () => {
26
+ const prev = { ...process.env };
27
+
28
+ afterEach(() => {
29
+ process.env = { ...prev };
30
+ vi.unstubAllGlobals();
31
+ });
32
+
33
+ it('requires an apiUrl (no hosted default) and strips trailing slash', () => {
34
+ delete process.env.LEXISYNC_API_URL;
35
+ expect(() => resolveApiUrl()).toThrow(MISSING_API_URL);
36
+ expect(() => resolveCdnBase()).toThrow(/apiUrl is required/);
37
+ expect(resolveApiUrl('https://x.example/')).toBe('https://x.example');
38
+ });
39
+
40
+ it('reads LEXISYNC_API_URL', () => {
41
+ process.env.LEXISYNC_API_URL = 'https://api.custom/';
42
+ expect(resolveApiUrl()).toBe('https://api.custom');
43
+ });
44
+
45
+ it('resolveCdnBase prefers explicit cdnUrl, then env, then {apiUrl}/cdn', () => {
46
+ expect(resolveCdnBase(undefined, 'https://cdn.custom/')).toBe('https://cdn.custom');
47
+ process.env.LEXISYNC_CDN_URL = 'https://env-cdn/';
48
+ expect(resolveCdnBase()).toBe('https://env-cdn');
49
+ delete process.env.LEXISYNC_CDN_URL;
50
+ expect(resolveCdnBase('https://lexisync.app')).toBe('https://lexisync.app/cdn');
51
+ expect(resolveCdnBase('https://selfhosted.example')).toBe('https://selfhosted.example/cdn');
52
+ });
53
+ });
54
+
55
+ describe('rowsToResource', () => {
56
+ it('maps nested and flat rows; ignores empty', () => {
57
+ expect(rowsToResource(null)).toEqual({});
58
+ expect(
59
+ rowsToResource([
60
+ { key: { identifier: 'a' }, value: 'A' },
61
+ { identifier: 'b', value: 'B' },
62
+ { value: 'no-id' },
63
+ { identifier: 'c' },
64
+ ]),
65
+ ).toEqual({ a: 'A', b: 'B', c: '' });
66
+ });
67
+ });
68
+
69
+ describe('cdnUrl', () => {
70
+ it('builds .json path on pure CDN host', () => {
71
+ expect(
72
+ cdnUrl({
73
+ cdnUrl: 'https://cdn.example.com',
74
+ projectId: 'p1',
75
+ version: 'production',
76
+ language: 'en',
77
+ namespace: 'common',
78
+ }),
79
+ ).toBe('https://cdn.example.com/p1/production/en/common.json');
80
+ });
81
+
82
+ it('builds non-.json path when base ends with /cdn', () => {
83
+ expect(
84
+ cdnUrl({
85
+ apiUrl: 'https://selfhosted.example',
86
+ projectId: 'p1',
87
+ version: 'latest',
88
+ language: 'nl',
89
+ namespace: 'app',
90
+ }),
91
+ ).toBe('https://selfhosted.example/cdn/p1/latest/nl/app');
92
+ });
93
+
94
+ it('defaults version/language/namespace', () => {
95
+ const u = cdnUrl({ cdnUrl: 'https://cdn.example.com', projectId: 'p' });
96
+ expect(u).toBe('https://cdn.example.com/p/latest/en/default.json');
97
+ });
98
+ });
99
+
100
+ function mockFetchSequence(responses) {
101
+ const fn = vi.fn();
102
+ for (const r of responses) fn.mockResolvedValueOnce(r);
103
+ vi.stubGlobal('fetch', fn);
104
+ return fn;
105
+ }
106
+
107
+ function jsonRes(body, status = 200) {
108
+ return {
109
+ ok: status >= 200 && status < 300,
110
+ status,
111
+ json: async () => body,
112
+ text: async () => (typeof body === 'string' ? body : JSON.stringify(body)),
113
+ };
114
+ }
115
+
116
+ describe('getTranslations', () => {
117
+ afterEach(() => vi.unstubAllGlobals());
118
+
119
+ it('returns CDN object on success', async () => {
120
+ mockFetchSequence([jsonRes({ hello: 'world' })]);
121
+ const data = await getTranslations({
122
+ cdnUrl: 'https://cdn.example.com',
123
+ projectId: 'p',
124
+ namespace: 'common',
125
+ language: 'en',
126
+ version: 'production',
127
+ });
128
+ expect(data).toEqual({ hello: 'world' });
129
+ });
130
+
131
+ it('falls back to legacy array API for latest', async () => {
132
+ mockFetchSequence([
133
+ jsonRes({ error: 'nope' }, 404),
134
+ jsonRes([{ identifier: 'k', value: 'v' }]),
135
+ ]);
136
+ const data = await getTranslations({
137
+ apiUrl: 'https://lexisync.example.com',
138
+ projectId: 'p',
139
+ namespace: 'common',
140
+ language: 'en',
141
+ version: 'latest',
142
+ });
143
+ expect(data).toEqual({ k: 'v' });
144
+ });
145
+
146
+ it('throws on published version miss', async () => {
147
+ mockFetchSequence([jsonRes('missing', 404)]);
148
+ await expect(
149
+ getTranslations({
150
+ cdnUrl: 'https://cdn.example.com',
151
+ projectId: 'p',
152
+ namespace: 'common',
153
+ language: 'en',
154
+ version: 'production',
155
+ }),
156
+ ).rejects.toThrow(/GET catalog failed|missing/);
157
+ });
158
+
159
+ it('throws when legacy fallback fails', async () => {
160
+ mockFetchSequence([jsonRes({}, 404), jsonRes('nope', 500)]);
161
+ await expect(
162
+ getTranslations({
163
+ apiUrl: 'https://lexisync.example.com',
164
+ projectId: 'p',
165
+ namespace: 'common',
166
+ language: 'en',
167
+ version: 'latest',
168
+ }),
169
+ ).rejects.toThrow();
170
+ });
171
+
172
+ it('defaults version to latest when omitted', async () => {
173
+ mockFetchSequence([jsonRes({ a: 1 })]);
174
+ await getTranslations({
175
+ cdnUrl: 'https://cdn.example.com',
176
+ projectId: 'p',
177
+ namespace: 'common',
178
+ language: 'en',
179
+ });
180
+ expect(String(fetch.mock.calls[0][0])).toContain('/latest/');
181
+ });
182
+ });
183
+
184
+ describe('write helpers', () => {
185
+ afterEach(() => vi.unstubAllGlobals());
186
+
187
+ it('postSync success + error (incl. empty error body)', async () => {
188
+ mockFetchSequence([
189
+ jsonRes({ ok: true }),
190
+ jsonRes({}, 400), // no error field → status message
191
+ {
192
+ ok: false,
193
+ status: 500,
194
+ json: async () => {
195
+ throw new Error('bad json');
196
+ },
197
+ text: async () => '',
198
+ },
199
+ ]);
200
+ await expect(
201
+ postSync({ apiUrl: 'https://x', apiKey: 'k', projectId: 'p', languageCode: 'en', data: {} }),
202
+ ).resolves.toEqual({ ok: true });
203
+ await expect(
204
+ postSync({ apiUrl: 'https://x', apiKey: 'k', projectId: 'p', languageCode: 'en', data: {} }),
205
+ ).rejects.toThrow(/Sync failed \(400\)/);
206
+ await expect(
207
+ postSync({ apiUrl: 'https://x', apiKey: 'k', projectId: 'p', languageCode: 'en', data: {} }),
208
+ ).rejects.toThrow(/Sync failed \(500\)/);
209
+ });
210
+
211
+ it('upsertTranslation success + error', async () => {
212
+ mockFetchSequence([jsonRes({ id: 1 }), jsonRes({ error: 'bad' }, 400)]);
213
+ await expect(
214
+ upsertTranslation({
215
+ apiUrl: 'https://x',
216
+ apiKey: 'k',
217
+ projectId: 'p',
218
+ namespace: 'c',
219
+ identifier: 'i',
220
+ languageCode: 'en',
221
+ value: 'v',
222
+ }),
223
+ ).resolves.toEqual({ id: 1 });
224
+ await expect(
225
+ upsertTranslation({
226
+ apiUrl: 'https://x',
227
+ apiKey: 'k',
228
+ projectId: 'p',
229
+ namespace: 'c',
230
+ identifier: 'i',
231
+ languageCode: 'en',
232
+ value: 'v',
233
+ }),
234
+ ).rejects.toThrow(/bad|Upsert failed/);
235
+ });
236
+
237
+ it('publishVersion success + error', async () => {
238
+ mockFetchSequence([jsonRes({ version: 'production' }), jsonRes({ error: 'pub' }, 400)]);
239
+ await expect(
240
+ publishVersion({ apiUrl: 'https://x', apiKey: 'k', projectId: 'p', version: 'production' }),
241
+ ).resolves.toEqual({ version: 'production' });
242
+ await expect(
243
+ publishVersion({ apiUrl: 'https://x', apiKey: 'k', projectId: 'p', version: 'production' }),
244
+ ).rejects.toThrow(/pub|Publish failed/);
245
+ });
246
+
247
+ it('listVersions success + error', async () => {
248
+ mockFetchSequence([jsonRes({ versions: ['production'] }), jsonRes({ error: 'x' }, 500)]);
249
+ await expect(listVersions({ apiUrl: 'https://x', projectId: 'p' })).resolves.toEqual({
250
+ versions: ['production'],
251
+ });
252
+ await expect(listVersions({ apiUrl: 'https://x', projectId: 'p' })).rejects.toThrow();
253
+ });
254
+ });
255
+
256
+ describe('v1 helpers', () => {
257
+ afterEach(() => vi.unstubAllGlobals());
258
+
259
+ it('discover/getMe/listLanguages/addLanguage/download/reportMissing', async () => {
260
+ mockFetchSequence([
261
+ jsonRes({ ok: true }),
262
+ jsonRes({ me: 1 }),
263
+ jsonRes({ languages: ['en'] }),
264
+ jsonRes({ code: 'nl' }),
265
+ jsonRes({ catalog: {} }),
266
+ jsonRes({ catalog: {} }), // download without language/namespace
267
+ jsonRes({ created: 1 }),
268
+ jsonRes({ created: 2 }), // reportMissing defaults
269
+ jsonRes({ error: { message: 'denied' } }, 403),
270
+ jsonRes({ error: 'plain' }, 400),
271
+ jsonRes({}, 418), // no error field
272
+ ]);
273
+
274
+ await expect(discoverApi({ apiUrl: 'https://x' })).resolves.toEqual({ ok: true });
275
+ await expect(getMe({ apiUrl: 'https://x', apiKey: 'k' })).resolves.toEqual({ me: 1 });
276
+ await expect(
277
+ listLanguages({ apiUrl: 'https://x', apiKey: 'k', projectId: 'p' }),
278
+ ).resolves.toEqual({
279
+ languages: ['en'],
280
+ });
281
+ await expect(
282
+ addLanguage({ apiUrl: 'https://x', apiKey: 'k', projectId: 'p', code: 'nl', name: 'NL' }),
283
+ ).resolves.toEqual({ code: 'nl' });
284
+ await expect(
285
+ downloadCatalog({
286
+ apiUrl: 'https://x',
287
+ apiKey: 'k',
288
+ projectId: 'p',
289
+ language: 'en',
290
+ namespace: 'c',
291
+ }),
292
+ ).resolves.toEqual({ catalog: {} });
293
+ await expect(
294
+ downloadCatalog({ apiUrl: 'https://x', apiKey: 'k', projectId: 'p' }),
295
+ ).resolves.toEqual({ catalog: {} });
296
+ await expect(
297
+ reportMissing({ apiUrl: 'https://x', apiKey: 'k', projectId: 'p', keys: ['a'] }),
298
+ ).resolves.toEqual({ created: 1 });
299
+ await expect(
300
+ reportMissing({
301
+ apiUrl: 'https://x',
302
+ apiKey: 'k',
303
+ projectId: 'p',
304
+ namespace: 'app',
305
+ languageCode: 'nl',
306
+ keys: ['b'],
307
+ }),
308
+ ).resolves.toEqual({ created: 2 });
309
+
310
+ await expect(getMe({ apiUrl: 'https://x', apiKey: 'k' })).rejects.toThrow(/denied/);
311
+ await expect(getMe({ apiUrl: 'https://x', apiKey: 'k' })).rejects.toThrow(/plain/);
312
+ await expect(getMe({ apiUrl: 'https://x', apiKey: 'k' })).rejects.toThrow(
313
+ /Request failed \(418\)/,
314
+ );
315
+ });
316
+
317
+ it('discoverApi without args uses LEXISYNC_API_URL, else throws', async () => {
318
+ const prevUrl = process.env.LEXISYNC_API_URL;
319
+ process.env.LEXISYNC_API_URL = 'https://lexisync.example.com';
320
+ mockFetchSequence([jsonRes({ routes: [] })]);
321
+ await expect(discoverApi()).resolves.toEqual({ routes: [] });
322
+ delete process.env.LEXISYNC_API_URL;
323
+ await expect(discoverApi()).rejects.toThrow(/apiUrl is required/);
324
+ if (prevUrl !== undefined) process.env.LEXISYNC_API_URL = prevUrl;
325
+ });
326
+ });
327
+
328
+ describe('branch coverage extras', () => {
329
+ afterEach(() => {
330
+ vi.unstubAllGlobals();
331
+ // restore env
332
+ });
333
+
334
+ it('publishVersion/listVersions use status text when error body empty', async () => {
335
+ mockFetchSequence([
336
+ {
337
+ ok: false,
338
+ status: 502,
339
+ json: async () => {
340
+ throw new Error('x');
341
+ },
342
+ text: async () => '',
343
+ },
344
+ { ok: false, status: 503, json: async () => ({}), text: async () => '' },
345
+ ]);
346
+ await expect(
347
+ publishVersion({ apiUrl: 'https://x', apiKey: 'k', projectId: 'p', version: 'production' }),
348
+ ).rejects.toThrow(/Publish failed \(502\)/);
349
+ await expect(listVersions({ apiUrl: 'https://x', projectId: 'p' })).rejects.toThrow(
350
+ /List versions failed \(503\)/,
351
+ );
352
+ });
353
+
354
+ it('listVersions tolerates a non-JSON error body', async () => {
355
+ mockFetchSequence([
356
+ {
357
+ ok: false,
358
+ status: 504,
359
+ json: async () => {
360
+ throw new Error('not json');
361
+ },
362
+ },
363
+ ]);
364
+ await expect(listVersions({ apiUrl: 'https://x', projectId: 'p' })).rejects.toThrow(
365
+ /List versions failed \(504\)/,
366
+ );
367
+ });
368
+
369
+ it('v1Fetch stringifies non-string error objects', async () => {
370
+ mockFetchSequence([jsonRes({ error: { code: 1, nested: true } }, 400)]);
371
+ await expect(getMe({ apiUrl: 'https://x', apiKey: 'k' })).rejects.toThrow(/nested/);
372
+ });
373
+
374
+ it('getTranslations ignores CDN payload that is an array or has error', async () => {
375
+ // array payload → not plain object map → fallback for latest
376
+ mockFetchSequence([
377
+ jsonRes([{ identifier: 'x', value: '1' }]),
378
+ jsonRes([{ identifier: 'x', value: '1' }]),
379
+ ]);
380
+ const data = await getTranslations({
381
+ apiUrl: 'https://lexisync.example.com',
382
+ projectId: 'p',
383
+ namespace: 'common',
384
+ language: 'en',
385
+ version: 'latest',
386
+ });
387
+ expect(data).toEqual({ x: '1' });
388
+
389
+ // object with error field on production → throw
390
+ mockFetchSequence([jsonRes({ error: 'nope' }, 200)]);
391
+ await expect(
392
+ getTranslations({
393
+ cdnUrl: 'https://cdn.example.com',
394
+ projectId: 'p',
395
+ namespace: 'common',
396
+ language: 'en',
397
+ version: 'production',
398
+ }),
399
+ ).rejects.toThrow();
400
+ });
401
+
402
+ it('upsertTranslation empty error body uses status', async () => {
403
+ mockFetchSequence([{ ok: false, status: 409, json: async () => ({}), text: async () => '' }]);
404
+ await expect(
405
+ upsertTranslation({
406
+ apiUrl: 'https://x',
407
+ apiKey: 'k',
408
+ projectId: 'p',
409
+ namespace: 'c',
410
+ identifier: 'i',
411
+ languageCode: 'en',
412
+ value: 'v',
413
+ }),
414
+ ).rejects.toThrow(/Upsert failed \(409\)/);
415
+ });
416
+
417
+ it('upsertTranslation non-JSON error body still reports the status', async () => {
418
+ // A gateway/proxy 502 or an HTML error page makes res.json() reject, so
419
+ // the `.catch(() => ({}))` guard fires and we must still surface the
420
+ // status rather than an opaque "Unexpected token < in JSON" TypeError.
421
+ mockFetchSequence([
422
+ {
423
+ ok: false,
424
+ status: 502,
425
+ json: async () => {
426
+ throw new SyntaxError('Unexpected token < in JSON at position 0');
427
+ },
428
+ text: async () => '<html>Bad Gateway</html>',
429
+ },
430
+ ]);
431
+ await expect(
432
+ upsertTranslation({
433
+ apiUrl: 'https://x',
434
+ apiKey: 'k',
435
+ projectId: 'p',
436
+ namespace: 'c',
437
+ identifier: 'i',
438
+ languageCode: 'en',
439
+ value: 'v',
440
+ }),
441
+ ).rejects.toThrow(/Upsert failed \(502\)/);
442
+ });
443
+
444
+ it('resolveCdnBase without process.env.LEXISYNC_CDN_URL uses api host rules', () => {
445
+ const prev = process.env.LEXISYNC_CDN_URL;
446
+ delete process.env.LEXISYNC_CDN_URL;
447
+ expect(resolveCdnBase('https://other.example.com')).toBe('https://other.example.com/cdn');
448
+ if (prev !== undefined) process.env.LEXISYNC_CDN_URL = prev;
449
+ });
450
+
451
+ it('getTranslations empty error bodies use status fallbacks', async () => {
452
+ mockFetchSequence([
453
+ jsonRes({}, 404),
454
+ { ok: false, status: 500, json: async () => ({}), text: async () => '' },
455
+ ]);
456
+ await expect(
457
+ getTranslations({
458
+ apiUrl: 'https://lexisync.example.com',
459
+ projectId: 'p',
460
+ namespace: 'common',
461
+ language: 'en',
462
+ version: 'latest',
463
+ }),
464
+ ).rejects.toThrow(/GET translations failed \(500\)/);
465
+
466
+ mockFetchSequence([{ ok: false, status: 404, json: async () => ({}), text: async () => '' }]);
467
+ await expect(
468
+ getTranslations({
469
+ cdnUrl: 'https://cdn.example.com',
470
+ projectId: 'p',
471
+ namespace: 'common',
472
+ language: 'en',
473
+ version: 'production',
474
+ }),
475
+ ).rejects.toThrow(/GET catalog failed \(404\)/);
476
+ });
477
+
478
+ it('getTranslations without namespace omits query param on legacy', async () => {
479
+ mockFetchSequence([jsonRes({}, 404), jsonRes([{ identifier: 'a', value: '1' }])]);
480
+ const data = await getTranslations({
481
+ apiUrl: 'https://lexisync.example.com',
482
+ projectId: 'p',
483
+ language: 'en',
484
+ version: 'latest',
485
+ });
486
+ expect(data).toEqual({ a: '1' });
487
+ const legacyUrl = String(fetch.mock.calls[1][0]);
488
+ expect(legacyUrl).not.toContain('namespace=');
489
+ });
490
+ });
@@ -7,30 +7,32 @@ const os = require('os');
7
7
  const CONFIG_DIR = path.join(os.homedir(), '.lexisync');
8
8
  const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
9
9
 
10
- function readStore() {
10
+ function readStore(file = CONFIG_FILE) {
11
11
  try {
12
- return JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
12
+ return JSON.parse(fs.readFileSync(file, 'utf8'));
13
13
  } catch {
14
14
  return {};
15
15
  }
16
16
  }
17
17
 
18
- function writeStore(data) {
19
- fs.mkdirSync(CONFIG_DIR, { recursive: true });
20
- fs.writeFileSync(CONFIG_FILE, JSON.stringify(data, null, 2) + '\n');
18
+ function writeStore(data, file = CONFIG_FILE, dir = CONFIG_DIR) {
19
+ fs.mkdirSync(dir, { recursive: true });
20
+ fs.writeFileSync(file, JSON.stringify(data, null, 2) + '\n');
21
21
  }
22
22
 
23
- function createConfig() {
23
+ function createConfig(opts = {}) {
24
+ const file = opts.file || CONFIG_FILE;
25
+ const dir = opts.dir || CONFIG_DIR;
24
26
  return {
25
27
  get(key) {
26
- return readStore()[key];
28
+ return readStore(file)[key];
27
29
  },
28
30
  set(key, value) {
29
- const data = readStore();
31
+ const data = readStore(file);
30
32
  data[key] = value;
31
- writeStore(data);
33
+ writeStore(data, file, dir);
32
34
  },
33
35
  };
34
36
  }
35
37
 
36
- module.exports = { createConfig, CONFIG_FILE };
38
+ module.exports = { createConfig, CONFIG_FILE, CONFIG_DIR, readStore, writeStore };
@@ -0,0 +1,54 @@
1
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest';
2
+ import fs from 'node:fs';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { createConfig, CONFIG_FILE, CONFIG_DIR, readStore, writeStore } from './config-store.js';
6
+
7
+ describe('config-store', () => {
8
+ let tmp;
9
+ let file;
10
+ let dir;
11
+
12
+ beforeEach(() => {
13
+ tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'lexisync-cfg-'));
14
+ dir = path.join(tmp, '.lexisync');
15
+ file = path.join(dir, 'config.json');
16
+ });
17
+
18
+ afterEach(() => {
19
+ fs.rmSync(tmp, { recursive: true, force: true });
20
+ });
21
+
22
+ it('exports default paths under ~/.lexisync', () => {
23
+ expect(CONFIG_DIR).toContain('.lexisync');
24
+ expect(CONFIG_FILE.endsWith('config.json')).toBe(true);
25
+ });
26
+
27
+ it('createConfig() without opts uses default paths (read-only get)', () => {
28
+ const cfg = createConfig();
29
+ // get is safe even if file missing
30
+ expect(cfg.get('__unit_test_missing_key__')).toBeUndefined();
31
+ });
32
+
33
+ it('get/set round-trips via injectable path', () => {
34
+ const cfg = createConfig({ file, dir });
35
+ expect(cfg.get('missing')).toBeUndefined();
36
+ cfg.set('apiKey', 'sk_test');
37
+ expect(cfg.get('apiKey')).toBe('sk_test');
38
+ expect(fs.existsSync(file)).toBe(true);
39
+ const raw = JSON.parse(fs.readFileSync(file, 'utf8'));
40
+ expect(raw.apiKey).toBe('sk_test');
41
+ });
42
+
43
+ it('readStore returns {} on missing or corrupt JSON', () => {
44
+ expect(readStore(path.join(tmp, 'nope.json'))).toEqual({});
45
+ const bad = path.join(tmp, 'bad.json');
46
+ fs.writeFileSync(bad, '{not json');
47
+ expect(readStore(bad)).toEqual({});
48
+ });
49
+
50
+ it('writeStore creates dir and pretty-prints', () => {
51
+ writeStore({ a: 1 }, file, dir);
52
+ expect(fs.readFileSync(file, 'utf8')).toBe('{\n "a": 1\n}\n');
53
+ });
54
+ });
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "lexisync",
3
- "version": "0.2.0",
4
- "description": "CLI and i18next backend for LexiSync — sync locale files and load translations at runtime",
3
+ "version": "1.0.0",
4
+ "description": "CLI and i18next backend for self-hosted LexiSync — sync locale files and load translations at runtime",
5
5
  "license": "MIT",
6
6
  "author": "Sander Post",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/sanderpost/lexisync.git",
9
+ "url": "https://github.com/sanderpost/lexisync",
10
10
  "directory": "packages/lexisync"
11
11
  },
12
- "homepage": "https://lexisync-six.vercel.app/docs",
12
+ "homepage": "https://github.com/sanderpost/lexisync/tree/main/packages/lexisync#readme",
13
13
  "bugs": {
14
14
  "url": "https://github.com/sanderpost/lexisync/issues"
15
15
  },
@@ -20,7 +20,8 @@
20
20
  "translation",
21
21
  "tms",
22
22
  "cli",
23
- "i18n"
23
+ "i18n",
24
+ "self-hosted"
24
25
  ],
25
26
  "type": "commonjs",
26
27
  "main": "lib/backend.js",
@@ -43,10 +44,11 @@
43
44
  "LICENSE"
44
45
  ],
45
46
  "engines": {
46
- "node": ">=18"
47
+ "node": ">=20"
47
48
  },
48
49
  "scripts": {
49
- "prepublishOnly": "node -e \"require('./lib/backend'); require('./lib/client')\""
50
+ "prepublishOnly": "node -e \"require('./lib/backend'); require('./lib/client')\"",
51
+ "test": "cd ../.. && npx vitest run packages/lexisync"
50
52
  },
51
53
  "peerDependencies": {
52
54
  "i18next": ">=22.0.0"
@@ -57,7 +59,7 @@
57
59
  }
58
60
  },
59
61
  "dependencies": {
60
- "axios": "^1.18.1",
62
+ "axios": "^1.20.0",
61
63
  "commander": "^12.1.0"
62
64
  }
63
- }
65
+ }