@codeleap/cli 1.0.2 → 1.1.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.
- package/.gitattributes +1 -0
- package/dist/commands/init.js +68 -26
- package/dist/commands/keystoresAndroid.js +128 -0
- package/dist/commands/rename.js +154 -0
- package/dist/index.js +6 -4
- package/dist/lib/android/index.js +18 -0
- package/dist/lib/android/keystore.js +27 -0
- package/dist/lib/android/rename.js +266 -0
- package/dist/lib/android/utils.js +67 -0
- package/dist/lib/firebase.js +19 -0
- package/dist/lib/index.js +22 -1
- package/dist/lib/ios/index.js +18 -0
- package/dist/lib/ios/rename.js +160 -0
- package/dist/lib/ios/utils.js +28 -0
- package/dist/lib/spinner.js +11 -2
- package/dist/lib/utils.js +69 -0
- package/dist/lib/walk.js +130 -0
- package/package.json +43 -31
- package/yarn-error.log +25945 -0
- package/dist/index.d.ts +0 -1
- package/src/commands/init.ts +0 -31
- package/src/index.ts +0 -13
- package/src/lib/Command.ts +0 -10
- package/src/lib/index.ts +0 -3
- package/src/lib/spinner.ts +0 -21
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.path = exports.fs = exports.subprocess = exports.getNewBundleName = void 0;
|
|
32
|
+
var child_process_1 = __importDefault(require("child_process"));
|
|
33
|
+
var getNewBundleName = function (newName) { return "uk.co.codeleap.".concat(newName.trim()); };
|
|
34
|
+
exports.getNewBundleName = getNewBundleName;
|
|
35
|
+
function subprocess(name) {
|
|
36
|
+
var params = [];
|
|
37
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
38
|
+
params[_i - 1] = arguments[_i];
|
|
39
|
+
}
|
|
40
|
+
return new Promise(function (resolve, reject) {
|
|
41
|
+
var _a, _b, _c, _d;
|
|
42
|
+
console.log("Running ".concat(params[0], " ").concat(params[1].join(' ')));
|
|
43
|
+
var child = child_process_1.default.spawn.apply(child_process_1.default, __spreadArray([], __read(params), false));
|
|
44
|
+
child.on('error', function (err) {
|
|
45
|
+
console.log("".concat(name, " finished with error: "), err.toString());
|
|
46
|
+
reject(err);
|
|
47
|
+
});
|
|
48
|
+
child.on('close', function (code) {
|
|
49
|
+
console.log("".concat(name, " finished with code: "), code);
|
|
50
|
+
if (code !== 0) {
|
|
51
|
+
reject("".concat(name, " finieshed with non zero exit code"));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
resolve(code);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
(_b = (_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on) === null || _b === void 0 ? void 0 : _b.call(_a, 'data', function (outdata) {
|
|
58
|
+
console.log(outdata.toString());
|
|
59
|
+
});
|
|
60
|
+
(_d = (_c = child.stderr) === null || _c === void 0 ? void 0 : _c.on) === null || _d === void 0 ? void 0 : _d.call(_c, 'data', function (errdata) {
|
|
61
|
+
console.error(errdata.toString());
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
exports.subprocess = subprocess;
|
|
66
|
+
var path_1 = __importDefault(require("path"));
|
|
67
|
+
exports.path = path_1.default;
|
|
68
|
+
var fs_1 = __importDefault(require("fs"));
|
|
69
|
+
exports.fs = fs_1.default;
|
package/dist/lib/walk.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
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 (_) 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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.walkDir = void 0;
|
|
54
|
+
var common_1 = require("@codeleap/common");
|
|
55
|
+
var fs_1 = __importDefault(require("fs"));
|
|
56
|
+
var dive_1 = __importDefault(require("dive"));
|
|
57
|
+
var matchFile = function (path, stat, config) {
|
|
58
|
+
var isDir = stat.isDirectory();
|
|
59
|
+
if (isDir && !config.dir) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
if (!isDir && !config.file) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
var pathData = (0, common_1.parseFilePathData)(path);
|
|
66
|
+
var conditions = [];
|
|
67
|
+
if (!!config.name) {
|
|
68
|
+
var nameMatch = false;
|
|
69
|
+
if (config.name instanceof RegExp) {
|
|
70
|
+
nameMatch = config.name.test(path);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
var matchConfig = (0, common_1.parseFilePathData)(config.name);
|
|
74
|
+
nameMatch = [
|
|
75
|
+
pathData.name === matchConfig.name,
|
|
76
|
+
pathData.extension === matchConfig.extension,
|
|
77
|
+
pathData.path === matchConfig.path,
|
|
78
|
+
].some(function (x) { return x; });
|
|
79
|
+
}
|
|
80
|
+
conditions.push(nameMatch);
|
|
81
|
+
}
|
|
82
|
+
if (!isDir && !!config.ext) {
|
|
83
|
+
var extMatch = false;
|
|
84
|
+
extMatch = config.ext.includes(pathData.extension);
|
|
85
|
+
conditions.push(extMatch);
|
|
86
|
+
}
|
|
87
|
+
return conditions.every(function (a) { return a; });
|
|
88
|
+
};
|
|
89
|
+
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, common_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 (!common_1.TypeGuards.isNil(newContent) && !isDir) {
|
|
121
|
+
fs_1.default.writeFileSync(file, newContent);
|
|
122
|
+
}
|
|
123
|
+
}, function () {
|
|
124
|
+
resolve();
|
|
125
|
+
});
|
|
126
|
+
})];
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
exports.walkDir = walkDir;
|
package/package.json
CHANGED
|
@@ -1,31 +1,43 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@codeleap/cli",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"main": "
|
|
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
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
},
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@codeleap/cli",
|
|
3
|
+
"version": "1.1.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": "*",
|
|
14
|
+
"@types/inquirer": "^8.2.0",
|
|
15
|
+
"typescript": "^4.5.5"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@codeleap/common": "*"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc --build",
|
|
22
|
+
"lint": "eslint -c .eslintrc.js --fix \"./src/**/*.{ts,tsx,js,jsx}\"",
|
|
23
|
+
"dev:cli": "node dist/index.js",
|
|
24
|
+
"start": "node dist/index.js",
|
|
25
|
+
"dev": "tsnd src/index.ts"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"axios": "^0.24.0",
|
|
29
|
+
"chalk": "4.1.2",
|
|
30
|
+
"chalk-animation": "^1.6.0",
|
|
31
|
+
"cleye": "^1.1.0",
|
|
32
|
+
"dive": "^0.5.0",
|
|
33
|
+
"figlet": "^1.5.2",
|
|
34
|
+
"firebase-admin": "^11.0.1",
|
|
35
|
+
"generate-password": "^1.7.0",
|
|
36
|
+
"inquirer": "^8.2.0",
|
|
37
|
+
"nanospinner": "^1.0.0",
|
|
38
|
+
"node-keytool": "^0.0.3",
|
|
39
|
+
"react": "^17.0.2",
|
|
40
|
+
"react-icons": "^4.3.1",
|
|
41
|
+
"yup": "^0.32.11"
|
|
42
|
+
}
|
|
43
|
+
}
|