@codeleap/cli 3.16.0 → 3.17.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/codepushBootstrap.d.ts +28 -0
- package/dist/commands/codepushBootstrap.js +149 -0
- package/dist/commands/codepushDeploy.d.ts +28 -0
- package/dist/commands/codepushDeploy.js +101 -0
- package/dist/commands/configure.d.ts +26 -0
- package/dist/commands/convertorWebp.d.ts +29 -0
- package/dist/commands/convertorWebp.js +2 -10
- package/dist/commands/createApp.d.ts +40 -0
- package/dist/commands/createStyleSheets.d.ts +0 -0
- package/dist/commands/downloadKeystores.d.ts +24 -0
- package/dist/commands/keystoresAndroid.d.ts +25 -0
- package/dist/commands/rename.d.ts +64 -0
- package/dist/commands/syncIcons.d.ts +37 -0
- package/dist/constants.d.ts +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -1
- package/dist/lib/Command.d.ts +2 -0
- package/dist/lib/alterCliSettings.d.ts +2 -0
- package/dist/lib/alterCliSettings.js +19 -0
- package/dist/lib/android/index.d.ts +2 -0
- package/dist/lib/android/keystore.d.ts +14 -0
- package/dist/lib/android/rename.d.ts +7 -0
- package/dist/lib/android/utils.d.ts +3 -0
- package/dist/lib/appcenter.d.ts +21 -0
- package/dist/lib/appcenter.js +209 -0
- package/dist/lib/createApp/common.d.ts +1 -0
- package/dist/lib/createApp/mobile.d.ts +7 -0
- package/dist/lib/firebase.d.ts +2 -0
- package/dist/lib/getCliSettings.d.ts +4 -0
- package/dist/lib/getCliSettings.js +34 -0
- package/dist/lib/git.d.ts +2 -0
- package/dist/lib/git.js +73 -0
- package/dist/lib/index.d.ts +20 -0
- package/dist/lib/index.js +4 -0
- package/dist/lib/ios/index.d.ts +2 -0
- package/dist/lib/ios/rename.d.ts +7 -0
- package/dist/lib/ios/utils.d.ts +2 -0
- package/dist/lib/spinner.d.ts +6 -0
- package/dist/lib/utils.d.ts +18 -0
- package/dist/lib/utils.js +78 -3
- package/dist/lib/walk.d.ts +37 -0
- package/dist/types.d.ts +28 -0
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type KeystoreCredentials = {
|
|
2
|
+
'storePassword': string;
|
|
3
|
+
'keyAlias': string;
|
|
4
|
+
'keyPassword': string;
|
|
5
|
+
};
|
|
6
|
+
export declare class AndroidConfigFile {
|
|
7
|
+
path?: string;
|
|
8
|
+
data: {};
|
|
9
|
+
constructor(path?: string);
|
|
10
|
+
setKey(key: string, value: KeystoreCredentials): void;
|
|
11
|
+
save(): void;
|
|
12
|
+
}
|
|
13
|
+
export declare const generateReleaseKeystore: (androidFolder?: string) => Promise<void>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import firebase from 'firebase-admin';
|
|
2
|
+
type RenameAndroidOptions = {
|
|
3
|
+
changeBundle?: boolean;
|
|
4
|
+
firebase?: firebase.app.App;
|
|
5
|
+
};
|
|
6
|
+
export declare function renameAndroid(androidFolder: string, newName: string, options?: RenameAndroidOptions): Promise<void>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type ApplicationPlatform = 'ios' | 'android';
|
|
2
|
+
declare function addDeployment(name: string, application: string): Promise<void>;
|
|
3
|
+
declare function getApplication(platform: ApplicationPlatform): Promise<string>;
|
|
4
|
+
export declare function updateDeployment(name: string, application: string): Promise<void>;
|
|
5
|
+
export declare function deploymentExists(name: string, platform: ApplicationPlatform): Promise<boolean>;
|
|
6
|
+
export declare const createApplication: (platform: ApplicationPlatform, token: string) => Promise<{
|
|
7
|
+
app: any;
|
|
8
|
+
appToken: any;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const Codepush: {
|
|
11
|
+
getApplication: typeof getApplication;
|
|
12
|
+
addDeployment: typeof addDeployment;
|
|
13
|
+
updateDeployment: typeof updateDeployment;
|
|
14
|
+
createApplication: (platform: ApplicationPlatform, token: string) => Promise<{
|
|
15
|
+
app: any;
|
|
16
|
+
appToken: any;
|
|
17
|
+
}>;
|
|
18
|
+
deploymentExists: typeof deploymentExists;
|
|
19
|
+
createDeployment: (name: string, platform: ApplicationPlatform) => Promise<any>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,209 @@
|
|
|
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 (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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.Codepush = exports.createApplication = exports.deploymentExists = exports.updateDeployment = void 0;
|
|
43
|
+
var getCliSettings_1 = require("./getCliSettings");
|
|
44
|
+
var utils_1 = require("./utils");
|
|
45
|
+
var axios_1 = __importDefault(require("axios"));
|
|
46
|
+
function addDeployment(name, application) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0: return [4 /*yield*/, (0, utils_1.subprocess)('Create deployment', 'appcenter', ['codepush', 'deployment', 'add', name, '-a', application], {})];
|
|
51
|
+
case 1:
|
|
52
|
+
_a.sent();
|
|
53
|
+
return [2 /*return*/];
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function getApplication(platform) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
+
var settings, platformSettings, predictedName;
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
settings = (0, getCliSettings_1.getCliSettings)().codepush;
|
|
63
|
+
platformSettings = settings[platform];
|
|
64
|
+
if (!platformSettings) {
|
|
65
|
+
predictedName = "".concat(settings.ApplicationName, "-").concat(platform);
|
|
66
|
+
return [2 /*return*/, "".concat(settings.OwnerName, "/").concat(predictedName)];
|
|
67
|
+
}
|
|
68
|
+
return [2 /*return*/, "".concat(settings.OwnerName, "/").concat(platformSettings.ApplicationName)];
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function getAPI(token, platform) {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
if (!token && !!platform) {
|
|
75
|
+
token = (_b = (_a = (0, getCliSettings_1.getCliSettings)().codepush) === null || _a === void 0 ? void 0 : _a[platform]) === null || _b === void 0 ? void 0 : _b.ApiToken;
|
|
76
|
+
}
|
|
77
|
+
return axios_1.default.create({
|
|
78
|
+
baseURL: 'https://api.appcenter.ms/v0.1',
|
|
79
|
+
headers: {
|
|
80
|
+
'Content-Type': 'application/json',
|
|
81
|
+
'X-API-Token': token,
|
|
82
|
+
'Accept': 'application/json',
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function updateDeployment(name, application) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
88
|
+
return __generator(this, function (_a) {
|
|
89
|
+
switch (_a.label) {
|
|
90
|
+
case 0: return [4 /*yield*/, (0, utils_1.subprocess)('Create deployment', 'appcenter', [
|
|
91
|
+
'codepush',
|
|
92
|
+
'release-react',
|
|
93
|
+
'-a',
|
|
94
|
+
application,
|
|
95
|
+
'-d',
|
|
96
|
+
name,
|
|
97
|
+
'-t',
|
|
98
|
+
'1.0.0',
|
|
99
|
+
], {})];
|
|
100
|
+
case 1:
|
|
101
|
+
_a.sent();
|
|
102
|
+
return [2 /*return*/];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
exports.updateDeployment = updateDeployment;
|
|
108
|
+
function deploymentExists(name, platform) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
+
var application, api, response, e_1;
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
switch (_a.label) {
|
|
113
|
+
case 0: return [4 /*yield*/, getApplication(platform)];
|
|
114
|
+
case 1:
|
|
115
|
+
application = _a.sent();
|
|
116
|
+
api = getAPI(undefined, platform);
|
|
117
|
+
_a.label = 2;
|
|
118
|
+
case 2:
|
|
119
|
+
_a.trys.push([2, 4, , 5]);
|
|
120
|
+
return [4 /*yield*/, api.get("/apps/".concat(application, "/deployments/").concat(name), {
|
|
121
|
+
validateStatus: function () { return true; },
|
|
122
|
+
})];
|
|
123
|
+
case 3:
|
|
124
|
+
response = _a.sent();
|
|
125
|
+
return [2 /*return*/, response.status === 200];
|
|
126
|
+
case 4:
|
|
127
|
+
e_1 = _a.sent();
|
|
128
|
+
console.error('Error checking deployment', e_1);
|
|
129
|
+
process.exit(1);
|
|
130
|
+
return [3 /*break*/, 5];
|
|
131
|
+
case 5: return [2 /*return*/, false];
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
exports.deploymentExists = deploymentExists;
|
|
137
|
+
var createApplication = function (platform, token) { return __awaiter(void 0, void 0, void 0, function () {
|
|
138
|
+
var settings, name, api, platformName, appName, createAppResponse, createTokenResponse, appToken, app;
|
|
139
|
+
return __generator(this, function (_a) {
|
|
140
|
+
switch (_a.label) {
|
|
141
|
+
case 0:
|
|
142
|
+
settings = (0, getCliSettings_1.getCliSettings)().codepush;
|
|
143
|
+
return [4 /*yield*/, getApplication(platform)];
|
|
144
|
+
case 1:
|
|
145
|
+
name = _a.sent();
|
|
146
|
+
api = getAPI(token, platform);
|
|
147
|
+
platformName = {
|
|
148
|
+
ios: 'iOS',
|
|
149
|
+
android: 'Android',
|
|
150
|
+
}[platform];
|
|
151
|
+
appName = "".concat(settings.ApplicationName, "-").concat(platformName);
|
|
152
|
+
return [4 /*yield*/, api.post("/orgs/".concat(settings.OwnerName, "/apps"), {
|
|
153
|
+
'description': appName,
|
|
154
|
+
'release_type': "Beta",
|
|
155
|
+
'display_name': appName,
|
|
156
|
+
'name': appName,
|
|
157
|
+
'os': platformName,
|
|
158
|
+
'platform': 'React-Native',
|
|
159
|
+
})];
|
|
160
|
+
case 2:
|
|
161
|
+
createAppResponse = _a.sent();
|
|
162
|
+
return [4 /*yield*/, (0, utils_1.waitFor)(3000)];
|
|
163
|
+
case 3:
|
|
164
|
+
_a.sent();
|
|
165
|
+
return [4 /*yield*/, api.post("/apps/".concat(settings.OwnerName, "/").concat(appName, "/api_tokens"), {
|
|
166
|
+
description: 'Automation token',
|
|
167
|
+
scope: [
|
|
168
|
+
'all',
|
|
169
|
+
],
|
|
170
|
+
})];
|
|
171
|
+
case 4:
|
|
172
|
+
createTokenResponse = _a.sent();
|
|
173
|
+
appToken = createTokenResponse.data.api_token;
|
|
174
|
+
app = createAppResponse.data;
|
|
175
|
+
return [2 /*return*/, {
|
|
176
|
+
app: app,
|
|
177
|
+
appToken: appToken,
|
|
178
|
+
}];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}); };
|
|
182
|
+
exports.createApplication = createApplication;
|
|
183
|
+
var createDeployment = function (name, platform) { return __awaiter(void 0, void 0, void 0, function () {
|
|
184
|
+
var application, api, response;
|
|
185
|
+
return __generator(this, function (_a) {
|
|
186
|
+
switch (_a.label) {
|
|
187
|
+
case 0: return [4 /*yield*/, getApplication(platform)];
|
|
188
|
+
case 1:
|
|
189
|
+
application = _a.sent();
|
|
190
|
+
return [4 /*yield*/, getAPI(undefined, platform)];
|
|
191
|
+
case 2:
|
|
192
|
+
api = _a.sent();
|
|
193
|
+
return [4 /*yield*/, api.post("/apps/".concat(application, "/deployments"), {
|
|
194
|
+
name: name,
|
|
195
|
+
})];
|
|
196
|
+
case 3:
|
|
197
|
+
response = _a.sent();
|
|
198
|
+
return [2 /*return*/, response.data];
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}); };
|
|
202
|
+
exports.Codepush = {
|
|
203
|
+
getApplication: getApplication,
|
|
204
|
+
addDeployment: addDeployment,
|
|
205
|
+
updateDeployment: updateDeployment,
|
|
206
|
+
createApplication: exports.createApplication,
|
|
207
|
+
deploymentExists: deploymentExists,
|
|
208
|
+
createDeployment: createDeployment,
|
|
209
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function initRepoFromTemplate(templateUrl: string, location: string): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CodeleapCLISettings } from '../types';
|
|
2
|
+
export declare let cachedSettings: CodeleapCLISettings;
|
|
3
|
+
export declare function getCliSettings(required?: boolean): CodeleapCLISettings;
|
|
4
|
+
export declare function invalidateSettingsCache(withValue?: CodeleapCLISettings): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.invalidateSettingsCache = exports.getCliSettings = exports.cachedSettings = void 0;
|
|
4
|
+
var constants_1 = require("../constants");
|
|
5
|
+
var utils_1 = require("./utils");
|
|
6
|
+
exports.cachedSettings = null;
|
|
7
|
+
function getCliSettings(required) {
|
|
8
|
+
if (required === void 0) { required = true; }
|
|
9
|
+
if (exports.cachedSettings) {
|
|
10
|
+
return exports.cachedSettings;
|
|
11
|
+
}
|
|
12
|
+
var settingsPath = constants_1.CODELEAP_CLI_SETTINGS_PATH;
|
|
13
|
+
if (!utils_1.fs.existsSync(settingsPath) && required) {
|
|
14
|
+
console.error('Settings not found, check path:', settingsPath);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
var settingsJSON = utils_1.fs.readFileSync(settingsPath).toString();
|
|
19
|
+
try {
|
|
20
|
+
var settings = JSON.parse(settingsJSON);
|
|
21
|
+
exports.cachedSettings = settings;
|
|
22
|
+
return settings;
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
console.error('Error parsing settings, check path:', settingsPath);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.getCliSettings = getCliSettings;
|
|
30
|
+
function invalidateSettingsCache(withValue) {
|
|
31
|
+
if (withValue === void 0) { withValue = null; }
|
|
32
|
+
exports.cachedSettings = withValue;
|
|
33
|
+
}
|
|
34
|
+
exports.invalidateSettingsCache = invalidateSettingsCache;
|
package/dist/lib/git.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
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 (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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getDefaultBranchName = exports.getCurrentBranch = void 0;
|
|
40
|
+
var utils_1 = require("./utils");
|
|
41
|
+
function getCurrentBranch() {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
+
var stdout, branchName;
|
|
44
|
+
return __generator(this, function (_a) {
|
|
45
|
+
switch (_a.label) {
|
|
46
|
+
case 0: return [4 /*yield*/, (0, utils_1.subprocess)('Get current branch', 'git', ['rev-parse', '--abbrev-ref', 'HEAD'], {})];
|
|
47
|
+
case 1:
|
|
48
|
+
stdout = (_a.sent()).stdout;
|
|
49
|
+
branchName = stdout.join('').trim();
|
|
50
|
+
return [2 /*return*/, branchName];
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
exports.getCurrentBranch = getCurrentBranch;
|
|
56
|
+
function getDefaultBranchName() {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
+
var stdout, branchName;
|
|
59
|
+
return __generator(this, function (_a) {
|
|
60
|
+
switch (_a.label) {
|
|
61
|
+
case 0: return [4 /*yield*/, (0, utils_1.subprocess)('Get default branch', 'git', ['symbolic-ref', '--short', 'refs/remotes/origin/HEAD'], {})];
|
|
62
|
+
case 1:
|
|
63
|
+
stdout = (_a.sent()).stdout;
|
|
64
|
+
branchName = stdout.join('').trim();
|
|
65
|
+
if (branchName.startsWith('origin/')) {
|
|
66
|
+
branchName = branchName.replace('origin/', '');
|
|
67
|
+
}
|
|
68
|
+
return [2 /*return*/, branchName];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
exports.getDefaultBranchName = getDefaultBranchName;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { default as figlet } from 'figlet';
|
|
2
|
+
export { default as chalk } from 'chalk';
|
|
3
|
+
export { default as inquirer } from 'inquirer';
|
|
4
|
+
export declare const git: import("simple-git").SimpleGit;
|
|
5
|
+
export declare const octokit: import("@octokit/core").Octokit & {
|
|
6
|
+
paginate: import("@octokit/plugin-paginate-rest").PaginateInterface;
|
|
7
|
+
} & import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api & {
|
|
8
|
+
retry: {
|
|
9
|
+
retryRequest: (error: import("@octokit/request-error").RequestError, retries: number, retryAfter: number) => import("@octokit/request-error").RequestError;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export * from './utils';
|
|
13
|
+
export * from './walk';
|
|
14
|
+
export * from './android';
|
|
15
|
+
export * from './getCliSettings';
|
|
16
|
+
export * from './git';
|
|
17
|
+
export * from './alterCliSettings';
|
|
18
|
+
export * from './appcenter';
|
|
19
|
+
export * from './ios';
|
|
20
|
+
export { createMobileApp } from './createApp/mobile';
|
package/dist/lib/index.js
CHANGED
|
@@ -36,6 +36,10 @@ exports.octokit = new octokit_1.Octokit({
|
|
|
36
36
|
__exportStar(require("./utils"), exports);
|
|
37
37
|
__exportStar(require("./walk"), exports);
|
|
38
38
|
__exportStar(require("./android"), exports);
|
|
39
|
+
__exportStar(require("./getCliSettings"), exports);
|
|
40
|
+
__exportStar(require("./git"), exports);
|
|
41
|
+
__exportStar(require("./alterCliSettings"), exports);
|
|
42
|
+
__exportStar(require("./appcenter"), exports);
|
|
39
43
|
__exportStar(require("./ios"), exports);
|
|
40
44
|
var mobile_1 = require("./createApp/mobile");
|
|
41
45
|
Object.defineProperty(exports, "createMobileApp", { enumerable: true, get: function () { return mobile_1.createMobileApp; } });
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import cp from 'child_process';
|
|
2
|
+
export declare const getNewBundleName: (newName: string) => string;
|
|
3
|
+
export declare function subprocess(name: string, ...params: Parameters<typeof cp.spawn>): Promise<{
|
|
4
|
+
stdout: string[];
|
|
5
|
+
stderr: string[];
|
|
6
|
+
}>;
|
|
7
|
+
export declare function listPrompt(items: string[], numbered?: boolean): string;
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
export { fs, path, };
|
|
11
|
+
export declare function findExecutable(exec: string): string;
|
|
12
|
+
export declare function parseFilePathData(path: string): {
|
|
13
|
+
path: string;
|
|
14
|
+
extension: string;
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function formatError(err: any): any[];
|
|
18
|
+
export declare function waitFor(ms?: number): Promise<unknown>;
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,10 +1,47 @@
|
|
|
1
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 (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
|
+
};
|
|
2
38
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
40
|
};
|
|
5
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseFilePathData = exports.findExecutable = exports.path = exports.fs = exports.listPrompt = exports.subprocess = exports.getNewBundleName = void 0;
|
|
42
|
+
exports.waitFor = exports.formatError = exports.parseFilePathData = exports.findExecutable = exports.path = exports.fs = exports.listPrompt = exports.subprocess = exports.getNewBundleName = void 0;
|
|
7
43
|
var child_process_1 = __importDefault(require("child_process"));
|
|
44
|
+
var axios_1 = require("axios");
|
|
8
45
|
var getNewBundleName = function (newName) { return "uk.co.codeleap.".concat(newName.trim()); };
|
|
9
46
|
exports.getNewBundleName = getNewBundleName;
|
|
10
47
|
function subprocess(name) {
|
|
@@ -14,8 +51,14 @@ function subprocess(name) {
|
|
|
14
51
|
}
|
|
15
52
|
return new Promise(function (resolve, reject) {
|
|
16
53
|
var _a, _b, _c, _d;
|
|
54
|
+
var stdout = [];
|
|
55
|
+
var stderr = [];
|
|
17
56
|
console.log("Running ".concat(params[0], " ").concat(params[1].join(' ')));
|
|
18
|
-
var child = child_process_1.default.spawn(params[0], params[1].map(function (x) {
|
|
57
|
+
var child = child_process_1.default.spawn(params[0], params[1].map(function (x) {
|
|
58
|
+
if (typeof x === 'string')
|
|
59
|
+
return x;
|
|
60
|
+
return JSON.stringify(x);
|
|
61
|
+
}), params[2]);
|
|
19
62
|
child.on('error', function (err) {
|
|
20
63
|
console.log("".concat(name, " finished with error: "), err.toString());
|
|
21
64
|
reject(err);
|
|
@@ -26,14 +69,19 @@ function subprocess(name) {
|
|
|
26
69
|
reject("".concat(name, " finieshed with non zero exit code"));
|
|
27
70
|
}
|
|
28
71
|
else {
|
|
29
|
-
resolve(
|
|
72
|
+
resolve({
|
|
73
|
+
stdout: stdout,
|
|
74
|
+
stderr: stderr,
|
|
75
|
+
});
|
|
30
76
|
}
|
|
31
77
|
});
|
|
32
78
|
(_b = (_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on) === null || _b === void 0 ? void 0 : _b.call(_a, 'data', function (outdata) {
|
|
33
79
|
console.log(outdata.toString());
|
|
80
|
+
stdout.push(outdata.toString());
|
|
34
81
|
});
|
|
35
82
|
(_d = (_c = child.stderr) === null || _c === void 0 ? void 0 : _c.on) === null || _d === void 0 ? void 0 : _d.call(_c, 'data', function (errdata) {
|
|
36
83
|
console.error(errdata.toString());
|
|
84
|
+
stderr.push(errdata.toString());
|
|
37
85
|
});
|
|
38
86
|
});
|
|
39
87
|
}
|
|
@@ -76,3 +124,30 @@ function parseFilePathData(path) {
|
|
|
76
124
|
};
|
|
77
125
|
}
|
|
78
126
|
exports.parseFilePathData = parseFilePathData;
|
|
127
|
+
function formatError(err) {
|
|
128
|
+
var _a, _b, _c, _d, _e;
|
|
129
|
+
var content = [];
|
|
130
|
+
if ((0, axios_1.isAxiosError)(err)) {
|
|
131
|
+
var fullUrl = (_b = (_a = err.request) === null || _a === void 0 ? void 0 : _a.res) === null || _b === void 0 ? void 0 : _b.responseUrl;
|
|
132
|
+
var message = "Request to ".concat(fullUrl, " failed with status ").concat((_c = err.response) === null || _c === void 0 ? void 0 : _c.status);
|
|
133
|
+
if (!!((_d = err === null || err === void 0 ? void 0 : err.response) === null || _d === void 0 ? void 0 : _d.data)) {
|
|
134
|
+
content = [message, (_e = err.response) === null || _e === void 0 ? void 0 : _e.data];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
content = [err];
|
|
139
|
+
}
|
|
140
|
+
return content;
|
|
141
|
+
}
|
|
142
|
+
exports.formatError = formatError;
|
|
143
|
+
function waitFor(ms) {
|
|
144
|
+
if (ms === void 0) { ms = 1000; }
|
|
145
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
146
|
+
return __generator(this, function (_a) {
|
|
147
|
+
return [2 /*return*/, new Promise(function (resolve) {
|
|
148
|
+
setTimeout(resolve, ms);
|
|
149
|
+
})];
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
exports.waitFor = waitFor;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
type WalkDirInfo = {
|
|
4
|
+
parentPath: string;
|
|
5
|
+
name: string;
|
|
6
|
+
file?: {
|
|
7
|
+
content?: string;
|
|
8
|
+
ext: string;
|
|
9
|
+
};
|
|
10
|
+
dir?: {
|
|
11
|
+
contents: string[];
|
|
12
|
+
};
|
|
13
|
+
stat: fs.Stats;
|
|
14
|
+
err?: any;
|
|
15
|
+
path: string;
|
|
16
|
+
isDir: boolean;
|
|
17
|
+
};
|
|
18
|
+
type FileMatch = {
|
|
19
|
+
name?: string | RegExp;
|
|
20
|
+
dir?: boolean;
|
|
21
|
+
file?: boolean;
|
|
22
|
+
ext?: string[];
|
|
23
|
+
};
|
|
24
|
+
type WalkDirConfig = {
|
|
25
|
+
action: (info: WalkDirInfo) => string | void;
|
|
26
|
+
path: string;
|
|
27
|
+
options?: {
|
|
28
|
+
recursive?: boolean;
|
|
29
|
+
all?: boolean;
|
|
30
|
+
directories?: boolean;
|
|
31
|
+
files?: boolean;
|
|
32
|
+
scanFileContent?: boolean;
|
|
33
|
+
ignore?: FileMatch[];
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export declare function walkDir(config: WalkDirConfig): Promise<void>;
|
|
37
|
+
export {};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type CodeleapCLIUserConfig = {
|
|
2
|
+
GITHUB_TOKEN: string;
|
|
3
|
+
SHELL?: string;
|
|
4
|
+
};
|
|
5
|
+
export type CodepushAppConfig = {
|
|
6
|
+
ApplicationName: string;
|
|
7
|
+
ApiToken: string;
|
|
8
|
+
};
|
|
9
|
+
export type CodeleapCLISettings = {
|
|
10
|
+
'convertor-webp': {
|
|
11
|
+
input: string;
|
|
12
|
+
output: string;
|
|
13
|
+
convertor: {
|
|
14
|
+
compressionQuality: number;
|
|
15
|
+
resizeWidth: number;
|
|
16
|
+
processColorChannels: boolean;
|
|
17
|
+
inputFormats: string[];
|
|
18
|
+
ignoreFiles: string[];
|
|
19
|
+
};
|
|
20
|
+
mode: 'multi' | 'single';
|
|
21
|
+
};
|
|
22
|
+
'codepush': {
|
|
23
|
+
ApplicationName: string;
|
|
24
|
+
OwnerName: string;
|
|
25
|
+
ios?: CodepushAppConfig;
|
|
26
|
+
android?: CodepushAppConfig;
|
|
27
|
+
};
|
|
28
|
+
};
|