@vocab/phrase 0.0.0-master-20240711232538 → 0.0.0-master-20250202230611

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.
@@ -2,10 +2,11 @@ import { type UserConfig } from '@vocab/core';
2
2
  interface PushOptions {
3
3
  branch: string;
4
4
  deleteUnusedKeys?: boolean;
5
+ ignore?: string[];
5
6
  }
6
7
  /**
7
8
  * Uploads translations to the Phrase API for each language.
8
9
  * A unique namespace is appended to each key using the file path the key came from.
9
10
  */
10
- export declare function push({ branch, deleteUnusedKeys }: PushOptions, config: UserConfig): Promise<void>;
11
+ export declare function push({ branch, deleteUnusedKeys, ignore }: PushOptions, config: UserConfig): Promise<void>;
11
12
  export {};
@@ -1,2 +1,2 @@
1
- export * from "./declarations/src/index";
1
+ export * from "./declarations/src/index.js";
2
2
  //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidm9jYWItcGhyYXNlLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi9kZWNsYXJhdGlvbnMvc3JjL2luZGV4LmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
@@ -131,10 +131,10 @@ async function pullAllTranslations(branch) {
131
131
  const phraseResult = await callPhrase(`translations?branch=${branch}&per_page=100`);
132
132
  const translations = {};
133
133
  for (const r of phraseResult) {
134
- if (!translations[r.locale.code]) {
135
- translations[r.locale.code] = {};
134
+ if (!translations[r.locale.name]) {
135
+ translations[r.locale.name] = {};
136
136
  }
137
- translations[r.locale.code][r.key.name] = {
137
+ translations[r.locale.name][r.key.name] = {
138
138
  message: r.content
139
139
  };
140
140
  }
@@ -296,13 +296,20 @@ async function pull({
296
296
  */
297
297
  async function push({
298
298
  branch,
299
- deleteUnusedKeys: deleteUnusedKeys$1
299
+ deleteUnusedKeys: deleteUnusedKeys$1,
300
+ ignore
300
301
  }, config) {
302
+ if (ignore) {
303
+ trace(`ignoring files on paths: ${ignore.join(', ')}`);
304
+ }
301
305
  const allLanguageTranslations = await core.loadAllTranslations({
302
306
  fallbacks: 'none',
303
307
  includeNodeModules: false,
304
308
  withTags: true
305
- }, config);
309
+ }, {
310
+ ...config,
311
+ ignore: [...(config.ignore || []), ...(ignore || [])]
312
+ });
306
313
  trace(`Pushing translations to branch ${branch}`);
307
314
  const allLanguages = config.languages.map(v => v.name);
308
315
  await ensureBranch(branch);
@@ -131,10 +131,10 @@ async function pullAllTranslations(branch) {
131
131
  const phraseResult = await callPhrase(`translations?branch=${branch}&per_page=100`);
132
132
  const translations = {};
133
133
  for (const r of phraseResult) {
134
- if (!translations[r.locale.code]) {
135
- translations[r.locale.code] = {};
134
+ if (!translations[r.locale.name]) {
135
+ translations[r.locale.name] = {};
136
136
  }
137
- translations[r.locale.code][r.key.name] = {
137
+ translations[r.locale.name][r.key.name] = {
138
138
  message: r.content
139
139
  };
140
140
  }
@@ -296,13 +296,20 @@ async function pull({
296
296
  */
297
297
  async function push({
298
298
  branch,
299
- deleteUnusedKeys: deleteUnusedKeys$1
299
+ deleteUnusedKeys: deleteUnusedKeys$1,
300
+ ignore
300
301
  }, config) {
302
+ if (ignore) {
303
+ trace(`ignoring files on paths: ${ignore.join(', ')}`);
304
+ }
301
305
  const allLanguageTranslations = await core.loadAllTranslations({
302
306
  fallbacks: 'none',
303
307
  includeNodeModules: false,
304
308
  withTags: true
305
- }, config);
309
+ }, {
310
+ ...config,
311
+ ignore: [...(config.ignore || []), ...(ignore || [])]
312
+ });
306
313
  trace(`Pushing translations to branch ${branch}`);
307
314
  const allLanguages = config.languages.map(v => v.name);
308
315
  await ensureBranch(branch);
@@ -121,10 +121,10 @@ async function pullAllTranslations(branch) {
121
121
  const phraseResult = await callPhrase(`translations?branch=${branch}&per_page=100`);
122
122
  const translations = {};
123
123
  for (const r of phraseResult) {
124
- if (!translations[r.locale.code]) {
125
- translations[r.locale.code] = {};
124
+ if (!translations[r.locale.name]) {
125
+ translations[r.locale.name] = {};
126
126
  }
127
- translations[r.locale.code][r.key.name] = {
127
+ translations[r.locale.name][r.key.name] = {
128
128
  message: r.content
129
129
  };
130
130
  }
@@ -286,13 +286,20 @@ async function pull({
286
286
  */
287
287
  async function push({
288
288
  branch,
289
- deleteUnusedKeys: deleteUnusedKeys$1
289
+ deleteUnusedKeys: deleteUnusedKeys$1,
290
+ ignore
290
291
  }, config) {
292
+ if (ignore) {
293
+ trace(`ignoring files on paths: ${ignore.join(', ')}`);
294
+ }
291
295
  const allLanguageTranslations = await loadAllTranslations({
292
296
  fallbacks: 'none',
293
297
  includeNodeModules: false,
294
298
  withTags: true
295
- }, config);
299
+ }, {
300
+ ...config,
301
+ ignore: [...(config.ignore || []), ...(ignore || [])]
302
+ });
296
303
  trace(`Pushing translations to branch ${branch}`);
297
304
  const allLanguages = config.languages.map(v => v.name);
298
305
  await ensureBranch(branch);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vocab/phrase",
3
- "version": "0.0.0-master-20240711232538",
3
+ "version": "0.0.0-master-20250202230611",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/seek-oss/vocab.git",
@@ -17,7 +17,7 @@
17
17
  "csv-stringify": "^6.2.3",
18
18
  "debug": "^4.3.1",
19
19
  "picocolors": "^1.0.0",
20
- "@vocab/core": "^1.6.2"
20
+ "@vocab/core": "^1.6.3"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/debug": "^4.1.5",