@tolgee/cli 2.1.4 → 2.1.6

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.
@@ -1,11 +1,18 @@
1
1
  import FormData from 'form-data';
2
+ import { pathToPossix } from '../utils/pathToPossix.js';
2
3
  export const createImportClient = ({ apiClient }) => {
3
4
  return {
4
5
  async import(data) {
5
6
  const body = new FormData();
6
7
  for (const file of data.files) {
7
- body.append('files', file.data, { filepath: file.name });
8
+ // converting paths to possix style, so it's correctly matched on the server
9
+ body.append('files', file.data, { filepath: pathToPossix(file.name) });
8
10
  }
11
+ data.params.fileMappings = data.params.fileMappings.map((i) => ({
12
+ ...i,
13
+ // converting paths to possix style, so it's correctly matched on the server
14
+ fileName: pathToPossix(i.fileName),
15
+ }));
9
16
  body.append('params', JSON.stringify(data.params));
10
17
  return apiClient.POST('/v2/projects/{projectId}/single-step-import', {
11
18
  params: { path: { projectId: apiClient.getProjectId() } },
@@ -37,7 +37,7 @@ export function parseObject(context) {
37
37
  }
38
38
  switch (state) {
39
39
  case 0 /* S.ExpectProperty */:
40
- if (type === 'object.key') {
40
+ if (type === 'object.key' || type === 'string') {
41
41
  state = 1 /* S.ExpectDoubleColon */;
42
42
  lastKey = token.token;
43
43
  }
@@ -0,0 +1,4 @@
1
+ import path from 'path';
2
+ export function pathToPossix(input) {
3
+ return input.replaceAll(path.sep, path.posix.sep);
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolgee/cli",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "type": "module",
5
5
  "description": "A tool to interact with the Tolgee Platform through CLI",
6
6
  "repository": {