@codeleap/cli 5.0.13 → 5.0.14
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.
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.configureSplashCommand = void 0;
|
|
40
|
+
var constants_1 = require("../../constants");
|
|
41
|
+
var lib_1 = require("../../lib");
|
|
42
|
+
var Command_1 = require("../../lib/Command");
|
|
43
|
+
var utils_1 = require("./utils");
|
|
44
|
+
var commandName = 'configure-splash';
|
|
45
|
+
exports.configureSplashCommand = (0, Command_1.codeleapCommand)({
|
|
46
|
+
name: commandName,
|
|
47
|
+
settingsRequired: true,
|
|
48
|
+
parameters: [],
|
|
49
|
+
help: {
|
|
50
|
+
description: 'Command to set application splash using bootsplash files.',
|
|
51
|
+
examples: [
|
|
52
|
+
"codeleap ".concat(commandName),
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
}, function (argv) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
+
var flags, _, splash, launchScreen, err_1;
|
|
57
|
+
return __generator(this, function (_a) {
|
|
58
|
+
switch (_a.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
flags = argv.flags, _ = argv._;
|
|
61
|
+
_a.label = 1;
|
|
62
|
+
case 1:
|
|
63
|
+
_a.trys.push([1, 4, , 5]);
|
|
64
|
+
return [4 /*yield*/, (0, utils_1.syncSplash)()];
|
|
65
|
+
case 2:
|
|
66
|
+
splash = _a.sent();
|
|
67
|
+
return [4 /*yield*/, (0, utils_1.syncLaunchScreen)()];
|
|
68
|
+
case 3:
|
|
69
|
+
launchScreen = _a.sent();
|
|
70
|
+
if (splash && launchScreen) {
|
|
71
|
+
setTimeout(function () {
|
|
72
|
+
lib_1.fs.rmSync(constants_1.USER_CONFIG.splash.assetsDir, { recursive: true, force: true });
|
|
73
|
+
}, 500);
|
|
74
|
+
}
|
|
75
|
+
return [3 /*break*/, 5];
|
|
76
|
+
case 4:
|
|
77
|
+
err_1 = _a.sent();
|
|
78
|
+
console.error(err_1);
|
|
79
|
+
return [3 /*break*/, 5];
|
|
80
|
+
case 5: return [2 /*return*/];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}); });
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.syncLaunchScreen = exports.syncSplash = void 0;
|
|
40
|
+
var constants_1 = require("../../constants");
|
|
41
|
+
var lib_1 = require("../../lib");
|
|
42
|
+
var iosName = constants_1.USER_CONFIG.splash.iosAppName;
|
|
43
|
+
var splashImagePath = constants_1.USER_CONFIG.splash.splashImagePath;
|
|
44
|
+
var baseDir = constants_1.USER_CONFIG.splash.assetsDir;
|
|
45
|
+
var androidSourceDir = lib_1.path.join(baseDir, 'android');
|
|
46
|
+
var androidDestDir = './android/app/src/main/res';
|
|
47
|
+
var iosSourceDir = lib_1.path.join(baseDir, 'ios');
|
|
48
|
+
var iosDestDir = "./ios/".concat(iosName);
|
|
49
|
+
var iosSplashDir = "./ios/".concat(iosName, "/Images.xcassets/splash.imageset");
|
|
50
|
+
var androidSplashFileName = 'launch_screen.png';
|
|
51
|
+
function copyFiles(src, dest) {
|
|
52
|
+
if (!lib_1.fs.existsSync(dest)) {
|
|
53
|
+
lib_1.fs.mkdirSync(dest, { recursive: true });
|
|
54
|
+
}
|
|
55
|
+
lib_1.fs.readdirSync(src).forEach(function (file) {
|
|
56
|
+
var srcFile = lib_1.path.join(src, file);
|
|
57
|
+
var destFile = lib_1.path.join(dest, file);
|
|
58
|
+
if (lib_1.fs.statSync(srcFile).isDirectory()) {
|
|
59
|
+
copyFiles(srcFile, lib_1.path.join(dest, file));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
lib_1.fs.copyFileSync(srcFile, destFile);
|
|
63
|
+
console.log("File: ".concat(srcFile, " -> ").concat(destFile, "."));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function syncSplash() {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
console.log('Splash -> Syncing Android');
|
|
71
|
+
if (!lib_1.fs.existsSync(androidSourceDir)) {
|
|
72
|
+
console.log('Android folder not found.');
|
|
73
|
+
return [2 /*return*/, false];
|
|
74
|
+
}
|
|
75
|
+
lib_1.fs.readdirSync(androidSourceDir).forEach(function (folder) {
|
|
76
|
+
var sourcePath = lib_1.path.join(androidSourceDir, folder);
|
|
77
|
+
var destPath = lib_1.path.join(androidDestDir, folder);
|
|
78
|
+
if (lib_1.fs.statSync(sourcePath).isDirectory() && folder.startsWith('drawable')) {
|
|
79
|
+
copyFiles(sourcePath, destPath);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
console.log('Splash -> Syncing ios');
|
|
83
|
+
if (!lib_1.fs.existsSync(iosSourceDir)) {
|
|
84
|
+
console.log('Ios folder not found!');
|
|
85
|
+
return [2 /*return*/];
|
|
86
|
+
}
|
|
87
|
+
copyFiles(iosSourceDir, iosDestDir);
|
|
88
|
+
console.log('Sync concluded!');
|
|
89
|
+
return [2 /*return*/, true];
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
exports.syncSplash = syncSplash;
|
|
94
|
+
function syncLaunchScreen() {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
+
return __generator(this, function (_a) {
|
|
97
|
+
if (!lib_1.fs.existsSync(splashImagePath)) {
|
|
98
|
+
console.log("LaunchScreen -> Splash file ".concat(splashImagePath, " not found!"));
|
|
99
|
+
return [2 /*return*/, false];
|
|
100
|
+
}
|
|
101
|
+
console.log('LaunchScreen -> Syncing Android');
|
|
102
|
+
lib_1.fs.readdirSync(androidDestDir).forEach(function (folder) {
|
|
103
|
+
var possibleTarget = lib_1.path.join(androidDestDir, folder, androidSplashFileName);
|
|
104
|
+
if (lib_1.fs.existsSync(possibleTarget)) {
|
|
105
|
+
lib_1.fs.copyFileSync(splashImagePath, possibleTarget);
|
|
106
|
+
console.log("File: ".concat(possibleTarget));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
console.log('LaunchScreen -> Syncing ios');
|
|
110
|
+
lib_1.fs.readdirSync(iosSplashDir).forEach(function (file) {
|
|
111
|
+
var filePath = lib_1.path.join(iosSplashDir, file);
|
|
112
|
+
if (file.endsWith('.png') && lib_1.fs.statSync(filePath).isFile()) {
|
|
113
|
+
lib_1.fs.copyFileSync(splashImagePath, filePath);
|
|
114
|
+
console.log("File: ".concat(filePath));
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
console.log('Sync concluded!');
|
|
118
|
+
return [2 /*return*/, true];
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
exports.syncLaunchScreen = syncLaunchScreen;
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ 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
|
+
var configureSplash_1 = require("./commands/configureSplash");
|
|
14
15
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
15
16
|
var packageJson = require('../package.json');
|
|
16
17
|
(0, cleye_1.cli)({
|
|
@@ -25,6 +26,7 @@ var packageJson = require('../package.json');
|
|
|
25
26
|
convertorWebp_1.convertorWebpCommand,
|
|
26
27
|
configureTheme_1.configureThemeCommand,
|
|
27
28
|
linguiTranslate_1.linguiTranslateCommand,
|
|
29
|
+
configureSplash_1.configureSplashCommand,
|
|
28
30
|
],
|
|
29
31
|
version: packageJson.version,
|
|
30
32
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/cli",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.14",
|
|
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": "5.0.
|
|
13
|
+
"@codeleap/config": "5.0.14",
|
|
14
14
|
"@types/inquirer": "^8.2.0",
|
|
15
15
|
"@types/libsodium-wrappers": "^0.7.10",
|
|
16
16
|
"cross-env": "^7.0.3"
|