@codeleap/cli 2.4.9 → 3.0.2

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.
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -71,7 +71,7 @@ exports.renameMobileCommand = (0, Command_1.codeleapCommand)({
71
71
  "codeleap ".concat(commandName, " myAppName --ios # renames only ios folder"),
72
72
  "codeleap ".concat(commandName, " myAppName --android # renames only android folder"),
73
73
  "codeleap ".concat(commandName, " myAppName --android --ios # renames both folders"),
74
- "codeleap ".concat(commandName, " myAppName --android --ios --dry # Will show the diff in \"previous -> new\" format"),
74
+ "codeleap ".concat(commandName, " myAppName --android --ios # Will show the diff in \"previous -> new\" format"),
75
75
  ],
76
76
  },
77
77
  flags: {
@@ -93,7 +93,7 @@ exports.renameMobileCommand = (0, Command_1.codeleapCommand)({
93
93
  },
94
94
  },
95
95
  }, function (argv) { return __awaiter(void 0, void 0, void 0, function () {
96
- var flags, _, name, answers, bundleName, androidFolder_1, iosFolder_1, appJsonPath, appJson;
96
+ var flags, _, name, answers, androidFolder_1, iosFolder_1, appJsonPath, appJson;
97
97
  return __generator(this, function (_a) {
98
98
  switch (_a.label) {
99
99
  case 0:
@@ -111,12 +111,6 @@ exports.renameMobileCommand = (0, Command_1.codeleapCommand)({
111
111
  name = answers.name;
112
112
  _a.label = 2;
113
113
  case 2:
114
- if (flags.dry) {
115
- console.log(lib_1.chalk.yellow("Dry run, no changes will be made"));
116
- bundleName = (0, lib_1.getNewBundleName)(name);
117
- console.log("Bundle name: ".concat(bundleName));
118
- console.log("App name: ".concat(name));
119
- }
120
114
  if (flags.android) {
121
115
  androidFolder_1 = path_1.default.join(constants_1.cwd, 'android');
122
116
  (0, spinner_1.spinWhileNotCompleted)(function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -0,0 +1,101 @@
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 (_) 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
+ Object.defineProperty(exports, "__esModule", { value: true });
55
+ exports.syncIconsCommand = void 0;
56
+ var Command_1 = require("../lib/Command");
57
+ var lib_1 = require("../lib");
58
+ require("../lib/firebase");
59
+ var commandName = 'syncIcons';
60
+ var supportedExtensions = ['png', 'jpg', 'jpeg'];
61
+ exports.syncIconsCommand = (0, Command_1.codeleapCommand)({
62
+ name: commandName,
63
+ help: {
64
+ description: 'Synchronize icons from the app/assets/icons folder into a ts file with their exports',
65
+ examples: [
66
+ "codeleap ".concat(commandName),
67
+ ],
68
+ },
69
+ flags: {
70
+ logdiff: {
71
+ type: Boolean,
72
+ default: true,
73
+ },
74
+ },
75
+ }, function (argv) { return __awaiter(void 0, void 0, void 0, function () {
76
+ var flags, _, iconFiles, iconEntries, iconEntriesString, iconEntriesFile;
77
+ return __generator(this, function (_a) {
78
+ flags = argv.flags, _ = argv._;
79
+ iconFiles = lib_1.fs.readdirSync('./src/app/assets/icons', {
80
+ withFileTypes: true,
81
+ }).filter(function (i) {
82
+ var extension = i.name.split('.').pop();
83
+ return i.isFile() && supportedExtensions.includes(extension);
84
+ });
85
+ iconEntries = iconFiles.map(function (iconFile) {
86
+ var extension = iconFile.name.split('.').pop().toLowerCase();
87
+ var filename = iconFile.name.replace(".".concat(extension), '');
88
+ return [filename, iconFile.name];
89
+ });
90
+ iconEntriesString = iconEntries.map(function (_a) {
91
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
92
+ return " '".concat(key, "': require('./").concat(value, "'),");
93
+ }).join('\n');
94
+ iconEntriesFile = "export const imageIcons = {\n".concat(iconEntriesString, "\n}");
95
+ lib_1.fs.writeFileSync('./src/app/assets/icons/exports.ts', iconEntriesFile);
96
+ if (flags.logdiff) {
97
+ console.log(iconEntriesFile);
98
+ }
99
+ return [2 /*return*/];
100
+ });
101
+ }); });
package/dist/constants.js CHANGED
File without changes
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ var createApp_1 = require("./commands/createApp");
7
7
  var downloadKeystores_1 = require("./commands/downloadKeystores");
8
8
  var keystoresAndroid_1 = require("./commands/keystoresAndroid");
9
9
  var rename_1 = require("./commands/rename");
10
+ var syncIcons_1 = require("./commands/syncIcons");
10
11
  // eslint-disable-next-line @typescript-eslint/no-var-requires
11
12
  var packageJson = require('../package.json');
12
13
  (0, cleye_1.cli)({
@@ -16,7 +17,8 @@ var packageJson = require('../package.json');
16
17
  rename_1.renameMobileCommand,
17
18
  createApp_1.createAppCommand,
18
19
  configure_1.configureCommand,
19
- downloadKeystores_1.downloadKeystores
20
+ downloadKeystores_1.downloadKeystores,
21
+ syncIcons_1.syncIconsCommand
20
22
  ],
21
23
  version: packageJson.version,
22
24
  });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/lib/index.js CHANGED
File without changes
File without changes
@@ -73,27 +73,21 @@ function renameIos(iosFolder, newName, options) {
73
73
  newName = newName.trim();
74
74
  return [4 /*yield*/, (0, walk_1.walkDir)({
75
75
  action: function (info) {
76
- var _a, _b, _c;
77
76
  // console.log({ a: info.name })
78
77
  if (info.name.includes(currentName)) {
79
78
  var renameRegex = new RegExp(currentName, 'g');
80
79
  var lastMatch_1 = info.path.lastIndexOf(currentName);
80
+ var idx_1 = 0;
81
81
  renameQueue.push({
82
82
  from: info.path.replace(renameRegex, function (str, i) {
83
83
  if (i == lastMatch_1) {
84
84
  return str;
85
85
  }
86
+ idx_1++;
86
87
  return newName;
87
88
  }),
88
89
  to: info.path.replace(renameRegex, newName),
89
90
  });
90
- if ((_c = (_b = (_a = info.file) === null || _a === void 0 ? void 0 : _a.ext) === null || _b === void 0 ? void 0 : _b.endsWith) === null || _c === void 0 ? void 0 : _c.call(_b, 'xcscheme')) {
91
- var schemeType = info.name.replace(/\.xcscheme/, '').split(' ').reverse()[0];
92
- renameQueue.push({
93
- from: info.path,
94
- to: path_1.default.join(info.parentPath, "".concat(newName, " ").concat(schemeType, ".xcscheme"))
95
- });
96
- }
97
91
  }
98
92
  if (!info.isDir) {
99
93
  var content = info.file.content;
@@ -109,7 +103,8 @@ function renameIos(iosFolder, newName, options) {
109
103
  scanFileContent: true,
110
104
  ignore: [
111
105
  {
112
- name: 'GoogleService-Info.plist',
106
+ name: 'GoogleService-Info',
107
+ ext: ['plist'],
113
108
  file: true,
114
109
  },
115
110
  {
File without changes
File without changes
package/dist/lib/utils.js CHANGED
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.parseFilePathData = exports.findExecutable = exports.path = exports.fs = exports.listPrompt = exports.subprocess = exports.getNewBundleName = void 0;
7
7
  var child_process_1 = __importDefault(require("child_process"));
8
- var getNewBundleName = function (newName) { return "uk.co.codeleap.".concat(newName.trim().toLowerCase()); };
8
+ var getNewBundleName = function (newName) { return "uk.co.codeleap.".concat(newName.trim()); };
9
9
  exports.getNewBundleName = getNewBundleName;
10
10
  function subprocess(name) {
11
11
  var params = [];
package/dist/lib/walk.js CHANGED
File without changes
package/dist/types.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/cli",
3
- "version": "2.4.9",
3
+ "version": "3.0.2",
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>",
@@ -44,4 +44,4 @@
44
44
  "simple-git": "^3.15.0",
45
45
  "yup": "^0.32.11"
46
46
  }
47
- }
47
+ }