@lingui/cli 4.0.0 → 4.1.0
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.
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.js
CHANGED
|
@@ -13,8 +13,11 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.createCompiledCatalog = exports.getCatalogs = exports.getCatalogForFile = exports.getFormat = void 0;
|
|
20
|
+
exports.extractor = exports.createCompiledCatalog = exports.getCatalogs = exports.getCatalogForFile = exports.getFormat = void 0;
|
|
18
21
|
var formats_1 = require("./formats");
|
|
19
22
|
Object.defineProperty(exports, "getFormat", { enumerable: true, get: function () { return formats_1.getFormat; } });
|
|
20
23
|
var getCatalogs_1 = require("./catalog/getCatalogs");
|
|
@@ -22,4 +25,6 @@ Object.defineProperty(exports, "getCatalogForFile", { enumerable: true, get: fun
|
|
|
22
25
|
Object.defineProperty(exports, "getCatalogs", { enumerable: true, get: function () { return getCatalogs_1.getCatalogs; } });
|
|
23
26
|
var compile_1 = require("./compile");
|
|
24
27
|
Object.defineProperty(exports, "createCompiledCatalog", { enumerable: true, get: function () { return compile_1.createCompiledCatalog; } });
|
|
28
|
+
var babel_1 = require("./extractors/babel");
|
|
29
|
+
Object.defineProperty(exports, "extractor", { enumerable: true, get: function () { return __importDefault(babel_1).default; } });
|
|
25
30
|
__exportStar(require("./types"), exports);
|
package/dist/lingui-extract.js
CHANGED
|
@@ -44,9 +44,16 @@ async function command(config, options) {
|
|
|
44
44
|
config.service.name &&
|
|
45
45
|
config.service.name.length) {
|
|
46
46
|
const moduleName = config.service.name.charAt(0).toLowerCase() + config.service.name.slice(1);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
try {
|
|
48
|
+
const module = require(`./services/${moduleName}`);
|
|
49
|
+
await module
|
|
50
|
+
.default(config, options)
|
|
51
|
+
.then(console.log)
|
|
52
|
+
.catch(console.error);
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
console.error(`Can't load service module ${moduleName}`, err);
|
|
56
|
+
}
|
|
50
57
|
}
|
|
51
58
|
return commandSuccess;
|
|
52
59
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LinguiConfigNormalized } from "@lingui/conf";
|
|
2
2
|
import { CliExtractOptions } from "../lingui-extract";
|
|
3
|
-
export default function syncProcess(config: LinguiConfigNormalized, options: CliExtractOptions):
|
|
3
|
+
export default function syncProcess(config: LinguiConfigNormalized, options: CliExtractOptions): Promise<string>;
|
|
@@ -23,25 +23,27 @@ const getTargetLocales = (config) => {
|
|
|
23
23
|
return config.locales.filter((value) => value != sourceLocale && value != pseudoLocale);
|
|
24
24
|
};
|
|
25
25
|
// Main sync method, call "Init" or "Sync" depending on the project context
|
|
26
|
-
function syncProcess(config, options) {
|
|
26
|
+
async function syncProcess(config, options) {
|
|
27
27
|
if (config.format != "po") {
|
|
28
28
|
console.error(`\n----------\nTranslation.io service is only compatible with the "po" format. Please update your Lingui configuration accordingly.\n----------`);
|
|
29
29
|
process.exit(1);
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
errors
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
return await new Promise((resolve, reject) => {
|
|
32
|
+
const successCallback = (project) => {
|
|
33
|
+
resolve(`\n----------\nProject successfully synchronized. Please use this URL to translate: ${project.url}\n----------`);
|
|
34
|
+
};
|
|
35
|
+
const failCallback = (errors) => {
|
|
36
|
+
reject(`\n----------\nSynchronization with Translation.io failed: ${errors.join(", ")}\n----------`);
|
|
37
|
+
};
|
|
38
|
+
init(config, options, successCallback, (errors) => {
|
|
39
|
+
if (errors.length &&
|
|
40
|
+
errors[0] === "This project has already been initialized.") {
|
|
41
|
+
sync(config, options, successCallback, failCallback);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
failCallback(errors);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
45
47
|
});
|
|
46
48
|
}
|
|
47
49
|
exports.default = syncProcess;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "CLI for working wit message catalogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"@babel/parser": "^7.21.2",
|
|
53
53
|
"@babel/runtime": "^7.21.0",
|
|
54
54
|
"@babel/types": "^7.21.2",
|
|
55
|
-
"@lingui/babel-plugin-extract-messages": "4.
|
|
56
|
-
"@lingui/conf": "4.
|
|
57
|
-
"@lingui/core": "4.
|
|
58
|
-
"@lingui/format-po": "4.
|
|
59
|
-
"@lingui/message-utils": "4.
|
|
55
|
+
"@lingui/babel-plugin-extract-messages": "4.1.0",
|
|
56
|
+
"@lingui/conf": "4.1.0",
|
|
57
|
+
"@lingui/core": "4.1.0",
|
|
58
|
+
"@lingui/format-po": "4.1.0",
|
|
59
|
+
"@lingui/message-utils": "4.1.0",
|
|
60
60
|
"babel-plugin-macros": "^3.0.1",
|
|
61
61
|
"chalk": "^4.1.0",
|
|
62
62
|
"chokidar": "3.5.1",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@lingui/jest-mocks": "*",
|
|
81
|
-
"@lingui/macro": "4.
|
|
81
|
+
"@lingui/macro": "4.1.0",
|
|
82
82
|
"@types/convert-source-map": "^2.0.0",
|
|
83
83
|
"@types/glob": "^8.1.0",
|
|
84
84
|
"@types/micromatch": "^4.0.1",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"mock-fs": "^5.2.0",
|
|
87
87
|
"mockdate": "^3.0.5"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "471813c5de9ade3acccf647e18922b570a804577"
|
|
90
90
|
}
|