@codeleap/cli 6.3.0 → 6.8.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.
Files changed (73) hide show
  1. package/dist/commands/configure.js +26 -61
  2. package/dist/commands/configure.js.map +1 -0
  3. package/dist/commands/configureSplash/index.js +21 -61
  4. package/dist/commands/configureSplash/index.js.map +1 -0
  5. package/dist/commands/configureSplash/utils.js +68 -86
  6. package/dist/commands/configureSplash/utils.js.map +1 -0
  7. package/dist/commands/configureTheme/index.js +31 -80
  8. package/dist/commands/configureTheme/index.js.map +1 -0
  9. package/dist/commands/configureTheme/types.js +1 -0
  10. package/dist/commands/configureTheme/types.js.map +1 -0
  11. package/dist/commands/configureTheme/utils.js +110 -105
  12. package/dist/commands/configureTheme/utils.js.map +1 -0
  13. package/dist/commands/convertorWebp.js +93 -189
  14. package/dist/commands/convertorWebp.js.map +1 -0
  15. package/dist/commands/createApp.js +24 -62
  16. package/dist/commands/createApp.js.map +1 -0
  17. package/dist/commands/createComponent/index.js +54 -88
  18. package/dist/commands/createComponent/index.js.map +1 -0
  19. package/dist/commands/createComponent/utils.js +66 -34
  20. package/dist/commands/createComponent/utils.js.map +1 -0
  21. package/dist/commands/downloadKeystores.js +11 -47
  22. package/dist/commands/downloadKeystores.js.map +1 -0
  23. package/dist/commands/keystoresAndroid.js +6 -40
  24. package/dist/commands/keystoresAndroid.js.map +1 -0
  25. package/dist/commands/linguiTranslate.js +64 -195
  26. package/dist/commands/linguiTranslate.js.map +1 -0
  27. package/dist/commands/rename.js +49 -110
  28. package/dist/commands/rename.js.map +1 -0
  29. package/dist/commands/syncIcons.js +29 -74
  30. package/dist/commands/syncIcons.js.map +1 -0
  31. package/dist/constants.js +42 -20
  32. package/dist/constants.js.map +1 -0
  33. package/dist/index.js +14 -13
  34. package/dist/index.js.map +1 -0
  35. package/dist/lib/Command.js +23 -76
  36. package/dist/lib/Command.js.map +1 -0
  37. package/dist/lib/android/index.js +1 -0
  38. package/dist/lib/android/index.js.map +1 -0
  39. package/dist/lib/android/keystore.js +91 -117
  40. package/dist/lib/android/keystore.js.map +1 -0
  41. package/dist/lib/android/rename.js +131 -246
  42. package/dist/lib/android/rename.js.map +1 -0
  43. package/dist/lib/android/utils.js +41 -36
  44. package/dist/lib/android/utils.js.map +1 -0
  45. package/dist/lib/createApp/common.js +13 -41
  46. package/dist/lib/createApp/common.js.map +1 -0
  47. package/dist/lib/createApp/mobile.js +120 -176
  48. package/dist/lib/createApp/mobile.js.map +1 -0
  49. package/dist/lib/firebase.js +11 -33
  50. package/dist/lib/firebase.js.map +1 -0
  51. package/dist/lib/index.js +4 -3
  52. package/dist/lib/index.js.map +1 -0
  53. package/dist/lib/ios/index.js +1 -0
  54. package/dist/lib/ios/index.js.map +1 -0
  55. package/dist/lib/ios/rename.js +90 -140
  56. package/dist/lib/ios/rename.js.map +1 -0
  57. package/dist/lib/ios/utils.js +21 -10
  58. package/dist/lib/ios/utils.js.map +1 -0
  59. package/dist/lib/spinner.js +21 -52
  60. package/dist/lib/spinner.js.map +1 -0
  61. package/dist/lib/utils.js +56 -32
  62. package/dist/lib/utils.js.map +1 -0
  63. package/dist/lib/walk.js +65 -87
  64. package/dist/lib/walk.js.map +1 -0
  65. package/dist/types.js +1 -0
  66. package/dist/types.js.map +1 -0
  67. package/dist/utils/index.js +1 -0
  68. package/dist/utils/index.js.map +1 -0
  69. package/dist/utils/misc.js +45 -34
  70. package/dist/utils/misc.js.map +1 -0
  71. package/package.json +10 -5
  72. package/.gitattributes +0 -1
  73. package/package.json.bak +0 -45
@@ -8,42 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
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
11
  Object.defineProperty(exports, "__esModule", { value: true });
39
12
  exports.configureCommand = void 0;
40
- var Command_1 = require("../lib/Command");
41
- var lib_1 = require("../lib");
13
+ const Command_1 = require("../lib/Command");
14
+ const lib_1 = require("../lib");
42
15
  require("../lib/firebase");
43
- var constants_1 = require("../constants");
44
- var commandName = 'configure';
45
- var ACCESS_TOKEN_HELP = 'https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token';
46
- var neededPerms = [
16
+ const constants_1 = require("../constants");
17
+ const commandName = 'configure';
18
+ const ACCESS_TOKEN_HELP = 'https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token';
19
+ const neededPerms = [
47
20
  'Create Repo',
48
21
  ].join(', ');
49
22
  exports.configureCommand = (0, Command_1.codeleapCommand)({
@@ -51,34 +24,26 @@ exports.configureCommand = (0, Command_1.codeleapCommand)({
51
24
  help: {
52
25
  description: 'Configure profile for codeleap cli',
53
26
  examples: [
54
- "codeleap ".concat(commandName, " # Follow the prompts"),
27
+ `codeleap ${commandName} # Follow the prompts`,
55
28
  ],
56
29
  },
57
- }, function (argv) { return __awaiter(void 0, void 0, void 0, function () {
58
- var flags, _, answers, options;
59
- return __generator(this, function (_a) {
60
- switch (_a.label) {
61
- case 0:
62
- flags = argv.flags, _ = argv._;
63
- return [4 /*yield*/, lib_1.inquirer.prompt([
64
- {
65
- name: 'username',
66
- message: 'What is your name?',
67
- },
68
- {
69
- name: 'githubPat',
70
- message: "Please insert your Github access token. Instructions for getting an access token can be found here ".concat(ACCESS_TOKEN_HELP, ".\nRequired permissions are: ").concat(neededPerms, "\n"),
71
- },
72
- ])];
73
- case 1:
74
- answers = _a.sent();
75
- options = {
76
- GITHUB_TOKEN: answers.githubPat,
77
- };
78
- lib_1.fs.writeFileSync(constants_1.cliConfigPath, JSON.stringify(options, null, 2), {
79
- encoding: 'utf-8',
80
- });
81
- return [2 /*return*/];
82
- }
30
+ }, (argv) => __awaiter(void 0, void 0, void 0, function* () {
31
+ const { flags, _ } = argv;
32
+ const answers = yield lib_1.inquirer.prompt([
33
+ {
34
+ name: 'username',
35
+ message: 'What is your name?',
36
+ },
37
+ {
38
+ name: 'githubPat',
39
+ message: `Please insert your Github access token. Instructions for getting an access token can be found here ${ACCESS_TOKEN_HELP}.\nRequired permissions are: ${neededPerms}\n`,
40
+ },
41
+ ]);
42
+ const options = {
43
+ GITHUB_TOKEN: answers.githubPat,
44
+ };
45
+ lib_1.fs.writeFileSync(constants_1.cliConfigPath, JSON.stringify(options, null, 2), {
46
+ encoding: 'utf-8',
83
47
  });
84
- }); });
48
+ }));
49
+ //# sourceMappingURL=configure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/commands/configure.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,4CAAgD;AAChD,gCAAqC;AACrC,2BAAwB;AACxB,4CAA4C;AAE5C,MAAM,WAAW,GAAG,WAAW,CAAA;AAE/B,MAAM,iBAAiB,GAAG,iHAAiH,CAAA;AAC3I,MAAM,WAAW,GAAG;IAClB,aAAa;CACd,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAEC,QAAA,gBAAgB,GAAG,IAAA,yBAAe,EAC7C;IACE,IAAI,EAAE,WAAW;IAEjB,IAAI,EAAE;QACJ,WAAW,EAAE,oCAAoC;QACjD,QAAQ,EAAE;YACR,YAAY,WAAW,uBAAuB;SAC/C;KACF;CAEF,EACD,CAAO,IAAI,EAAE,EAAE;IACb,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,CAAA;IAEzB,MAAM,OAAO,GAAG,MAAM,cAAQ,CAAC,MAAM,CAAC;QACpC;YACE,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,oBAAoB;SAC9B;QACD;YACE,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,sGAAsG,iBAAiB,gCAAgC,WAAW,IAAI;SAChL;KACF,CAAC,CAAA;IACF,MAAM,OAAO,GAAyB;QACpC,YAAY,EAAE,OAAO,CAAC,SAAS;KAChC,CAAA;IAED,QAAE,CAAC,aAAa,CAAC,yBAAa,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;QAChE,QAAQ,EAAE,OAAO;KAClB,CAAC,CAAA;AACJ,CAAC,CAAA,CACF,CAAA"}
@@ -8,40 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
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
11
  Object.defineProperty(exports, "__esModule", { value: true });
39
12
  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';
13
+ const constants_1 = require("../../constants");
14
+ const lib_1 = require("../../lib");
15
+ const Command_1 = require("../../lib/Command");
16
+ const utils_1 = require("./utils");
17
+ const commandName = 'configure-splash';
45
18
  exports.configureSplashCommand = (0, Command_1.codeleapCommand)({
46
19
  name: commandName,
47
20
  settingsRequired: true,
@@ -49,35 +22,22 @@ exports.configureSplashCommand = (0, Command_1.codeleapCommand)({
49
22
  help: {
50
23
  description: 'Command to set application splash using bootsplash files.',
51
24
  examples: [
52
- "codeleap ".concat(commandName),
25
+ `codeleap ${commandName}`,
53
26
  ],
54
27
  },
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*/];
28
+ }, (argv) => __awaiter(void 0, void 0, void 0, function* () {
29
+ const { flags, _ } = argv;
30
+ try {
31
+ const splash = yield (0, utils_1.syncSplash)();
32
+ const launchScreen = yield (0, utils_1.syncLaunchScreen)();
33
+ if (splash && launchScreen) {
34
+ setTimeout(() => {
35
+ lib_1.fs.rmSync(constants_1.USER_CONFIG.splash.assetsDir, { recursive: true, force: true });
36
+ }, 500);
81
37
  }
82
- });
83
- }); });
38
+ }
39
+ catch (err) {
40
+ console.error(err);
41
+ }
42
+ }));
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/configureSplash/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA6C;AAC7C,mCAA8B;AAC9B,+CAAmD;AACnD,mCAAsD;AAEtD,MAAM,WAAW,GAAG,kBAAkB,CAAA;AAEzB,QAAA,sBAAsB,GAAG,IAAA,yBAAe,EACnD;IACE,IAAI,EAAE,WAAW;IACjB,gBAAgB,EAAE,IAAI;IACtB,UAAU,EAAE,EAAE;IACd,IAAI,EAAE;QACJ,WAAW,EAAE,2DAA2D;QACxE,QAAQ,EAAE;YACR,YAAY,WAAW,EAAE;SAC1B;KACF;CACF,EACD,CAAO,IAAI,EAAE,EAAE;IACb,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,CAAA;IAEzB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAU,GAAE,CAAA;QACjC,MAAM,YAAY,GAAG,MAAM,IAAA,wBAAgB,GAAE,CAAA;QAE7C,IAAI,MAAM,IAAI,YAAY,EAAE,CAAC;YAC3B,UAAU,CAAC,GAAG,EAAE;gBACd,QAAE,CAAC,MAAM,CAAC,uBAAW,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;YAC3E,CAAC,EAAE,GAAG,CAAC,CAAA;QACT,CAAC;IACH,CAAC;IAAC,OAAM,GAAG,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACpB,CAAC;AACH,CAAC,CAAA,CACF,CAAA"}
@@ -8,114 +8,96 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
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
11
  Object.defineProperty(exports, "__esModule", { value: true });
39
12
  exports.syncSplash = syncSplash;
40
13
  exports.syncLaunchScreen = syncLaunchScreen;
41
- var constants_1 = require("../../constants");
42
- var lib_1 = require("../../lib");
43
- var iosName = constants_1.USER_CONFIG.splash.iosAppName;
44
- var splashImagePath = constants_1.USER_CONFIG.splash.splashImagePath;
45
- var baseDir = constants_1.USER_CONFIG.splash.assetsDir;
46
- var androidSourceDir = lib_1.path.join(baseDir, 'android');
47
- var androidDestDir = './android/app/src/main/res';
48
- var iosSourceDir = lib_1.path.join(baseDir, 'ios');
49
- var iosDestDir = "./ios/".concat(iosName);
50
- var iosSplashDir = "./ios/".concat(iosName, "/Images.xcassets/splash.imageset");
51
- var androidSplashFileName = 'launch_screen.png';
14
+ const constants_1 = require("../../constants");
15
+ const lib_1 = require("../../lib");
16
+ const getConfig = () => {
17
+ var _a;
18
+ if (!constants_1.USER_CONFIG.splash) {
19
+ throw new Error('SplashScreen not configured');
20
+ }
21
+ const iosName = constants_1.USER_CONFIG.splash.iosAppName;
22
+ const baseDir = constants_1.USER_CONFIG.splash.assetsDir;
23
+ return {
24
+ iosName,
25
+ baseDir,
26
+ splashImagePath: (_a = constants_1.USER_CONFIG.splash) === null || _a === void 0 ? void 0 : _a.splashImagePath,
27
+ androidSourceDir: lib_1.path.join(baseDir, 'android'),
28
+ androidDestDir: './android/app/src/main/res',
29
+ iosSourceDir: lib_1.path.join(baseDir, 'ios'),
30
+ iosDestDir: `./ios/${iosName}`,
31
+ iosSplashDir: `./ios/${iosName}/Images.xcassets/splash.imageset`,
32
+ androidSplashFileName: 'launch_screen.png',
33
+ };
34
+ };
52
35
  function copyFiles(src, dest) {
53
36
  if (!lib_1.fs.existsSync(dest)) {
54
37
  lib_1.fs.mkdirSync(dest, { recursive: true });
55
38
  }
56
- lib_1.fs.readdirSync(src).forEach(function (file) {
57
- var srcFile = lib_1.path.join(src, file);
58
- var destFile = lib_1.path.join(dest, file);
39
+ lib_1.fs.readdirSync(src).forEach(file => {
40
+ const srcFile = lib_1.path.join(src, file);
41
+ const destFile = lib_1.path.join(dest, file);
59
42
  if (lib_1.fs.statSync(srcFile).isDirectory()) {
60
43
  copyFiles(srcFile, lib_1.path.join(dest, file));
61
44
  }
62
45
  else {
63
46
  lib_1.fs.copyFileSync(srcFile, destFile);
64
- console.log("File: ".concat(srcFile, " -> ").concat(destFile, "."));
47
+ console.log(`File: ${srcFile} -> ${destFile}.`);
65
48
  }
66
49
  });
67
50
  }
68
51
  function syncSplash() {
69
- return __awaiter(this, void 0, void 0, function () {
70
- return __generator(this, function (_a) {
71
- console.log('Splash -> Syncing Android');
72
- if (!lib_1.fs.existsSync(androidSourceDir)) {
73
- console.log('Android folder not found.');
74
- return [2 /*return*/, false];
75
- }
76
- lib_1.fs.readdirSync(androidSourceDir).forEach(function (folder) {
77
- var sourcePath = lib_1.path.join(androidSourceDir, folder);
78
- var destPath = lib_1.path.join(androidDestDir, folder);
79
- if (lib_1.fs.statSync(sourcePath).isDirectory() && folder.startsWith('drawable')) {
80
- copyFiles(sourcePath, destPath);
81
- }
82
- });
83
- console.log('Splash -> Syncing ios');
84
- if (!lib_1.fs.existsSync(iosSourceDir)) {
85
- console.log('Ios folder not found!');
86
- return [2 /*return*/];
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ const { androidSourceDir, androidDestDir, iosDestDir, iosSourceDir } = getConfig();
54
+ console.log('Splash -> Syncing Android');
55
+ if (!lib_1.fs.existsSync(androidSourceDir)) {
56
+ console.log('Android folder not found.');
57
+ return false;
58
+ }
59
+ lib_1.fs.readdirSync(androidSourceDir).forEach(folder => {
60
+ const sourcePath = lib_1.path.join(androidSourceDir, folder);
61
+ const destPath = lib_1.path.join(androidDestDir, folder);
62
+ if (lib_1.fs.statSync(sourcePath).isDirectory() && folder.startsWith('drawable')) {
63
+ copyFiles(sourcePath, destPath);
87
64
  }
88
- copyFiles(iosSourceDir, iosDestDir);
89
- console.log('Sync concluded!');
90
- return [2 /*return*/, true];
91
65
  });
66
+ console.log('Splash -> Syncing ios');
67
+ if (!lib_1.fs.existsSync(iosSourceDir)) {
68
+ console.log('Ios folder not found!');
69
+ return;
70
+ }
71
+ copyFiles(iosSourceDir, iosDestDir);
72
+ console.log('Sync concluded!');
73
+ return true;
92
74
  });
93
75
  }
94
76
  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];
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ const { splashImagePath, androidDestDir, androidSplashFileName, iosSplashDir } = getConfig();
79
+ if (!lib_1.fs.existsSync(splashImagePath)) {
80
+ console.log(`LaunchScreen -> Splash file ${splashImagePath} not found!`);
81
+ return false;
82
+ }
83
+ console.log('LaunchScreen -> Syncing Android');
84
+ lib_1.fs.readdirSync(androidDestDir).forEach(folder => {
85
+ const possibleTarget = lib_1.path.join(androidDestDir, folder, androidSplashFileName);
86
+ if (lib_1.fs.existsSync(possibleTarget)) {
87
+ lib_1.fs.copyFileSync(splashImagePath, possibleTarget);
88
+ console.log(`File: ${possibleTarget}`);
89
+ }
90
+ });
91
+ console.log('LaunchScreen -> Syncing ios');
92
+ lib_1.fs.readdirSync(iosSplashDir).forEach(file => {
93
+ const filePath = lib_1.path.join(iosSplashDir, file);
94
+ if (file.endsWith('.png') && lib_1.fs.statSync(filePath).isFile()) {
95
+ lib_1.fs.copyFileSync(splashImagePath, filePath);
96
+ console.log(`File: ${filePath}`);
100
97
  }
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
98
  });
99
+ console.log('Sync concluded!');
100
+ return true;
120
101
  });
121
102
  }
103
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/commands/configureSplash/utils.ts"],"names":[],"mappings":";;;;;;;;;;;AA0CA,gCA8BC;AAED,4CAgCC;AA1GD,+CAA6C;AAC7C,mCAAoC;AAEpC,MAAM,SAAS,GAAG,GAAG,EAAE;;IACrB,IAAI,CAAC,uBAAW,CAAC,MAAM,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;IAChD,CAAC;IAED,MAAM,OAAO,GAAG,uBAAW,CAAC,MAAM,CAAC,UAAU,CAAA;IAC7C,MAAM,OAAO,GAAG,uBAAW,CAAC,MAAM,CAAC,SAAS,CAAA;IAE5C,OAAO;QACL,OAAO;QACP,OAAO;QACP,eAAe,EAAE,MAAA,uBAAW,CAAC,MAAM,0CAAE,eAAe;QACpD,gBAAgB,EAAE,UAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC;QAC/C,cAAc,EAAE,4BAA4B;QAC5C,YAAY,EAAE,UAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC;QACvC,UAAU,EAAE,SAAS,OAAO,EAAE;QAC9B,YAAY,EAAE,SAAS,OAAO,kCAAkC;QAChE,qBAAqB,EAAE,mBAAmB;KAC3C,CAAA;AACH,CAAC,CAAA;AAED,SAAS,SAAS,CAAC,GAAW,EAAE,IAAY;IAC1C,IAAI,CAAC,QAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,QAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACzC,CAAC;IAED,QAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACjC,MAAM,OAAO,GAAG,UAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QACpC,MAAM,QA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CAAA;YAE9C,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC5D,QAAE,CAAC,YAAY,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAA;gBAC1C,OAAO,CAAC,GAAG,CAAC,SAAS,QAAQ,EAAE,CAAC,CAAA;YAClC,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;QAE9B,OAAO,IAAI,CAAA;IACb,CAAC;CAAA"}
@@ -8,55 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
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
- var __read = (this && this.__read) || function (o, n) {
39
- var m = typeof Symbol === "function" && o[Symbol.iterator];
40
- if (!m) return o;
41
- var i = m.call(o), r, ar = [], e;
42
- try {
43
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
- }
45
- catch (error) { e = { error: error }; }
46
- finally {
47
- try {
48
- if (r && !r.done && (m = i["return"])) m.call(i);
49
- }
50
- finally { if (e) throw e.error; }
51
- }
52
- return ar;
53
- };
54
11
  Object.defineProperty(exports, "__esModule", { value: true });
55
12
  exports.configureThemeCommand = void 0;
56
- var Command_1 = require("../../lib/Command");
57
- var utils_1 = require("../../utils");
58
- var utils_2 = require("./utils");
59
- var commandName = 'configure-theme';
13
+ const Command_1 = require("../../lib/Command");
14
+ const utils_1 = require("../../utils");
15
+ const utils_2 = require("./utils");
16
+ const commandName = 'configure-theme';
60
17
  exports.configureThemeCommand = (0, Command_1.codeleapCommand)({
61
18
  name: commandName,
62
19
  settingsRequired: true,
@@ -64,40 +21,34 @@ exports.configureThemeCommand = (0, Command_1.codeleapCommand)({
64
21
  help: {
65
22
  description: 'Command to set application theme using figma files.',
66
23
  examples: [
67
- "codeleap ".concat(commandName),
24
+ `codeleap ${commandName}`,
68
25
  ],
69
26
  },
70
- }, function (argv) { return __awaiter(void 0, void 0, void 0, function () {
71
- var flags, _, measures, globalColors, contextColors, modeName;
72
- return __generator(this, function (_a) {
73
- flags = argv.flags, _ = argv._;
74
- measures = (0, utils_2.createThemeFile)({
75
- fileName: 'measures',
76
- content: (0, utils_2.resolveMeasure)(),
77
- });
78
- (0, utils_1.logObj)(measures);
79
- globalColors = (0, utils_2.createThemeFile)({
80
- fileName: 'baseColors',
81
- content: (0, utils_2.resolveGlobalColors)(),
27
+ }, (argv) => __awaiter(void 0, void 0, void 0, function* () {
28
+ const { flags, _ } = argv;
29
+ const measures = (0, utils_2.createThemeFile)({
30
+ fileName: 'measures',
31
+ content: (0, utils_2.resolveMeasure)(),
32
+ });
33
+ (0, utils_1.logObj)(measures);
34
+ const globalColors = (0, utils_2.createThemeFile)({
35
+ fileName: 'baseColors',
36
+ content: (0, utils_2.resolveGlobalColors)(),
37
+ folder: 'colors',
38
+ });
39
+ (0, utils_1.logObj)(globalColors);
40
+ const contextColors = (0, utils_2.resolveContextColors)();
41
+ for (const modeName in contextColors) {
42
+ (0, utils_2.createThemeFile)({
43
+ fileName: modeName,
44
+ content: contextColors[modeName],
82
45
  folder: 'colors',
46
+ render: (name, content) => {
47
+ const rendered = (0, utils_2.renderColorObject)(content, 2);
48
+ return `import colors from './baseColors'\n\nexport default {\n ...colors,\n${rendered}\n}`;
49
+ }
83
50
  });
84
- (0, utils_1.logObj)(globalColors);
85
- contextColors = (0, utils_2.resolveContextColors)();
86
- for (modeName in contextColors) {
87
- (0, utils_2.createThemeFile)({
88
- fileName: modeName,
89
- content: contextColors[modeName],
90
- folder: 'colors',
91
- render: function (name, content) {
92
- var colors = Object.entries(content).map(function (_a) {
93
- var _b = __read(_a, 2), key = _b[0], value = _b[1];
94
- return " ".concat(key, ": colors.").concat(value, ",");
95
- }).join("\n");
96
- return "import colors from './baseColors'\n\nexport default {\n ...colors,\n".concat(colors, "\n}");
97
- }
98
- });
99
- }
100
- (0, utils_1.logObj)(contextColors);
101
- return [2 /*return*/];
102
- });
103
- }); });
51
+ }
52
+ (0, utils_1.logObj)(contextColors);
53
+ }));
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/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AAC;IAED,IAAA,cAAM,EAAC,aAAa,CAAC,CAAA;AACvB,CAAC,CAAA,CACF,CAAA"}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/commands/configureTheme/types.ts"],"names":[],"mappings":""}