@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
package/dist/lib/walk.js CHANGED
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -19,111 +8,100 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
19
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
20
9
  });
21
10
  };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- 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;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
50
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
51
13
  };
52
14
  Object.defineProperty(exports, "__esModule", { value: true });
53
15
  exports.walkDir = walkDir;
54
- var fs_1 = __importDefault(require("fs"));
55
- var dive_1 = __importDefault(require("dive"));
56
- var utils_1 = require("./utils");
57
- var matchFile = function (path, stat, config) {
58
- var isDir = stat.isDirectory();
16
+ const fs_1 = __importDefault(require("fs"));
17
+ const dive_1 = __importDefault(require("dive"));
18
+ const utils_1 = require("./utils");
19
+ /**
20
+ * Tests whether a single path/stat pair satisfies a `FileMatch` filter.
21
+ * Returns `false` immediately when the entry type (file vs directory) does not
22
+ * match `config.dir` / `config.file` flags, so callers never need to guard
23
+ * against type mismatches.
24
+ */
25
+ const matchFile = (path, stat, config) => {
26
+ const isDir = stat.isDirectory();
59
27
  if (isDir && !config.dir) {
60
28
  return false;
61
29
  }
62
30
  if (!isDir && !config.file) {
63
31
  return false;
64
32
  }
65
- var pathData = (0, utils_1.parseFilePathData)(path);
66
- var conditions = [];
33
+ const pathData = (0, utils_1.parseFilePathData)(path);
34
+ const conditions = [];
67
35
  if (!!config.name) {
68
- var nameMatch = false;
36
+ let nameMatch = false;
69
37
  if (config.name instanceof RegExp) {
70
38
  nameMatch = config.name.test(path);
71
39
  }
72
40
  else {
73
- var matchConfig = (0, utils_1.parseFilePathData)(config.name);
41
+ const matchConfig = (0, utils_1.parseFilePathData)(config.name);
74
42
  nameMatch = [
75
43
  pathData.name === matchConfig.name,
76
44
  pathData.extension === matchConfig.extension,
77
45
  pathData.path === matchConfig.path,
78
- ].some(function (x) { return x; });
46
+ ].some(x => x);
79
47
  }
80
48
  conditions.push(nameMatch);
81
49
  }
82
50
  if (!isDir && !!config.ext) {
83
- var extMatch = false;
51
+ let extMatch = false;
84
52
  extMatch = config.ext.includes(pathData.extension);
85
53
  conditions.push(extMatch);
86
54
  }
87
- return conditions.every(function (a) { return a; });
55
+ return conditions.every(a => a);
88
56
  };
57
+ /**
58
+ * Recursively visits every file (and optionally directory) under
59
+ * `config.path`, invoking `config.action` for each entry.
60
+ *
61
+ * When `action` returns a non-null, non-undefined string for a file entry,
62
+ * that string is written back to disk, enabling in-place content transforms
63
+ * across an entire directory tree in a single traversal.
64
+ *
65
+ * Entries matching any filter in `config.options.ignore` are skipped before
66
+ * `action` is called. Defaults to recursive traversal with directory entries
67
+ * included.
68
+ */
89
69
  function walkDir(config) {
90
- return __awaiter(this, void 0, void 0, function () {
91
- var options;
92
- return __generator(this, function (_a) {
93
- options = __assign({ directories: true, recursive: true }, config.options);
94
- return [2 /*return*/, new Promise(function (resolve) {
95
- (0, dive_1.default)(config.path, options, function (err, file, stat) {
96
- var isDir = stat.isDirectory();
97
- var pathData = (0, utils_1.parseFilePathData)(file);
98
- if (options.ignore) {
99
- var ignore = options.ignore.some(function (i) { return matchFile(file, stat, i); });
100
- if (ignore)
101
- return;
102
- }
103
- var fileInfo = isDir ? null : {
104
- ext: pathData.extension,
105
- content: (options === null || options === void 0 ? void 0 : options.scanFileContent) ? fs_1.default.readFileSync(file).toString() : '',
106
- };
107
- var dirInfo = isDir ? {
108
- contents: fs_1.default.readdirSync(file),
109
- } : null;
110
- var newContent = config.action({
111
- path: file,
112
- stat: stat,
113
- err: err,
114
- isDir: isDir,
115
- dir: dirInfo,
116
- name: pathData.name,
117
- parentPath: pathData.path,
118
- file: fileInfo,
119
- });
120
- if (![undefined, null].includes(newContent) && !isDir) {
121
- fs_1.default.writeFileSync(file, newContent);
122
- }
123
- }, function () {
124
- resolve();
125
- });
126
- })];
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ const options = Object.assign({ directories: true, recursive: true }, config.options);
72
+ return new Promise((resolve) => {
73
+ (0, dive_1.default)(config.path, options, (err, file, stat) => {
74
+ const isDir = stat.isDirectory();
75
+ const pathData = (0, utils_1.parseFilePathData)(file);
76
+ if (options.ignore) {
77
+ const ignore = options.ignore.some((i) => matchFile(file, stat, i));
78
+ if (ignore)
79
+ return;
80
+ }
81
+ const fileInfo = isDir ? null : {
82
+ ext: pathData.extension,
83
+ content: (options === null || options === void 0 ? void 0 : options.scanFileContent) ? fs_1.default.readFileSync(file).toString() : '',
84
+ };
85
+ const dirInfo = isDir ? {
86
+ contents: fs_1.default.readdirSync(file),
87
+ } : null;
88
+ const newContent = config.action({
89
+ path: file,
90
+ stat,
91
+ err,
92
+ isDir,
93
+ dir: dirInfo,
94
+ name: pathData.name,
95
+ parentPath: pathData.path,
96
+ file: fileInfo,
97
+ });
98
+ if (![undefined, null].includes(newContent) && !isDir) {
99
+ fs_1.default.writeFileSync(file, newContent);
100
+ }
101
+ }, () => {
102
+ resolve();
103
+ });
127
104
  });
128
105
  });
129
106
  }
107
+ //# sourceMappingURL=walk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walk.js","sourceRoot":"","sources":["../../src/lib/walk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAmHA,0BA6CC;AAhKD,4CAAmB;AACnB,gDAAuB;AACvB,mCAA2C;AAuD3C;;;;;GAKG;AACH,MAAM,SAAS,GAAG,CAAC,IAAW,EAAE,IAAa,EAAE,MAAgB,EAAE,EAAE;IACjE,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;IAEhC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACzB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,QAAQ,GAAG,IAAA,yBAAiB,EAAC,IAAI,CAAC,CAAA;IAExC,MAAM,UAAU,GAAG,EAAE,CAAA;IACrB,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAClB,IAAI,SAAS,GAAG,KAAK,CAAA;QAErB,I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AG,EAAE;gBACN,OAAO,EAAE,CAAA;YACX,CAAC,CAAC,CAAA;QAEJ,CAAC,CAAC,CAAA;IACJ,CAAC;CAAA"}
package/dist/types.js CHANGED
@@ -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/types.ts"],"names":[],"mappings":""}
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./misc"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB"}
@@ -1,86 +1,97 @@
1
1
  "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
- if (ar || !(i in from)) {
21
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
- ar[i] = from[i];
23
- }
24
- }
25
- return to.concat(ar || Array.prototype.slice.call(from));
26
- };
27
2
  Object.defineProperty(exports, "__esModule", { value: true });
28
3
  exports.logObj = logObj;
29
4
  exports.resolveJSON = resolveJSON;
30
5
  exports.resolveFile = resolveFile;
31
6
  exports.resolveDir = resolveDir;
32
7
  exports.writeFile = writeFile;
33
- var constants_1 = require("../constants");
34
- var lib_1 = require("../lib");
8
+ const constants_1 = require("../constants");
9
+ const lib_1 = require("../lib");
10
+ /**
11
+ * Pretty-prints an object as indented JSON to stdout.
12
+ * Currently a no-op — the function returns immediately before the
13
+ * `console.log` call, acting as a toggleable debug helper.
14
+ */
35
15
  function logObj(obj) {
16
+ return;
36
17
  return console.log(JSON.stringify(obj, null, 2));
37
18
  }
19
+ /**
20
+ * Normalises a `Path` value into a relative string suitable for resolving
21
+ * against `cliDir`.
22
+ * - Functions are called with `USER_CONFIG` so callers can derive paths from
23
+ * the runtime config.
24
+ * - String arrays are joined with `path.join`.
25
+ * - Absolute paths (starting with `/`) have the leading slash stripped so the
26
+ * subsequent `path.resolve(cliDir, …)` anchors correctly to `cliDir` rather
27
+ * than the filesystem root.
28
+ */
38
29
  function transformPath(p) {
39
- var toResolvePath = typeof p == 'function' ? p(constants_1.USER_CONFIG) : p;
30
+ let toResolvePath = typeof p == 'function' ? p(constants_1.USER_CONFIG) : p;
40
31
  if (!Array.isArray(toResolvePath)) {
41
32
  if (toResolvePath === null || toResolvePath === void 0 ? void 0 : toResolvePath.startsWith('/')) {
42
- var _a = __read(toResolvePath), _ = _a[0], restPath = _a.slice(1);
33
+ const [_, ...restPath] = toResolvePath;
43
34
  toResolvePath = restPath.join('');
44
35
  }
45
36
  return toResolvePath;
46
37
  }
47
38
  else {
48
- return lib_1.path.join.apply(lib_1.path, __spreadArray([], __read(toResolvePath), false));
39
+ return lib_1.path.join(...toResolvePath);
49
40
  }
50
41
  }
42
+ /**
43
+ * Reads and JSON-parses a file relative to `cliDir`.
44
+ * Returns `null` on any error (file not found, invalid JSON, etc.) so callers
45
+ * can treat a missing or malformed file as an absent value without try/catch.
46
+ */
51
47
  function resolveJSON(p) {
52
48
  try {
53
- var transformedPath = transformPath(p);
49
+ const transformedPath = transformPath(p);
54
50
  return JSON.parse(lib_1.fs.readFileSync(lib_1.path.resolve(constants_1.cliDir, transformedPath)).toString());
55
51
  }
56
52
  catch (_a) {
57
53
  return null;
58
54
  }
59
55
  }
56
+ /**
57
+ * Reads a UTF-8 text file relative to `cliDir`.
58
+ * Returns `null` on any error so callers do not need to guard against
59
+ * missing files separately.
60
+ */
60
61
  function resolveFile(p) {
61
62
  try {
62
- var transformedPath = transformPath(p);
63
+ const transformedPath = transformPath(p);
63
64
  return lib_1.fs.readFileSync(lib_1.path.resolve(constants_1.cliDir, transformedPath), 'utf-8');
64
65
  }
65
66
  catch (_a) {
66
67
  return null;
67
68
  }
68
69
  }
70
+ /**
71
+ * Lists the entries of a directory relative to `cliDir`.
72
+ * Returns `null` on any error (directory not found, permission denied, etc.).
73
+ */
69
74
  function resolveDir(p) {
70
75
  try {
71
- var transformedPath = transformPath(p);
76
+ const transformedPath = transformPath(p);
72
77
  return lib_1.fs.readdirSync(lib_1.path.resolve(constants_1.cliDir, transformedPath));
73
78
  }
74
79
  catch (_a) {
75
80
  return null;
76
81
  }
77
82
  }
83
+ /**
84
+ * Writes `content` as UTF-8 to a file relative to `cliDir`.
85
+ * Returns `null` on any error rather than throwing, consistent with the other
86
+ * helpers in this module.
87
+ */
78
88
  function writeFile(p, content) {
79
89
  try {
80
- var transformedPath = transformPath(p);
90
+ const transformedPath = transformPath(p);
81
91
  return lib_1.fs.writeFileSync(lib_1.path.resolve(constants_1.cliDir, transformedPath), content, 'utf-8');
82
92
  }
83
93
  catch (_a) {
84
94
  return null;
85
95
  }
86
96
  }
97
+ //# sourceMappingURL=misc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"misc.js","sourceRoot":"","sources":["../../src/utils/misc.ts"],"names":[],"mappings":";;AAQA,wBAGC;AAmCD,kCAOC;AAOD,kCAOC;AAMD,gCAOC;AAOD,8BAOC;AA9FD,4CAAkD;AAClD,gCAAiC;AAEjC;;;;GAIG;AACH,SAAgB,MAAM,CAAC,GAAwB;IAC7C,OAAM;IACN,OAAO,OAAO,CAAC,GAAG,CAAC,IAA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,CAAA;IACxE,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,UAAU,CAAC,CAAO;IAChC,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;QACxC,OAAO,QAAE,CAAC,WAAW,CAAC,UAAI,CAAC,OAAO,CAAC,kBAAM,EAAE,eAAe,CAAC,CAAC,CAAA;IAC9D,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,SAAS,CAAC,CAAO,EAAE,OAAY;IAC7C,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;QACxC,OAAO,QAAE,CAAC,aAAa,CAAC,UAAI,CAAC,OAAO,CAAC,kBAAM,EAAE,eAAe,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IAClF,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@codeleap/cli",
3
- "version": "6.3.0",
3
+ "version": "6.8.0",
4
4
  "main": "./dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "files": [
7
+ "dist"
8
+ ],
5
9
  "repository": "git@github.com:codeleap-uk/codeleap-lib.git",
6
10
  "author": "Paulo Henrique De Souza <paulosouza300272@gmail.com>",
7
11
  "license": "UNLICENSED",
@@ -10,7 +14,8 @@
10
14
  "codeleap-cli": "./dist/index.js"
11
15
  },
12
16
  "devDependencies": {
13
- "@codeleap/config": "6.3.0",
17
+ "@codeleap/config": "6.8.0",
18
+ "@codeleap/styles": "6.8.0",
14
19
  "@types/inquirer": "^8.2.0",
15
20
  "@types/libsodium-wrappers": "^0.7.10",
16
21
  "cross-env": "^7.0.3"
@@ -19,7 +24,7 @@
19
24
  "typescript": "5.5.2"
20
25
  },
21
26
  "scripts": {
22
- "build": "tsc --build",
27
+ "build": "tsc --build tsconfig.build.json",
23
28
  "lint": "eslint -c .eslintrc.js --fix \"./src/**/*.{ts,tsx,js,jsx}\"",
24
29
  "dev:cli": "node dist/index.js",
25
30
  "start": "node dist/index.js",
@@ -29,7 +34,7 @@
29
34
  "axios": "^1.7.9",
30
35
  "chalk": "4.1.2",
31
36
  "chalk-animation": "^1.6.0",
32
- "cleye": "^1.1.0",
37
+ "cleye": "2.6.0",
33
38
  "cli-progress": "^3.12.0",
34
39
  "dive": "^0.5.0",
35
40
  "figlet": "^1.5.2",
@@ -42,4 +47,4 @@
42
47
  "octokit": "^2.0.10",
43
48
  "simple-git": "^3.15.0"
44
49
  }
45
- }
50
+ }
package/.gitattributes DELETED
@@ -1 +0,0 @@
1
- index.ts eol=lf
package/package.json.bak DELETED
@@ -1,45 +0,0 @@
1
- {
2
- "name": "@codeleap/cli",
3
- "version": "6.3.0",
4
- "main": "./dist/index.js",
5
- "repository": "git@github.com:codeleap-uk/codeleap-lib.git",
6
- "author": "Paulo Henrique De Souza <paulosouza300272@gmail.com>",
7
- "license": "UNLICENSED",
8
- "bin": {
9
- "codeleap": "./dist/index.js",
10
- "codeleap-cli": "./dist/index.js"
11
- },
12
- "devDependencies": {
13
- "@codeleap/config": "workspace:*",
14
- "@types/inquirer": "^8.2.0",
15
- "@types/libsodium-wrappers": "^0.7.10",
16
- "cross-env": "^7.0.3"
17
- },
18
- "peerDependencies": {
19
- "typescript": "5.5.2"
20
- },
21
- "scripts": {
22
- "build": "tsc --build",
23
- "lint": "eslint -c .eslintrc.js --fix \"./src/**/*.{ts,tsx,js,jsx}\"",
24
- "dev:cli": "node dist/index.js",
25
- "start": "node dist/index.js",
26
- "dev": "cross-env CODELEAP_CLI_DEV_MODE=true tsnd --transpile-only src/index.ts"
27
- },
28
- "dependencies": {
29
- "axios": "^1.7.9",
30
- "chalk": "4.1.2",
31
- "chalk-animation": "^1.6.0",
32
- "cleye": "^1.1.0",
33
- "cli-progress": "^3.12.0",
34
- "dive": "^0.5.0",
35
- "figlet": "^1.5.2",
36
- "firebase-admin": "^11.4.1",
37
- "generate-password": "^1.7.0",
38
- "inquirer": "^8.2.0",
39
- "libsodium-wrappers": "^0.7.10",
40
- "nanospinner": "^1.0.0",
41
- "node-keytool": "^0.0.3",
42
- "octokit": "^2.0.10",
43
- "simple-git": "^3.15.0"
44
- }
45
- }