@tolgee/cli 1.0.2 → 1.1.1
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/README.md +11 -8
- package/dist/client/errors.js +1 -5
- package/dist/client/export.js +1 -4
- package/dist/client/import.js +5 -11
- package/dist/client/index.js +17 -23
- package/dist/client/internal/requester.js +14 -20
- package/dist/client/internal/schema.generated.js +1 -2
- package/dist/client/internal/schema.utils.js +1 -2
- package/dist/client/languages.js +1 -4
- package/dist/client/project.js +1 -4
- package/dist/commands/extract/check.js +11 -13
- package/dist/commands/extract/print.js +10 -12
- package/dist/commands/extract.js +8 -13
- package/dist/commands/login.js +16 -22
- package/dist/commands/pull.js +12 -14
- package/dist/commands/push.js +28 -30
- package/dist/commands/sync/compare.js +18 -23
- package/dist/commands/sync/sync.js +34 -39
- package/dist/commands/sync/syncUtils.js +10 -18
- package/dist/config/credentials.js +16 -25
- package/dist/config/tolgeerc.js +11 -14
- package/dist/constants.js +11 -18
- package/dist/extractor/extractor.js +59 -0
- package/dist/extractor/index.js +1 -2
- package/dist/extractor/machines/comments.js +78 -0
- package/dist/extractor/machines/react.js +37 -42
- package/dist/extractor/machines/shared/comments.js +3 -6
- package/dist/extractor/machines/shared/properties.js +60 -17
- package/dist/extractor/machines/svelte.js +490 -0
- package/dist/extractor/runner.js +8 -16
- package/dist/extractor/tokenizer.js +24 -20
- package/dist/extractor/warnings.js +9 -16
- package/dist/extractor/worker.js +23 -29
- package/dist/index.js +53 -58
- package/dist/options.js +14 -17
- package/dist/utils/ask.js +4 -12
- package/dist/utils/configPath.js +10 -10
- package/dist/utils/deferred.js +1 -5
- package/dist/utils/logger.js +8 -19
- package/dist/utils/moduleLoader.js +7 -14
- package/dist/utils/overwriteDir.js +13 -17
- package/dist/utils/zip.js +11 -16
- package/package.json +37 -28
- package/textmate/Svelte.tmLanguage +1084 -0
- package/textmate/THIRD_PARTY_NOTICE +13 -0
- package/textmate/TypeScript.tmLanguage +98 -90
- package/textmate/TypeScriptReact.tmLanguage +80 -72
- package/dist/extractor/presets/react.js +0 -29
package/dist/utils/zip.js
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
const promises_1 = require("fs/promises");
|
6
|
-
const path_1 = require("path");
|
7
|
-
const yauzl_1 = require("yauzl");
|
1
|
+
import { createWriteStream } from 'fs';
|
2
|
+
import { mkdir } from 'fs/promises';
|
3
|
+
import { join, dirname } from 'path';
|
4
|
+
import { fromBuffer } from 'yauzl';
|
8
5
|
const ZIP_PARSER_OPTS = {
|
9
6
|
strictFileNames: true,
|
10
7
|
decodeStrings: true,
|
@@ -14,7 +11,7 @@ function dumpFile(zip, entry, dest) {
|
|
14
11
|
zip.openReadStream(entry, (err, stream) => {
|
15
12
|
if (err)
|
16
13
|
throw err;
|
17
|
-
const writeStream =
|
14
|
+
const writeStream = createWriteStream(dest);
|
18
15
|
stream.pipe(writeStream);
|
19
16
|
// Unlock reading loop
|
20
17
|
stream.on('end', () => zip.readEntry());
|
@@ -26,11 +23,11 @@ function dumpFile(zip, entry, dest) {
|
|
26
23
|
* @param zipBlob The ZIP blob
|
27
24
|
* @param dest The destination path
|
28
25
|
*/
|
29
|
-
function unzipBuffer(zipBlob, dest) {
|
26
|
+
export function unzipBuffer(zipBlob, dest) {
|
30
27
|
return new Promise((resolve, reject) => {
|
31
28
|
zipBlob.arrayBuffer().then((buffer) => {
|
32
29
|
const nodeBuffer = Buffer.from(buffer);
|
33
|
-
|
30
|
+
fromBuffer(nodeBuffer, ZIP_PARSER_OPTS, (err, zip) => {
|
34
31
|
if (err) {
|
35
32
|
return reject(err);
|
36
33
|
}
|
@@ -39,14 +36,13 @@ function unzipBuffer(zipBlob, dest) {
|
|
39
36
|
});
|
40
37
|
});
|
41
38
|
}
|
42
|
-
exports.unzipBuffer = unzipBuffer;
|
43
39
|
/**
|
44
40
|
* Unzips a ZIP file loaded in memory to a destination on disk.
|
45
41
|
*
|
46
42
|
* @param file The ZIP file
|
47
43
|
* @param dest The destination path
|
48
44
|
*/
|
49
|
-
function unzip(zip, dest) {
|
45
|
+
export function unzip(zip, dest) {
|
50
46
|
// Enforce expected & security options.
|
51
47
|
// Lazy entries is what this reader is based upon.
|
52
48
|
// Decode strings ensures file paths are sanitized by yazul
|
@@ -68,11 +64,11 @@ function unzip(zip, dest) {
|
|
68
64
|
zip.readEntry();
|
69
65
|
return;
|
70
66
|
}
|
71
|
-
const entryPath =
|
67
|
+
const entryPath = join(dest, entry.fileName);
|
72
68
|
// Handle directory creation
|
73
|
-
const entryDirName =
|
69
|
+
const entryDirName = dirname(entryPath);
|
74
70
|
if (!seenDirectories.has(entryDirName)) {
|
75
|
-
|
71
|
+
mkdir(entryDirName, { recursive: true }).then(() => dumpFile(zip, entry, entryPath));
|
76
72
|
}
|
77
73
|
else {
|
78
74
|
dumpFile(zip, entry, entryPath);
|
@@ -80,4 +76,3 @@ function unzip(zip, dest) {
|
|
80
76
|
});
|
81
77
|
});
|
82
78
|
}
|
83
|
-
exports.unzip = unzip;
|
package/package.json
CHANGED
@@ -1,25 +1,29 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tolgee/cli",
|
3
|
-
"version": "1.
|
4
|
-
"type": "
|
3
|
+
"version": "1.1.1",
|
4
|
+
"type": "module",
|
5
5
|
"description": "A tool to interact with the Tolgee Platform through CLI",
|
6
|
+
"repository": {
|
7
|
+
"type": "git",
|
8
|
+
"url": "https://github.com/tolgee/tolgee-cli.git"
|
9
|
+
},
|
6
10
|
"bin": {
|
7
11
|
"tolgee": "./dist/index.js"
|
8
12
|
},
|
9
13
|
"scripts": {
|
10
14
|
"build": "rimraf dist dist-types && tsc && cp dist-types/extractor/index.d.ts extractor.d.ts",
|
11
15
|
"test": "npm run test:unit && npm run test:e2e && npm run test:package",
|
12
|
-
"test:unit": "jest -c jest.unit.config.ts",
|
13
|
-
"pretest:e2e": "npm run tolgee:start",
|
16
|
+
"test:unit": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest -c jest.unit.config.ts",
|
17
|
+
"pretest:e2e": "npm run build && npm run tolgee:start",
|
14
18
|
"posttest:e2e": "npm run tolgee:stop",
|
15
|
-
"test:e2e": "jest -c jest.e2e.config.ts --runInBand",
|
16
|
-
"test:e2e-run": "jest -c jest.e2e.config.ts --runInBand",
|
17
|
-
"test:package": "node scripts/validatePackage.
|
18
|
-
"tolgee:start": "node scripts/startDocker.
|
19
|
+
"test:e2e": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest -c jest.e2e.config.ts --runInBand",
|
20
|
+
"test:e2e-run": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest -c jest.e2e.config.ts --runInBand",
|
21
|
+
"test:package": "node scripts/validatePackage.js",
|
22
|
+
"tolgee:start": "node scripts/startDocker.js",
|
19
23
|
"tolgee:stop": "docker stop tolgee_cli_e2e",
|
20
|
-
"lint": "
|
24
|
+
"lint": "eslint --ext .ts --ext .js --ext .cjs ./src ./test ./scripts jest.config.ts jest.*.config.ts",
|
21
25
|
"prettier": "prettier --write ./src ./test ./scripts jest.config.ts jest.*.config.ts",
|
22
|
-
"run-dev": "ts-node ./src/index.ts",
|
26
|
+
"run-dev": "cross-env NODE_OPTIONS=\"--loader=ts-node/esm\" node ./src/index.ts",
|
23
27
|
"schema": "openapi-typescript http://localhost:22222/v3/api-docs/All%20Internal%20-%20for%20Tolgee%20Web%20application --output src/client/internal/schema.generated.ts",
|
24
28
|
"release": "semantic-release"
|
25
29
|
},
|
@@ -28,33 +32,38 @@
|
|
28
32
|
"dependencies": {
|
29
33
|
"ansi-colors": "^4.1.3",
|
30
34
|
"base32-decode": "^1.0.0",
|
31
|
-
"commander": "^10.0.
|
32
|
-
"cosmiconfig": "^8.
|
35
|
+
"commander": "^10.0.1",
|
36
|
+
"cosmiconfig": "^8.1.3",
|
33
37
|
"form-data": "^4.0.0",
|
34
|
-
"glob": "^
|
38
|
+
"glob": "^10.2.5",
|
35
39
|
"json5": "^2.2.3",
|
36
|
-
"undici": "^5.
|
40
|
+
"undici": "^5.22.1",
|
37
41
|
"vscode-oniguruma": "^1.7.0",
|
38
|
-
"vscode-textmate": "^
|
39
|
-
"xstate": "^4.
|
42
|
+
"vscode-textmate": "^9.0.0",
|
43
|
+
"xstate": "^4.37.2",
|
40
44
|
"yauzl": "^2.10.0"
|
41
45
|
},
|
42
46
|
"devDependencies": {
|
43
|
-
"@
|
44
|
-
"@semantic-release/changelog": "^6.0.2",
|
47
|
+
"@semantic-release/changelog": "^6.0.3",
|
45
48
|
"@semantic-release/git": "^10.0.1",
|
46
|
-
"@types/
|
47
|
-
"@types/
|
48
|
-
"@types/node": "^18.11.18",
|
49
|
+
"@types/jest": "^29.5.1",
|
50
|
+
"@types/node": "^20.2.1",
|
49
51
|
"@types/yauzl": "^2.10.0",
|
50
|
-
"
|
51
|
-
"
|
52
|
-
"
|
53
|
-
"
|
54
|
-
"
|
55
|
-
"
|
52
|
+
"@typescript-eslint/eslint-plugin": "^5.59.6",
|
53
|
+
"@typescript-eslint/parser": "^5.59.6",
|
54
|
+
"cross-env": "^7.0.3",
|
55
|
+
"eslint": "^8.40.0",
|
56
|
+
"eslint-plugin-jest": "^27.2.1",
|
57
|
+
"eslint-plugin-prettier": "^4.2.1",
|
58
|
+
"jest": "^29.5.0",
|
59
|
+
"js-yaml": "^4.1.0",
|
60
|
+
"openapi-typescript": "^6.2.4",
|
61
|
+
"prettier": "^2.8.8",
|
62
|
+
"rimraf": "^5.0.1",
|
63
|
+
"semantic-release": "^21.0.2",
|
64
|
+
"ts-jest": "^29.1.0",
|
56
65
|
"ts-node": "^10.9.1",
|
57
|
-
"typescript": "^
|
66
|
+
"typescript": "^5.0.4"
|
58
67
|
},
|
59
68
|
"engines": {
|
60
69
|
"node": ">= 18"
|