@featurevisor/cli 0.53.4 → 0.54.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/.eslintcache +1 -1
- package/CHANGELOG.md +16 -0
- package/lib/index.js +89 -65
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +35 -25
package/.eslintcache
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"/home/runner/work/featurevisor/featurevisor/packages/cli/bin.js":"1","/home/runner/work/featurevisor/featurevisor/packages/cli/src/index.ts":"2"},{"size":45,"mtime":
|
|
1
|
+
[{"/home/runner/work/featurevisor/featurevisor/packages/cli/bin.js":"1","/home/runner/work/featurevisor/featurevisor/packages/cli/src/index.ts":"2"},{"size":45,"mtime":1697574571530,"results":"3","hashOfConfig":"4"},{"size":5393,"mtime":1697574571530,"results":"5","hashOfConfig":"4"},{"filePath":"6","messages":"7","suppressedMessages":"8","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"pxfieg",{"filePath":"9","messages":"10","suppressedMessages":"11","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/runner/work/featurevisor/featurevisor/packages/cli/bin.js",[],[],"/home/runner/work/featurevisor/featurevisor/packages/cli/src/index.ts",[],[]]
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.54.0](https://github.com/featurevisor/featurevisor/compare/v0.53.5...v0.54.0) (2023-10-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @featurevisor/cli
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.53.5](https://github.com/featurevisor/featurevisor/compare/v0.53.4...v0.53.5) (2023-10-17)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @featurevisor/cli
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.53.4](https://github.com/featurevisor/featurevisor/compare/v0.53.3...v0.53.4) (2023-10-17)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @featurevisor/cli
|
package/lib/index.js
CHANGED
|
@@ -55,11 +55,25 @@ function requireAndGetProjectConfig(rootDirectoryPath) {
|
|
|
55
55
|
requireConfigFile(configModulePath);
|
|
56
56
|
return (0, core_1.getProjectConfig)(rootDirectoryPath);
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function getDependencies(options) {
|
|
59
59
|
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
-
var rootDirectoryPath;
|
|
60
|
+
var rootDirectoryPath, projectConfig, datasource;
|
|
61
61
|
return __generator(this, function (_a) {
|
|
62
62
|
rootDirectoryPath = process.cwd();
|
|
63
|
+
projectConfig = requireAndGetProjectConfig(rootDirectoryPath);
|
|
64
|
+
datasource = new core_1.Datasource(projectConfig);
|
|
65
|
+
return [2 /*return*/, {
|
|
66
|
+
rootDirectoryPath: rootDirectoryPath,
|
|
67
|
+
projectConfig: projectConfig,
|
|
68
|
+
datasource: datasource,
|
|
69
|
+
options: options,
|
|
70
|
+
}];
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function main() {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
+
return __generator(this, function (_a) {
|
|
63
77
|
yargs(process.argv.slice(2))
|
|
64
78
|
.usage("Usage: <command> [options]")
|
|
65
79
|
/**
|
|
@@ -69,11 +83,14 @@ function main() {
|
|
|
69
83
|
command: "init",
|
|
70
84
|
handler: function (options) {
|
|
71
85
|
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
-
var hasError;
|
|
86
|
+
var deps, hasError;
|
|
73
87
|
return __generator(this, function (_a) {
|
|
74
88
|
switch (_a.label) {
|
|
75
|
-
case 0: return [4 /*yield*/, (
|
|
89
|
+
case 0: return [4 /*yield*/, getDependencies(options)];
|
|
76
90
|
case 1:
|
|
91
|
+
deps = _a.sent();
|
|
92
|
+
return [4 /*yield*/, (0, core_1.initProject)(deps.rootDirectoryPath, options.example)];
|
|
93
|
+
case 2:
|
|
77
94
|
hasError = _a.sent();
|
|
78
95
|
if (hasError) {
|
|
79
96
|
process.exit(1);
|
|
@@ -91,15 +108,16 @@ function main() {
|
|
|
91
108
|
*/
|
|
92
109
|
.command({
|
|
93
110
|
command: "lint",
|
|
94
|
-
handler: function () {
|
|
111
|
+
handler: function (options) {
|
|
95
112
|
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
-
var
|
|
113
|
+
var deps, hasError;
|
|
97
114
|
return __generator(this, function (_a) {
|
|
98
115
|
switch (_a.label) {
|
|
99
|
-
case 0:
|
|
100
|
-
projectConfig = requireAndGetProjectConfig(rootDirectoryPath);
|
|
101
|
-
return [4 /*yield*/, (0, core_1.lintProject)(projectConfig)];
|
|
116
|
+
case 0: return [4 /*yield*/, getDependencies(options)];
|
|
102
117
|
case 1:
|
|
118
|
+
deps = _a.sent();
|
|
119
|
+
return [4 /*yield*/, (0, core_1.lintProject)(deps)];
|
|
120
|
+
case 2:
|
|
103
121
|
hasError = _a.sent();
|
|
104
122
|
if (hasError) {
|
|
105
123
|
process.exit(1);
|
|
@@ -118,24 +136,25 @@ function main() {
|
|
|
118
136
|
command: "build",
|
|
119
137
|
handler: function (options) {
|
|
120
138
|
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
-
var
|
|
139
|
+
var deps, e_1;
|
|
122
140
|
return __generator(this, function (_a) {
|
|
123
141
|
switch (_a.label) {
|
|
124
|
-
case 0:
|
|
125
|
-
projectConfig = requireAndGetProjectConfig(rootDirectoryPath);
|
|
126
|
-
_a.label = 1;
|
|
142
|
+
case 0: return [4 /*yield*/, getDependencies(options)];
|
|
127
143
|
case 1:
|
|
128
|
-
_a.
|
|
129
|
-
|
|
144
|
+
deps = _a.sent();
|
|
145
|
+
_a.label = 2;
|
|
130
146
|
case 2:
|
|
131
|
-
_a.
|
|
132
|
-
return [
|
|
147
|
+
_a.trys.push([2, 4, , 5]);
|
|
148
|
+
return [4 /*yield*/, (0, core_1.buildProject)(deps, options)];
|
|
133
149
|
case 3:
|
|
150
|
+
_a.sent();
|
|
151
|
+
return [3 /*break*/, 5];
|
|
152
|
+
case 4:
|
|
134
153
|
e_1 = _a.sent();
|
|
135
154
|
console.error(e_1);
|
|
136
155
|
process.exit(1);
|
|
137
|
-
return [3 /*break*/,
|
|
138
|
-
case
|
|
156
|
+
return [3 /*break*/, 5];
|
|
157
|
+
case 5: return [2 /*return*/];
|
|
139
158
|
}
|
|
140
159
|
});
|
|
141
160
|
});
|
|
@@ -147,26 +166,27 @@ function main() {
|
|
|
147
166
|
*/
|
|
148
167
|
.command({
|
|
149
168
|
command: "restore",
|
|
150
|
-
handler: function () {
|
|
169
|
+
handler: function (options) {
|
|
151
170
|
return __awaiter(this, void 0, void 0, function () {
|
|
152
|
-
var
|
|
171
|
+
var deps, e_2;
|
|
153
172
|
return __generator(this, function (_a) {
|
|
154
173
|
switch (_a.label) {
|
|
155
|
-
case 0:
|
|
156
|
-
projectConfig = requireAndGetProjectConfig(rootDirectoryPath);
|
|
157
|
-
_a.label = 1;
|
|
174
|
+
case 0: return [4 /*yield*/, getDependencies(options)];
|
|
158
175
|
case 1:
|
|
159
|
-
_a.
|
|
160
|
-
|
|
176
|
+
deps = _a.sent();
|
|
177
|
+
_a.label = 2;
|
|
161
178
|
case 2:
|
|
162
|
-
_a.
|
|
163
|
-
return [
|
|
179
|
+
_a.trys.push([2, 4, , 5]);
|
|
180
|
+
return [4 /*yield*/, (0, core_1.restoreProject)(deps)];
|
|
164
181
|
case 3:
|
|
182
|
+
_a.sent();
|
|
183
|
+
return [3 /*break*/, 5];
|
|
184
|
+
case 4:
|
|
165
185
|
e_2 = _a.sent();
|
|
166
186
|
console.error(e_2.message);
|
|
167
187
|
process.exit(1);
|
|
168
|
-
return [3 /*break*/,
|
|
169
|
-
case
|
|
188
|
+
return [3 /*break*/, 5];
|
|
189
|
+
case 5: return [2 /*return*/];
|
|
170
190
|
}
|
|
171
191
|
});
|
|
172
192
|
});
|
|
@@ -178,15 +198,16 @@ function main() {
|
|
|
178
198
|
*/
|
|
179
199
|
.command({
|
|
180
200
|
command: "test",
|
|
181
|
-
handler: function () {
|
|
201
|
+
handler: function (options) {
|
|
182
202
|
return __awaiter(this, void 0, void 0, function () {
|
|
183
|
-
var
|
|
203
|
+
var deps, hasError;
|
|
184
204
|
return __generator(this, function (_a) {
|
|
185
205
|
switch (_a.label) {
|
|
186
|
-
case 0:
|
|
187
|
-
projectConfig = requireAndGetProjectConfig(rootDirectoryPath);
|
|
188
|
-
return [4 /*yield*/, (0, core_1.testProject)(rootDirectoryPath, projectConfig)];
|
|
206
|
+
case 0: return [4 /*yield*/, getDependencies(options)];
|
|
189
207
|
case 1:
|
|
208
|
+
deps = _a.sent();
|
|
209
|
+
return [4 /*yield*/, (0, core_1.testProject)(deps)];
|
|
210
|
+
case 2:
|
|
190
211
|
hasError = _a.sent();
|
|
191
212
|
if (hasError) {
|
|
192
213
|
process.exit(1);
|
|
@@ -205,28 +226,29 @@ function main() {
|
|
|
205
226
|
command: "site [subcommand]",
|
|
206
227
|
handler: function (options) {
|
|
207
228
|
return __awaiter(this, void 0, void 0, function () {
|
|
208
|
-
var
|
|
229
|
+
var deps, allowedSubcommands, hasError;
|
|
209
230
|
return __generator(this, function (_a) {
|
|
210
231
|
switch (_a.label) {
|
|
211
|
-
case 0:
|
|
212
|
-
|
|
232
|
+
case 0: return [4 /*yield*/, getDependencies(options)];
|
|
233
|
+
case 1:
|
|
234
|
+
deps = _a.sent();
|
|
213
235
|
allowedSubcommands = ["export", "serve"];
|
|
214
236
|
if (!allowedSubcommands.includes(options.subcommand)) {
|
|
215
237
|
console.log("Please specify a subcommand: `export` or `serve`");
|
|
216
238
|
return [2 /*return*/];
|
|
217
239
|
}
|
|
218
|
-
if (!(options.subcommand === "export")) return [3 /*break*/,
|
|
219
|
-
return [4 /*yield*/, (0, core_1.exportSite)(
|
|
220
|
-
case
|
|
240
|
+
if (!(options.subcommand === "export")) return [3 /*break*/, 3];
|
|
241
|
+
return [4 /*yield*/, (0, core_1.exportSite)(deps)];
|
|
242
|
+
case 2:
|
|
221
243
|
hasError = _a.sent();
|
|
222
244
|
if (hasError) {
|
|
223
245
|
process.exit(1);
|
|
224
246
|
}
|
|
225
|
-
_a.label =
|
|
226
|
-
case
|
|
247
|
+
_a.label = 3;
|
|
248
|
+
case 3:
|
|
227
249
|
// serve
|
|
228
250
|
if (options.subcommand === "serve") {
|
|
229
|
-
(0, core_1.serveSite)(
|
|
251
|
+
(0, core_1.serveSite)(deps);
|
|
230
252
|
}
|
|
231
253
|
return [2 /*return*/];
|
|
232
254
|
}
|
|
@@ -244,24 +266,25 @@ function main() {
|
|
|
244
266
|
command: "generate-code",
|
|
245
267
|
handler: function (options) {
|
|
246
268
|
return __awaiter(this, void 0, void 0, function () {
|
|
247
|
-
var
|
|
269
|
+
var deps, e_3;
|
|
248
270
|
return __generator(this, function (_a) {
|
|
249
271
|
switch (_a.label) {
|
|
250
|
-
case 0:
|
|
251
|
-
projectConfig = requireAndGetProjectConfig(rootDirectoryPath);
|
|
252
|
-
_a.label = 1;
|
|
272
|
+
case 0: return [4 /*yield*/, getDependencies(options)];
|
|
253
273
|
case 1:
|
|
254
|
-
_a.
|
|
255
|
-
|
|
274
|
+
deps = _a.sent();
|
|
275
|
+
_a.label = 2;
|
|
256
276
|
case 2:
|
|
257
|
-
_a.
|
|
258
|
-
return [
|
|
277
|
+
_a.trys.push([2, 4, , 5]);
|
|
278
|
+
return [4 /*yield*/, (0, core_1.generateCodeForProject)(deps, options)];
|
|
259
279
|
case 3:
|
|
280
|
+
_a.sent();
|
|
281
|
+
return [3 /*break*/, 5];
|
|
282
|
+
case 4:
|
|
260
283
|
e_3 = _a.sent();
|
|
261
284
|
console.error(e_3.message);
|
|
262
285
|
process.exit(1);
|
|
263
|
-
return [3 /*break*/,
|
|
264
|
-
case
|
|
286
|
+
return [3 /*break*/, 5];
|
|
287
|
+
case 5: return [2 /*return*/];
|
|
265
288
|
}
|
|
266
289
|
});
|
|
267
290
|
});
|
|
@@ -274,26 +297,27 @@ function main() {
|
|
|
274
297
|
*/
|
|
275
298
|
.command({
|
|
276
299
|
command: "find-duplicate-segments",
|
|
277
|
-
handler: function () {
|
|
300
|
+
handler: function (options) {
|
|
278
301
|
return __awaiter(this, void 0, void 0, function () {
|
|
279
|
-
var
|
|
302
|
+
var deps, e_4;
|
|
280
303
|
return __generator(this, function (_a) {
|
|
281
304
|
switch (_a.label) {
|
|
282
|
-
case 0:
|
|
283
|
-
projectConfig = requireAndGetProjectConfig(rootDirectoryPath);
|
|
284
|
-
_a.label = 1;
|
|
305
|
+
case 0: return [4 /*yield*/, getDependencies(options)];
|
|
285
306
|
case 1:
|
|
286
|
-
_a.
|
|
287
|
-
|
|
307
|
+
deps = _a.sent();
|
|
308
|
+
_a.label = 2;
|
|
288
309
|
case 2:
|
|
289
|
-
_a.
|
|
290
|
-
return [
|
|
310
|
+
_a.trys.push([2, 4, , 5]);
|
|
311
|
+
return [4 /*yield*/, (0, core_1.findDuplicateSegmentsInProject)(deps)];
|
|
291
312
|
case 3:
|
|
313
|
+
_a.sent();
|
|
314
|
+
return [3 /*break*/, 5];
|
|
315
|
+
case 4:
|
|
292
316
|
e_4 = _a.sent();
|
|
293
317
|
console.error(e_4.message);
|
|
294
318
|
process.exit(1);
|
|
295
|
-
return [3 /*break*/,
|
|
296
|
-
case
|
|
319
|
+
return [3 /*break*/, 5];
|
|
320
|
+
case 5: return [2 /*return*/];
|
|
297
321
|
}
|
|
298
322
|
});
|
|
299
323
|
});
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAyB;AACzB,2BAA6B;AAE7B,6BAA+B;AAE/B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAyB;AACzB,2BAA6B;AAE7B,6BAA+B;AAE/B,2CAgB4B;AAE5B,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,UAAC,MAAM;IACtC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,SAAS,iBAAiB,CAAC,gBAAgB;IACzC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QACpC,OAAO,CAAC,KAAK,CAAC,0EAA0E,CAAC,CAAC;QAE1F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC;AAED,SAAS,0BAA0B,CAAC,iBAAiB;IACnD,IAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,yBAAkB,CAAC,CAAC;IAE1E,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAEpC,OAAO,IAAA,uBAAgB,EAAC,iBAAiB,CAAC,CAAC;AAC7C,CAAC;AAED,SAAe,eAAe,CAAC,OAAO;;;;YAC9B,iBAAiB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;YAClC,aAAa,GAAG,0BAA0B,CAAC,iBAAiB,CAAC,CAAC;YAC9D,UAAU,GAAG,IAAI,iBAAU,CAAC,aAAa,CAAC,CAAC;YAEjD,sBAAO;oBACL,iBAAiB,mBAAA;oBACjB,aAAa,eAAA;oBACb,UAAU,YAAA;oBACV,OAAO,SAAA;iBACR,E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F,OAAO,CAAC;gBACP,OAAO,EAAE,yBAAyB;gBAClC,OAAO,EAAE,UAAgB,OAAO;;;;;wCACjB,qBAAM,eAAe,CAAC,OAAO,CAAC,EAAA;;oCAArC,IAAI,GAAG,SAA8B;;;;oCAGzC,qBAAM,IAAA,qCAA8B,EAAC,IAAI,CAAC,EAAA;;oCAA1C,SAA0C,CAAC;;;;oCAE3C,OAAO,CAAC,KAAK,CAAC,GAAC,CAAC,OAAO,CAAC,CAAC;oCACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;;;;;iBAEnB;aACF,CAAC;iBACD,OAAO,CAAC,kBAAkB,EAAE,0BAA0B,CAAC;gBAExD;;mBAEG;gBAEH,6BAA6B;gBAE7B;;mBAEG;iBAEF,OAAO,CAAC;gBACP,OAAO,EAAE,GAAG;gBACZ,OAAO;oBACL,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACnB,CAAC;aACF,CAAC,CAAC,IAAI,CAAC;YAEV,sBAAO;;;CACR;AAED,IAAI,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@featurevisor/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.0",
|
|
4
4
|
"description": "CLI package of Featurevisor",
|
|
5
5
|
"main": "bin.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
},
|
|
48
48
|
"license": "MIT",
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@featurevisor/core": "^0.
|
|
50
|
+
"@featurevisor/core": "^0.54.0",
|
|
51
51
|
"yargs": "^17.6.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/yargs": "^17.0.22"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "42110a7a96169c6309600e00ed122e86203d34f4"
|
|
57
57
|
}
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
BuildCLIOptions,
|
|
18
18
|
GenerateCodeCLIOptions,
|
|
19
19
|
restoreProject,
|
|
20
|
+
Dependencies,
|
|
21
|
+
Datasource,
|
|
20
22
|
} from "@featurevisor/core";
|
|
21
23
|
|
|
22
24
|
process.on("unhandledRejection", (reason) => {
|
|
@@ -40,9 +42,20 @@ function requireAndGetProjectConfig(rootDirectoryPath) {
|
|
|
40
42
|
return getProjectConfig(rootDirectoryPath);
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
async function
|
|
45
|
+
async function getDependencies(options): Promise<Dependencies> {
|
|
44
46
|
const rootDirectoryPath = process.cwd();
|
|
47
|
+
const projectConfig = requireAndGetProjectConfig(rootDirectoryPath);
|
|
48
|
+
const datasource = new Datasource(projectConfig);
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
rootDirectoryPath,
|
|
52
|
+
projectConfig,
|
|
53
|
+
datasource,
|
|
54
|
+
options,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
45
57
|
|
|
58
|
+
async function main() {
|
|
46
59
|
yargs(process.argv.slice(2))
|
|
47
60
|
.usage("Usage: <command> [options]")
|
|
48
61
|
|
|
@@ -52,7 +65,8 @@ async function main() {
|
|
|
52
65
|
.command({
|
|
53
66
|
command: "init",
|
|
54
67
|
handler: async function (options) {
|
|
55
|
-
const
|
|
68
|
+
const deps = await getDependencies(options);
|
|
69
|
+
const hasError = await initProject(deps.rootDirectoryPath, options.example);
|
|
56
70
|
|
|
57
71
|
if (hasError) {
|
|
58
72
|
process.exit(1);
|
|
@@ -67,10 +81,10 @@ async function main() {
|
|
|
67
81
|
*/
|
|
68
82
|
.command({
|
|
69
83
|
command: "lint",
|
|
70
|
-
handler: async function () {
|
|
71
|
-
const
|
|
84
|
+
handler: async function (options) {
|
|
85
|
+
const deps = await getDependencies(options);
|
|
72
86
|
|
|
73
|
-
const hasError = await lintProject(
|
|
87
|
+
const hasError = await lintProject(deps);
|
|
74
88
|
|
|
75
89
|
if (hasError) {
|
|
76
90
|
process.exit(1);
|
|
@@ -85,10 +99,10 @@ async function main() {
|
|
|
85
99
|
.command({
|
|
86
100
|
command: "build",
|
|
87
101
|
handler: async function (options) {
|
|
88
|
-
const
|
|
102
|
+
const deps = await getDependencies(options);
|
|
89
103
|
|
|
90
104
|
try {
|
|
91
|
-
await buildProject(
|
|
105
|
+
await buildProject(deps, options as BuildCLIOptions);
|
|
92
106
|
} catch (e) {
|
|
93
107
|
console.error(e);
|
|
94
108
|
process.exit(1);
|
|
@@ -102,11 +116,11 @@ async function main() {
|
|
|
102
116
|
*/
|
|
103
117
|
.command({
|
|
104
118
|
command: "restore",
|
|
105
|
-
handler: async function () {
|
|
106
|
-
const
|
|
119
|
+
handler: async function (options) {
|
|
120
|
+
const deps = await getDependencies(options);
|
|
107
121
|
|
|
108
122
|
try {
|
|
109
|
-
await restoreProject(
|
|
123
|
+
await restoreProject(deps);
|
|
110
124
|
} catch (e) {
|
|
111
125
|
console.error(e.message);
|
|
112
126
|
process.exit(1);
|
|
@@ -120,10 +134,10 @@ async function main() {
|
|
|
120
134
|
*/
|
|
121
135
|
.command({
|
|
122
136
|
command: "test",
|
|
123
|
-
handler: async function () {
|
|
124
|
-
const
|
|
137
|
+
handler: async function (options) {
|
|
138
|
+
const deps = await getDependencies(options);
|
|
125
139
|
|
|
126
|
-
const hasError = await testProject(
|
|
140
|
+
const hasError = await testProject(deps);
|
|
127
141
|
|
|
128
142
|
if (hasError) {
|
|
129
143
|
process.exit(1);
|
|
@@ -138,7 +152,7 @@ async function main() {
|
|
|
138
152
|
.command({
|
|
139
153
|
command: "site [subcommand]",
|
|
140
154
|
handler: async function (options) {
|
|
141
|
-
const
|
|
155
|
+
const deps = await getDependencies(options);
|
|
142
156
|
|
|
143
157
|
const allowedSubcommands = ["export", "serve"];
|
|
144
158
|
|
|
@@ -149,7 +163,7 @@ async function main() {
|
|
|
149
163
|
|
|
150
164
|
// export
|
|
151
165
|
if (options.subcommand === "export") {
|
|
152
|
-
const hasError = await exportSite(
|
|
166
|
+
const hasError = await exportSite(deps);
|
|
153
167
|
|
|
154
168
|
if (hasError) {
|
|
155
169
|
process.exit(1);
|
|
@@ -158,7 +172,7 @@ async function main() {
|
|
|
158
172
|
|
|
159
173
|
// serve
|
|
160
174
|
if (options.subcommand === "serve") {
|
|
161
|
-
serveSite(
|
|
175
|
+
serveSite(deps);
|
|
162
176
|
}
|
|
163
177
|
},
|
|
164
178
|
})
|
|
@@ -172,14 +186,10 @@ async function main() {
|
|
|
172
186
|
.command({
|
|
173
187
|
command: "generate-code",
|
|
174
188
|
handler: async function (options) {
|
|
175
|
-
const
|
|
189
|
+
const deps = await getDependencies(options);
|
|
176
190
|
|
|
177
191
|
try {
|
|
178
|
-
await generateCodeForProject(
|
|
179
|
-
rootDirectoryPath,
|
|
180
|
-
projectConfig,
|
|
181
|
-
options as unknown as GenerateCodeCLIOptions,
|
|
182
|
-
);
|
|
192
|
+
await generateCodeForProject(deps, options as unknown as GenerateCodeCLIOptions);
|
|
183
193
|
} catch (e) {
|
|
184
194
|
console.error(e.message);
|
|
185
195
|
process.exit(1);
|
|
@@ -194,11 +204,11 @@ async function main() {
|
|
|
194
204
|
*/
|
|
195
205
|
.command({
|
|
196
206
|
command: "find-duplicate-segments",
|
|
197
|
-
handler: async function () {
|
|
198
|
-
const
|
|
207
|
+
handler: async function (options) {
|
|
208
|
+
const deps = await getDependencies(options);
|
|
199
209
|
|
|
200
210
|
try {
|
|
201
|
-
await findDuplicateSegmentsInProject(
|
|
211
|
+
await findDuplicateSegmentsInProject(deps);
|
|
202
212
|
} catch (e) {
|
|
203
213
|
console.error(e.message);
|
|
204
214
|
process.exit(1);
|