@zeppos/zeus-cli 1.7.10 → 1.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/bin/main.js +85 -30
- package/bin/post-command.js +1 -1
- package/index.js +1 -1
- package/modules/bridge.js +43 -33
- package/modules/build.js +72 -36
- package/modules/create.js +213 -216
- package/modules/help.js +21 -11
- package/modules/prune.js +1 -1
- package/modules/run.js +29 -17
- package/modules/version.js +5 -6
- package/modules/yargsCmdBuilders.js +3 -3
- package/package.json +6 -4
- package/private-modules/zeppos-app-utils/dist/api/index.js +18 -20
- package/private-modules/zeppos-app-utils/dist/config/device.js +19 -17
- package/private-modules/zeppos-app-utils/dist/config/index.js +1 -1
- package/private-modules/zeppos-app-utils/dist/config/project.js +14 -14
- package/private-modules/zeppos-app-utils/dist/hm-analytics.js +14 -13
- package/private-modules/zeppos-app-utils/dist/index.js +18 -8
- package/private-modules/zeppos-app-utils/dist/logger/index.js +5 -5
- package/private-modules/zeppos-app-utils/dist/logger/my-logger.js +1 -1
- package/private-modules/zeppos-app-utils/dist/modules/build.js +73 -46
- package/private-modules/zeppos-app-utils/dist/modules/config.js +14 -12
- package/private-modules/zeppos-app-utils/dist/modules/create/index.js +71 -39
- package/private-modules/zeppos-app-utils/dist/modules/create/local-app.js +82 -66
- package/private-modules/zeppos-app-utils/dist/modules/create/yeoman-app.js +6 -6
- package/private-modules/zeppos-app-utils/dist/modules/fetchDevices.js +73 -40
- package/private-modules/zeppos-app-utils/dist/modules/index.js +1 -1
- package/private-modules/zeppos-app-utils/dist/modules/login.js +16 -15
- package/private-modules/zeppos-app-utils/dist/modules/open/index.js +62 -50
- package/private-modules/zeppos-app-utils/dist/modules/prune.js +5 -5
- package/private-modules/zeppos-app-utils/dist/modules/status.js +12 -12
- package/private-modules/zeppos-app-utils/dist/simulator.js +3 -3
- package/private-modules/zeppos-app-utils/dist/storage/index.js +7 -7
- package/private-modules/zeppos-app-utils/dist/tools/index.js +24 -14
- package/private-modules/zeppos-app-utils/dist/tools/tools.js +3 -3
- package/private-modules/zeppos-app-utils/dist/websocket.js +9 -9
- package/private-modules/zeppos-app-utils/package.json +2 -1
- package/utils/pre-check.js +52 -29
- package/utils/tools.js +4 -4
package/modules/create.js
CHANGED
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
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 =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -47,237 +47,232 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
47
47
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
48
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
49
|
};
|
|
50
|
-
exports
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
51
|
exports.create = void 0;
|
|
52
52
|
var lodash_1 = require("lodash");
|
|
53
53
|
var inquirer_1 = __importDefault(require("inquirer"));
|
|
54
54
|
var path_1 = require("path");
|
|
55
55
|
var zeppos_app_utils_1 = require("zeppos-app-utils");
|
|
56
56
|
var AppType = zeppos_app_utils_1.config.AppType, getDeviceConf = zeppos_app_utils_1.config.getDeviceConf;
|
|
57
|
-
var inquirerFunc = function (
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
message: 'What type of application do you want to create?',
|
|
78
|
-
choices: Object.keys(AppType)
|
|
57
|
+
var inquirerFunc = function (args_1, _a) { return __awaiter(void 0, [args_1, _a], void 0, function (args, _b) {
|
|
58
|
+
var _c, promptAppType, _d, promptOsVersion, _e, promptTemplate, _f, promptWithAppSide, _g, promptWithSettings, _h, promptBuildTargets, _j, configVersion, _k, deviceTargets, OSV2DeviceTargetNames;
|
|
59
|
+
var appTemplateChoices = _b.appTemplateChoices, workoutExtTemplateChoices = _b.workoutExtTemplateChoices, watchfaceTemplateChoices = _b.watchfaceTemplateChoices;
|
|
60
|
+
return __generator(this, function (_l) {
|
|
61
|
+
switch (_l.label) {
|
|
62
|
+
case 0:
|
|
63
|
+
_c = args.appType, promptAppType = _c === void 0 ? '' : _c, _d = args.OSVersion, promptOsVersion = _d === void 0 ? '' : _d, _e = args.template, promptTemplate = _e === void 0 ? '' : _e, _f = args.withAppSide, promptWithAppSide = _f === void 0 ? false : _f, _g = args.withSettings, promptWithSettings = _g === void 0 ? false : _g, _h = args.buildTargets, promptBuildTargets = _h === void 0 ? [] : _h, _j = args.configVersion, configVersion = _j === void 0 ? 'v2' : _j;
|
|
64
|
+
_k = getDeviceConf(), deviceTargets = _k.deviceTargets, OSV2DeviceTargetNames = _k.OSV2DeviceTargetNames;
|
|
65
|
+
return [4, inquirer_1.default
|
|
66
|
+
.prompt([
|
|
67
|
+
{
|
|
68
|
+
name: 'appType',
|
|
69
|
+
type: 'list',
|
|
70
|
+
when: function (args) {
|
|
71
|
+
var bool = !promptAppType || !Object.values(AppType).includes(promptAppType);
|
|
72
|
+
if (!bool) {
|
|
73
|
+
args.appType = promptAppType.toUpperCase();
|
|
74
|
+
}
|
|
75
|
+
return bool;
|
|
79
76
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return bool && !isWorkoutExtension;
|
|
92
|
-
},
|
|
93
|
-
message: 'Which OS version API to develop with?',
|
|
94
|
-
choices: function (args) {
|
|
95
|
-
var isWatchFace = args.appType.toLowerCase() === AppType.WATCHFACE;
|
|
96
|
-
var options = [{
|
|
97
|
-
name: 'OS 1.0 API (Build products can run on devices with OS 1.0 and above)',
|
|
98
|
-
value: 'v1'
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'OS 2.0 API (Build products can run on devices with OS 2.0 and above)',
|
|
102
|
-
value: 'v2'
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: 'OS 3.0 API (Build products can run on devices with OS 3.0 and above)',
|
|
106
|
-
value: 'v3'
|
|
107
|
-
}, {
|
|
108
|
-
name: 'OS 4.0 API (Build products can run on devices with OS 4.0 and above)',
|
|
109
|
-
value: 'v4'
|
|
110
|
-
}];
|
|
111
|
-
if (isWatchFace) {
|
|
112
|
-
options = options.slice(0, 2);
|
|
113
|
-
}
|
|
114
|
-
return __spreadArray([
|
|
115
|
-
new inquirer_1["default"].Separator(),
|
|
116
|
-
new inquirer_1["default"].Separator('Device Basic Information: https://docs.zepp.com/docs/reference/related-resources/device-list/'),
|
|
117
|
-
new inquirer_1["default"].Separator()
|
|
118
|
-
], options, true);
|
|
77
|
+
message: 'What type of application do you want to create?',
|
|
78
|
+
choices: Object.keys(AppType),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'OSVersion',
|
|
82
|
+
type: 'list',
|
|
83
|
+
when: function (args) {
|
|
84
|
+
var isWorkoutExtension = args.appType.toLowerCase() === AppType.WORKOUT_EXTENSION;
|
|
85
|
+
var bool = !promptOsVersion || !['v1', 'v2'].includes(promptOsVersion);
|
|
86
|
+
if (!bool) {
|
|
87
|
+
args.OSVersion = promptOsVersion;
|
|
119
88
|
}
|
|
89
|
+
if (isWorkoutExtension)
|
|
90
|
+
args.OSVersion = 'v3.5';
|
|
91
|
+
return bool && !isWorkoutExtension;
|
|
120
92
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
93
|
+
message: 'Which OS version API to develop with?',
|
|
94
|
+
choices: function (args) {
|
|
95
|
+
var isWatchFace = args.appType.toLowerCase() === AppType.WATCHFACE;
|
|
96
|
+
var options = [
|
|
97
|
+
{
|
|
98
|
+
name: 'OS 1.0 API (Build products can run on devices with OS 1.0 and above)',
|
|
99
|
+
value: 'v1',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'OS 2.0 API (Build products can run on devices with OS 2.0 and above)',
|
|
103
|
+
value: 'v2',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'OS 3.0 API (Build products can run on devices with OS 3.0 and above)',
|
|
107
|
+
value: 'v3',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'OS 4.0 API (Build products can run on devices with OS 4.0 and above)',
|
|
111
|
+
value: 'v4',
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
if (isWatchFace) {
|
|
115
|
+
options = options.slice(0, 2);
|
|
142
116
|
}
|
|
117
|
+
return __spreadArray([
|
|
118
|
+
new inquirer_1.default.Separator(),
|
|
119
|
+
new inquirer_1.default.Separator('Device Basic Information: https://docs.zepp.com/docs/reference/related-resources/device-list/'),
|
|
120
|
+
new inquirer_1.default.Separator()
|
|
121
|
+
], options, true);
|
|
143
122
|
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
var
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
args.template = objMap.value;
|
|
157
|
-
}
|
|
158
|
-
return isWorkoutExtension && !objMap;
|
|
159
|
-
},
|
|
160
|
-
message: 'Which app template do you want to use?',
|
|
161
|
-
choices: function (args) {
|
|
162
|
-
var val = workoutExtTemplateChoices[args.OSVersion] || [];
|
|
163
|
-
return __spreadArray([
|
|
164
|
-
new inquirer_1["default"].Separator(),
|
|
165
|
-
new inquirer_1["default"].Separator('Choose a app template')
|
|
166
|
-
], val, true);
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'template',
|
|
126
|
+
type: 'list',
|
|
127
|
+
when: function (args) {
|
|
128
|
+
var isApp = args.appType.toLowerCase() === AppType.APP;
|
|
129
|
+
var objMap = appTemplateChoices[args.OSVersion].find(function (val) {
|
|
130
|
+
var name = val.name === 'Hello World' ? 'Hello_World' : val.name;
|
|
131
|
+
return name === promptTemplate;
|
|
132
|
+
});
|
|
133
|
+
if (isApp && objMap) {
|
|
134
|
+
args.template = objMap.value;
|
|
167
135
|
}
|
|
136
|
+
return isApp && !objMap;
|
|
168
137
|
},
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
138
|
+
message: 'Which app template do you want to use?',
|
|
139
|
+
choices: function (args) {
|
|
140
|
+
var val = appTemplateChoices[args.OSVersion] || [];
|
|
141
|
+
return __spreadArray([new inquirer_1.default.Separator(), new inquirer_1.default.Separator('Choose a app template')], val, true);
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'template',
|
|
146
|
+
type: 'list',
|
|
147
|
+
when: function (args) {
|
|
148
|
+
var isWorkoutExtension = args.appType.toLowerCase() === AppType.WORKOUT_EXTENSION;
|
|
149
|
+
if (!isWorkoutExtension)
|
|
150
|
+
return isWorkoutExtension;
|
|
151
|
+
var objMap = workoutExtTemplateChoices[args.OSVersion].find(function (val) {
|
|
152
|
+
var name = val.name === 'Hello World' ? 'Hello_World' : val.name;
|
|
153
|
+
return name === promptTemplate;
|
|
154
|
+
});
|
|
155
|
+
if (isWorkoutExtension && objMap) {
|
|
156
|
+
args.template = objMap.value;
|
|
187
157
|
}
|
|
158
|
+
return isWorkoutExtension && !objMap;
|
|
188
159
|
},
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
|
|
160
|
+
message: 'Which app template do you want to use?',
|
|
161
|
+
choices: function (args) {
|
|
162
|
+
var val = workoutExtTemplateChoices[args.OSVersion] || [];
|
|
163
|
+
return __spreadArray([new inquirer_1.default.Separator(), new inquirer_1.default.Separator('Choose a app template')], val, true);
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: 'template',
|
|
168
|
+
type: 'list',
|
|
169
|
+
when: function (args) {
|
|
170
|
+
var isWatchFace = args.appType.toLowerCase() === AppType.WATCHFACE;
|
|
171
|
+
var objMap = watchfaceTemplateChoices[args.OSVersion].find(function (val) { return val.name === promptTemplate; });
|
|
172
|
+
if (isWatchFace && objMap) {
|
|
173
|
+
args.template = objMap.value;
|
|
174
|
+
}
|
|
175
|
+
return isWatchFace && !objMap;
|
|
202
176
|
},
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
177
|
+
message: 'Which watchface template do you want to use?',
|
|
178
|
+
choices: function (args) {
|
|
179
|
+
var val = watchfaceTemplateChoices[args.OSVersion] || [];
|
|
180
|
+
return __spreadArray([new inquirer_1.default.Separator(), new inquirer_1.default.Separator('Choose a watchface template')], val, true);
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'withAppSide',
|
|
185
|
+
type: 'confirm',
|
|
186
|
+
when: function (args) {
|
|
187
|
+
var isApp = args.appType.toLowerCase() === AppType.APP;
|
|
188
|
+
var isEmpty = args.template === 0;
|
|
189
|
+
if (isApp && isEmpty && promptWithAppSide) {
|
|
190
|
+
args.withAppSide = promptWithAppSide !== 'no';
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
return isApp && isEmpty;
|
|
194
|
+
},
|
|
195
|
+
message: 'Should this application contain a app-side component?',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: 'withSettings',
|
|
199
|
+
type: 'confirm',
|
|
200
|
+
when: function (args) {
|
|
201
|
+
var withAppSide = args.withAppSide;
|
|
202
|
+
if (withAppSide && promptWithSettings) {
|
|
203
|
+
args.withSettings = promptWithSettings !== 'no';
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
return withAppSide;
|
|
207
|
+
},
|
|
208
|
+
message: 'Should this application contain a settings component?',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: 'shapeOfPlatform',
|
|
212
|
+
type: 'checkbox',
|
|
213
|
+
when: function (args) {
|
|
214
|
+
var isApp = args.appType.toLowerCase() === AppType.APP;
|
|
215
|
+
var isEmpty = args.template === 0;
|
|
216
|
+
var osVersionAboveV2 = args.OSVersion.replace('v', '') - 2 > 0;
|
|
217
|
+
return osVersionAboveV2 && isApp && isEmpty;
|
|
218
|
+
},
|
|
219
|
+
choices: [
|
|
220
|
+
new inquirer_1.default.Separator(),
|
|
221
|
+
new inquirer_1.default.Separator('Choose the shape of the device'),
|
|
222
|
+
{ name: 'Round-screen smartwatch device', value: 'r', checked: true },
|
|
223
|
+
{ name: 'Square-screen smartwatch device', value: 's' },
|
|
224
|
+
{ name: 'Band device', value: 'b' },
|
|
225
|
+
],
|
|
226
|
+
default: 'r',
|
|
227
|
+
message: 'On which device platform do you plan to install the application?',
|
|
228
|
+
},
|
|
229
|
+
])
|
|
230
|
+
.then(function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
231
|
+
var choicePlatforms_1, answer;
|
|
232
|
+
return __generator(this, function (_a) {
|
|
233
|
+
switch (_a.label) {
|
|
234
|
+
case 0:
|
|
235
|
+
if (!(typeof promptBuildTargets === 'string')) return [3, 1];
|
|
236
|
+
args.buildTargets = (0, lodash_1.intersection)(Object.keys(deviceTargets), promptBuildTargets.split(','));
|
|
237
|
+
return [3, 3];
|
|
238
|
+
case 1:
|
|
239
|
+
if (!(configVersion !== 'v3')) return [3, 3];
|
|
240
|
+
choicePlatforms_1 = [];
|
|
241
|
+
switch (args.OSVersion) {
|
|
242
|
+
case 'v1':
|
|
243
|
+
choicePlatforms_1 = Object.keys(deviceTargets);
|
|
244
|
+
break;
|
|
245
|
+
case 'v2':
|
|
246
|
+
choicePlatforms_1 = OSV2DeviceTargetNames;
|
|
247
|
+
break;
|
|
248
|
+
default:
|
|
249
|
+
break;
|
|
211
250
|
}
|
|
212
|
-
return
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
],
|
|
231
|
-
"default": 'r',
|
|
232
|
-
message: 'On which device platform do you plan to install the application?'
|
|
251
|
+
if (!choicePlatforms_1.length) return [3, 3];
|
|
252
|
+
return [4, inquirer_1.default.prompt({
|
|
253
|
+
name: 'buildTargets',
|
|
254
|
+
type: 'checkbox',
|
|
255
|
+
when: function () { return args.template === 0; },
|
|
256
|
+
choices: choicePlatforms_1.map(function (platform) { return ({
|
|
257
|
+
name: deviceTargets[platform].deviceName,
|
|
258
|
+
value: platform,
|
|
259
|
+
checked: platform === choicePlatforms_1[0],
|
|
260
|
+
}); }),
|
|
261
|
+
default: choicePlatforms_1[0],
|
|
262
|
+
message: 'Which platforms of this application should be built?',
|
|
263
|
+
})];
|
|
264
|
+
case 2:
|
|
265
|
+
answer = _a.sent();
|
|
266
|
+
Object.assign(args, answer);
|
|
267
|
+
_a.label = 3;
|
|
268
|
+
case 3: return [2, args];
|
|
233
269
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
case 0:
|
|
239
|
-
if (!(typeof promptBuildTargets === 'string')) return [3, 1];
|
|
240
|
-
args.buildTargets = (0, lodash_1.intersection)(Object.keys(deviceTargets), promptBuildTargets.split(','));
|
|
241
|
-
return [3, 3];
|
|
242
|
-
case 1:
|
|
243
|
-
if (!(configVersion !== 'v3')) return [3, 3];
|
|
244
|
-
choicePlatforms_1 = [];
|
|
245
|
-
switch (args.OSVersion) {
|
|
246
|
-
case 'v1':
|
|
247
|
-
choicePlatforms_1 = Object.keys(deviceTargets);
|
|
248
|
-
break;
|
|
249
|
-
case 'v2':
|
|
250
|
-
choicePlatforms_1 = OSV2DeviceTargetNames;
|
|
251
|
-
break;
|
|
252
|
-
default:
|
|
253
|
-
break;
|
|
254
|
-
}
|
|
255
|
-
if (!choicePlatforms_1.length) return [3, 3];
|
|
256
|
-
return [4, inquirer_1["default"].prompt({
|
|
257
|
-
name: 'buildTargets',
|
|
258
|
-
type: 'checkbox',
|
|
259
|
-
when: function () { return args.template === 0; },
|
|
260
|
-
choices: choicePlatforms_1.map(function (platform) { return ({
|
|
261
|
-
name: deviceTargets[platform].deviceName,
|
|
262
|
-
value: platform,
|
|
263
|
-
checked: platform === choicePlatforms_1[0]
|
|
264
|
-
}); }),
|
|
265
|
-
"default": choicePlatforms_1[0],
|
|
266
|
-
message: 'Which platforms of this application should be built?'
|
|
267
|
-
})];
|
|
268
|
-
case 2:
|
|
269
|
-
answer = _a.sent();
|
|
270
|
-
Object.assign(args, answer);
|
|
271
|
-
_a.label = 3;
|
|
272
|
-
case 3: return [2, args];
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
}); })];
|
|
276
|
-
case 1: return [2, _k.sent()];
|
|
277
|
-
}
|
|
278
|
-
});
|
|
270
|
+
});
|
|
271
|
+
}); })];
|
|
272
|
+
case 1: return [2, _l.sent()];
|
|
273
|
+
}
|
|
279
274
|
});
|
|
280
|
-
};
|
|
275
|
+
}); };
|
|
281
276
|
var create = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
282
277
|
var cmd, _a, projectName, beforeFiles, cwdPath;
|
|
283
278
|
return __generator(this, function (_b) {
|
|
@@ -286,9 +281,11 @@ var create = function (args) { return __awaiter(void 0, void 0, void 0, function
|
|
|
286
281
|
cmd = args._[0], _a = args.projectName, projectName = _a === void 0 ? '' : _a;
|
|
287
282
|
beforeFiles = [];
|
|
288
283
|
cwdPath = (0, path_1.resolve)('./');
|
|
289
|
-
return [4, (0, zeppos_app_utils_1.checkCreateName)(cmd, cwdPath, projectName, 'CLI')
|
|
284
|
+
return [4, (0, zeppos_app_utils_1.checkCreateName)(cmd, cwdPath, projectName, 'CLI')
|
|
285
|
+
.then(function (res) {
|
|
290
286
|
beforeFiles = res.beforeFiles;
|
|
291
|
-
})
|
|
287
|
+
})
|
|
288
|
+
.catch(function (res) {
|
|
292
289
|
zeppos_app_utils_1.logger.error(res.message);
|
|
293
290
|
process.exit(1);
|
|
294
291
|
})];
|
package/modules/help.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -32,8 +42,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
42
|
});
|
|
33
43
|
};
|
|
34
44
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g =
|
|
45
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
47
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
48
|
function step(op) {
|
|
39
49
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -61,7 +71,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
61
71
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
72
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
73
|
};
|
|
64
|
-
exports
|
|
74
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
75
|
exports.help = void 0;
|
|
66
76
|
var fs_extra_1 = __importDefault(require("fs-extra"));
|
|
67
77
|
var path = __importStar(require("path"));
|
|
@@ -69,7 +79,7 @@ var zeppos_app_utils_1 = require("zeppos-app-utils");
|
|
|
69
79
|
var help = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
70
80
|
var pkg, cmd;
|
|
71
81
|
return __generator(this, function (_a) {
|
|
72
|
-
pkg = fs_extra_1
|
|
82
|
+
pkg = fs_extra_1.default.readJSONSync(path.resolve(__dirname, '../package.json'));
|
|
73
83
|
cmd = process.env.CMD_NAME;
|
|
74
84
|
zeppos_app_utils_1.logger.log("Usage: ".concat(cmd, " <command> [args?]"));
|
|
75
85
|
zeppos_app_utils_1.logger.log('');
|
package/modules/prune.js
CHANGED
|
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
}
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
|
-
exports
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.prune = void 0;
|
|
26
26
|
var zeppos_app_utils_1 = require("zeppos-app-utils");
|
|
27
27
|
var prune = function (args) {
|