opral / inlang-cli

Issue tracker repo for the CLI
0 stars 0 forks source link

CLI (still) makes network requests when all translations are complete #4

Closed pboling closed 1 month ago

pboling commented 4 months ago

I'm on a particularly strange internet connection right now, and some requests are blocked, but others work. I can access GitHub to report this, but I can't run any of my regular format/lint scripts because the inlang CLI is integrated, and even though I have zero missing translations it is still making requests.

This is not the same as the just fixed issue of other network requests being made in the same situation, i.e. when all translations already exist.

I'm on the latest release:

  "@inlang/cli": "^2.15.3",

It is my expectation that in my scenario, where all my translations exist, I should be able to run my lint and format tasks, including inlang's, when on airplane mode with no network available at all.

I have this command as part of my normal "format" task:

> pnpm inlang machine translate --force --project project.inlang "--sourceLanguageTag" "en" "--targetLanguageTags" "es,es-419,fr,fr-CA,pt,pt-BR"

If all translations exist I expect the above command to not result in any network activity. Is my expectation invalid?

Here is what I get:

Using existing cloned repo
ModuleImportError: Couldn't import the plugin "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js":

TypeError: fetch failed
    at resolveModules (file:///Users/pboling/src/myapp/monolith/node_modules/.pnpm/@inlang+cli@2.15.3/node_modules/@inlang/cli/dist/main.js:73925:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  module: 'https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js',
  cause: TypeError: fetch failed
      at node:internal/deps/undici/undici:12345:11
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async $import (file:///Users/pboling/src/myapp/monolith/node_modules/.pnpm/@inlang+cli@2.15.3/node_modules/@inlang/cli/dist/main.js:73480:27)
      at async resolveModules (file:///Users/pboling/src/myapp/monolith/node_modules/.pnpm/@inlang+cli@2.15.3/node_modules/@inlang/cli/dist/main.js:73923:28) {
    cause: ConnectTimeoutError: Connect Timeout Error
        at onConnectTimeout (node:internal/deps/undici/undici:7492:28)
        at node:internal/deps/undici/undici:7448:50
        at Immediate._onImmediate (node:internal/deps/undici/undici:7480:13)
        at process.processImmediate (node:internal/timers:478:21) {
      code: 'UND_ERR_CONNECT_TIMEOUT'
    }
  }
}
 ELIFECYCLE  Command failed with exit code 1.
jldec commented 4 months ago

Thanks for reporting this @pboling

Inlang does not support offline use at the moment because plugin modules (e.g. as used by lint reports) are loaded from the cdn on startup, and are not installed or cached, like npm modules might be.

This allows tools like Fink to work in the browser without depending on npm, but I understand that it feels surprising for other npm-installed tools like the inlang cli.

We have an open issue for gathering feedback on this here https://github.com/opral/inlang-message-sdk/issues/43

samuelstroschein commented 1 month ago

closing as "we are releasing the sdk v2" which should solve many issues