@sprucelabs/spruce-cli 14.28.4 → 14.28.8
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/CHANGELOG.md +32 -0
- package/build/__tests__/behavioral/BootingWithBadFiles.test.d.ts +2 -0
- package/build/__tests__/behavioral/BootingWithBadFiles.test.js +84 -17
- package/build/__tests__/behavioral/BootingWithBadFiles.test.js.map +1 -1
- package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js +1 -1
- package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js.map +1 -1
- package/build/__tests__/behavioral/skill/UpgradingASkill2.test.d.ts +1 -1
- package/build/__tests__/behavioral/skill/UpgradingASkill2.test.js +10 -20
- package/build/__tests__/behavioral/skill/UpgradingASkill2.test.js.map +1 -1
- package/build/__tests__/behavioral/{CreatingADataStore.test.d.ts → stores/CreatingADataStore.test.d.ts} +2 -1
- package/build/__tests__/behavioral/{CreatingADataStore.test.js → stores/CreatingADataStore.test.js} +87 -57
- package/build/__tests__/behavioral/stores/CreatingADataStore.test.js.map +1 -0
- package/build/__tests__/behavioral/{KeepingDataStoresInSync.test.d.ts → stores/KeepingDataStoresInSync.test.d.ts} +2 -2
- package/build/__tests__/behavioral/{KeepingDataStoresInSync.test.js → stores/KeepingDataStoresInSync.test.js} +42 -42
- package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.js.map +1 -0
- package/build/cli.d.ts +1 -1
- package/build/cli.js +1 -1
- package/build/cli.js.map +1 -1
- package/build/features/node/NodeFeature.js +6 -11
- package/build/features/node/NodeFeature.js.map +1 -1
- package/build/features/store/actions/SyncAction.js +11 -10
- package/build/features/store/actions/SyncAction.js.map +1 -1
- package/build/features/store/writers/StoreWriter.d.ts +6 -0
- package/build/features/store/writers/StoreWriter.js +78 -8
- package/build/features/store/writers/StoreWriter.js.map +1 -1
- package/package.json +28 -28
- package/src/__tests__/behavioral/BootingWithBadFiles.test.ts +17 -2
- package/src/__tests__/behavioral/events/KeepingEventsInSync2.test.ts +1 -1
- package/src/__tests__/behavioral/skill/UpgradingASkill2.test.ts +1 -10
- package/src/__tests__/behavioral/{CreatingADataStore.test.ts → stores/CreatingADataStore.test.ts} +13 -6
- package/src/__tests__/behavioral/{KeepingDataStoresInSync.test.ts → stores/KeepingDataStoresInSync.test.ts} +6 -6
- package/src/cli.ts +2 -2
- package/src/features/node/NodeFeature.ts +0 -3
- package/src/features/store/actions/SyncAction.ts +2 -1
- package/src/features/store/writers/StoreWriter.ts +30 -0
- package/build/__tests__/behavioral/CreatingADataStore.test.js.map +0 -1
- package/build/__tests__/behavioral/KeepingDataStoresInSync.test.js.map +0 -1
package/build/__tests__/behavioral/{CreatingADataStore.test.js → stores/CreatingADataStore.test.js}
RENAMED
|
@@ -33,19 +33,19 @@ var _testUtils = require("@sprucelabs/test-utils");
|
|
|
33
33
|
|
|
34
34
|
require("@sprucelabs/spruce-store-plugin");
|
|
35
35
|
|
|
36
|
-
var _CommandService = _interopRequireDefault(require("
|
|
36
|
+
var _CommandService = _interopRequireDefault(require("../../../services/CommandService"));
|
|
37
37
|
|
|
38
|
-
var _AbstractSkillTest2 = _interopRequireDefault(require("
|
|
38
|
+
var _AbstractSkillTest2 = _interopRequireDefault(require("../../../tests/AbstractSkillTest"));
|
|
39
39
|
|
|
40
|
-
var _test2 = _interopRequireDefault(require("
|
|
40
|
+
var _test2 = _interopRequireDefault(require("../../../tests/utilities/test.utility"));
|
|
41
41
|
|
|
42
|
-
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _class, _class2, _temp;
|
|
42
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _class, _class2, _temp;
|
|
43
43
|
|
|
44
44
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
45
45
|
|
|
46
46
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
47
|
|
|
48
|
-
var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(), _dec3 = (0, _test.test)(), _dec4 = (0, _test.test)(), _dec5 = (0, _test.test)(), _dec6 = (0, _test.test)(), _dec7 = (0, _test.test)(), _dec8 = (0, _test.test)(), _dec9 = (0, _test.test)(), _dec10 = (0, _test.test)(), (_class = (_temp = _class2 = /*#__PURE__*/function (_AbstractSkillTest) {
|
|
48
|
+
var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(), _dec3 = (0, _test.test)(), _dec4 = (0, _test.test)(), _dec5 = (0, _test.test)(), _dec6 = (0, _test.test)(), _dec7 = (0, _test.test)(), _dec8 = (0, _test.test)(), _dec9 = (0, _test.test)(), _dec10 = (0, _test.test)(), _dec11 = (0, _test.test)(), (_class = (_temp = _class2 = /*#__PURE__*/function (_AbstractSkillTest) {
|
|
49
49
|
(0, _inherits2["default"])(CreatingDataStoresTest, _AbstractSkillTest);
|
|
50
50
|
|
|
51
51
|
var _super = _createSuper(CreatingDataStoresTest);
|
|
@@ -90,7 +90,7 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
90
90
|
case 0:
|
|
91
91
|
_context2.next = 2;
|
|
92
92
|
return this.cli.checkHealth({
|
|
93
|
-
|
|
93
|
+
shouldRunOnSourceFiles: true
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
case 2:
|
|
@@ -160,21 +160,51 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
160
160
|
return generatesValidStoreFile;
|
|
161
161
|
}()
|
|
162
162
|
}, {
|
|
163
|
-
key: "
|
|
163
|
+
key: "generatesAMapFile",
|
|
164
164
|
value: function () {
|
|
165
|
-
var
|
|
166
|
-
var
|
|
165
|
+
var _generatesAMapFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
166
|
+
var file;
|
|
167
167
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
168
168
|
while (1) {
|
|
169
169
|
switch (_context4.prev = _context4.next) {
|
|
170
170
|
case 0:
|
|
171
|
-
|
|
171
|
+
file = this.resolveHashSprucePath('stores', 'stores.ts');
|
|
172
|
+
|
|
173
|
+
_test.assert.isTrue(_spruceSkillUtils.diskUtil.doesFileExist(file));
|
|
174
|
+
|
|
175
|
+
_context4.next = 4;
|
|
176
|
+
return this.Service('typeChecker').check(file);
|
|
177
|
+
|
|
178
|
+
case 4:
|
|
179
|
+
case "end":
|
|
180
|
+
return _context4.stop();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}, _callee4, this);
|
|
184
|
+
}));
|
|
185
|
+
|
|
186
|
+
function generatesAMapFile() {
|
|
187
|
+
return _generatesAMapFile.apply(this, arguments);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return generatesAMapFile;
|
|
191
|
+
}()
|
|
192
|
+
}, {
|
|
193
|
+
key: "getsOneStoresBackFromHealthCheck",
|
|
194
|
+
value: function () {
|
|
195
|
+
var _getsOneStoresBackFromHealthCheck = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
196
|
+
var health;
|
|
197
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
198
|
+
while (1) {
|
|
199
|
+
switch (_context5.prev = _context5.next) {
|
|
200
|
+
case 0:
|
|
201
|
+
_context5.next = 2;
|
|
172
202
|
return this.cli.checkHealth({
|
|
173
|
-
|
|
203
|
+
shouldRunOnSourceFiles: true
|
|
174
204
|
});
|
|
175
205
|
|
|
176
206
|
case 2:
|
|
177
|
-
health =
|
|
207
|
+
health = _context5.sent;
|
|
178
208
|
|
|
179
209
|
_test.assert.isTruthy(health.store);
|
|
180
210
|
|
|
@@ -186,10 +216,10 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
186
216
|
|
|
187
217
|
case 7:
|
|
188
218
|
case "end":
|
|
189
|
-
return
|
|
219
|
+
return _context5.stop();
|
|
190
220
|
}
|
|
191
221
|
}
|
|
192
|
-
},
|
|
222
|
+
}, _callee5, this);
|
|
193
223
|
}));
|
|
194
224
|
|
|
195
225
|
function getsOneStoresBackFromHealthCheck() {
|
|
@@ -201,13 +231,13 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
201
231
|
}, {
|
|
202
232
|
key: "canGenerateASecondStoreFile",
|
|
203
233
|
value: function () {
|
|
204
|
-
var _canGenerateASecondStoreFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
234
|
+
var _canGenerateASecondStoreFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
205
235
|
var results, path;
|
|
206
|
-
return _regenerator["default"].wrap(function
|
|
236
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
207
237
|
while (1) {
|
|
208
|
-
switch (
|
|
238
|
+
switch (_context6.prev = _context6.next) {
|
|
209
239
|
case 0:
|
|
210
|
-
|
|
240
|
+
_context6.next = 2;
|
|
211
241
|
return this.Action('store', 'create').execute({
|
|
212
242
|
nameReadable: 'Bid',
|
|
213
243
|
nameReadablePlural: 'Bids',
|
|
@@ -215,20 +245,20 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
215
245
|
});
|
|
216
246
|
|
|
217
247
|
case 2:
|
|
218
|
-
results =
|
|
248
|
+
results = _context6.sent;
|
|
219
249
|
|
|
220
250
|
_test.assert.isFalsy(results.errors);
|
|
221
251
|
|
|
222
252
|
path = _test2["default"].assertFileByNameInGeneratedFiles('Bids.store.ts', results.files);
|
|
223
|
-
|
|
253
|
+
_context6.next = 7;
|
|
224
254
|
return this.Service('typeChecker').check(path);
|
|
225
255
|
|
|
226
256
|
case 7:
|
|
227
257
|
case "end":
|
|
228
|
-
return
|
|
258
|
+
return _context6.stop();
|
|
229
259
|
}
|
|
230
260
|
}
|
|
231
|
-
},
|
|
261
|
+
}, _callee6, this);
|
|
232
262
|
}));
|
|
233
263
|
|
|
234
264
|
function canGenerateASecondStoreFile() {
|
|
@@ -240,19 +270,19 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
240
270
|
}, {
|
|
241
271
|
key: "getsSecondStoresBackFromHealthCheck",
|
|
242
272
|
value: function () {
|
|
243
|
-
var _getsSecondStoresBackFromHealthCheck = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
273
|
+
var _getsSecondStoresBackFromHealthCheck = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
244
274
|
var health;
|
|
245
|
-
return _regenerator["default"].wrap(function
|
|
275
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
246
276
|
while (1) {
|
|
247
|
-
switch (
|
|
277
|
+
switch (_context7.prev = _context7.next) {
|
|
248
278
|
case 0:
|
|
249
|
-
|
|
279
|
+
_context7.next = 2;
|
|
250
280
|
return this.cli.checkHealth({
|
|
251
|
-
|
|
281
|
+
shouldRunOnSourceFiles: true
|
|
252
282
|
});
|
|
253
283
|
|
|
254
284
|
case 2:
|
|
255
|
-
health =
|
|
285
|
+
health = _context7.sent;
|
|
256
286
|
|
|
257
287
|
_test.assert.isTruthy(health.store);
|
|
258
288
|
|
|
@@ -266,10 +296,10 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
266
296
|
|
|
267
297
|
case 8:
|
|
268
298
|
case "end":
|
|
269
|
-
return
|
|
299
|
+
return _context7.stop();
|
|
270
300
|
}
|
|
271
301
|
}
|
|
272
|
-
},
|
|
302
|
+
}, _callee7, this);
|
|
273
303
|
}));
|
|
274
304
|
|
|
275
305
|
function getsSecondStoresBackFromHealthCheck() {
|
|
@@ -281,13 +311,13 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
281
311
|
}, {
|
|
282
312
|
key: "errorsWhenGeneratingAStoreWithTheSameName",
|
|
283
313
|
value: function () {
|
|
284
|
-
var _errorsWhenGeneratingAStoreWithTheSameName = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
314
|
+
var _errorsWhenGeneratingAStoreWithTheSameName = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
285
315
|
var results;
|
|
286
|
-
return _regenerator["default"].wrap(function
|
|
316
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
287
317
|
while (1) {
|
|
288
|
-
switch (
|
|
318
|
+
switch (_context8.prev = _context8.next) {
|
|
289
319
|
case 0:
|
|
290
|
-
|
|
320
|
+
_context8.next = 2;
|
|
291
321
|
return this.Action('store', 'create').execute({
|
|
292
322
|
nameReadable: 'Bid',
|
|
293
323
|
nameReadablePlural: 'Bids',
|
|
@@ -295,7 +325,7 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
295
325
|
});
|
|
296
326
|
|
|
297
327
|
case 2:
|
|
298
|
-
results =
|
|
328
|
+
results = _context8.sent;
|
|
299
329
|
|
|
300
330
|
_test.assert.isTruthy(results.errors);
|
|
301
331
|
|
|
@@ -303,10 +333,10 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
303
333
|
|
|
304
334
|
case 5:
|
|
305
335
|
case "end":
|
|
306
|
-
return
|
|
336
|
+
return _context8.stop();
|
|
307
337
|
}
|
|
308
338
|
}
|
|
309
|
-
},
|
|
339
|
+
}, _callee8, this);
|
|
310
340
|
}));
|
|
311
341
|
|
|
312
342
|
function errorsWhenGeneratingAStoreWithTheSameName() {
|
|
@@ -318,13 +348,13 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
318
348
|
}, {
|
|
319
349
|
key: "storeFactoryAndStoresAreTyped",
|
|
320
350
|
value: function () {
|
|
321
|
-
var _storeFactoryAndStoresAreTyped = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
351
|
+
var _storeFactoryAndStoresAreTyped = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
|
|
322
352
|
var results, path, storeContents, testFile, testContents, dest;
|
|
323
|
-
return _regenerator["default"].wrap(function
|
|
353
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
324
354
|
while (1) {
|
|
325
|
-
switch (
|
|
355
|
+
switch (_context9.prev = _context9.next) {
|
|
326
356
|
case 0:
|
|
327
|
-
|
|
357
|
+
_context9.next = 2;
|
|
328
358
|
return this.Action('store', 'create').execute({
|
|
329
359
|
nameReadable: 'Product',
|
|
330
360
|
nameReadablePlural: 'Products',
|
|
@@ -332,7 +362,7 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
332
362
|
});
|
|
333
363
|
|
|
334
364
|
case 2:
|
|
335
|
-
results =
|
|
365
|
+
results = _context9.sent;
|
|
336
366
|
path = _test2["default"].assertFileByNameInGeneratedFiles('Products.store.ts', results.files);
|
|
337
367
|
storeContents = _spruceSkillUtils.diskUtil.readFile(path).replace('type ProductsStoreOptions = UniversalStoreOptions', 'type ProductsStoreOptions = UniversalStoreOptions & {hello: string}');
|
|
338
368
|
|
|
@@ -344,15 +374,15 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
344
374
|
|
|
345
375
|
_spruceSkillUtils.diskUtil.writeFile(dest, testContents);
|
|
346
376
|
|
|
347
|
-
|
|
377
|
+
_context9.next = 12;
|
|
348
378
|
return this.Service('typeChecker').check(dest);
|
|
349
379
|
|
|
350
380
|
case 12:
|
|
351
381
|
case "end":
|
|
352
|
-
return
|
|
382
|
+
return _context9.stop();
|
|
353
383
|
}
|
|
354
384
|
}
|
|
355
|
-
},
|
|
385
|
+
}, _callee9, this);
|
|
356
386
|
}));
|
|
357
387
|
|
|
358
388
|
function storeFactoryAndStoresAreTyped() {
|
|
@@ -364,19 +394,19 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
364
394
|
}, {
|
|
365
395
|
key: "doesNotCreateAbstractTestFileBecauseTestIsNotInstalled",
|
|
366
396
|
value: function () {
|
|
367
|
-
var _doesNotCreateAbstractTestFileBecauseTestIsNotInstalled = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
368
|
-
return _regenerator["default"].wrap(function
|
|
397
|
+
var _doesNotCreateAbstractTestFileBecauseTestIsNotInstalled = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
398
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
369
399
|
while (1) {
|
|
370
|
-
switch (
|
|
400
|
+
switch (_context10.prev = _context10.next) {
|
|
371
401
|
case 0:
|
|
372
402
|
_test.assert.isFalse(_spruceSkillUtils.diskUtil.doesFileExist(CreatingDataStoresTest.getAbstractTestPath()));
|
|
373
403
|
|
|
374
404
|
case 1:
|
|
375
405
|
case "end":
|
|
376
|
-
return
|
|
406
|
+
return _context10.stop();
|
|
377
407
|
}
|
|
378
408
|
}
|
|
379
|
-
},
|
|
409
|
+
}, _callee10);
|
|
380
410
|
}));
|
|
381
411
|
|
|
382
412
|
function doesNotCreateAbstractTestFileBecauseTestIsNotInstalled() {
|
|
@@ -388,11 +418,11 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
388
418
|
}, {
|
|
389
419
|
key: "upgradeRestoresDataStoreTypes",
|
|
390
420
|
value: function () {
|
|
391
|
-
var _upgradeRestoresDataStoreTypes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
421
|
+
var _upgradeRestoresDataStoreTypes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
392
422
|
var storesFile;
|
|
393
|
-
return _regenerator["default"].wrap(function
|
|
423
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
394
424
|
while (1) {
|
|
395
|
-
switch (
|
|
425
|
+
switch (_context11.prev = _context11.next) {
|
|
396
426
|
case 0:
|
|
397
427
|
_CommandService["default"].setMockResponse('yarn rebuild', {
|
|
398
428
|
code: 0
|
|
@@ -406,7 +436,7 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
406
436
|
|
|
407
437
|
_spruceSkillUtils.diskUtil.deleteFile(storesFile);
|
|
408
438
|
|
|
409
|
-
|
|
439
|
+
_context11.next = 6;
|
|
410
440
|
return this.Action('node', 'upgrade').execute({});
|
|
411
441
|
|
|
412
442
|
case 6:
|
|
@@ -414,10 +444,10 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
414
444
|
|
|
415
445
|
case 7:
|
|
416
446
|
case "end":
|
|
417
|
-
return
|
|
447
|
+
return _context11.stop();
|
|
418
448
|
}
|
|
419
449
|
}
|
|
420
|
-
},
|
|
450
|
+
}, _callee11, this);
|
|
421
451
|
}));
|
|
422
452
|
|
|
423
453
|
function upgradeRestoresDataStoreTypes() {
|
|
@@ -433,6 +463,6 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
433
463
|
}
|
|
434
464
|
}]);
|
|
435
465
|
return CreatingDataStoresTest;
|
|
436
|
-
}(_AbstractSkillTest2["default"]), (0, _defineProperty2["default"])(_class2, "skillCacheKey", 'stores'), _temp), ((0, _applyDecoratedDescriptor2["default"])(_class, "hasCreateStoreAction", [_dec], Object.getOwnPropertyDescriptor(_class, "hasCreateStoreAction"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "getsNoStoresBackFromHealthCheck", [_dec2], Object.getOwnPropertyDescriptor(_class, "getsNoStoresBackFromHealthCheck"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "generatesValidStoreFile", [_dec3], Object.getOwnPropertyDescriptor(_class, "generatesValidStoreFile"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "
|
|
466
|
+
}(_AbstractSkillTest2["default"]), (0, _defineProperty2["default"])(_class2, "skillCacheKey", 'stores'), _temp), ((0, _applyDecoratedDescriptor2["default"])(_class, "hasCreateStoreAction", [_dec], Object.getOwnPropertyDescriptor(_class, "hasCreateStoreAction"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "getsNoStoresBackFromHealthCheck", [_dec2], Object.getOwnPropertyDescriptor(_class, "getsNoStoresBackFromHealthCheck"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "generatesValidStoreFile", [_dec3], Object.getOwnPropertyDescriptor(_class, "generatesValidStoreFile"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "generatesAMapFile", [_dec4], Object.getOwnPropertyDescriptor(_class, "generatesAMapFile"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "getsOneStoresBackFromHealthCheck", [_dec5], Object.getOwnPropertyDescriptor(_class, "getsOneStoresBackFromHealthCheck"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "canGenerateASecondStoreFile", [_dec6], Object.getOwnPropertyDescriptor(_class, "canGenerateASecondStoreFile"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "getsSecondStoresBackFromHealthCheck", [_dec7], Object.getOwnPropertyDescriptor(_class, "getsSecondStoresBackFromHealthCheck"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "errorsWhenGeneratingAStoreWithTheSameName", [_dec8], Object.getOwnPropertyDescriptor(_class, "errorsWhenGeneratingAStoreWithTheSameName"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "storeFactoryAndStoresAreTyped", [_dec9], Object.getOwnPropertyDescriptor(_class, "storeFactoryAndStoresAreTyped"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "doesNotCreateAbstractTestFileBecauseTestIsNotInstalled", [_dec10], Object.getOwnPropertyDescriptor(_class, "doesNotCreateAbstractTestFileBecauseTestIsNotInstalled"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "upgradeRestoresDataStoreTypes", [_dec11], Object.getOwnPropertyDescriptor(_class, "upgradeRestoresDataStoreTypes"), _class)), _class));
|
|
437
467
|
exports["default"] = CreatingDataStoresTest;
|
|
438
468
|
//# sourceMappingURL=CreatingADataStore.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/__tests__/behavioral/stores/CreatingADataStore.test.ts"],"names":["CreatingDataStoresTest","assert","isFunction","Action","execute","cli","checkHealth","shouldRunOnSourceFiles","health","isFalsy","skill","errors","isTruthy","store","isArray","stores","isLength","nameReadable","nameReadablePlural","namePascal","results","path","testUtil","assertFileByNameInGeneratedFiles","files","Service","check","file","resolveHashSprucePath","isTrue","diskUtil","doesFileExist","isEqual","name","errorAssertUtil","assertError","storeContents","readFile","replace","writeFile","testFile","resolveTestPath","testContents","dest","resolvePath","isFalse","getAbstractTestPath","CommandService","setMockResponse","code","storesFile","deleteFile","AbstractSkillTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;IAEqBA,sB,WAGnB,iB,UAKA,iB,UAWA,iB,UA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EAAvB,CADD;;AAFD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;yHAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAECC,2CAAeC,eAAf,CAA+B,cAA/B,EAA+C;AAC9CC,kBAAAA,IAAI,EAAE;AADwC,iBAA/C;;AAIAF,2CAAeC,eAAf,CAA+B,YAA/B,EAA8C;AAC7CC,kBAAAA,IAAI,EAAE;AADuC,iBAA9C;;AAIMC,gBAAAA,UAVP,GAUoB,KAAKtB,qBAAL,CAA2B,wBAA3B,CAVpB;;AAWCE,2CAASqB,UAAT,CAAoBD,UAApB;;AAXD;AAAA,uBAYO,KAAK/C,MAAL,CAAY,MAAZ,EAAoB,SAApB,EAA+BC,OAA/B,CAAuC,EAAvC,CAZP;;AAAA;AAaCH,6BAAO4B,MAAP,CAAcC,2BAASC,aAAT,CAAuBmB,UAAvB,CAAd;;AAbD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAgBA,+BAA6C;AAC5C,aAAO,KAAKN,WAAL,CAAiB,KAAjB,EAAwB,OAAxB,EAAiC,0BAAjC,CAAP;AACA;;;EAtJkDQ,8B,8DAClB,Q","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport { errorAssertUtil } from '@sprucelabs/test-utils'\nimport '@sprucelabs/spruce-store-plugin'\nimport CommandService from '../../../services/CommandService'\nimport AbstractSkillTest from '../../../tests/AbstractSkillTest'\nimport testUtil from '../../../tests/utilities/test.utility'\n\nexport default class CreatingDataStoresTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'stores'\n\n\t@test()\n\tprotected static async hasCreateStoreAction() {\n\t\tassert.isFunction(this.Action('store', 'create').execute)\n\t}\n\n\t@test()\n\tprotected static async getsNoStoresBackFromHealthCheck() {\n\t\tconst health = await this.cli.checkHealth({ shouldRunOnSourceFiles: true })\n\n\t\tassert.isFalsy(health.skill.errors)\n\t\tassert.isTruthy(health.store)\n\t\tassert.isFalsy(health.store.errors)\n\t\tassert.isArray(health.store.stores)\n\t\tassert.isLength(health.store.stores, 0)\n\t}\n\n\t@test()\n\tprotected static async generatesValidStoreFile() {\n\t\tconst results = await this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Person',\n\t\t\tnameReadablePlural: 'People',\n\t\t\tnamePascal: 'Person',\n\t\t})\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tconst path = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'People.store.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tawait this.Service('typeChecker').check(path)\n\t}\n\n\t@test()\n\tprotected static async generatesAMapFile() {\n\t\tconst file = this.resolveHashSprucePath('stores', 'stores.ts')\n\t\tassert.isTrue(diskUtil.doesFileExist(file))\n\t\tawait this.Service('typeChecker').check(file)\n\t}\n\n\t@test()\n\tprotected static async getsOneStoresBackFromHealthCheck() {\n\t\tconst health = await this.cli.checkHealth({ shouldRunOnSourceFiles: true })\n\t\tassert.isTruthy(health.store)\n\t\tassert.isFalsy(health.store.errors)\n\t\tassert.isLength(health.store.stores, 1)\n\t\tassert.isEqual(health.store.stores[0].name, 'People')\n\t}\n\n\t@test()\n\tprotected static async canGenerateASecondStoreFile() {\n\t\tconst results = await this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Bid',\n\t\t\tnameReadablePlural: 'Bids',\n\t\t\tnamePascal: 'Bid',\n\t\t})\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tconst path = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'Bids.store.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tawait this.Service('typeChecker').check(path)\n\t}\n\n\t@test()\n\tprotected static async getsSecondStoresBackFromHealthCheck() {\n\t\tconst health = await this.cli.checkHealth({ shouldRunOnSourceFiles: true })\n\n\t\tassert.isTruthy(health.store)\n\t\tassert.isFalsy(health.store.errors)\n\t\tassert.isLength(health.store.stores, 2)\n\t\tassert.isEqual(health.store.stores[0].name, 'Bids')\n\t\tassert.isEqual(health.store.stores[1].name, 'People')\n\t}\n\n\t@test()\n\tprotected static async errorsWhenGeneratingAStoreWithTheSameName() {\n\t\tconst results = await this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Bid',\n\t\t\tnameReadablePlural: 'Bids',\n\t\t\tnamePascal: 'Bid',\n\t\t})\n\n\t\tassert.isTruthy(results.errors)\n\t\terrorAssertUtil.assertError(results.errors[0], 'STORE_EXISTS')\n\t}\n\n\t@test()\n\tprotected static async storeFactoryAndStoresAreTyped() {\n\t\tconst results = await this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Product',\n\t\t\tnameReadablePlural: 'Products',\n\t\t\tnamePascal: 'Product',\n\t\t})\n\n\t\tconst path = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'Products.store.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tconst storeContents = diskUtil\n\t\t\t.readFile(path)\n\t\t\t.replace(\n\t\t\t\t'type ProductsStoreOptions = UniversalStoreOptions',\n\t\t\t\t'type ProductsStoreOptions = UniversalStoreOptions & {hello: string}'\n\t\t\t)\n\n\t\tdiskUtil.writeFile(path, storeContents)\n\n\t\tconst testFile = this.resolveTestPath('store-test.ts.hbs')\n\t\tconst testContents = diskUtil.readFile(testFile)\n\n\t\tconst dest = this.resolvePath('src', 'test.ts')\n\t\tdiskUtil.writeFile(dest, testContents)\n\n\t\tawait this.Service('typeChecker').check(dest)\n\t}\n\n\t@test()\n\tprotected static async doesNotCreateAbstractTestFileBecauseTestIsNotInstalled() {\n\t\tassert.isFalse(\n\t\t\tdiskUtil.doesFileExist(CreatingDataStoresTest.getAbstractTestPath())\n\t\t)\n\t}\n\n\t@test()\n\tprotected static async upgradeRestoresDataStoreTypes() {\n\t\tCommandService.setMockResponse('yarn rebuild', {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tCommandService.setMockResponse(/yarn add/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst storesFile = this.resolveHashSprucePath('stores/stores.types.ts')\n\t\tdiskUtil.deleteFile(storesFile)\n\t\tawait this.Action('node', 'upgrade').execute({})\n\t\tassert.isTrue(diskUtil.doesFileExist(storesFile))\n\t}\n\n\tprivate static getAbstractTestPath(): string {\n\t\treturn this.resolvePath('src', 'tests', 'AbstractDataStoreTest.ts')\n\t}\n}\n"],"file":"CreatingADataStore.test.js"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import AbstractSkillTest from '
|
|
1
|
+
import AbstractSkillTest from '../../../tests/AbstractSkillTest';
|
|
2
2
|
export default class KeepingDataStoresInSyncTest extends AbstractSkillTest {
|
|
3
3
|
protected static skillCacheKey: string;
|
|
4
4
|
protected static badStoreDest: string;
|
|
@@ -6,7 +6,7 @@ export default class KeepingDataStoresInSyncTest extends AbstractSkillTest {
|
|
|
6
6
|
protected static beforeEach(): Promise<void>;
|
|
7
7
|
protected static hasSyncAction(): Promise<void>;
|
|
8
8
|
protected static syncsNothingToStart(): Promise<void>;
|
|
9
|
-
private static syncStores;
|
|
10
9
|
protected static badFileReturnsError(): Promise<void>;
|
|
11
10
|
protected static generatesValidTypeFile(): Promise<void>;
|
|
11
|
+
private static syncStores;
|
|
12
12
|
}
|
|
@@ -33,9 +33,9 @@ var _test = require("@sprucelabs/test");
|
|
|
33
33
|
|
|
34
34
|
var _testUtils = require("@sprucelabs/test-utils");
|
|
35
35
|
|
|
36
|
-
var _AbstractSkillTest2 = _interopRequireDefault(require("
|
|
36
|
+
var _AbstractSkillTest2 = _interopRequireDefault(require("../../../tests/AbstractSkillTest"));
|
|
37
37
|
|
|
38
|
-
var _test2 = _interopRequireDefault(require("
|
|
38
|
+
var _test2 = _interopRequireDefault(require("../../../tests/utilities/test.utility"));
|
|
39
39
|
|
|
40
40
|
var _dec, _dec2, _dec3, _dec4, _class, _class2, _temp;
|
|
41
41
|
|
|
@@ -164,46 +164,22 @@ var KeepingDataStoresInSyncTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
|
|
|
164
164
|
|
|
165
165
|
return syncsNothingToStart;
|
|
166
166
|
}()
|
|
167
|
-
}, {
|
|
168
|
-
key: "syncStores",
|
|
169
|
-
value: function () {
|
|
170
|
-
var _syncStores = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
171
|
-
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
172
|
-
while (1) {
|
|
173
|
-
switch (_context5.prev = _context5.next) {
|
|
174
|
-
case 0:
|
|
175
|
-
return _context5.abrupt("return", this.Action('store', 'sync').execute({}));
|
|
176
|
-
|
|
177
|
-
case 1:
|
|
178
|
-
case "end":
|
|
179
|
-
return _context5.stop();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}, _callee5, this);
|
|
183
|
-
}));
|
|
184
|
-
|
|
185
|
-
function syncStores() {
|
|
186
|
-
return _syncStores.apply(this, arguments);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return syncStores;
|
|
190
|
-
}()
|
|
191
167
|
}, {
|
|
192
168
|
key: "badFileReturnsError",
|
|
193
169
|
value: function () {
|
|
194
|
-
var _badFileReturnsError = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
170
|
+
var _badFileReturnsError = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
195
171
|
var results;
|
|
196
|
-
return _regenerator["default"].wrap(function
|
|
172
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
197
173
|
while (1) {
|
|
198
|
-
switch (
|
|
174
|
+
switch (_context5.prev = _context5.next) {
|
|
199
175
|
case 0:
|
|
200
176
|
_spruceSkillUtils.diskUtil.writeFile(this.badStoreDest, 'throw new Error("Cheese!")');
|
|
201
177
|
|
|
202
|
-
|
|
178
|
+
_context5.next = 3;
|
|
203
179
|
return this.syncStores();
|
|
204
180
|
|
|
205
181
|
case 3:
|
|
206
|
-
results =
|
|
182
|
+
results = _context5.sent;
|
|
207
183
|
|
|
208
184
|
_test.assert.isArray(results.errors);
|
|
209
185
|
|
|
@@ -215,10 +191,10 @@ var KeepingDataStoresInSyncTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
|
|
|
215
191
|
|
|
216
192
|
case 7:
|
|
217
193
|
case "end":
|
|
218
|
-
return
|
|
194
|
+
return _context5.stop();
|
|
219
195
|
}
|
|
220
196
|
}
|
|
221
|
-
},
|
|
197
|
+
}, _callee5, this);
|
|
222
198
|
}));
|
|
223
199
|
|
|
224
200
|
function badFileReturnsError() {
|
|
@@ -230,13 +206,13 @@ var KeepingDataStoresInSyncTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
|
|
|
230
206
|
}, {
|
|
231
207
|
key: "generatesValidTypeFile",
|
|
232
208
|
value: function () {
|
|
233
|
-
var _generatesValidTypeFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
209
|
+
var _generatesValidTypeFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
234
210
|
var results, typesFile;
|
|
235
|
-
return _regenerator["default"].wrap(function
|
|
211
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
236
212
|
while (1) {
|
|
237
|
-
switch (
|
|
213
|
+
switch (_context6.prev = _context6.next) {
|
|
238
214
|
case 0:
|
|
239
|
-
|
|
215
|
+
_context6.next = 2;
|
|
240
216
|
return this.Action('store', 'create').execute({
|
|
241
217
|
nameReadable: 'Bid',
|
|
242
218
|
nameReadablePlural: 'Bids',
|
|
@@ -244,21 +220,21 @@ var KeepingDataStoresInSyncTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
|
|
|
244
220
|
});
|
|
245
221
|
|
|
246
222
|
case 2:
|
|
247
|
-
|
|
223
|
+
_context6.next = 4;
|
|
248
224
|
return this.syncStores();
|
|
249
225
|
|
|
250
226
|
case 4:
|
|
251
|
-
results =
|
|
227
|
+
results = _context6.sent;
|
|
252
228
|
typesFile = _test2["default"].assertFileByNameInGeneratedFiles('stores.types.ts', results.files);
|
|
253
|
-
|
|
229
|
+
_context6.next = 8;
|
|
254
230
|
return this.Service('typeChecker').check(typesFile);
|
|
255
231
|
|
|
256
232
|
case 8:
|
|
257
233
|
case "end":
|
|
258
|
-
return
|
|
234
|
+
return _context6.stop();
|
|
259
235
|
}
|
|
260
236
|
}
|
|
261
|
-
},
|
|
237
|
+
}, _callee6, this);
|
|
262
238
|
}));
|
|
263
239
|
|
|
264
240
|
function generatesValidTypeFile() {
|
|
@@ -267,6 +243,30 @@ var KeepingDataStoresInSyncTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
|
|
|
267
243
|
|
|
268
244
|
return generatesValidTypeFile;
|
|
269
245
|
}()
|
|
246
|
+
}, {
|
|
247
|
+
key: "syncStores",
|
|
248
|
+
value: function () {
|
|
249
|
+
var _syncStores = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
250
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
251
|
+
while (1) {
|
|
252
|
+
switch (_context7.prev = _context7.next) {
|
|
253
|
+
case 0:
|
|
254
|
+
return _context7.abrupt("return", this.Action('store', 'sync').execute({}));
|
|
255
|
+
|
|
256
|
+
case 1:
|
|
257
|
+
case "end":
|
|
258
|
+
return _context7.stop();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}, _callee7, this);
|
|
262
|
+
}));
|
|
263
|
+
|
|
264
|
+
function syncStores() {
|
|
265
|
+
return _syncStores.apply(this, arguments);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return syncStores;
|
|
269
|
+
}()
|
|
270
270
|
}]);
|
|
271
271
|
return KeepingDataStoresInSyncTest;
|
|
272
272
|
}(_AbstractSkillTest2["default"]), (0, _defineProperty2["default"])(_class2, "skillCacheKey", 'stores'), (0, _defineProperty2["default"])(_class2, "badStoreDest", void 0), _temp), ((0, _applyDecoratedDescriptor2["default"])(_class, "hasSyncAction", [_dec], Object.getOwnPropertyDescriptor(_class, "hasSyncAction"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "syncsNothingToStart", [_dec2], Object.getOwnPropertyDescriptor(_class, "syncsNothingToStart"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "badFileReturnsError", [_dec3], Object.getOwnPropertyDescriptor(_class, "badFileReturnsError"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "generatesValidTypeFile", [_dec4], Object.getOwnPropertyDescriptor(_class, "generatesValidTypeFile"), _class)), _class));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/__tests__/behavioral/stores/KeepingDataStoresInSync.test.ts"],"names":["KeepingDataStoresInSyncTest","badStoreDest","resolvePath","diskUtil","deleteFile","assert","isFunction","Action","execute","syncStores","results","isLength","files","writeFile","isArray","errors","errorAssertUtil","assertError","file","nameReadable","nameReadablePlural","namePascal","typesFile","testUtil","assertFileByNameInGeneratedFiles","Service","check","AbstractSkillTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;IAEqBA,2B,WAanB,iB,UAKA,iB,UAOA,iB,UAaA,iB;;;;;;;;;;;;;qGAnCD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAEC,qBAAKC,YAAL,GAAoB,KAAKC,WAAL,CAAiB,yBAAjB,CAApB;;AAFD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;sGAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAECC,2CAASC,UAAT,CAAoB,KAAKH,YAAzB;;AAFD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;yGAKA;AAAA;AAAA;AAAA;AAAA;AAECI,6BAAOC,UAAP,CAAkB,KAAKC,MAAL,CAAY,OAAZ,EAAqB,MAArB,EAA6BC,OAA/C;;A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AAkCJ,SAAlC,CAfP;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;sGAkBA;AAAA;AAAA;AAAA;AAAA;AAAA,kDACQ,KAAKf,MAAL,CAAY,OAAZ,EAAqB,MAArB,EAA6BC,OAA7B,CAAqC,EAArC,CADR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAxDwDmB,8B,8DACvB,Q","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport { errorAssertUtil } from '@sprucelabs/test-utils'\nimport AbstractSkillTest from '../../../tests/AbstractSkillTest'\nimport testUtil from '../../../tests/utilities/test.utility'\n\nexport default class KeepingDataStoresInSyncTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'stores'\n\tprotected static badStoreDest: string\n\tprotected static async beforeAll() {\n\t\tawait super.beforeAll()\n\t\tthis.badStoreDest = this.resolvePath('src/stores/Bad.store.ts')\n\t}\n\n\tprotected static async beforeEach() {\n\t\tawait super.beforeEach()\n\t\tdiskUtil.deleteFile(this.badStoreDest)\n\t}\n\n\t@test()\n\tprotected static async hasSyncAction() {\n\t\tassert.isFunction(this.Action('store', 'sync').execute)\n\t}\n\n\t@test()\n\tprotected static async syncsNothingToStart() {\n\t\tconst results = await this.syncStores()\n\n\t\tassert.isLength(results.files, 0)\n\t}\n\n\t@test()\n\tprotected static async badFileReturnsError() {\n\t\tdiskUtil.writeFile(this.badStoreDest, 'throw new Error(\"Cheese!\")')\n\n\t\tconst results = await this.syncStores()\n\t\tassert.isArray(results.errors)\n\t\tassert.isLength(results.errors, 1)\n\n\t\terrorAssertUtil.assertError(results.errors[0], 'FAILED_TO_IMPORT', {\n\t\t\tfile: 'Bad.store.ts',\n\t\t})\n\t}\n\n\t@test()\n\tprotected static async generatesValidTypeFile() {\n\t\tawait this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Bid',\n\t\t\tnameReadablePlural: 'Bids',\n\t\t\tnamePascal: 'Bid',\n\t\t})\n\n\t\tconst results = await this.syncStores()\n\n\t\tconst typesFile = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'stores.types.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tawait this.Service('typeChecker').check(typesFile)\n\t}\n\n\tprivate static async syncStores() {\n\t\treturn this.Action('store', 'sync').execute({})\n\t}\n}\n"],"file":"KeepingDataStoresInSync.test.js"}
|
package/build/cli.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import ServiceFactory from './services/ServiceFactory';
|
|
|
12
12
|
import { ApiClientFactory } from './types/apiClient.types';
|
|
13
13
|
import { GraphicsInterface } from './types/cli.types';
|
|
14
14
|
interface HealthOptions {
|
|
15
|
-
|
|
15
|
+
shouldRunOnSourceFiles?: boolean;
|
|
16
16
|
}
|
|
17
17
|
export interface CliInterface extends MercuryEventEmitter<GlobalEventContract> {
|
|
18
18
|
installFeatures: FeatureInstaller['install'];
|
package/build/cli.js
CHANGED
|
@@ -244,7 +244,7 @@ var Cli = /*#__PURE__*/function () {
|
|
|
244
244
|
case 5:
|
|
245
245
|
_context5.prev = 5;
|
|
246
246
|
commandService = this.serviceFactory.Service(this.cwd, 'command');
|
|
247
|
-
command = (options === null || options === void 0 ? void 0 : options.
|
|
247
|
+
command = (options === null || options === void 0 ? void 0 : options.shouldRunOnSourceFiles) === false ? 'yarn health' : 'yarn health.local';
|
|
248
248
|
_context5.next = 10;
|
|
249
249
|
return commandService.execute(command);
|
|
250
250
|
|