TerenYeung / poeditor-cli

POEditor cli is the Standard Tooling for workflow of POEditor.
3 stars 7 forks source link

Does not work with key_value_json fileType #6

Open monikaint opened 2 years ago

monikaint commented 2 years ago

Hi, i'm trying to use poeditor pull within my project, but I get an error. Could you help me?

My poeditor-config.json looks like this:

{
  "apiToken": "{API_TOKEN_HERE}",
  "projectId": {PROJECT_ID_HERE},
  "fileType": "key_value_json",
  "targetDir": "./src/locales"
}

When I try poeditor pull command in terminal, I get an error:

ErrorCaptureStackTrace(err);
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Object
    at Object.writeFileSync (node:fs:2159:5)
    at /opt/homebrew/lib/node_modules/poeditor/packages/commands/pull.js:106:8
    at Array.forEach (<anonymous>)
    at writeFiles (/opt/homebrew/lib/node_modules/poeditor/packages/commands/pull.js:94:9)
    at getTermFiles (/opt/homebrew/lib/node_modules/poeditor/packages/commands/pull.js:80:3)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Previously I have tried with "fileType": "json" and it worked correctly.

Reggionick commented 2 years ago

I think that @TerenYeung hasn't published a new version with the latest fixes. Have you tried to reference the GitHub repository instead of the npm's latest version?

monikaint commented 2 years ago

I have tried to installing poeditor-cli repository like this npm i https://github.com/TerenYeung/poeditor-cli.git, but I get the same error.

TerenYeung commented 2 years ago

@monikaint I'm sorry firstly, It's my fault as the lib is designed for apple_strings, android_strings and json in the begining. However, I describe not clearly in README and the usage of attention. Now, the cli only support apple_strings, android_strings and json to use apple_strings, android_strings, js or json as configuration to export .xml/.strings/.json .