Skip to content

Commit

Permalink
fix(): cli and conf needed hotfix for #1110
Browse files Browse the repository at this point in the history
  • Loading branch information
semoal committed Sep 7, 2021
1 parent 18d1884 commit 1c6378d
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 101 deletions.
18 changes: 10 additions & 8 deletions examples/create-react-app/lingui.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
module.exports = {
module.exports = {
locales: ["en", "cs"],
sourceLocale: "en",
catalogs: [{
path: "<rootDir>/src/locales/{locale}/messages",
include: ["<rootDir>"],
exclude: ["**/node_modules/**"],
}],
format: "po"
}
catalogs: [
{
path: "<rootDir>/src/locales/{locale}/messages",
include: ["<rootDir>"],
exclude: ["**/node_modules/**"],
},
],
format: "po",
}
29 changes: 15 additions & 14 deletions examples/create-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,10 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@lingui/react": "latest",
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.6",
"@types/react": "^16.9.55",
"@types/react-dom": "^16.9.9",
"@lingui/react": "^3.11.0",
"@lingui/core": "^3.11.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.0",
"typescript": "^4.0.5"
"react-dom": "^17.0.1"
},
"scripts": {
"start": "yarn extract && yarn compile && react-scripts start",
Expand All @@ -41,8 +33,17 @@
]
},
"devDependencies": {
"@lingui/cli": "latest",
"@lingui/loader": "latest",
"@lingui/macro": "latest"
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.6",
"@types/react": "^16.9.55",
"@types/react-dom": "^16.9.9",
"react-scripts": "4.0.0",
"typescript": "^4.0.5",
"@lingui/cli": "^3.11.0",
"@lingui/loader": "^3.11.0",
"@lingui/macro": "^3.11.0"
}
}
2 changes: 1 addition & 1 deletion examples/create-react-app/src/locales/cs/messages.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions examples/create-react-app/src/locales/cs/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,38 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#: src/App.tsx:27
#: src/App.tsx:37
msgid "Date formatter example:"
msgstr "Příklad formátovače data:"

#: src/App.tsx:23
#: src/App.tsx:28
msgid "Decrement"
msgstr "Úbytek"

#: src/App.tsx:35
#: src/App.tsx:45
msgid "I have a balance of {0}"
msgstr "Mám zůstatek {0}"

#: src/App.tsx:20
#: src/App.tsx:25
msgid "Increment"
msgstr "Přírůstek"

#: src/App.tsx:11
#: src/App.tsx:14
msgid "Language switcher example:"
msgstr "Příklad přepínače jazyků:"

#: src/App.tsx:33
#: src/App.tsx:43
msgid "Number formatter example:"
msgstr "Příklad formátovače čísel:"

#: src/App.tsx:17
#: src/App.tsx:22
msgid "Plurals example:"
msgstr "Příklad množného čísla:"

#: src/App.tsx:29
#: src/App.tsx:39
msgid "Today is {0}"
msgstr "Dnes je {0}"

#: src/App.tsx:26
#: src/App.tsx:31
msgid "{count, plural, zero {There are no books} one {There's one book} other {There are # books}}"
msgstr "{count, plural, zero {Nejsou žádné knihy} one {Je tu jedna kniha} other {Existuje # knih}}"
18 changes: 9 additions & 9 deletions examples/create-react-app/src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,38 @@ msgstr ""
"Language-Team: \n"
"Plural-Forms: \n"

#: src/App.tsx:27
#: src/App.tsx:37
msgid "Date formatter example:"
msgstr "Date formatter example:"

#: src/App.tsx:23
#: src/App.tsx:28
msgid "Decrement"
msgstr "Decrement"

#: src/App.tsx:35
#: src/App.tsx:45
msgid "I have a balance of {0}"
msgstr "I have a balance of {0}"

#: src/App.tsx:20
#: src/App.tsx:25
msgid "Increment"
msgstr "Increment"

#: src/App.tsx:11
#: src/App.tsx:14
msgid "Language switcher example:"
msgstr "Language switcher example:"

#: src/App.tsx:33
#: src/App.tsx:43
msgid "Number formatter example:"
msgstr "Number formatter example:"

#: src/App.tsx:17
#: src/App.tsx:22
msgid "Plurals example:"
msgstr "Plurals example:"

#: src/App.tsx:29
#: src/App.tsx:39
msgid "Today is {0}"
msgstr "Today is {0}"

#: src/App.tsx:26
#: src/App.tsx:31
msgid "{count, plural, zero {There are no books} one {There's one book} other {There are # books}}"
msgstr "{count, plural, zero {There are no books} one {There's one book} other {There are # books}}"
105 changes: 68 additions & 37 deletions examples/create-react-app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,13 @@
dependencies:
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.12.5":
version "7.15.4"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.15.4.tgz#fd17d16bfdf878e6dd02d19753a39fa8a8d9c84a"
integrity sha512-99catp6bHCaxr4sJ/DbTGgHS4+Rs2RVd2g7iOap6SLGPDknRK9ztKNsE/Fg6QhSeh1FGE5f6gHGQmvvn3I3xhw==
dependencies:
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2":
version "7.8.4"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.8.4.tgz#d79f5a2040f7caa24d53e563aad49cbc05581308"
Expand Down Expand Up @@ -1418,29 +1425,29 @@
"@types/yargs" "^15.0.0"
chalk "^4.0.0"

"@lingui/babel-plugin-extract-messages@^3.7.1":
version "3.7.1"
resolved "https://registry.yarnpkg.com/@lingui/babel-plugin-extract-messages/-/babel-plugin-extract-messages-3.7.1.tgz#320d09aafa8874299765055b790b6f4e3fa2646b"
integrity sha512-9U4sdsF6NWUcITkcms3lpgAwqWWmsqZA4XGX3jMwQL0axq2zNTOKIlZmyzOtiteuLcOA8sb4KkrRhz7N09n7UQ==
"@lingui/babel-plugin-extract-messages@^3.11.0":
version "3.11.0"
resolved "https://registry.yarnpkg.com/@lingui/babel-plugin-extract-messages/-/babel-plugin-extract-messages-3.11.0.tgz#7e09caa15a3b18a9bbaa70691eb6e5d919b570fa"
integrity sha512-wSsJ1TDfTS+rNny3JVVLIgpGYKuyTTgwbgKCVBLovuAO5UdDusw0U06xXdrWah6UJcDO/pPKU0FGndWuwNzwbg==
dependencies:
"@babel/generator" "^7.11.6"
"@babel/runtime" "^7.11.2"
"@lingui/conf" "^3.7.1"
"@lingui/conf" "^3.11.0"
mkdirp "^1.0.4"

"@lingui/cli@^3.7.1", "@lingui/cli@latest":
version "3.7.1"
resolved "https://registry.yarnpkg.com/@lingui/cli/-/cli-3.7.1.tgz#ce60aa4a2e6982c8dbed415b03d27a2de7c2dfbd"
integrity sha512-PMSJVK9URfop0+y4wxRs8XwIdNW2StjgqOVogBL5qxDdNZinGz5wUoVU/CNzgM3BAz6HaVm2ZGwIDa7j2s6VSA==
"@lingui/cli@^3.11.0":
version "3.11.0"
resolved "https://registry.yarnpkg.com/@lingui/cli/-/cli-3.11.0.tgz#c5ef4da4fba9f842686cd9ba1ad6ad9da850694f"
integrity sha512-8donrPV0pU31OUNixDK7spb45Q71QBkOi5lhbENISnZ/bjEm/FAg2JmdhXl2vuKeZlhrLzoKSVl8tDDYTMtFRQ==
dependencies:
"@babel/generator" "^7.11.6"
"@babel/parser" "^7.11.5"
"@babel/plugin-syntax-jsx" "^7.10.4"
"@babel/runtime" "^7.11.2"
"@babel/types" "^7.11.5"
"@lingui/babel-plugin-extract-messages" "^3.7.1"
"@lingui/conf" "^3.7.1"
babel-plugin-macros "^2.8.0"
"@lingui/babel-plugin-extract-messages" "^3.11.0"
"@lingui/conf" "^3.11.0"
babel-plugin-macros "^3.0.1"
bcp-47 "^1.0.7"
chalk "^4.1.0"
chokidar "3.5.1"
Expand All @@ -1465,10 +1472,10 @@
pseudolocale "^1.1.0"
ramda "^0.27.1"

"@lingui/conf@^3.7.1":
version "3.7.1"
resolved "https://registry.yarnpkg.com/@lingui/conf/-/conf-3.7.1.tgz#14679e246a07d2822656d73e897bf96944510328"
integrity sha512-D80MjeLdV2YN+Nti4+hOh0qWhgZZa10iosKLpdXVxVrC9MCGa3XxPcaeK2EaRlbjgCCMmDZHghzKA7WOg67EkQ==
"@lingui/conf@^3.11.0":
version "3.11.0"
resolved "https://registry.yarnpkg.com/@lingui/conf/-/conf-3.11.0.tgz#1c736102dc0662d2948afb8e3dbe505bbc8826db"
integrity sha512-Z84FwEBnrYM9J3ZsAQUxHzMw1qkEz5o16+wyk5x0/02pkBQ+9pH3Nx1wc8WnAnSlCHtV/AzIffjPqxW+U5qejQ==
dependencies:
"@babel/runtime" "^7.11.2"
"@endemolshinegroup/cosmiconfig-typescript-loader" "^3.0.2"
Expand All @@ -1477,42 +1484,42 @@
jest-validate "^26.5.2"
lodash.get "^4.4.2"

"@lingui/core@^3.7.1":
version "3.7.1"
resolved "https://registry.yarnpkg.com/@lingui/core/-/core-3.7.1.tgz#c67b6aee648ee226742d77fe0214383e16672b91"
integrity sha512-VJeyjVTvgc3FcILIGBtu0m4CxIqw9cHAU93dCN7wlI074hn+KtZZxI47pzViRqmpDknLcriZ5Ua7GqP3IpHadA==
"@lingui/core@^3.11.0":
version "3.11.0"
resolved "https://registry.yarnpkg.com/@lingui/core/-/core-3.11.0.tgz#6a82319b1b2e100d891ae5d38cdf0e4b9be12ff6"
integrity sha512-o9XE/ymOVZ3icWN57+RyKL1CkHxnj9h8pquf97eO3JPaU7KVatXTz1iq9mSAt+tq1vHT7USLcdhwncRSq5FPZw==
dependencies:
"@babel/runtime" "^7.11.2"
make-plural "^6.2.2"
messageformat-parser "^4.1.3"

"@lingui/loader@latest":
version "3.7.1"
resolved "https://registry.yarnpkg.com/@lingui/loader/-/loader-3.7.1.tgz#3f65c89cfbce717d0e14d6cc973ef7d9cd247f5a"
integrity sha512-hsFnaI3pnBDqj8JEwGKXcU2bGYesM7STaNcDnVNazfw2j2lGTxP6yeQdA7mVeTXq+DzEa6jr7ksqYTuzRBLLlA==
"@lingui/loader@^3.11.0":
version "3.11.0"
resolved "https://registry.yarnpkg.com/@lingui/loader/-/loader-3.11.0.tgz#3bdc602dfa3057cac5511a7f3799af415ebc8dde"
integrity sha512-JlmwW2zsCciiTi00NevYCAsHcA9CDd3dwjAP7TuKqKIoPCWHj8dwMKRP+yLiSqf+CpiLVh9NJbpqQWcriQpPeA==
dependencies:
"@babel/runtime" "^7.11.2"
"@lingui/cli" "^3.7.1"
"@lingui/conf" "^3.7.1"
"@lingui/cli" "^3.11.0"
"@lingui/conf" "^3.11.0"
loader-utils "^2.0.0"
ramda "^0.27.1"

"@lingui/macro@latest":
version "3.7.1"
resolved "https://registry.yarnpkg.com/@lingui/macro/-/macro-3.7.1.tgz#6d9d0c262e2841f4f329c9a31ec897f4d2fb0964"
integrity sha512-dQ5TIshKbDFoLkCdQZIGgZkwYmEjKrBi7toMtt1j2BF3sPkijFGa0eFKHZA/2QEbx/uqwv8TbzqpJ3OH7JTDSg==
"@lingui/macro@^3.11.0":
version "3.11.0"
resolved "https://registry.yarnpkg.com/@lingui/macro/-/macro-3.11.0.tgz#5cfb3aa79a2da3de328b86c92e5469a09b1a77d1"
integrity sha512-smCGrVOJrs4zNuAzGU9wWl3fBG5suKnfpyjtQ7U0NQrCEmaN2UpP5FQX4Jx64Bno4vhu17G6XISCv1QrkksQKw==
dependencies:
"@babel/runtime" "^7.11.2"
"@lingui/conf" "^3.7.1"
"@lingui/conf" "^3.11.0"
ramda "^0.27.1"

"@lingui/react@latest":
version "3.7.1"
resolved "https://registry.yarnpkg.com/@lingui/react/-/react-3.7.1.tgz#4f71ef7082405c90534ba8ea02284c9f5102401d"
integrity sha512-ZXs4RdJdfMAXBwxxZrw/Ytts6YqTSIR3VTbQ04yqPFmCBp1f1gsz4ejrN7oHhgrCiNImbT7UNK+byn2NnfbhVA==
"@lingui/react@^3.11.0":
version "3.11.0"
resolved "https://registry.yarnpkg.com/@lingui/react/-/react-3.11.0.tgz#5f292f29d93973d7d7d660bcf4e3eae2cd62e472"
integrity sha512-jPyghSCaEEfJeLam5fuNOOWxGzO2PfkCs4tRCCpSXadE/5qrB75kX5KzU78vH6pLmtAgwMlNlUFzTcec75JBVw==
dependencies:
"@babel/runtime" "^7.11.2"
"@lingui/core" "^3.7.1"
"@lingui/core" "^3.11.0"

"@nodelib/fs.scandir@2.1.3":
version "2.1.3"
Expand Down Expand Up @@ -2760,7 +2767,7 @@ babel-plugin-jest-hoist@^26.5.0:
"@types/babel__core" "^7.0.0"
"@types/babel__traverse" "^7.0.6"

babel-plugin-macros@2.8.0, babel-plugin-macros@^2.8.0:
babel-plugin-macros@2.8.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz#0f958a7cc6556b1e65344465d99111a1e5e10138"
integrity sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg==
Expand All @@ -2769,6 +2776,15 @@ babel-plugin-macros@2.8.0, babel-plugin-macros@^2.8.0:
cosmiconfig "^6.0.0"
resolve "^1.12.0"

babel-plugin-macros@^3.0.1:
version "3.1.0"
resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz#9ef6dc74deb934b4db344dc973ee851d148c50c1"
integrity sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==
dependencies:
"@babel/runtime" "^7.12.5"
cosmiconfig "^7.0.0"
resolve "^1.19.0"

babel-plugin-named-asset-import@^0.3.7:
version "0.3.7"
resolved "https://registry.yarnpkg.com/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.7.tgz#156cd55d3f1228a5765774340937afc8398067dd"
Expand Down Expand Up @@ -6282,6 +6298,13 @@ is-core-module@^2.0.0:
dependencies:
has "^1.0.3"

is-core-module@^2.2.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.6.0.tgz#d7553b2526fe59b92ba3e40c8df757ec8a709e19"
integrity sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==
dependencies:
has "^1.0.3"

is-data-descriptor@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56"
Expand Down Expand Up @@ -10043,6 +10066,14 @@ resolve@^1.10.0, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.3.2, resolve@^1.8.
dependencies:
path-parse "^1.0.6"

resolve@^1.19.0:
version "1.20.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975"
integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==
dependencies:
is-core-module "^2.2.0"
path-parse "^1.0.6"

restore-cursor@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e"
Expand Down
7 changes: 4 additions & 3 deletions packages/cli/src/api/extractors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ export default function extract(
if (typeof e === "string") {
// in case of the user using require.resolve in their extractors, we require that module
ext = require(e)
if ((ext as any).default) {
ext = (ext as any).default
}
}
if ((ext as any).default) {
ext = (ext as any).default
}

if (!ext.match(filename)) return false

let spinner
Expand Down
12 changes: 0 additions & 12 deletions packages/conf/src/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,6 @@ Object {
plugins: Array [],
presets: Array [],
},
extractors: Array [
Array [],
Array [
babel,
],
Array [
Object {
extract: [Function],
match: [Function],
},
],
],
fallbackLocales: Object {
en-gb: en,
},
Expand Down
Loading

1 comment on commit 1c6378d

@vercel
Copy link

@vercel vercel bot commented on 1c6378d Sep 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.