@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.
- package/dist/commands/configure.js +26 -61
- package/dist/commands/configure.js.map +1 -0
- package/dist/commands/configureSplash/index.js +21 -61
- package/dist/commands/configureSplash/index.js.map +1 -0
- package/dist/commands/configureSplash/utils.js +68 -86
- package/dist/commands/configureSplash/utils.js.map +1 -0
- package/dist/commands/configureTheme/index.js +31 -80
- package/dist/commands/configureTheme/index.js.map +1 -0
- package/dist/commands/configureTheme/types.js +1 -0
- package/dist/commands/configureTheme/types.js.map +1 -0
- package/dist/commands/configureTheme/utils.js +110 -105
- package/dist/commands/configureTheme/utils.js.map +1 -0
- package/dist/commands/convertorWebp.js +93 -189
- package/dist/commands/convertorWebp.js.map +1 -0
- package/dist/commands/createApp.js +24 -62
- package/dist/commands/createApp.js.map +1 -0
- package/dist/commands/createComponent/index.js +54 -88
- package/dist/commands/createComponent/index.js.map +1 -0
- package/dist/commands/createComponent/utils.js +66 -34
- package/dist/commands/createComponent/utils.js.map +1 -0
- package/dist/commands/downloadKeystores.js +11 -47
- package/dist/commands/downloadKeystores.js.map +1 -0
- package/dist/commands/keystoresAndroid.js +6 -40
- package/dist/commands/keystoresAndroid.js.map +1 -0
- package/dist/commands/linguiTranslate.js +64 -195
- package/dist/commands/linguiTranslate.js.map +1 -0
- package/dist/commands/rename.js +49 -110
- package/dist/commands/rename.js.map +1 -0
- package/dist/commands/syncIcons.js +29 -74
- package/dist/commands/syncIcons.js.map +1 -0
- package/dist/constants.js +42 -20
- package/dist/constants.js.map +1 -0
- package/dist/index.js +14 -13
- package/dist/index.js.map +1 -0
- package/dist/lib/Command.js +23 -76
- package/dist/lib/Command.js.map +1 -0
- package/dist/lib/android/index.js +1 -0
- package/dist/lib/android/index.js.map +1 -0
- package/dist/lib/android/keystore.js +91 -117
- package/dist/lib/android/keystore.js.map +1 -0
- package/dist/lib/android/rename.js +131 -246
- package/dist/lib/android/rename.js.map +1 -0
- package/dist/lib/android/utils.js +41 -36
- package/dist/lib/android/utils.js.map +1 -0
- package/dist/lib/createApp/common.js +13 -41
- package/dist/lib/createApp/common.js.map +1 -0
- package/dist/lib/createApp/mobile.js +120 -176
- package/dist/lib/createApp/mobile.js.map +1 -0
- package/dist/lib/firebase.js +11 -33
- package/dist/lib/firebase.js.map +1 -0
- package/dist/lib/index.js +4 -3
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/ios/index.js +1 -0
- package/dist/lib/ios/index.js.map +1 -0
- package/dist/lib/ios/rename.js +90 -140
- package/dist/lib/ios/rename.js.map +1 -0
- package/dist/lib/ios/utils.js +21 -10
- package/dist/lib/ios/utils.js.map +1 -0
- package/dist/lib/spinner.js +21 -52
- package/dist/lib/spinner.js.map +1 -0
- package/dist/lib/utils.js +56 -32
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/walk.js +65 -87
- package/dist/lib/walk.js.map +1 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/misc.js +45 -34
- package/dist/utils/misc.js.map +1 -0
- package/package.json +10 -5
- package/.gitattributes +0 -1
- package/package.json.bak +0 -45
|
@@ -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,251 +8,147 @@ 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
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
-
if (!m) return o;
|
|
52
|
-
var i = m.call(o), r, ar = [], e;
|
|
53
|
-
try {
|
|
54
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
-
}
|
|
56
|
-
catch (error) { e = { error: error }; }
|
|
57
|
-
finally {
|
|
58
|
-
try {
|
|
59
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
-
}
|
|
61
|
-
finally { if (e) throw e.error; }
|
|
62
|
-
}
|
|
63
|
-
return ar;
|
|
64
|
-
};
|
|
65
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
66
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
67
|
-
if (ar || !(i in from)) {
|
|
68
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
69
|
-
ar[i] = from[i];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
73
|
-
};
|
|
74
|
-
var __values = (this && this.__values) || function(o) {
|
|
75
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
76
|
-
if (m) return m.call(o);
|
|
77
|
-
if (o && typeof o.length === "number") return {
|
|
78
|
-
next: function () {
|
|
79
|
-
if (o && i >= o.length) o = void 0;
|
|
80
|
-
return { value: o && o[i++], done: !o };
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
84
|
-
};
|
|
85
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
86
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
87
13
|
};
|
|
88
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89
15
|
exports.renameAndroid = renameAndroid;
|
|
90
16
|
/* eslint-disable handle-callback-err */
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
17
|
+
const utils_1 = require("../utils");
|
|
18
|
+
const utils_2 = require("./utils");
|
|
19
|
+
const path_1 = __importDefault(require("path"));
|
|
20
|
+
const fs_1 = __importDefault(require("fs"));
|
|
21
|
+
const walk_1 = require("../walk");
|
|
22
|
+
const node_keytool_1 = __importDefault(require("node-keytool"));
|
|
23
|
+
const keystore_1 = require("./keystore");
|
|
24
|
+
/**
|
|
25
|
+
* Renames an Android project in place by rewriting all text files under
|
|
26
|
+
* `androidFolder`. The rename covers the human-readable app name in
|
|
27
|
+
* `strings.xml` and, when `changeBundle` is true, the package identifier
|
|
28
|
+
* throughout the project sources and manifests.
|
|
29
|
+
*
|
|
30
|
+
* Bundle rename also restructures the Java source tree to match the new
|
|
31
|
+
* package path (moves files from the old package directory to the new one
|
|
32
|
+
* and removes the stale directory).
|
|
33
|
+
*
|
|
34
|
+
* Skipped files: images, `google-services.json`, keystores, Gradle wrapper,
|
|
35
|
+
* and the `app/build` directory.
|
|
36
|
+
*
|
|
37
|
+
* When a Firebase app instance is provided and no Firebase Android app with
|
|
38
|
+
* the new bundle ID exists yet, a new one is created and `google-services.json`
|
|
39
|
+
* is updated. Existing keystore SHA certificates are registered with the new
|
|
40
|
+
* Firebase app automatically.
|
|
41
|
+
*/
|
|
98
42
|
function renameAndroid(androidFolder, newName, options) {
|
|
99
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return [4 /*yield*/, (0, walk_1.walkDir)({
|
|
113
|
-
action: function (info) {
|
|
114
|
-
if (!info.isDir) {
|
|
115
|
-
var content = info.file.content;
|
|
116
|
-
if (options === null || options === void 0 ? void 0 : options.changeBundle) {
|
|
117
|
-
content = content.replace(new RegExp("".concat(bundleId), 'g'), newBundleName);
|
|
118
|
-
}
|
|
119
|
-
var nameExp = new RegExp("(?<!\\.)".concat(currentName), 'g');
|
|
120
|
-
return content.replace(nameExp, newName.trim());
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
path: androidFolder,
|
|
124
|
-
options: {
|
|
125
|
-
scanFileContent: true,
|
|
126
|
-
ignore: [
|
|
127
|
-
{
|
|
128
|
-
name: 'google-services',
|
|
129
|
-
ext: ['json'],
|
|
130
|
-
file: true,
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
ext: ['png', 'jpg', 'jpeg'],
|
|
134
|
-
file: true,
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
name: 'gradle-wrapper',
|
|
138
|
-
file: true,
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
ext: ['keystore'],
|
|
142
|
-
file: true,
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
name: 'app/build',
|
|
146
|
-
dir: true,
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
},
|
|
150
|
-
}).then(function () {
|
|
151
|
-
var e_2, _a, e_3, _b;
|
|
152
|
-
if (options.changeBundle && newBundleName !== bundleId) {
|
|
153
|
-
var javaFolder = path_1.default.join(androidFolder, 'app', 'src', 'main', 'java');
|
|
154
|
-
var mainActivityFolder = path_1.default.join.apply(path_1.default, __spreadArray([javaFolder], __read(bundleId.split('.')), false));
|
|
155
|
-
var scan = javaFolder;
|
|
156
|
-
try {
|
|
157
|
-
for (var _c = __values(newBundleName.split('.')), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
158
|
-
var part = _d.value;
|
|
159
|
-
var folder = path_1.default.join(scan, part);
|
|
160
|
-
if (!fs_1.default.existsSync(folder)) {
|
|
161
|
-
fs_1.default.mkdirSync(folder);
|
|
162
|
-
}
|
|
163
|
-
scan = folder;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
167
|
-
finally {
|
|
168
|
-
try {
|
|
169
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
170
|
-
}
|
|
171
|
-
finally { if (e_2) throw e_2.error; }
|
|
172
|
-
}
|
|
173
|
-
try {
|
|
174
|
-
for (var _e = __values(fs_1.default.readdirSync(mainActivityFolder)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
175
|
-
var file = _f.value;
|
|
176
|
-
fs_1.default.copyFileSync(path_1.default.join(mainActivityFolder, file), path_1.default.join(scan, file));
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
180
|
-
finally {
|
|
181
|
-
try {
|
|
182
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
183
|
-
}
|
|
184
|
-
finally { if (e_3) throw e_3.error; }
|
|
185
|
-
}
|
|
186
|
-
fs_1.default.rmSync(mainActivityFolder, {
|
|
187
|
-
recursive: true,
|
|
188
|
-
force: true,
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
})];
|
|
192
|
-
case 1:
|
|
193
|
-
_c.sent();
|
|
194
|
-
if (!firebase)
|
|
195
|
-
return [2 /*return*/];
|
|
196
|
-
pm = firebase.projectManagement();
|
|
197
|
-
console.log(pm.app.options, pm.app.name);
|
|
198
|
-
return [4 /*yield*/, pm.listAndroidApps()];
|
|
199
|
-
case 2:
|
|
200
|
-
androidAppReqs = (_c.sent()).map(function (a) { return __awaiter(_this, void 0, void 0, function () {
|
|
201
|
-
var _a;
|
|
202
|
-
var _b;
|
|
203
|
-
return __generator(this, function (_c) {
|
|
204
|
-
switch (_c.label) {
|
|
205
|
-
case 0:
|
|
206
|
-
_a = [__assign({}, a)];
|
|
207
|
-
_b = {};
|
|
208
|
-
return [4 /*yield*/, a.getMetadata()];
|
|
209
|
-
case 1: return [2 /*return*/, __assign.apply(void 0, _a.concat([(_b.meta = (_c.sent()), _b)]))];
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
}); });
|
|
213
|
-
console.log(androidAppReqs);
|
|
214
|
-
return [4 /*yield*/, Promise.all(androidAppReqs)];
|
|
215
|
-
case 3:
|
|
216
|
-
androidApps = _c.sent();
|
|
217
|
-
googleServiceFile = path_1.default.join(androidFolder, 'app', 'google-services.json');
|
|
218
|
-
if (!!androidApps.some(function (a) { return a.meta.packageName === newBundleName; })) return [3 /*break*/, 6];
|
|
219
|
-
console.log("Creating new android app on firebase and updating google-services.json");
|
|
220
|
-
return [4 /*yield*/, pm.createAndroidApp(newBundleName, newName.trim())];
|
|
221
|
-
case 4:
|
|
222
|
-
newApp_1 = _c.sent();
|
|
223
|
-
return [4 /*yield*/, newApp_1.getConfig()];
|
|
224
|
-
case 5:
|
|
225
|
-
newGoogleServicesFile = _c.sent();
|
|
226
|
-
fs_1.default.writeFileSync(googleServiceFile, newGoogleServicesFile, {
|
|
227
|
-
encoding: 'utf-8',
|
|
228
|
-
});
|
|
229
|
-
keystoresFolder = path_1.default.join(androidFolder, 'app', 'keystores');
|
|
230
|
-
keystores = fs_1.default.readdirSync(keystoresFolder, {
|
|
231
|
-
withFileTypes: true,
|
|
232
|
-
});
|
|
233
|
-
gradleProperties = new keystore_1.AndroidConfigFile(path_1.default.join(androidFolder, 'app', 'keystores', 'config.json'));
|
|
234
|
-
try {
|
|
235
|
-
for (keystores_1 = __values(keystores), keystores_1_1 = keystores_1.next(); !keystores_1_1.done; keystores_1_1 = keystores_1.next()) {
|
|
236
|
-
keystore = keystores_1_1.value;
|
|
237
|
-
keyPathData = (0, utils_1.parseFilePathData)(keystore.name);
|
|
238
|
-
valid = ['jks', 'keystore'].includes(keyPathData.extension) && keystore.isFile();
|
|
239
|
-
if (!valid) {
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
242
|
-
storeTypeMap = {
|
|
243
|
-
'keystore': 'PKCS12',
|
|
244
|
-
'jks': 'JKS',
|
|
245
|
-
};
|
|
246
|
-
key = (0, node_keytool_1.default)(path_1.default.join(keystoresFolder, keystore.name), gradleProperties[keystore.name].storePassword, { debug: false, storeType: storeTypeMap[keyPathData.extension] });
|
|
247
|
-
key.list(function (err, vals) {
|
|
248
|
-
return vals.certs.forEach(function (c) {
|
|
249
|
-
newApp_1.addShaCertificate({
|
|
250
|
-
certType: c.algorithm.toLowerCase().replace('-', ''),
|
|
251
|
-
shaHash: c.fingerprint,
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
}
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const newBundleName = (0, utils_1.getNewBundleName)(newName);
|
|
45
|
+
const { firebase = null } = options || {};
|
|
46
|
+
const androidManifest = fs_1.default.readFileSync(path_1.default.join(androidFolder, 'app', 'src', 'main', 'AndroidManifest.xml')).toString();
|
|
47
|
+
const stringsXml = fs_1.default.readFileSync(path_1.default.join(androidFolder, 'app', 'src', 'main', 'res', 'values', 'strings.xml')).toString();
|
|
48
|
+
const bundleId = (0, utils_2.getAndroidBundleId)(androidManifest);
|
|
49
|
+
const currentName = (0, utils_2.getAndroidAppName)(stringsXml);
|
|
50
|
+
yield (0, walk_1.walkDir)({
|
|
51
|
+
action: (info) => {
|
|
52
|
+
if (!info.isDir) {
|
|
53
|
+
let content = info.file.content;
|
|
54
|
+
if (options === null || options === void 0 ? void 0 : options.changeBundle) {
|
|
55
|
+
content = content.replace(new RegExp(`${bundleId}`, 'g'), newBundleName);
|
|
256
56
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
57
|
+
const nameExp = new RegExp(`(?<!\\.)${currentName}`, 'g');
|
|
58
|
+
return content.replace(nameExp, newName.trim());
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
path: androidFolder,
|
|
62
|
+
options: {
|
|
63
|
+
scanFileContent: true,
|
|
64
|
+
ignore: [
|
|
65
|
+
{
|
|
66
|
+
name: 'google-services',
|
|
67
|
+
ext: ['json'],
|
|
68
|
+
file: true,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
ext: ['png', 'jpg', 'jpeg'],
|
|
72
|
+
file: true,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'gradle-wrapper',
|
|
76
|
+
file: true,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
ext: ['keystore'],
|
|
80
|
+
file: true,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'app/build',
|
|
84
|
+
dir: true,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
}).then(() => {
|
|
89
|
+
if (options.changeBundle && newBundleName !== bundleId) {
|
|
90
|
+
const javaFolder = path_1.default.join(androidFolder, 'app', 'src', 'main', 'java');
|
|
91
|
+
const mainActivityFolder = path_1.default.join(javaFolder, ...bundleId.split('.'));
|
|
92
|
+
let scan = javaFolder;
|
|
93
|
+
for (const part of newBundleName.split('.')) {
|
|
94
|
+
const folder = path_1.default.join(scan, part);
|
|
95
|
+
if (!fs_1.default.existsSync(folder)) {
|
|
96
|
+
fs_1.default.mkdirSync(folder);
|
|
263
97
|
}
|
|
264
|
-
|
|
265
|
-
|
|
98
|
+
scan = folder;
|
|
99
|
+
}
|
|
100
|
+
for (const file of fs_1.default.readdirSync(mainActivityFolder)) {
|
|
101
|
+
fs_1.default.copyFileSync(path_1.default.join(mainActivityFolder, file), path_1.default.join(scan, file));
|
|
102
|
+
}
|
|
103
|
+
fs_1.default.rmSync(mainActivityFolder, {
|
|
104
|
+
recursive: true,
|
|
105
|
+
force: true,
|
|
106
|
+
});
|
|
266
107
|
}
|
|
267
108
|
});
|
|
109
|
+
if (!firebase)
|
|
110
|
+
return;
|
|
111
|
+
const pm = firebase.projectManagement();
|
|
112
|
+
console.log(pm.app.options, pm.app.name);
|
|
113
|
+
const androidAppReqs = (yield pm.listAndroidApps()).map((a) => __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
return Object.assign(Object.assign({}, a), { meta: (yield a.getMetadata()) });
|
|
115
|
+
}));
|
|
116
|
+
console.log(androidAppReqs);
|
|
117
|
+
const androidApps = yield Promise.all(androidAppReqs);
|
|
118
|
+
const googleServiceFile = path_1.default.join(androidFolder, 'app', 'google-services.json');
|
|
119
|
+
if (!androidApps.some(a => a.meta.packageName === newBundleName)) {
|
|
120
|
+
console.log(`Creating new android app on firebase and updating google-services.json`);
|
|
121
|
+
const newApp = yield pm.createAndroidApp(newBundleName, newName.trim());
|
|
122
|
+
const newGoogleServicesFile = yield newApp.getConfig();
|
|
123
|
+
fs_1.default.writeFileSync(googleServiceFile, newGoogleServicesFile, {
|
|
124
|
+
encoding: 'utf-8',
|
|
125
|
+
});
|
|
126
|
+
const keystoresFolder = path_1.default.join(androidFolder, 'app', 'keystores');
|
|
127
|
+
const keystores = fs_1.default.readdirSync(keystoresFolder, {
|
|
128
|
+
withFileTypes: true,
|
|
129
|
+
});
|
|
130
|
+
const gradleProperties = new keystore_1.AndroidConfigFile(path_1.default.join(androidFolder, 'app', 'keystores', 'config.json'));
|
|
131
|
+
for (const keystore of keystores) {
|
|
132
|
+
const keyPathData = (0, utils_1.parseFilePathData)(keystore.name);
|
|
133
|
+
const valid = ['jks', 'keystore'].includes(keyPathData.extension) && keystore.isFile();
|
|
134
|
+
if (!valid) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const storeTypeMap = {
|
|
138
|
+
'keystore': 'PKCS12',
|
|
139
|
+
'jks': 'JKS',
|
|
140
|
+
};
|
|
141
|
+
const key = (0, node_keytool_1.default)(path_1.default.join(keystoresFolder, keystore.name), gradleProperties[keystore.name].storePassword, { debug: false, storeType: storeTypeMap[keyPathData.extension] });
|
|
142
|
+
key.list((err, vals) => {
|
|
143
|
+
return vals.certs.forEach(c => {
|
|
144
|
+
newApp.addShaCertificate({
|
|
145
|
+
certType: c.algorithm.toLowerCase().replace('-', ''),
|
|
146
|
+
shaHash: c.fingerprint,
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
268
152
|
});
|
|
269
153
|
}
|
|
154
|
+
//# sourceMappingURL=rename.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rename.js","sourceRoot":"","sources":["../../../src/lib/android/rename.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAmCA,sCAqJC;AAxLD,wCAAwC;AACxC,oCAA8D;AAC9D,mCAAqF;AACrF,gDAAuB;AACvB,4CAAmB;AACnB,kCAAiC;AAEjC,gEAAkC;AAElC,yCAA8C;AAQ9C;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAsB,aAAa,CACjC,aAAqB,EACrB,OAAe,EACf,OAA8B;;QAE9B,MAAM,aAAa,GAAG,IAAA,wBAAgB,EAAC,OAAO,CAAC,CAAA;QAC/C,MAAM,EAAC,QAAQ,GAAC,IAAI,EAAC,GAAG,OAAO,IAAI,EAAE,CAAA;QAErC,MAAM,eAAe,GAAG,YAAE,CAAC,YAAY,CACrC,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,qBAAqB,CAAC,CACtE,CAAC,QAAQ,EAAE,CAAA;QACZ,MAAM,UAAU,GAAG,YAAE,CAAC,YAAY,CAChC,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,CAAC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
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
6
|
exports.readGradleProperties = exports.getAndroidAppName = exports.getAndroidBundleId = void 0;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
/**
|
|
10
|
+
* Extracts the `package` attribute value from an `AndroidManifest.xml` string
|
|
11
|
+
* by simple substring search, without a full XML parser.
|
|
12
|
+
*/
|
|
13
|
+
const getAndroidBundleId = (androidManifestContent) => {
|
|
14
|
+
const pkgStr = 'package="';
|
|
15
|
+
const packageIdx = androidManifestContent.indexOf(pkgStr) + pkgStr.length;
|
|
16
|
+
let packageName = androidManifestContent.substring(packageIdx);
|
|
17
|
+
const packageEndIdx = packageName.indexOf('"');
|
|
25
18
|
packageName = packageName.substring(0, packageEndIdx);
|
|
26
19
|
return packageName.trim();
|
|
27
20
|
};
|
|
28
21
|
exports.getAndroidBundleId = getAndroidBundleId;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Extracts the `app_name` string resource value from a `strings.xml` file
|
|
24
|
+
* string by simple substring search, without a full XML parser.
|
|
25
|
+
*/
|
|
26
|
+
const getAndroidAppName = (stringsXmlContent) => {
|
|
27
|
+
const pkgStr = 'name="app_name">';
|
|
28
|
+
const packageIdx = stringsXmlContent.indexOf(pkgStr) + pkgStr.length;
|
|
29
|
+
let packageName = stringsXmlContent.substring(packageIdx);
|
|
30
|
+
const packageEndIdx = packageName.indexOf('<');
|
|
34
31
|
packageName = packageName.substring(0, packageEndIdx);
|
|
35
32
|
return packageName.trim();
|
|
36
33
|
// return JSON.parse(
|
|
@@ -40,31 +37,39 @@ var getAndroidAppName = function (stringsXmlContent) {
|
|
|
40
37
|
// ).name
|
|
41
38
|
};
|
|
42
39
|
exports.getAndroidAppName = getAndroidAppName;
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Parses Gradle properties files for an Android project. Always reads
|
|
42
|
+
* `gradle.properties` at the project root; also reads `app/gradle.properties`
|
|
43
|
+
* when it exists. Later files shadow earlier ones on key collisions.
|
|
44
|
+
* Comment lines (starting with `#`) and malformed `key=value` pairs are
|
|
45
|
+
* silently skipped.
|
|
46
|
+
*/
|
|
47
|
+
const readGradleProperties = (androidFolder) => {
|
|
48
|
+
const paths = [
|
|
45
49
|
path_1.default.join(androidFolder, 'gradle.properties'),
|
|
46
50
|
];
|
|
47
|
-
|
|
51
|
+
const appProperties = path_1.default.join(androidFolder, 'app', 'gradle.properties');
|
|
48
52
|
if (fs_1.default.existsSync(appProperties)) {
|
|
49
53
|
paths.push(appProperties);
|
|
50
54
|
}
|
|
51
|
-
|
|
52
|
-
paths.forEach(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
lines.forEach(
|
|
55
|
+
let mergedProps = {};
|
|
56
|
+
paths.forEach(path => {
|
|
57
|
+
const data = fs_1.default.readFileSync(path).toString();
|
|
58
|
+
const lines = data.split('\n').map(x => x.replace(/\n/g, '').replace(/\r/g, '')).filter(x => !!x.trim());
|
|
59
|
+
const props = {};
|
|
60
|
+
lines.forEach(l => {
|
|
57
61
|
if (l.startsWith('#'))
|
|
58
62
|
return;
|
|
59
|
-
|
|
63
|
+
const lineParts = l.split('=');
|
|
60
64
|
if (lineParts.length < 2)
|
|
61
65
|
return;
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
const value = lineParts[1].trim().split(' ')[0];
|
|
67
|
+
const property = lineParts[0].trim();
|
|
64
68
|
props[property] = value;
|
|
65
69
|
});
|
|
66
|
-
mergedProps =
|
|
70
|
+
mergedProps = Object.assign(Object.assign({}, mergedProps), props);
|
|
67
71
|
});
|
|
68
72
|
return mergedProps;
|
|
69
73
|
};
|
|
70
74
|
exports.readGradleProperties = readGradleProperties;
|
|
75
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/lib/android/utils.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAmB;AACnB,gDAAuB;AAEvB;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,sBAA8B,EAAE,EAAE;IACnE,MAAM,MAAM,GAAG,WAAW,CAAA;IAC1B,MAAM,UAAU,GAAG,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAA;IACzE,IAAI,WAAW,GAAG,sBAAsB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;IAC9D,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC9C,WAAW,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,EAAE,aAAa,CAAC,CAAA;IACrD,OAAO,WAAW,CAAC,IAAI,EAAE,CAAA;AAC3B,CAAC,CAAA;AAPY,QAAA,kBAAkB,sBAO9B;AACD;;;GAGG;AACI,MAAM,iBAAiB,GAAG,CAAC,iBAAyB,EAAE,EAAE;IAC7D,MAAM,MAAM,GAAG,kBAAkB,CAAA;IACjC,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAA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K,GAAG,EAAE,CAAA;QAEhB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAChB,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,OAAM;YAC7B,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC9B,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;gBAAE,OAAM;YAChC,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/C,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;YACpC,KAAK,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAA;QACzB,CAAC,CAAC,CAAA;QAEF,WAAW,mCACN,WAAW,GACX,KAAK,CACT,CAAA;IACH,CAAC,CAAC,CAAA;IACF,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAjCY,QAAA,oBAAoB,wBAiChC"}
|
|
@@ -8,49 +8,21 @@ 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.initRepoFromTemplate = initRepoFromTemplate;
|
|
40
|
-
|
|
13
|
+
const __1 = require("..");
|
|
14
|
+
/**
|
|
15
|
+
* Clones `templateUrl` into `location`, strips the template's `.git` history,
|
|
16
|
+
* and initialises a fresh `master` branch so the new project starts with a
|
|
17
|
+
* clean slate rather than the template's commit history.
|
|
18
|
+
*
|
|
19
|
+
* @sideeffect Creates a new directory at `location` and runs `git init` inside it.
|
|
20
|
+
*/
|
|
41
21
|
function initRepoFromTemplate(templateUrl, location) {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
case 1:
|
|
47
|
-
_a.sent();
|
|
48
|
-
__1.fs.rmSync(__1.path.join(location, '.git'), { force: true, recursive: true });
|
|
49
|
-
return [4 /*yield*/, __1.git.raw('-C', location, 'init', '--initial-branch', 'master')];
|
|
50
|
-
case 2:
|
|
51
|
-
_a.sent();
|
|
52
|
-
return [2 /*return*/];
|
|
53
|
-
}
|
|
54
|
-
});
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
yield __1.git.raw('clone', templateUrl, location);
|
|
24
|
+
__1.fs.rmSync(__1.path.join(location, '.git'), { force: true, recursive: true });
|
|
25
|
+
yield __1.git.raw('-C', location, 'init', '--initial-branch', 'master');
|
|
55
26
|
});
|
|
56
27
|
}
|
|
28
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/lib/createApp/common.ts"],"names":[],"mappings":";;;;;;;;;;;AASA,oDAUC;AAnBD,0BAAkC;AAElC;;;;;;GAMG;AACH,SAAsB,oBAAoB,CAAC,WAAkB,EAAE,QAAgB;;QAC7E,MAAM,OAAG,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAA;QAE7C,MAAE,CAAC,MAAM,CACP,QAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,EAC3B,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CACjC,CAAA;QAED,MAAM,OAAG,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,QAAQ,CAAC,CAAA;IAErE,CAAC;CAAA"}
|