question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CLI/Watch - Extract with [files] marks other strings as obsolete in messages file

See original GitHub issue

Describe the bug I am in the middle of writing a little script to automate extraction of strings using chockidar as watcher.

Unfortunately I have came across 2 errors.

  1. CLI - Whenever I pass a [files] string into the cmd it is not recognized and command is extracting from all source path provided in config file of lingui. But for my case it is not really important, just pointing this out. Ex. command lingui extract src/pages/SignIn/SignIn.tsx --verbose.
  2. Main problem - after hitting the default function of @lingui/cli/lingui-extract with a linguiConfig and linguiOptions prepared based on the source code I have managed to get the “cli” to extract from the file I pin-pointed, BUT after the extraction all other previously extracted strings from other files are marked as obsolete.

To Reproduce Just run this code via npm. It is just a base code to run the extraction from script.

const { getConfig, LinguiConfig } = require('@lingui/conf');

const linguiExtract = require('../node_modules/@lingui/cli/lingui-extract').default;

const linguiConfig = getConfig({
  configPath: process.env.LINGUI_CONFIG,
});

const linguiOptions = {
  verbose: true,
  clean: false,
  overwrite: true,
  files: ['src/pages/SignIn/SignIn.tsx'],
};

function prepareLinguiExtract(config, options) {
  linguiExtract(config, options);
}

prepareLinguiExtract(linguiConfig, linguiOptions);

Expected behavior I expect it to just extract string from the file I am pointing to, not to modify the whole messages file.

Additional context

  • jsLingui version 3.4.0
  • Babel version 7.12.3
  • CRA ejected, React 17.0.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jack1913commented, Feb 2, 2021

Sure, I can work on this. I already have a working code I can implement it natively, but I will sit to it by the end of the week.

0reactions
semoalcommented, Feb 23, 2021

Released your funcitonality with 3.6.0. Thanks for the contribution!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Zip file containing more than one file is sent as string. How to ...
When the entire zip file content is represented as string, getNextEntry() only gives the first file name correctly. After that, it gives another...
Read more >
Linux unzip command help and examples - Computer Hope
unzip lists, tests, or extracts files from archives of the zip ... file code type 180 ('C') when extracting Zip entries marked as...
Read more >
unzip -- list, test and extract compressed files in a ZIP archive
unzip will list, test, or extract files from a ZIP archive, ... The sequence number is applied whenever another file with the original...
Read more >
jest-get-type | Yarn - Package Manager
Generate a basic configuration file; Using Babel; Using webpack; Using Vite; Using Parcel; Using Typescript. Documentation; Badge; Contributing.
Read more >
Extract/Unzip Files - UiPath Documentation Portal
UiPath.System.Activities.Compression.Workflow.ExtractFiles Description Extracts all the contents of a zip file archive to a specified folder.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found