@sprucelabs/spruce-cli 17.0.15 → 17.1.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/CHANGELOG.md +27 -0
- package/build/__tests__/behavioral/polish/SettingUpPolish.test.d.ts +10 -0
- package/build/__tests__/behavioral/polish/SettingUpPolish.test.js +305 -0
- package/build/__tests__/behavioral/polish/SettingUpPolish.test.js.map +1 -0
- package/build/__tests__/testDirsAndFiles/related_schemas/v2020_10_06/skillWithExtraField.builder.d.ts +5 -0
- package/build/features/FeatureInstaller.d.ts +1 -1
- package/build/features/FeatureInstallerFactory.js +4 -2
- package/build/features/FeatureInstallerFactory.js.map +1 -1
- package/build/features/person/PersonFeature.d.ts +5 -5
- package/build/features/person/PersonFeature.js.map +1 -1
- package/build/features/polish/PolishFeature.d.ts +19 -0
- package/build/features/polish/PolishFeature.js +69 -0
- package/build/features/polish/PolishFeature.js.map +1 -0
- package/build/features/polish/actions/SetupAction.d.ts +13 -0
- package/build/features/polish/actions/SetupAction.js +115 -0
- package/build/features/polish/actions/SetupAction.js.map +1 -0
- package/build/features/polish/writers/PolishWriter.d.ts +4 -0
- package/build/features/polish/writers/PolishWriter.js +84 -0
- package/build/features/polish/writers/PolishWriter.js.map +1 -0
- package/build/widgets/terminalKit/TkBaseWidget.js +2 -2
- package/build/writers/WriterFactory.d.ts +2 -0
- package/build/writers/WriterFactory.js +4 -1
- package/build/writers/WriterFactory.js.map +1 -1
- package/package.json +46 -31
- package/src/__tests__/behavioral/polish/SettingUpPolish.test.ts +71 -0
- package/src/features/FeatureInstallerFactory.ts +3 -0
- package/src/features/person/PersonFeature.ts +6 -6
- package/src/features/polish/PolishFeature.ts +33 -0
- package/src/features/polish/actions/SetupAction.ts +36 -0
- package/src/features/polish/writers/PolishWriter.ts +23 -0
- package/src/writers/WriterFactory.ts +3 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
+
|
|
20
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
+
|
|
22
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
+
|
|
24
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
+
|
|
26
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
+
|
|
28
|
+
var _schema = require("@sprucelabs/schema");
|
|
29
|
+
|
|
30
|
+
var _spruceSkillUtils = require("@sprucelabs/spruce-skill-utils");
|
|
31
|
+
|
|
32
|
+
var _ScriptUpdater = _interopRequireDefault(require("../../../updaters/ScriptUpdater"));
|
|
33
|
+
|
|
34
|
+
var _AbstractAction2 = _interopRequireDefault(require("../../AbstractAction"));
|
|
35
|
+
|
|
36
|
+
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); }; }
|
|
37
|
+
|
|
38
|
+
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; } }
|
|
39
|
+
|
|
40
|
+
var optionsSchema = (0, _schema.buildSchema)({
|
|
41
|
+
id: 'setupPolishAction',
|
|
42
|
+
fields: {}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
var SetupAction = /*#__PURE__*/function (_AbstractAction) {
|
|
46
|
+
(0, _inherits2["default"])(SetupAction, _AbstractAction);
|
|
47
|
+
|
|
48
|
+
var _super = _createSuper(SetupAction);
|
|
49
|
+
|
|
50
|
+
function SetupAction() {
|
|
51
|
+
var _this;
|
|
52
|
+
|
|
53
|
+
(0, _classCallCheck2["default"])(this, SetupAction);
|
|
54
|
+
|
|
55
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
56
|
+
args[_key] = arguments[_key];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
60
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "optionsSchema", optionsSchema);
|
|
61
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "invocationMessage", 'Setting up polish... ✨');
|
|
62
|
+
return _this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
(0, _createClass2["default"])(SetupAction, [{
|
|
66
|
+
key: "execute",
|
|
67
|
+
value: function () {
|
|
68
|
+
var _execute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
69
|
+
var namespace, writer, files, scriptUpdater;
|
|
70
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
71
|
+
while (1) {
|
|
72
|
+
switch (_context.prev = _context.next) {
|
|
73
|
+
case 0:
|
|
74
|
+
_context.next = 2;
|
|
75
|
+
return this.Store('skill').loadCurrentSkillsNamespace();
|
|
76
|
+
|
|
77
|
+
case 2:
|
|
78
|
+
namespace = _context.sent;
|
|
79
|
+
writer = this.Writer('polish');
|
|
80
|
+
_context.next = 6;
|
|
81
|
+
return writer.writePolishScript(_spruceSkillUtils.diskUtil.resolvePath(this.cwd, 'src'), namespace.toLowerCase());
|
|
82
|
+
|
|
83
|
+
case 6:
|
|
84
|
+
files = _context.sent;
|
|
85
|
+
scriptUpdater = _ScriptUpdater["default"].FromFeature(this.parent, {
|
|
86
|
+
cwd: this.cwd
|
|
87
|
+
});
|
|
88
|
+
_context.next = 10;
|
|
89
|
+
return scriptUpdater.update();
|
|
90
|
+
|
|
91
|
+
case 10:
|
|
92
|
+
return _context.abrupt("return", {
|
|
93
|
+
files: files
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
case 11:
|
|
97
|
+
case "end":
|
|
98
|
+
return _context.stop();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, _callee, this);
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
function execute() {
|
|
105
|
+
return _execute.apply(this, arguments);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return execute;
|
|
109
|
+
}()
|
|
110
|
+
}]);
|
|
111
|
+
return SetupAction;
|
|
112
|
+
}(_AbstractAction2["default"]);
|
|
113
|
+
|
|
114
|
+
exports["default"] = SetupAction;
|
|
115
|
+
//# sourceMappingURL=SetupAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetupAction.js","names":["optionsSchema","buildSchema","id","fields","SetupAction","Store","loadCurrentSkillsNamespace","namespace","writer","Writer","writePolishScript","diskUtil","resolvePath","cwd","toLowerCase","files","scriptUpdater","ScriptUpdater","FromFeature","parent","update","AbstractAction"],"sources":["../../../../src/features/polish/actions/SetupAction.ts"],"sourcesContent":["import { buildSchema } from '@sprucelabs/schema'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport ScriptUpdater from '../../../updaters/ScriptUpdater'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\n\nconst optionsSchema = buildSchema({\n\tid: 'setupPolishAction',\n\tfields: {},\n})\n\ntype OptionsSchema = typeof optionsSchema\n\nexport default class SetupAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema: OptionsSchema = optionsSchema\n\tpublic invocationMessage = 'Setting up polish... ✨'\n\n\tpublic async execute(): Promise<FeatureActionResponse> {\n\t\tconst namespace = await this.Store('skill').loadCurrentSkillsNamespace()\n\t\tconst writer = this.Writer('polish')\n\t\tconst files = await writer.writePolishScript(\n\t\t\tdiskUtil.resolvePath(this.cwd, 'src'),\n\t\t\tnamespace.toLowerCase()\n\t\t)\n\n\t\tconst scriptUpdater = ScriptUpdater.FromFeature(this.parent, {\n\t\t\tcwd: this.cwd,\n\t\t})\n\n\t\tawait scriptUpdater.update()\n\n\t\treturn {\n\t\t\tfiles,\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAGA,IAAMA,aAAa,GAAG,IAAAC,mBAAA,EAAY;EACjCC,EAAE,EAAE,mBAD6B;EAEjCC,MAAM,EAAE;AAFyB,CAAZ,CAAtB;;IAOqBC,W;;;;;;;;;;;;;;;sGACkBJ,a;0GACX,wB;;;;;;;mGAE3B;QAAA;QAAA;UAAA;YAAA;cAAA;gBAAA;gBAAA,OACyB,KAAKK,KAAL,CAAW,OAAX,EAAoBC,0BAApB,EADzB;;cAAA;gBACOC,SADP;gBAEOC,MAFP,GAEgB,KAAKC,MAAL,CAAY,QAAZ,CAFhB;gBAAA;gBAAA,OAGqBD,MAAM,CAACE,iBAAP,CACnBC,0BAAA,CAASC,WAAT,CAAqB,KAAKC,GAA1B,EAA+B,KAA/B,CADmB,EAEnBN,SAAS,CAACO,WAAV,EAFmB,CAHrB;;cAAA;gBAGOC,KAHP;gBAQOC,aARP,GAQuBC,yBAAA,CAAcC,WAAd,CAA0B,KAAKC,MAA/B,EAAuC;kBAC5DN,GAAG,EAAE,KAAKA;gBADkD,CAAvC,CARvB;gBAAA;gBAAA,OAYOG,aAAa,CAACI,MAAd,EAZP;;cAAA;gBAAA,iCAcQ;kBACNL,KAAK,EAALA;gBADM,CAdR;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;EAJwCM,2B"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
+
|
|
20
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
+
|
|
22
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
+
|
|
24
|
+
var _path = _interopRequireDefault(require("path"));
|
|
25
|
+
|
|
26
|
+
var _AbstractWriter2 = _interopRequireDefault(require("../../../writers/AbstractWriter"));
|
|
27
|
+
|
|
28
|
+
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); }; }
|
|
29
|
+
|
|
30
|
+
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; } }
|
|
31
|
+
|
|
32
|
+
var PolishWriter = /*#__PURE__*/function (_AbstractWriter) {
|
|
33
|
+
(0, _inherits2["default"])(PolishWriter, _AbstractWriter);
|
|
34
|
+
|
|
35
|
+
var _super = _createSuper(PolishWriter);
|
|
36
|
+
|
|
37
|
+
function PolishWriter() {
|
|
38
|
+
(0, _classCallCheck2["default"])(this, PolishWriter);
|
|
39
|
+
return _super.apply(this, arguments);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
(0, _createClass2["default"])(PolishWriter, [{
|
|
43
|
+
key: "writePolishScript",
|
|
44
|
+
value: function () {
|
|
45
|
+
var _writePolishScript = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(destinationDir, skillNamespace) {
|
|
46
|
+
var filename, resolvedDestination, content, results;
|
|
47
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
48
|
+
while (1) {
|
|
49
|
+
switch (_context.prev = _context.next) {
|
|
50
|
+
case 0:
|
|
51
|
+
filename = "".concat(skillNamespace, ".polish.ts");
|
|
52
|
+
resolvedDestination = _path["default"].join(destinationDir, filename);
|
|
53
|
+
content = this.templates.polish();
|
|
54
|
+
_context.next = 5;
|
|
55
|
+
return this.writeFileIfChangedMixinResults(resolvedDestination, content, "Polish script at ".concat(filename, "!"));
|
|
56
|
+
|
|
57
|
+
case 5:
|
|
58
|
+
results = _context.sent;
|
|
59
|
+
_context.next = 8;
|
|
60
|
+
return this.lint(resolvedDestination);
|
|
61
|
+
|
|
62
|
+
case 8:
|
|
63
|
+
return _context.abrupt("return", results);
|
|
64
|
+
|
|
65
|
+
case 9:
|
|
66
|
+
case "end":
|
|
67
|
+
return _context.stop();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, _callee, this);
|
|
71
|
+
}));
|
|
72
|
+
|
|
73
|
+
function writePolishScript(_x, _x2) {
|
|
74
|
+
return _writePolishScript.apply(this, arguments);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return writePolishScript;
|
|
78
|
+
}()
|
|
79
|
+
}]);
|
|
80
|
+
return PolishWriter;
|
|
81
|
+
}(_AbstractWriter2["default"]);
|
|
82
|
+
|
|
83
|
+
exports["default"] = PolishWriter;
|
|
84
|
+
//# sourceMappingURL=PolishWriter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PolishWriter.js","names":["PolishWriter","destinationDir","skillNamespace","filename","resolvedDestination","pathUtil","join","content","templates","polish","writeFileIfChangedMixinResults","results","lint","AbstractWriter"],"sources":["../../../../src/features/polish/writers/PolishWriter.ts"],"sourcesContent":["import pathUtil from 'path'\nimport AbstractWriter from '../../../writers/AbstractWriter'\n\nexport default class PolishWriter extends AbstractWriter {\n\tpublic async writePolishScript(\n\t\tdestinationDir: string,\n\t\tskillNamespace: string\n\t) {\n\t\tconst filename = `${skillNamespace}.polish.ts`\n\t\tconst resolvedDestination = pathUtil.join(destinationDir, filename)\n\t\tconst content = this.templates.polish()\n\n\t\tconst results = await this.writeFileIfChangedMixinResults(\n\t\t\tresolvedDestination,\n\t\t\tcontent,\n\t\t\t`Polish script at ${filename}!`\n\t\t)\n\n\t\tawait this.lint(resolvedDestination)\n\n\t\treturn results\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;IAEqBA,Y;;;;;;;;;;;;;6GACpB,iBACCC,cADD,EAECC,cAFD;QAAA;QAAA;UAAA;YAAA;cAAA;gBAIOC,QAJP,aAIqBD,cAJrB;gBAKOE,mBALP,GAK6BC,gBAAA,CAASC,IAAT,CAAcL,cAAd,EAA8BE,QAA9B,CAL7B;gBAMOI,OANP,GAMiB,KAAKC,SAAL,CAAeC,MAAf,EANjB;gBAAA;gBAAA,OAQuB,KAAKC,8BAAL,CACrBN,mBADqB,EAErBG,OAFqB,6BAGDJ,QAHC,OARvB;;cAAA;gBAQOQ,OARP;gBAAA;gBAAA,OAcO,KAAKC,IAAL,CAAUR,mBAAV,CAdP;;cAAA;gBAAA,iCAgBQO,OAhBR;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;EADyCE,2B"}
|
|
@@ -41,8 +41,8 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
41
41
|
|
|
42
42
|
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; } }
|
|
43
43
|
|
|
44
|
-
var TkBaseWidget = /*#__PURE__*/function (
|
|
45
|
-
(0, _inherits2["default"])(TkBaseWidget,
|
|
44
|
+
var TkBaseWidget = /*#__PURE__*/function (_ref) {
|
|
45
|
+
(0, _inherits2["default"])(TkBaseWidget, _ref);
|
|
46
46
|
|
|
47
47
|
var _super = _createSuper(TkBaseWidget);
|
|
48
48
|
|
|
@@ -6,6 +6,7 @@ import ErrorWriter from '../features/error/writers/ErrorWriter';
|
|
|
6
6
|
import EventWriter from '../features/event/writers/EventWriter';
|
|
7
7
|
import LogWriter from '../features/log/writers/LogWriter';
|
|
8
8
|
import NodeWriter from '../features/node/writers/NodeWriter';
|
|
9
|
+
import PolishWriter from '../features/polish/writers/PolishWriter';
|
|
9
10
|
import SandboxWriter from '../features/sandbox/writers/SandboxWriter';
|
|
10
11
|
import SchemaWriter from '../features/schema/writers/SchemaWriter';
|
|
11
12
|
import SkillGenerator from '../features/skill/writers/SkillWriter';
|
|
@@ -31,6 +32,7 @@ export interface WriterMap {
|
|
|
31
32
|
store: StoreWriter;
|
|
32
33
|
view: ViewWriter;
|
|
33
34
|
log: LogWriter;
|
|
35
|
+
polish: PolishWriter;
|
|
34
36
|
}
|
|
35
37
|
export declare type WriterCode = keyof WriterMap;
|
|
36
38
|
export default class WriterFactory {
|
|
@@ -25,6 +25,8 @@ var _LogWriter = _interopRequireDefault(require("../features/log/writers/LogWrit
|
|
|
25
25
|
|
|
26
26
|
var _NodeWriter = _interopRequireDefault(require("../features/node/writers/NodeWriter"));
|
|
27
27
|
|
|
28
|
+
var _PolishWriter = _interopRequireDefault(require("../features/polish/writers/PolishWriter"));
|
|
29
|
+
|
|
28
30
|
var _SandboxWriter = _interopRequireDefault(require("../features/sandbox/writers/SandboxWriter"));
|
|
29
31
|
|
|
30
32
|
var _SchemaWriter = _interopRequireDefault(require("../features/schema/writers/SchemaWriter"));
|
|
@@ -56,7 +58,8 @@ var classMap = {
|
|
|
56
58
|
sandbox: _SandboxWriter["default"],
|
|
57
59
|
store: _StoreWriter["default"],
|
|
58
60
|
view: _ViewWriter["default"],
|
|
59
|
-
log: _LogWriter["default"]
|
|
61
|
+
log: _LogWriter["default"],
|
|
62
|
+
polish: _PolishWriter["default"]
|
|
60
63
|
};
|
|
61
64
|
|
|
62
65
|
var WriterFactory = /*#__PURE__*/function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WriterFactory.js","names":["classMap","error","ErrorWriter","event","EventWriter","schema","SchemaWriter","skill","SkillGenerator","test","TestGenerator","node","NodeWriter","vscode","VsCodeWriter","conversation","ConversationWriter","deploy","DeployWriter","sandbox","SandboxWriter","store","StoreWriter","view","ViewWriter","log","LogWriter","WriterFactory","options","templates","ui","linter","settings","code","Class","term"],"sources":["../../src/writers/WriterFactory.ts"],"sourcesContent":["import { SettingsService } from '@sprucelabs/spruce-skill-utils'\nimport { Templates } from '@sprucelabs/spruce-templates'\nimport ConversationWriter from '../features/conversation/writers/ConversationWriter'\nimport DeployWriter from '../features/deploy/writers/DeployWriter'\nimport ErrorWriter from '../features/error/writers/ErrorWriter'\nimport EventWriter from '../features/event/writers/EventWriter'\nimport LogWriter from '../features/log/writers/LogWriter'\nimport NodeWriter from '../features/node/writers/NodeWriter'\nimport SandboxWriter from '../features/sandbox/writers/SandboxWriter'\nimport SchemaWriter from '../features/schema/writers/SchemaWriter'\nimport SkillGenerator from '../features/skill/writers/SkillWriter'\nimport StoreWriter from '../features/store/writers/StoreWriter'\nimport TestGenerator from '../features/test/writers/TestWriter'\nimport ViewWriter from '../features/view/writers/ViewWriter'\nimport VsCodeWriter from '../features/vscode/writers/VsCodeWriter'\nimport LintService from '../services/LintService'\nimport { FileDescription } from '../types/cli.types'\nimport { GraphicsInterface } from '../types/cli.types'\nimport { WriterOptions } from './AbstractWriter'\n\nconst classMap = {\n\terror: ErrorWriter,\n\tevent: EventWriter,\n\tschema: SchemaWriter,\n\tskill: SkillGenerator,\n\ttest: TestGenerator,\n\tnode: NodeWriter,\n\tvscode: VsCodeWriter,\n\tconversation: ConversationWriter,\n\tdeploy: DeployWriter,\n\tsandbox: SandboxWriter,\n\tstore: StoreWriter,\n\tview: ViewWriter,\n\tlog: LogWriter,\n}\n\nexport interface WriterMap {\n\terror: ErrorWriter\n\tevent: EventWriter\n\tschema: SchemaWriter\n\tskill: SkillGenerator\n\ttest: TestGenerator\n\tnode: NodeWriter\n\tvscode: VsCodeWriter\n\tconversation: ConversationWriter\n\tdeploy: DeployWriter\n\tsandbox: SandboxWriter\n\tstore: StoreWriter\n\tview: ViewWriter\n\tlog: LogWriter\n}\n\nexport type WriterCode = keyof WriterMap\n\nexport default class WriterFactory {\n\tprivate templates: Templates\n\tprivate ui: GraphicsInterface\n\tprivate linter?: LintService\n\tprivate settings: SettingsService<string>\n\n\tpublic constructor(options: {\n\t\ttemplates: Templates\n\t\tui: GraphicsInterface\n\t\tlinter?: LintService\n\t\tsettings: SettingsService\n\t}) {\n\t\tconst { templates, ui, linter, settings } = options\n\n\t\tthis.templates = templates\n\t\tthis.ui = ui\n\t\tthis.linter = linter\n\t\tthis.settings = settings\n\t}\n\n\tpublic Writer<C extends WriterCode>(\n\t\tcode: C,\n\t\toptions: Partial<WriterOptions> & { fileDescriptions: FileDescription[] }\n\t): WriterMap[C] {\n\t\tconst Class = classMap[code]\n\t\treturn new Class({\n\t\t\ttemplates: this.templates,\n\t\t\tterm: this.ui,\n\t\t\tlinter: this.linter,\n\t\t\tsettings: this.settings,\n\t\t\t...(options || {}),\n\t\t}) as WriterMap[C]\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAMA,IAAMA,QAAQ,GAAG;EAChBC,KAAK,EAAEC,uBADS;EAEhBC,KAAK,EAAEC,uBAFS;EAGhBC,MAAM,EAAEC,wBAHQ;EAIhBC,KAAK,EAAEC,uBAJS;EAKhBC,IAAI,EAAEC,sBALU;EAMhBC,IAAI,EAAEC,sBANU;EAOhBC,MAAM,EAAEC,wBAPQ;EAQhBC,YAAY,EAAEC,8BARE;EAShBC,MAAM,EAAEC,wBATQ;EAUhBC,OAAO,EAAEC,yBAVO;EAWhBC,KAAK,EAAEC,uBAXS;EAYhBC,IAAI,EAAEC,sBAZU;EAahBC,GAAG,EAAEC;
|
|
1
|
+
{"version":3,"file":"WriterFactory.js","names":["classMap","error","ErrorWriter","event","EventWriter","schema","SchemaWriter","skill","SkillGenerator","test","TestGenerator","node","NodeWriter","vscode","VsCodeWriter","conversation","ConversationWriter","deploy","DeployWriter","sandbox","SandboxWriter","store","StoreWriter","view","ViewWriter","log","LogWriter","polish","PolishWriter","WriterFactory","options","templates","ui","linter","settings","code","Class","term"],"sources":["../../src/writers/WriterFactory.ts"],"sourcesContent":["import { SettingsService } from '@sprucelabs/spruce-skill-utils'\nimport { Templates } from '@sprucelabs/spruce-templates'\nimport ConversationWriter from '../features/conversation/writers/ConversationWriter'\nimport DeployWriter from '../features/deploy/writers/DeployWriter'\nimport ErrorWriter from '../features/error/writers/ErrorWriter'\nimport EventWriter from '../features/event/writers/EventWriter'\nimport LogWriter from '../features/log/writers/LogWriter'\nimport NodeWriter from '../features/node/writers/NodeWriter'\nimport PolishWriter from '../features/polish/writers/PolishWriter'\nimport SandboxWriter from '../features/sandbox/writers/SandboxWriter'\nimport SchemaWriter from '../features/schema/writers/SchemaWriter'\nimport SkillGenerator from '../features/skill/writers/SkillWriter'\nimport StoreWriter from '../features/store/writers/StoreWriter'\nimport TestGenerator from '../features/test/writers/TestWriter'\nimport ViewWriter from '../features/view/writers/ViewWriter'\nimport VsCodeWriter from '../features/vscode/writers/VsCodeWriter'\nimport LintService from '../services/LintService'\nimport { FileDescription } from '../types/cli.types'\nimport { GraphicsInterface } from '../types/cli.types'\nimport { WriterOptions } from './AbstractWriter'\n\nconst classMap = {\n\terror: ErrorWriter,\n\tevent: EventWriter,\n\tschema: SchemaWriter,\n\tskill: SkillGenerator,\n\ttest: TestGenerator,\n\tnode: NodeWriter,\n\tvscode: VsCodeWriter,\n\tconversation: ConversationWriter,\n\tdeploy: DeployWriter,\n\tsandbox: SandboxWriter,\n\tstore: StoreWriter,\n\tview: ViewWriter,\n\tlog: LogWriter,\n\tpolish: PolishWriter,\n}\n\nexport interface WriterMap {\n\terror: ErrorWriter\n\tevent: EventWriter\n\tschema: SchemaWriter\n\tskill: SkillGenerator\n\ttest: TestGenerator\n\tnode: NodeWriter\n\tvscode: VsCodeWriter\n\tconversation: ConversationWriter\n\tdeploy: DeployWriter\n\tsandbox: SandboxWriter\n\tstore: StoreWriter\n\tview: ViewWriter\n\tlog: LogWriter\n\tpolish: PolishWriter\n}\n\nexport type WriterCode = keyof WriterMap\n\nexport default class WriterFactory {\n\tprivate templates: Templates\n\tprivate ui: GraphicsInterface\n\tprivate linter?: LintService\n\tprivate settings: SettingsService<string>\n\n\tpublic constructor(options: {\n\t\ttemplates: Templates\n\t\tui: GraphicsInterface\n\t\tlinter?: LintService\n\t\tsettings: SettingsService\n\t}) {\n\t\tconst { templates, ui, linter, settings } = options\n\n\t\tthis.templates = templates\n\t\tthis.ui = ui\n\t\tthis.linter = linter\n\t\tthis.settings = settings\n\t}\n\n\tpublic Writer<C extends WriterCode>(\n\t\tcode: C,\n\t\toptions: Partial<WriterOptions> & { fileDescriptions: FileDescription[] }\n\t): WriterMap[C] {\n\t\tconst Class = classMap[code]\n\t\treturn new Class({\n\t\t\ttemplates: this.templates,\n\t\t\tterm: this.ui,\n\t\t\tlinter: this.linter,\n\t\t\tsettings: this.settings,\n\t\t\t...(options || {}),\n\t\t}) as WriterMap[C]\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAMA,IAAMA,QAAQ,GAAG;EAChBC,KAAK,EAAEC,uBADS;EAEhBC,KAAK,EAAEC,uBAFS;EAGhBC,MAAM,EAAEC,wBAHQ;EAIhBC,KAAK,EAAEC,uBAJS;EAKhBC,IAAI,EAAEC,sBALU;EAMhBC,IAAI,EAAEC,sBANU;EAOhBC,MAAM,EAAEC,wBAPQ;EAQhBC,YAAY,EAAEC,8BARE;EAShBC,MAAM,EAAEC,wBATQ;EAUhBC,OAAO,EAAEC,yBAVO;EAWhBC,KAAK,EAAEC,uBAXS;EAYhBC,IAAI,EAAEC,sBAZU;EAahBC,GAAG,EAAEC,qBAbW;EAchBC,MAAM,EAAEC;AAdQ,CAAjB;;IAoCqBC,a;EAMpB,uBAAmBC,OAAnB,EAKG;IAAA;IAAA;IAAA;IAAA;IAAA;IACF,IAAQC,SAAR,GAA4CD,OAA5C,CAAQC,SAAR;IAAA,IAAmBC,EAAnB,GAA4CF,OAA5C,CAAmBE,EAAnB;IAAA,IAAuBC,MAAvB,GAA4CH,OAA5C,CAAuBG,MAAvB;IAAA,IAA+BC,QAA/B,GAA4CJ,OAA5C,CAA+BI,QAA/B;IAEA,KAAKH,SAAL,GAAiBA,SAAjB;IACA,KAAKC,EAAL,GAAUA,EAAV;IACA,KAAKC,MAAL,GAAcA,MAAd;IACA,KAAKC,QAAL,GAAgBA,QAAhB;EACA;;;;WAED,gBACCC,IADD,EAECL,OAFD,EAGgB;MACf,IAAMM,KAAK,GAAGpC,QAAQ,CAACmC,IAAD,CAAtB;MACA,OAAO,IAAIC,KAAJ;QACNL,SAAS,EAAE,KAAKA,SADV;QAENM,IAAI,EAAE,KAAKL,EAFL;QAGNC,MAAM,EAAE,KAAKA,MAHP;QAINC,QAAQ,EAAE,KAAKA;MAJT,GAKFJ,OAAO,IAAI,EALT,EAAP;IAOA"}
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
|
-
"version": "17.0
|
|
21
|
+
"version": "17.1.0",
|
|
22
22
|
"bin": {
|
|
23
23
|
"spruce": "./build/index.js"
|
|
24
24
|
},
|
|
@@ -76,19 +76,19 @@
|
|
|
76
76
|
"@babel/plugin-proposal-decorators": "^7.18.2",
|
|
77
77
|
"@babel/runtime": "^7.18.3",
|
|
78
78
|
"@jest/reporters": "^28.1.1",
|
|
79
|
-
"@sprucelabs/error": "^5.0.
|
|
80
|
-
"@sprucelabs/heartwood-view-controllers": "^
|
|
81
|
-
"@sprucelabs/jest-json-reporter": "^6.0.
|
|
82
|
-
"@sprucelabs/mercury-client": "^
|
|
83
|
-
"@sprucelabs/mercury-event-emitter": "^
|
|
84
|
-
"@sprucelabs/mercury-types": "^
|
|
85
|
-
"@sprucelabs/schema": "^28.2.
|
|
86
|
-
"@sprucelabs/spruce-core-schemas": "^
|
|
87
|
-
"@sprucelabs/spruce-event-plugin": "^
|
|
88
|
-
"@sprucelabs/spruce-event-utils": "^
|
|
89
|
-
"@sprucelabs/spruce-skill-booter": "^
|
|
90
|
-
"@sprucelabs/spruce-skill-utils": "^26.0.
|
|
91
|
-
"@sprucelabs/spruce-templates": "^17.0
|
|
79
|
+
"@sprucelabs/error": "^5.0.475",
|
|
80
|
+
"@sprucelabs/heartwood-view-controllers": "^84.3.7",
|
|
81
|
+
"@sprucelabs/jest-json-reporter": "^6.0.408",
|
|
82
|
+
"@sprucelabs/mercury-client": "^31.0.7",
|
|
83
|
+
"@sprucelabs/mercury-event-emitter": "^31.0.7",
|
|
84
|
+
"@sprucelabs/mercury-types": "^35.0.3",
|
|
85
|
+
"@sprucelabs/schema": "^28.2.51",
|
|
86
|
+
"@sprucelabs/spruce-core-schemas": "^34.0.4",
|
|
87
|
+
"@sprucelabs/spruce-event-plugin": "^41.0.4",
|
|
88
|
+
"@sprucelabs/spruce-event-utils": "^27.0.5",
|
|
89
|
+
"@sprucelabs/spruce-skill-booter": "^41.0.4",
|
|
90
|
+
"@sprucelabs/spruce-skill-utils": "^26.0.88",
|
|
91
|
+
"@sprucelabs/spruce-templates": "^17.1.0",
|
|
92
92
|
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
|
93
93
|
"@typescript-eslint/parser": "^5.27.1",
|
|
94
94
|
"cfonts": "^3.1.0",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"chokidar": "^3.5.3",
|
|
97
97
|
"cli-table3": "^0.6.2",
|
|
98
98
|
"commander": "7.2.0",
|
|
99
|
-
"core-js": "^3.23.
|
|
99
|
+
"core-js": "^3.23.1",
|
|
100
100
|
"emphasize": "4.2.0",
|
|
101
101
|
"fs-extra": "^10.1.0",
|
|
102
102
|
"gifwrap": "^0.10.1",
|
|
@@ -119,16 +119,16 @@
|
|
|
119
119
|
"uuid": "^8.3.2"
|
|
120
120
|
},
|
|
121
121
|
"devDependencies": {
|
|
122
|
-
"@sprucelabs/data-stores": "^
|
|
122
|
+
"@sprucelabs/data-stores": "^17.0.3",
|
|
123
123
|
"@sprucelabs/jest-sheets-reporter": "^1.3.47",
|
|
124
|
-
"@sprucelabs/mercury-core-events": "^
|
|
125
|
-
"@sprucelabs/resolve-path-aliases": "^1.1.
|
|
126
|
-
"@sprucelabs/spruce-conversation-plugin": "^
|
|
127
|
-
"@sprucelabs/spruce-deploy-plugin": "^
|
|
128
|
-
"@sprucelabs/spruce-store-plugin": "^
|
|
129
|
-
"@sprucelabs/spruce-test-fixtures": "^
|
|
130
|
-
"@sprucelabs/test": "^7.7.
|
|
131
|
-
"@sprucelabs/test-utils": "^3.1.
|
|
124
|
+
"@sprucelabs/mercury-core-events": "^12.0.5",
|
|
125
|
+
"@sprucelabs/resolve-path-aliases": "^1.1.62",
|
|
126
|
+
"@sprucelabs/spruce-conversation-plugin": "^41.0.4",
|
|
127
|
+
"@sprucelabs/spruce-deploy-plugin": "^41.0.4",
|
|
128
|
+
"@sprucelabs/spruce-store-plugin": "^41.0.4",
|
|
129
|
+
"@sprucelabs/spruce-test-fixtures": "^41.0.4",
|
|
130
|
+
"@sprucelabs/test": "^7.7.329",
|
|
131
|
+
"@sprucelabs/test-utils": "^3.1.14",
|
|
132
132
|
"@types/blessed": "^0.1.19",
|
|
133
133
|
"@types/eslint": "^8.4.3",
|
|
134
134
|
"@types/fs-extra": "^9.0.13",
|
|
@@ -138,35 +138,35 @@
|
|
|
138
138
|
"@types/lodash": "^4.14.182",
|
|
139
139
|
"@types/md5": "^2.3.2",
|
|
140
140
|
"@types/mkdirp": "^1.0.2",
|
|
141
|
-
"@types/node": "^
|
|
141
|
+
"@types/node": "^18.0.0",
|
|
142
142
|
"@types/promise.allsettled": "^1.0.3",
|
|
143
143
|
"@types/ps-node": "^0.1.1",
|
|
144
144
|
"@types/rimraf": "^3.0.2",
|
|
145
|
-
"@types/semver": "^7.3.
|
|
145
|
+
"@types/semver": "^7.3.10",
|
|
146
146
|
"@types/sha1": "^1.1.3",
|
|
147
147
|
"@types/slug": "^5.0.3",
|
|
148
148
|
"@types/superagent": "^4.1.15",
|
|
149
149
|
"@types/terminal-kit": "^1.34.0",
|
|
150
150
|
"@types/uuid": "^8.3.4",
|
|
151
151
|
"chokidar-cli": "^3.0.0",
|
|
152
|
-
"concurrently": "^7.2.
|
|
152
|
+
"concurrently": "^7.2.2",
|
|
153
153
|
"conventional-changelog-sprucelabs": "^1.1.2",
|
|
154
154
|
"dotenv": "^16.0.1",
|
|
155
|
-
"eslint": "^8.
|
|
155
|
+
"eslint": "^8.18.0",
|
|
156
156
|
"eslint-config-spruce": "^10.11.2",
|
|
157
157
|
"find-process": "^1.4.7",
|
|
158
158
|
"jest": "^28.1.1",
|
|
159
159
|
"jest-circus": "^28.1.1",
|
|
160
160
|
"jest-junit": "^13.2.0",
|
|
161
161
|
"jest-reporters": "^0.0.2",
|
|
162
|
-
"prettier": "^2.7.
|
|
162
|
+
"prettier": "^2.7.1",
|
|
163
163
|
"ps-node": "^0.1.6",
|
|
164
164
|
"rimraf": "^3.0.2",
|
|
165
165
|
"ts-jest": "^28.0.5",
|
|
166
166
|
"ts-node": "^10.8.1",
|
|
167
167
|
"tsc-watch": "^5.0.3",
|
|
168
168
|
"tsconfig-paths": "^4.0.0",
|
|
169
|
-
"typescript": "^4.7.
|
|
169
|
+
"typescript": "^4.7.4"
|
|
170
170
|
},
|
|
171
171
|
"testSkillCache": {
|
|
172
172
|
"everything": [
|
|
@@ -194,6 +194,9 @@
|
|
|
194
194
|
},
|
|
195
195
|
{
|
|
196
196
|
"code": "conversation"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"code": "polish"
|
|
197
200
|
}
|
|
198
201
|
],
|
|
199
202
|
"everythingInNode": [
|
|
@@ -277,6 +280,18 @@
|
|
|
277
280
|
"code": "event"
|
|
278
281
|
}
|
|
279
282
|
],
|
|
283
|
+
"polish": [
|
|
284
|
+
{
|
|
285
|
+
"code": "skill",
|
|
286
|
+
"options": {
|
|
287
|
+
"name": "testing polish",
|
|
288
|
+
"description": "this too, is a great test!"
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"code": "polish"
|
|
293
|
+
}
|
|
294
|
+
],
|
|
280
295
|
"sandbox": [
|
|
281
296
|
{
|
|
282
297
|
"code": "skill",
|
|
@@ -597,5 +612,5 @@
|
|
|
597
612
|
"terminal-kit"
|
|
598
613
|
]
|
|
599
614
|
},
|
|
600
|
-
"gitHead": "
|
|
615
|
+
"gitHead": "e557a50edaaf2cc61f241f9a6b6b223f69991fe4"
|
|
601
616
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
|
+
import { test, assert } from '@sprucelabs/test'
|
|
3
|
+
import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
4
|
+
|
|
5
|
+
export default class SettingUpPolishTest extends AbstractCliTest {
|
|
6
|
+
@test()
|
|
7
|
+
protected static async hasCreateAction() {
|
|
8
|
+
assert.isFunction(this.Action('polish', 'setup').execute)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@test()
|
|
12
|
+
protected static async setsUpExpectedScript() {
|
|
13
|
+
await this.setupPolish()
|
|
14
|
+
|
|
15
|
+
const { destination } = await this.generateExpectedFile()
|
|
16
|
+
|
|
17
|
+
assert.isTrue(
|
|
18
|
+
diskUtil.doesFileExist(destination),
|
|
19
|
+
`Did not find polish script at ${destination}!`
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@test()
|
|
24
|
+
protected static async polishResultsAreExpected() {
|
|
25
|
+
const results = await this.setupPolish()
|
|
26
|
+
const { filename, destination } = await this.generateExpectedFile()
|
|
27
|
+
|
|
28
|
+
assert.isLength(results.files, 1)
|
|
29
|
+
assert.isEqualDeep(results, {
|
|
30
|
+
files: [
|
|
31
|
+
{
|
|
32
|
+
name: filename,
|
|
33
|
+
description: `Polish script at ${filename}!`,
|
|
34
|
+
path: destination,
|
|
35
|
+
action: 'generated',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@test()
|
|
42
|
+
protected static async createsExpectedScript() {
|
|
43
|
+
await this.setupPolish()
|
|
44
|
+
const pkg = this.Service('pkg')
|
|
45
|
+
const scripts = pkg.get('scripts')
|
|
46
|
+
assert.isEqual(scripts.polish, 'heartwood-polish')
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@test()
|
|
50
|
+
protected static async makeSureScriptHasSomethingAndIsValid() {
|
|
51
|
+
const results = await this.setupPolish()
|
|
52
|
+
const { destination } = await this.generateExpectedFile()
|
|
53
|
+
const contents = diskUtil.readFile(destination)
|
|
54
|
+
assert.isNotEqual(contents, '')
|
|
55
|
+
await this.assertValidActionResponseFiles(results)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private static async generateExpectedFile() {
|
|
59
|
+
const store = this.Store('skill')
|
|
60
|
+
const namespace = await store.loadCurrentSkillsNamespace()
|
|
61
|
+
const filename = `${namespace.toLowerCase()}.polish.ts`
|
|
62
|
+
const destination = this.resolvePath('src', filename)
|
|
63
|
+
return { filename, destination }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private static async setupPolish() {
|
|
67
|
+
await this.FeatureFixture().installCachedFeatures('polish')
|
|
68
|
+
const results = await this.Action('polish', 'setup').execute({})
|
|
69
|
+
return results
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -20,6 +20,7 @@ import NodeFeature from './node/NodeFeature'
|
|
|
20
20
|
import OnboardFeature from './onboard/OnboardFeature'
|
|
21
21
|
import OrganizationFeature from './organization/OrganizationFeature'
|
|
22
22
|
import PersonFeature from './person/PersonFeature'
|
|
23
|
+
import PolishFeature from './polish/PolishFeature'
|
|
23
24
|
import SandboxFeature from './sandbox/SandboxFeature'
|
|
24
25
|
import SchemaFeature from './schema/SchemaFeature'
|
|
25
26
|
import SkillFeature from './skill/SkillFeature'
|
|
@@ -50,6 +51,7 @@ export default class FeatureInstallerFactory {
|
|
|
50
51
|
CacheFeature,
|
|
51
52
|
LogFeature,
|
|
52
53
|
DependencyFeature,
|
|
54
|
+
PolishFeature,
|
|
53
55
|
]
|
|
54
56
|
|
|
55
57
|
public static readonly featureCodes: FeatureCode[] = [
|
|
@@ -73,6 +75,7 @@ export default class FeatureInstallerFactory {
|
|
|
73
75
|
'cache',
|
|
74
76
|
'log',
|
|
75
77
|
'dependency',
|
|
78
|
+
'polish',
|
|
76
79
|
]
|
|
77
80
|
|
|
78
81
|
public static WithAllFeatures(options: {
|
|
@@ -2,12 +2,6 @@ import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
|
2
2
|
import AbstractFeature, { FeatureDependency } from '../AbstractFeature'
|
|
3
3
|
import { FeatureCode } from '../features.types'
|
|
4
4
|
|
|
5
|
-
declare module '../../features/features.types' {
|
|
6
|
-
interface FeatureMap {
|
|
7
|
-
person: PersonFeature
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
5
|
export default class PersonFeature extends AbstractFeature {
|
|
12
6
|
public code: FeatureCode = 'person'
|
|
13
7
|
public nameReadable = 'Person'
|
|
@@ -26,3 +20,9 @@ export default class PersonFeature extends AbstractFeature {
|
|
|
26
20
|
return this.featureInstaller.isInstalled('skill')
|
|
27
21
|
}
|
|
28
22
|
}
|
|
23
|
+
|
|
24
|
+
declare module '../../features/features.types' {
|
|
25
|
+
interface FeatureMap {
|
|
26
|
+
person: PersonFeature
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { diskUtil, NpmPackage } from '@sprucelabs/spruce-skill-utils'
|
|
2
|
+
import AbstractFeature, { FeatureDependency } from '../AbstractFeature'
|
|
3
|
+
import { FeatureCode } from '../features.types'
|
|
4
|
+
|
|
5
|
+
export default class PolishFeature extends AbstractFeature {
|
|
6
|
+
public code: FeatureCode = 'polish'
|
|
7
|
+
public nameReadable = 'Polish'
|
|
8
|
+
public description =
|
|
9
|
+
'Run through your skill as a robot, clicking and typing and asserting!'
|
|
10
|
+
public dependencies: FeatureDependency[] = [
|
|
11
|
+
{
|
|
12
|
+
code: 'skill',
|
|
13
|
+
isRequired: true,
|
|
14
|
+
},
|
|
15
|
+
]
|
|
16
|
+
public packageDependencies: NpmPackage[] = [
|
|
17
|
+
{
|
|
18
|
+
name: '@sprucelabs/heartwood-polish',
|
|
19
|
+
isDev: true,
|
|
20
|
+
},
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
public actionsDir = diskUtil.resolvePath(__dirname, 'actions')
|
|
24
|
+
public scripts = {
|
|
25
|
+
polish: 'heartwood-polish',
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module '../../features/features.types' {
|
|
30
|
+
interface FeatureMap {
|
|
31
|
+
polish: PolishFeature
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { buildSchema } from '@sprucelabs/schema'
|
|
2
|
+
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
3
|
+
import ScriptUpdater from '../../../updaters/ScriptUpdater'
|
|
4
|
+
import AbstractAction from '../../AbstractAction'
|
|
5
|
+
import { FeatureActionResponse } from '../../features.types'
|
|
6
|
+
|
|
7
|
+
const optionsSchema = buildSchema({
|
|
8
|
+
id: 'setupPolishAction',
|
|
9
|
+
fields: {},
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
type OptionsSchema = typeof optionsSchema
|
|
13
|
+
|
|
14
|
+
export default class SetupAction extends AbstractAction<OptionsSchema> {
|
|
15
|
+
public optionsSchema: OptionsSchema = optionsSchema
|
|
16
|
+
public invocationMessage = 'Setting up polish... ✨'
|
|
17
|
+
|
|
18
|
+
public async execute(): Promise<FeatureActionResponse> {
|
|
19
|
+
const namespace = await this.Store('skill').loadCurrentSkillsNamespace()
|
|
20
|
+
const writer = this.Writer('polish')
|
|
21
|
+
const files = await writer.writePolishScript(
|
|
22
|
+
diskUtil.resolvePath(this.cwd, 'src'),
|
|
23
|
+
namespace.toLowerCase()
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
const scriptUpdater = ScriptUpdater.FromFeature(this.parent, {
|
|
27
|
+
cwd: this.cwd,
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
await scriptUpdater.update()
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
files,
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|