@codeleap/cli 5.8.20 → 6.0.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/dist/commands/configureSplash/utils.js +2 -3
- package/dist/commands/configureTheme/utils.js +7 -7
- package/dist/commands/convertorWebp.js +77 -12
- package/dist/commands/createComponent/utils.js +7 -8
- package/dist/commands/downloadKeystores.js +17 -19
- package/dist/commands/keystoresAndroid.js +10 -12
- package/dist/commands/linguiTranslate.js +104 -106
- package/dist/index.js +2 -2
- package/dist/lib/android/keystore.js +3 -3
- package/dist/lib/android/rename.js +1 -2
- package/dist/lib/createApp/common.js +1 -2
- package/dist/lib/createApp/mobile.js +1 -2
- package/dist/lib/firebase.js +1 -2
- package/dist/lib/ios/rename.js +1 -2
- package/dist/lib/spinner.js +1 -2
- package/dist/lib/utils.js +5 -5
- package/dist/lib/walk.js +1 -2
- package/dist/utils/misc.js +5 -6
- package/package.json +2 -2
- package/package.json.bak +1 -1
|
@@ -36,7 +36,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.syncSplash = syncSplash;
|
|
40
|
+
exports.syncLaunchScreen = syncLaunchScreen;
|
|
40
41
|
var constants_1 = require("../../constants");
|
|
41
42
|
var lib_1 = require("../../lib");
|
|
42
43
|
var iosName = constants_1.USER_CONFIG.splash.iosAppName;
|
|
@@ -90,7 +91,6 @@ function syncSplash() {
|
|
|
90
91
|
});
|
|
91
92
|
});
|
|
92
93
|
}
|
|
93
|
-
exports.syncSplash = syncSplash;
|
|
94
94
|
function syncLaunchScreen() {
|
|
95
95
|
return __awaiter(this, void 0, void 0, function () {
|
|
96
96
|
return __generator(this, function (_a) {
|
|
@@ -119,4 +119,3 @@ function syncLaunchScreen() {
|
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
exports.syncLaunchScreen = syncLaunchScreen;
|
|
@@ -36,7 +36,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
36
36
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.transformObj = exports.replaceDoubleQuotesWithSingle = void 0;
|
|
40
|
+
exports.createThemeFile = createThemeFile;
|
|
41
|
+
exports.transformMeasure = transformMeasure;
|
|
42
|
+
exports.resolveMeasure = resolveMeasure;
|
|
43
|
+
exports.resolveContextColors = resolveContextColors;
|
|
44
|
+
exports.transformGlobalColors = transformGlobalColors;
|
|
45
|
+
exports.resolveGlobalColors = resolveGlobalColors;
|
|
40
46
|
var constants_1 = require("../../constants");
|
|
41
47
|
var lib_1 = require("../../lib");
|
|
42
48
|
var utils_1 = require("../../utils");
|
|
@@ -60,7 +66,6 @@ function createThemeFile(options) {
|
|
|
60
66
|
lib_1.fs.writeFileSync(lib_1.path.resolve(basePath, "".concat(fileName, ".ts")), TSContent);
|
|
61
67
|
return content;
|
|
62
68
|
}
|
|
63
|
-
exports.createThemeFile = createThemeFile;
|
|
64
69
|
function parseColor(color) {
|
|
65
70
|
if (typeof color !== 'object')
|
|
66
71
|
return null;
|
|
@@ -100,7 +105,6 @@ function transformMeasure(shape) {
|
|
|
100
105
|
return acc;
|
|
101
106
|
}, {});
|
|
102
107
|
}
|
|
103
|
-
exports.transformMeasure = transformMeasure;
|
|
104
108
|
function resolveMeasure() {
|
|
105
109
|
try {
|
|
106
110
|
var measuresTokens = (0, utils_1.resolveJSON)(function (config) { return config.theme.assets.measureTokens; });
|
|
@@ -111,7 +115,6 @@ function resolveMeasure() {
|
|
|
111
115
|
return {};
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
|
-
exports.resolveMeasure = resolveMeasure;
|
|
115
118
|
// Context Colors
|
|
116
119
|
function transformContextColors(shape) {
|
|
117
120
|
var e_1, _a;
|
|
@@ -173,7 +176,6 @@ function resolveContextColors() {
|
|
|
173
176
|
return {};
|
|
174
177
|
}
|
|
175
178
|
}
|
|
176
|
-
exports.resolveContextColors = resolveContextColors;
|
|
177
179
|
// Global colors
|
|
178
180
|
function transformGlobalColors(shape) {
|
|
179
181
|
return Object.fromEntries(shape.variables.reduce(function (acc, variable) {
|
|
@@ -184,7 +186,6 @@ function transformGlobalColors(shape) {
|
|
|
184
186
|
return acc;
|
|
185
187
|
}, []));
|
|
186
188
|
}
|
|
187
|
-
exports.transformGlobalColors = transformGlobalColors;
|
|
188
189
|
function resolveGlobalColors() {
|
|
189
190
|
try {
|
|
190
191
|
var globalColors = (0, utils_1.resolveJSON)(function (config) { return config.theme.assets.globalColors; });
|
|
@@ -195,4 +196,3 @@ function resolveGlobalColors() {
|
|
|
195
196
|
return {};
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
|
-
exports.resolveGlobalColors = resolveGlobalColors;
|
|
@@ -53,7 +53,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
53
53
|
exports.convertorWebpCommand = void 0;
|
|
54
54
|
var Command_1 = require("../lib/Command");
|
|
55
55
|
var fs_1 = __importDefault(require("fs"));
|
|
56
|
-
|
|
56
|
+
var path_1 = __importDefault(require("path"));
|
|
57
|
+
var sharp_1 = __importDefault(require("sharp"));
|
|
57
58
|
var lib_1 = require("../lib");
|
|
58
59
|
require("../lib/firebase");
|
|
59
60
|
var constants_1 = require("../constants");
|
|
@@ -68,11 +69,11 @@ exports.convertorWebpCommand = (0, Command_1.codeleapCommand)({
|
|
|
68
69
|
],
|
|
69
70
|
},
|
|
70
71
|
}, function (argv) { return __awaiter(void 0, void 0, void 0, function () {
|
|
71
|
-
var flags, _, settings, isMultipleConversion, isSingleConversion, filename, answers, files, inputFiles, _loop_1, inputFiles_1, inputFiles_1_1, inputFile;
|
|
72
|
-
var e_1,
|
|
73
|
-
var
|
|
74
|
-
return __generator(this, function (
|
|
75
|
-
switch (
|
|
72
|
+
var flags, _, settings, isMultipleConversion, isSingleConversion, filename, answers, files, inputFiles, _loop_1, inputFiles_1, inputFiles_1_1, inputFile, _loop_2, files_1, files_1_1, file, e_1_1;
|
|
73
|
+
var e_2, _a, e_1, _b;
|
|
74
|
+
var _c, _d, _e, _f, _g;
|
|
75
|
+
return __generator(this, function (_h) {
|
|
76
|
+
switch (_h.label) {
|
|
76
77
|
case 0:
|
|
77
78
|
flags = argv.flags, _ = argv._;
|
|
78
79
|
settings = constants_1.USER_CONFIG['convertor-webp'];
|
|
@@ -87,9 +88,9 @@ exports.convertorWebpCommand = (0, Command_1.codeleapCommand)({
|
|
|
87
88
|
},
|
|
88
89
|
])];
|
|
89
90
|
case 1:
|
|
90
|
-
answers =
|
|
91
|
+
answers = _h.sent();
|
|
91
92
|
filename = answers.filename;
|
|
92
|
-
|
|
93
|
+
_h.label = 2;
|
|
93
94
|
case 2:
|
|
94
95
|
console.log('Starting conversion', settings);
|
|
95
96
|
if (!fs_1.default.existsSync(settings.output)) {
|
|
@@ -109,7 +110,7 @@ exports.convertorWebpCommand = (0, Command_1.codeleapCommand)({
|
|
|
109
110
|
inputFiles = fs_1.default.readdirSync(settings.input);
|
|
110
111
|
if (isMultipleConversion) {
|
|
111
112
|
_loop_1 = function (inputFile) {
|
|
112
|
-
var isCorrectFormat = (
|
|
113
|
+
var isCorrectFormat = (_d = (_c = settings === null || settings === void 0 ? void 0 : settings.convertor) === null || _c === void 0 ? void 0 : _c.inputFormats) === null || _d === void 0 ? void 0 : _d.some(function (_format) { return inputFile === null || inputFile === void 0 ? void 0 : inputFile.endsWith(_format); });
|
|
113
114
|
var isIgnoredFile = settings.convertor.ignoreFiles.includes(inputFile === null || inputFile === void 0 ? void 0 : inputFile.split('.')[0]);
|
|
114
115
|
if (isCorrectFormat && !isIgnoredFile) {
|
|
115
116
|
files.push(inputFile);
|
|
@@ -121,12 +122,12 @@ exports.convertorWebpCommand = (0, Command_1.codeleapCommand)({
|
|
|
121
122
|
_loop_1(inputFile);
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
|
-
catch (
|
|
125
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
125
126
|
finally {
|
|
126
127
|
try {
|
|
127
128
|
if (inputFiles_1_1 && !inputFiles_1_1.done && (_a = inputFiles_1.return)) _a.call(inputFiles_1);
|
|
128
129
|
}
|
|
129
|
-
finally { if (
|
|
130
|
+
finally { if (e_2) throw e_2.error; }
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
else {
|
|
@@ -144,7 +145,71 @@ exports.convertorWebpCommand = (0, Command_1.codeleapCommand)({
|
|
|
144
145
|
process.exit(1);
|
|
145
146
|
}
|
|
146
147
|
console.log('Files to convert', files);
|
|
147
|
-
|
|
148
|
+
_loop_2 = function (file) {
|
|
149
|
+
var inputPath, outputPath, img, img_metadata, imageProcessing, needResize, newWidth, newHeight, hasAlfaChannels;
|
|
150
|
+
return __generator(this, function (_j) {
|
|
151
|
+
switch (_j.label) {
|
|
152
|
+
case 0:
|
|
153
|
+
inputPath = path_1.default.join(settings.input, file);
|
|
154
|
+
outputPath = path_1.default.join(settings.output, path_1.default.parse(file).name + '.webp');
|
|
155
|
+
if (fs_1.default.existsSync(outputPath)) {
|
|
156
|
+
fs_1.default.unlinkSync(outputPath);
|
|
157
|
+
}
|
|
158
|
+
img = (0, sharp_1.default)(inputPath);
|
|
159
|
+
return [4 /*yield*/, img.metadata()];
|
|
160
|
+
case 1:
|
|
161
|
+
img_metadata = _j.sent();
|
|
162
|
+
imageProcessing = img.webp({ quality: Number((_e = settings === null || settings === void 0 ? void 0 : settings.convertor) === null || _e === void 0 ? void 0 : _e.compressionQuality) });
|
|
163
|
+
needResize = (img_metadata === null || img_metadata === void 0 ? void 0 : img_metadata.width) && (img_metadata === null || img_metadata === void 0 ? void 0 : img_metadata.width) > ((_f = settings === null || settings === void 0 ? void 0 : settings.convertor) === null || _f === void 0 ? void 0 : _f.resizeWidth);
|
|
164
|
+
if (needResize) {
|
|
165
|
+
newWidth = parseInt(String((_g = settings === null || settings === void 0 ? void 0 : settings.convertor) === null || _g === void 0 ? void 0 : _g.resizeWidth));
|
|
166
|
+
newHeight = parseInt(String(img_metadata.height * (newWidth / img_metadata.width)));
|
|
167
|
+
imageProcessing = imageProcessing.resize({ width: newWidth, height: newHeight });
|
|
168
|
+
}
|
|
169
|
+
hasAlfaChannels = img_metadata.channels && img_metadata.channels >= 4;
|
|
170
|
+
if (hasAlfaChannels && !!settings.convertor.processColorChannels) {
|
|
171
|
+
imageProcessing = imageProcessing.toColorspace('srgb');
|
|
172
|
+
}
|
|
173
|
+
imageProcessing.toFile(outputPath, function (err, info) {
|
|
174
|
+
if (err) {
|
|
175
|
+
console.error("Error converting ".concat(file, " to webP"), err);
|
|
176
|
+
process.exit(1);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
console.log("Image ".concat(file, " converted to webP"), info);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
return [2 /*return*/];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
_h.label = 3;
|
|
187
|
+
case 3:
|
|
188
|
+
_h.trys.push([3, 8, 9, 10]);
|
|
189
|
+
files_1 = __values(files), files_1_1 = files_1.next();
|
|
190
|
+
_h.label = 4;
|
|
191
|
+
case 4:
|
|
192
|
+
if (!!files_1_1.done) return [3 /*break*/, 7];
|
|
193
|
+
file = files_1_1.value;
|
|
194
|
+
return [5 /*yield**/, _loop_2(file)];
|
|
195
|
+
case 5:
|
|
196
|
+
_h.sent();
|
|
197
|
+
_h.label = 6;
|
|
198
|
+
case 6:
|
|
199
|
+
files_1_1 = files_1.next();
|
|
200
|
+
return [3 /*break*/, 4];
|
|
201
|
+
case 7: return [3 /*break*/, 10];
|
|
202
|
+
case 8:
|
|
203
|
+
e_1_1 = _h.sent();
|
|
204
|
+
e_1 = { error: e_1_1 };
|
|
205
|
+
return [3 /*break*/, 10];
|
|
206
|
+
case 9:
|
|
207
|
+
try {
|
|
208
|
+
if (files_1_1 && !files_1_1.done && (_b = files_1.return)) _b.call(files_1);
|
|
209
|
+
}
|
|
210
|
+
finally { if (e_1) throw e_1.error; }
|
|
211
|
+
return [7 /*endfinally*/];
|
|
212
|
+
case 10: return [2 /*return*/];
|
|
148
213
|
}
|
|
149
214
|
});
|
|
150
215
|
}); });
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.capitalize = capitalize;
|
|
4
|
+
exports.formatComponentName = formatComponentName;
|
|
5
|
+
exports.generateComponentFile = generateComponentFile;
|
|
6
|
+
exports.generateStylesheetFile = generateStylesheetFile;
|
|
7
|
+
exports.createFile = createFile;
|
|
8
|
+
exports.updateStylesheetsImport = updateStylesheetsImport;
|
|
9
|
+
exports.updateComponentsImport = updateComponentsImport;
|
|
4
10
|
var lib_1 = require("../../lib");
|
|
5
11
|
function capitalize(name) {
|
|
6
12
|
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
7
13
|
}
|
|
8
|
-
exports.capitalize = capitalize;
|
|
9
14
|
function formatComponentName(name) {
|
|
10
15
|
return capitalize(name.charAt(0).toUpperCase() + name.slice(1));
|
|
11
16
|
}
|
|
12
|
-
exports.formatComponentName = formatComponentName;
|
|
13
17
|
function generateComponentFile(componentName, app) {
|
|
14
18
|
var rootDir = app === 'web' ? '@/config' : '@/app';
|
|
15
19
|
return "import { React, StyleRegistry, StyleSheets } from '".concat(rootDir, "'\nimport { StyledComponent } from '@codeleap/styles'\nimport { useStylesFor } from '@codeleap/").concat(app, "'\n\ntype ").concat(componentName, "Props = {\n \n}\n\nexport const ").concat(componentName, ": StyledComponent<typeof StyleSheets.").concat(componentName, "Styles, ").concat(componentName, "Props> = (props) => {\n const { style } = props\n\n const styles = useStylesFor(").concat(componentName, ".styleRegistryName, style)\n\n return null\n}\n\n").concat(componentName, ".styleRegistryName = '").concat(componentName, "'\n").concat(componentName, ".elements = ['wrapper']\n\nStyleRegistry.registerComponent(").concat(componentName, ")\n");
|
|
16
20
|
}
|
|
17
|
-
exports.generateComponentFile = generateComponentFile;
|
|
18
21
|
function generateStylesheetFile(componentName, app) {
|
|
19
22
|
return "import { createStyles } from '@codeleap/styles'\nimport { StyleRegistry } from '../styles'\n\nexport type ".concat(componentName, "Composition = ''\n\nconst create").concat(componentName, "Variant = createStyles<").concat(componentName, "Composition>\n\nexport const ").concat(componentName, "Styles = {\n default: create").concat(componentName, "Variant(theme => ({})),\n}\n\nStyleRegistry.registerVariants('").concat(componentName, "', ").concat(componentName, "Styles)\n");
|
|
20
23
|
}
|
|
21
|
-
exports.generateStylesheetFile = generateStylesheetFile;
|
|
22
24
|
function createFile(_a) {
|
|
23
25
|
var dir = _a.dir, filePath = _a.filePath, content = _a.content, fileName = _a.fileName;
|
|
24
26
|
if (lib_1.fs.existsSync(filePath)) {
|
|
@@ -32,7 +34,6 @@ function createFile(_a) {
|
|
|
32
34
|
lib_1.fs.writeFileSync(filePath, content, 'utf-8');
|
|
33
35
|
console.log("\u2705 ".concat(fileName, " created successfully at: ").concat(filePath));
|
|
34
36
|
}
|
|
35
|
-
exports.createFile = createFile;
|
|
36
37
|
function updateStylesheetsImport(stylesheetsDir, componentName) {
|
|
37
38
|
var indexTsPath = "".concat(stylesheetsDir, "/index.ts");
|
|
38
39
|
var indexTsxPath = "".concat(stylesheetsDir, "/index.tsx");
|
|
@@ -53,7 +54,6 @@ function updateStylesheetsImport(stylesheetsDir, componentName) {
|
|
|
53
54
|
lib_1.fs.writeFileSync(indexPath, updatedContent, 'utf-8');
|
|
54
55
|
console.log("\u2705 Added export for ".concat(componentName, "Styles to ").concat(indexPath));
|
|
55
56
|
}
|
|
56
|
-
exports.updateStylesheetsImport = updateStylesheetsImport;
|
|
57
57
|
function updateComponentsImport(componentsDir, componentFolder, componentName) {
|
|
58
58
|
var indexTsPath = lib_1.path.join(componentsDir, 'index.ts');
|
|
59
59
|
var indexTsxPath = lib_1.path.join(componentsDir, 'index.tsx');
|
|
@@ -98,4 +98,3 @@ function updateComponentsImport(componentsDir, componentFolder, componentName) {
|
|
|
98
98
|
lib_1.fs.writeFileSync(componentIndexPath, componentUpdatedContent, 'utf-8');
|
|
99
99
|
console.log("\u2705 Added export for ".concat(componentName, " to ").concat(componentIndexPath));
|
|
100
100
|
}
|
|
101
|
-
exports.updateComponentsImport = updateComponentsImport;
|
|
@@ -45,23 +45,21 @@ exports.downloadKeystores = (0, Command_1.codeleapCommand)({
|
|
|
45
45
|
parameters: [
|
|
46
46
|
'[branch]'
|
|
47
47
|
],
|
|
48
|
-
}, function (_a) {
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
});
|
|
48
|
+
}, function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
49
|
+
var dir;
|
|
50
|
+
var _ = _b._;
|
|
51
|
+
return __generator(this, function (_c) {
|
|
52
|
+
switch (_c.label) {
|
|
53
|
+
case 0:
|
|
54
|
+
dir = lib_1.path.join(constants_1.cwd, 'android', 'app', 'keystores');
|
|
55
|
+
lib_1.fs.rmSync(dir, {
|
|
56
|
+
recursive: true,
|
|
57
|
+
force: true
|
|
58
|
+
});
|
|
59
|
+
return [4 /*yield*/, lib_1.git.raw('clone', "https://".concat(constants_1.USER_CONFIG.GITHUB_TOKEN, "@github.com/codeleap-uk/keystores-android.git"), '-b', _.branch, dir)];
|
|
60
|
+
case 1:
|
|
61
|
+
_c.sent();
|
|
62
|
+
return [2 /*return*/];
|
|
63
|
+
}
|
|
66
64
|
});
|
|
67
|
-
});
|
|
65
|
+
}); });
|
|
@@ -43,16 +43,14 @@ exports.generateReleaseKey = (0, Command_1.codeleapCommand)({
|
|
|
43
43
|
name: 'keystores-android',
|
|
44
44
|
parameters: [],
|
|
45
45
|
alias: 'i',
|
|
46
|
-
}, function (_a) {
|
|
47
|
-
var _ =
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
});
|
|
46
|
+
}, function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
47
|
+
var _ = _b._;
|
|
48
|
+
return __generator(this, function (_c) {
|
|
49
|
+
switch (_c.label) {
|
|
50
|
+
case 0: return [4 /*yield*/, (0, keystore_1.generateReleaseKeystore)()];
|
|
51
|
+
case 1:
|
|
52
|
+
_c.sent();
|
|
53
|
+
return [2 /*return*/];
|
|
54
|
+
}
|
|
57
55
|
});
|
|
58
|
-
});
|
|
56
|
+
}); });
|
|
@@ -113,110 +113,108 @@ exports.linguiTranslateCommand = (0, Command_1.codeleapCommand)({
|
|
|
113
113
|
help: {
|
|
114
114
|
description: 'Translate app locales',
|
|
115
115
|
},
|
|
116
|
-
}, function (_a) {
|
|
117
|
-
var
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
});
|
|
116
|
+
}, function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
117
|
+
var bar, quotesRegex, baseLanguage, locales, basePoContent, finished;
|
|
118
|
+
var _ = _b._;
|
|
119
|
+
return __generator(this, function (_c) {
|
|
120
|
+
switch (_c.label) {
|
|
121
|
+
case 0:
|
|
122
|
+
console.log("Starting translation process, this may take some time");
|
|
123
|
+
bar = new cli_progress_1.default.SingleBar({}, cli_progress_1.default.Presets.shades_classic);
|
|
124
|
+
quotesRegex = /msgstr\s+"(.*?)"/;
|
|
125
|
+
baseLanguage = constants_1.USER_CONFIG.translate.baseLanguage;
|
|
126
|
+
locales = (0, utils_1.resolveDir)(function (config) { return config.translate.localesDir; }).filter(function (l) { return l.endsWith('.po'); });
|
|
127
|
+
basePoContent = (0, utils_1.resolveFile)(function (config) { return [config.translate.localesDir, baseLanguage + '.po']; }).split('\n');
|
|
128
|
+
bar.start(basePoContent.length, 0);
|
|
129
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
|
|
130
|
+
var _loop_1, locales_1, locales_1_1, po, e_1_1;
|
|
131
|
+
var e_1, _a;
|
|
132
|
+
return __generator(this, function (_b) {
|
|
133
|
+
switch (_b.label) {
|
|
134
|
+
case 0:
|
|
135
|
+
_loop_1 = function (po) {
|
|
136
|
+
var language, poContent, updatedPoContent, i, currentLanguageLine, baseLanguageLine, hadTranslated, isNotTextLine, text, translatedText;
|
|
137
|
+
return __generator(this, function (_c) {
|
|
138
|
+
switch (_c.label) {
|
|
139
|
+
case 0:
|
|
140
|
+
bar.update(0);
|
|
141
|
+
language = po.split('.')[0];
|
|
142
|
+
if (language === baseLanguage)
|
|
143
|
+
return [2 /*return*/, "continue"];
|
|
144
|
+
console.log("\nTranslating locale: ".concat(language));
|
|
145
|
+
poContent = (0, utils_1.resolveFile)(function (config) { return [config.translate.localesDir, po]; }).split('\n');
|
|
146
|
+
updatedPoContent = __spreadArray([], __read(poContent), false);
|
|
147
|
+
i = 0;
|
|
148
|
+
_c.label = 1;
|
|
149
|
+
case 1:
|
|
150
|
+
if (!(i < basePoContent.length)) return [3 /*break*/, 4];
|
|
151
|
+
currentLanguageLine = poContent[i];
|
|
152
|
+
baseLanguageLine = basePoContent[i];
|
|
153
|
+
hadTranslated = !currentLanguageLine.includes('""');
|
|
154
|
+
isNotTextLine = !currentLanguageLine.includes('msgstr');
|
|
155
|
+
if (isNotTextLine || hadTranslated)
|
|
156
|
+
return [3 /*break*/, 3];
|
|
157
|
+
text = baseLanguageLine.match(quotesRegex)[1];
|
|
158
|
+
return [4 /*yield*/, translate(text, { from: baseLanguage, to: language })];
|
|
159
|
+
case 2:
|
|
160
|
+
translatedText = _c.sent();
|
|
161
|
+
if (translatedText) {
|
|
162
|
+
updatedPoContent[i] = currentLanguageLine.replace(quotesRegex, "msgstr \"".concat(translatedText, "\""));
|
|
163
|
+
}
|
|
164
|
+
bar.update(i + 1);
|
|
165
|
+
_c.label = 3;
|
|
166
|
+
case 3:
|
|
167
|
+
i++;
|
|
168
|
+
return [3 /*break*/, 1];
|
|
169
|
+
case 4:
|
|
170
|
+
if (!testEnabled) {
|
|
171
|
+
(0, utils_1.writeFile)(function (config) { return [config.translate.localesDir, po]; }, updatedPoContent.join('\n'));
|
|
172
|
+
}
|
|
173
|
+
bar.increment();
|
|
174
|
+
console.log("\nCompleted translation locale: ".concat(language));
|
|
175
|
+
return [2 /*return*/];
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
_b.label = 1;
|
|
180
|
+
case 1:
|
|
181
|
+
_b.trys.push([1, 6, 7, 8]);
|
|
182
|
+
locales_1 = __values(locales), locales_1_1 = locales_1.next();
|
|
183
|
+
_b.label = 2;
|
|
184
|
+
case 2:
|
|
185
|
+
if (!!locales_1_1.done) return [3 /*break*/, 5];
|
|
186
|
+
po = locales_1_1.value;
|
|
187
|
+
return [5 /*yield**/, _loop_1(po)];
|
|
188
|
+
case 3:
|
|
189
|
+
_b.sent();
|
|
190
|
+
_b.label = 4;
|
|
191
|
+
case 4:
|
|
192
|
+
locales_1_1 = locales_1.next();
|
|
193
|
+
return [3 /*break*/, 2];
|
|
194
|
+
case 5: return [3 /*break*/, 8];
|
|
195
|
+
case 6:
|
|
196
|
+
e_1_1 = _b.sent();
|
|
197
|
+
e_1 = { error: e_1_1 };
|
|
198
|
+
return [3 /*break*/, 8];
|
|
199
|
+
case 7:
|
|
200
|
+
try {
|
|
201
|
+
if (locales_1_1 && !locales_1_1.done && (_a = locales_1.return)) _a.call(locales_1);
|
|
202
|
+
}
|
|
203
|
+
finally { if (e_1) throw e_1.error; }
|
|
204
|
+
return [7 /*endfinally*/];
|
|
205
|
+
case 8:
|
|
206
|
+
setTimeout(function () { return resolve(true); }, 1000);
|
|
207
|
+
return [2 /*return*/];
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}); })];
|
|
211
|
+
case 1:
|
|
212
|
+
finished = _c.sent();
|
|
213
|
+
if (finished) {
|
|
214
|
+
console.log("\nAll translations completed successfully");
|
|
215
|
+
process.exit(0);
|
|
216
|
+
}
|
|
217
|
+
return [2 /*return*/];
|
|
218
|
+
}
|
|
221
219
|
});
|
|
222
|
-
});
|
|
220
|
+
}); });
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var downloadKeystores_1 = require("./commands/downloadKeystores");
|
|
|
8
8
|
var keystoresAndroid_1 = require("./commands/keystoresAndroid");
|
|
9
9
|
var rename_1 = require("./commands/rename");
|
|
10
10
|
var syncIcons_1 = require("./commands/syncIcons");
|
|
11
|
-
|
|
11
|
+
var convertorWebp_1 = require("./commands/convertorWebp");
|
|
12
12
|
var configureTheme_1 = require("./commands/configureTheme");
|
|
13
13
|
var linguiTranslate_1 = require("./commands/linguiTranslate");
|
|
14
14
|
var configureSplash_1 = require("./commands/configureSplash");
|
|
@@ -25,7 +25,7 @@ var packageJson = require('../package.json');
|
|
|
25
25
|
configure_1.configureCommand,
|
|
26
26
|
downloadKeystores_1.downloadKeystores,
|
|
27
27
|
syncIcons_1.syncIconsCommand,
|
|
28
|
-
|
|
28
|
+
convertorWebp_1.convertorWebpCommand,
|
|
29
29
|
configureTheme_1.configureThemeCommand,
|
|
30
30
|
linguiTranslate_1.linguiTranslateCommand,
|
|
31
31
|
configureSplash_1.configureSplashCommand,
|
|
@@ -67,10 +67,10 @@ var AndroidConfigFile = /** @class */ (function () {
|
|
|
67
67
|
return AndroidConfigFile;
|
|
68
68
|
}());
|
|
69
69
|
exports.AndroidConfigFile = AndroidConfigFile;
|
|
70
|
-
function genKeystore(
|
|
71
|
-
|
|
72
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
+
function genKeystore(type_1) {
|
|
71
|
+
return __awaiter(this, arguments, void 0, function (type, _cwd) {
|
|
73
72
|
var pass, alias, fileName;
|
|
73
|
+
if (_cwd === void 0) { _cwd = constants_1.cwd; }
|
|
74
74
|
return __generator(this, function (_a) {
|
|
75
75
|
switch (_a.label) {
|
|
76
76
|
case 0:
|
|
@@ -86,7 +86,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
86
86
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
87
87
|
};
|
|
88
88
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89
|
-
exports.renameAndroid =
|
|
89
|
+
exports.renameAndroid = renameAndroid;
|
|
90
90
|
/* eslint-disable handle-callback-err */
|
|
91
91
|
var utils_1 = require("../utils");
|
|
92
92
|
var utils_2 = require("./utils");
|
|
@@ -267,4 +267,3 @@ function renameAndroid(androidFolder, newName, options) {
|
|
|
267
267
|
});
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
|
-
exports.renameAndroid = renameAndroid;
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.initRepoFromTemplate =
|
|
39
|
+
exports.initRepoFromTemplate = initRepoFromTemplate;
|
|
40
40
|
var __1 = require("..");
|
|
41
41
|
function initRepoFromTemplate(templateUrl, location) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -54,4 +54,3 @@ function initRepoFromTemplate(templateUrl, location) {
|
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
exports.initRepoFromTemplate = initRepoFromTemplate;
|
|
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.createMobileApp =
|
|
42
|
+
exports.createMobileApp = createMobileApp;
|
|
43
43
|
var constants_1 = require("../../constants");
|
|
44
44
|
var path_1 = __importDefault(require("path"));
|
|
45
45
|
var common_1 = require("./common");
|
|
@@ -193,4 +193,3 @@ function createMobileApp(params) {
|
|
|
193
193
|
});
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
|
-
exports.createMobileApp = createMobileApp;
|
package/dist/lib/firebase.js
CHANGED
|
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.loadFirebaseAdmin =
|
|
42
|
+
exports.loadFirebaseAdmin = loadFirebaseAdmin;
|
|
43
43
|
var firebase_admin_1 = __importDefault(require("firebase-admin"));
|
|
44
44
|
// let _firebaseApp:firebase.app.App = null
|
|
45
45
|
// if (!_firebaseApp) {
|
|
@@ -61,5 +61,4 @@ function loadFirebaseAdmin(credentialPath) {
|
|
|
61
61
|
});
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
exports.loadFirebaseAdmin = loadFirebaseAdmin;
|
|
65
64
|
// export const firebaseApp = _firebaseApp
|
package/dist/lib/ios/rename.js
CHANGED
|
@@ -50,7 +50,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.renameIos =
|
|
53
|
+
exports.renameIos = renameIos;
|
|
54
54
|
var utils_1 = require("../utils");
|
|
55
55
|
var utils_2 = require("./utils");
|
|
56
56
|
var path_1 = __importDefault(require("path"));
|
|
@@ -159,4 +159,3 @@ function renameIos(iosFolder, newName, options) {
|
|
|
159
159
|
});
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
-
exports.renameIos = renameIos;
|
package/dist/lib/spinner.js
CHANGED
|
@@ -47,7 +47,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
47
47
|
return t;
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.spinWhileNotCompleted =
|
|
50
|
+
exports.spinWhileNotCompleted = spinWhileNotCompleted;
|
|
51
51
|
var nanospinner_1 = require("nanospinner");
|
|
52
52
|
function spinWhileNotCompleted(operation, opts) {
|
|
53
53
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -76,4 +76,3 @@ function spinWhileNotCompleted(operation, opts) {
|
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
exports.spinWhileNotCompleted = spinWhileNotCompleted;
|
package/dist/lib/utils.js
CHANGED
|
@@ -3,7 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.path = exports.fs = exports.getNewBundleName = void 0;
|
|
7
|
+
exports.subprocess = subprocess;
|
|
8
|
+
exports.listPrompt = listPrompt;
|
|
9
|
+
exports.findExecutable = findExecutable;
|
|
10
|
+
exports.parseFilePathData = parseFilePathData;
|
|
7
11
|
var child_process_1 = __importDefault(require("child_process"));
|
|
8
12
|
var getNewBundleName = function (newName) { return "uk.co.codeleap.".concat(newName.trim()); };
|
|
9
13
|
exports.getNewBundleName = getNewBundleName;
|
|
@@ -37,7 +41,6 @@ function subprocess(name) {
|
|
|
37
41
|
});
|
|
38
42
|
});
|
|
39
43
|
}
|
|
40
|
-
exports.subprocess = subprocess;
|
|
41
44
|
function listPrompt(items, numbered) {
|
|
42
45
|
if (numbered === void 0) { numbered = false; }
|
|
43
46
|
var textArr = items.map(function (i, idx) {
|
|
@@ -46,7 +49,6 @@ function listPrompt(items, numbered) {
|
|
|
46
49
|
});
|
|
47
50
|
return "\n".concat(textArr.join('\n'), "\n");
|
|
48
51
|
}
|
|
49
|
-
exports.listPrompt = listPrompt;
|
|
50
52
|
var path_1 = __importDefault(require("path"));
|
|
51
53
|
exports.path = path_1.default;
|
|
52
54
|
var fs_1 = __importDefault(require("fs"));
|
|
@@ -57,7 +59,6 @@ function findExecutable(exec) {
|
|
|
57
59
|
return;
|
|
58
60
|
return child_process_1.default.execSync('which ' + exec).toString().replace(/\n/g, '');
|
|
59
61
|
}
|
|
60
|
-
exports.findExecutable = findExecutable;
|
|
61
62
|
var separators = /[\\\/]+/;
|
|
62
63
|
function parseFilePathData(path) {
|
|
63
64
|
var parts = path.split(separators);
|
|
@@ -75,4 +76,3 @@ function parseFilePathData(path) {
|
|
|
75
76
|
name: fileName,
|
|
76
77
|
};
|
|
77
78
|
}
|
|
78
|
-
exports.parseFilePathData = parseFilePathData;
|
package/dist/lib/walk.js
CHANGED
|
@@ -50,7 +50,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.walkDir =
|
|
53
|
+
exports.walkDir = walkDir;
|
|
54
54
|
var fs_1 = __importDefault(require("fs"));
|
|
55
55
|
var dive_1 = __importDefault(require("dive"));
|
|
56
56
|
var utils_1 = require("./utils");
|
|
@@ -127,4 +127,3 @@ function walkDir(config) {
|
|
|
127
127
|
});
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
exports.walkDir = walkDir;
|
package/dist/utils/misc.js
CHANGED
|
@@ -25,13 +25,16 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
25
25
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.
|
|
28
|
+
exports.logObj = logObj;
|
|
29
|
+
exports.resolveJSON = resolveJSON;
|
|
30
|
+
exports.resolveFile = resolveFile;
|
|
31
|
+
exports.resolveDir = resolveDir;
|
|
32
|
+
exports.writeFile = writeFile;
|
|
29
33
|
var constants_1 = require("../constants");
|
|
30
34
|
var lib_1 = require("../lib");
|
|
31
35
|
function logObj(obj) {
|
|
32
36
|
return console.log(JSON.stringify(obj, null, 2));
|
|
33
37
|
}
|
|
34
|
-
exports.logObj = logObj;
|
|
35
38
|
function transformPath(p) {
|
|
36
39
|
var toResolvePath = typeof p == 'function' ? p(constants_1.USER_CONFIG) : p;
|
|
37
40
|
if (!Array.isArray(toResolvePath)) {
|
|
@@ -54,7 +57,6 @@ function resolveJSON(p) {
|
|
|
54
57
|
return null;
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
|
-
exports.resolveJSON = resolveJSON;
|
|
58
60
|
function resolveFile(p) {
|
|
59
61
|
try {
|
|
60
62
|
var transformedPath = transformPath(p);
|
|
@@ -64,7 +66,6 @@ function resolveFile(p) {
|
|
|
64
66
|
return null;
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
|
-
exports.resolveFile = resolveFile;
|
|
68
69
|
function resolveDir(p) {
|
|
69
70
|
try {
|
|
70
71
|
var transformedPath = transformPath(p);
|
|
@@ -74,7 +75,6 @@ function resolveDir(p) {
|
|
|
74
75
|
return null;
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
exports.resolveDir = resolveDir;
|
|
78
78
|
function writeFile(p, content) {
|
|
79
79
|
try {
|
|
80
80
|
var transformedPath = transformPath(p);
|
|
@@ -84,4 +84,3 @@ function writeFile(p, content) {
|
|
|
84
84
|
return null;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
exports.writeFile = writeFile;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"repository": "git@github.com:codeleap-uk/codeleap-lib.git",
|
|
6
6
|
"author": "Paulo Henrique De Souza <paulosouza300272@gmail.com>",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"codeleap-cli": "./dist/index.js"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@codeleap/config": "
|
|
13
|
+
"@codeleap/config": "6.0.1",
|
|
14
14
|
"@types/inquirer": "^8.2.0",
|
|
15
15
|
"@types/libsodium-wrappers": "^0.7.10",
|
|
16
16
|
"cross-env": "^7.0.3"
|