@sprucelabs/spruce-cli 14.28.3 → 14.28.7

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/build/__tests__/behavioral/BootingWithBadFiles.test.d.ts +2 -0
  3. package/build/__tests__/behavioral/BootingWithBadFiles.test.js +84 -17
  4. package/build/__tests__/behavioral/BootingWithBadFiles.test.js.map +1 -1
  5. package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js +1 -1
  6. package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js.map +1 -1
  7. package/build/__tests__/behavioral/skill/UpgradingASkill2.test.d.ts +1 -1
  8. package/build/__tests__/behavioral/skill/UpgradingASkill2.test.js +10 -20
  9. package/build/__tests__/behavioral/skill/UpgradingASkill2.test.js.map +1 -1
  10. package/build/__tests__/behavioral/{CreatingADataStore.test.d.ts → stores/CreatingADataStore.test.d.ts} +2 -1
  11. package/build/__tests__/behavioral/{CreatingADataStore.test.js → stores/CreatingADataStore.test.js} +84 -57
  12. package/build/__tests__/behavioral/stores/CreatingADataStore.test.js.map +1 -0
  13. package/build/__tests__/behavioral/{KeepingDataStoresInSync.test.d.ts → stores/KeepingDataStoresInSync.test.d.ts} +1 -1
  14. package/build/__tests__/behavioral/{KeepingDataStoresInSync.test.js → stores/KeepingDataStoresInSync.test.js} +2 -2
  15. package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.js.map +1 -0
  16. package/build/cli.d.ts +1 -1
  17. package/build/cli.js +1 -1
  18. package/build/cli.js.map +1 -1
  19. package/build/features/node/NodeFeature.js +6 -11
  20. package/build/features/node/NodeFeature.js.map +1 -1
  21. package/build/features/store/actions/SyncAction.js +11 -10
  22. package/build/features/store/actions/SyncAction.js.map +1 -1
  23. package/build/features/store/writers/StoreWriter.d.ts +6 -0
  24. package/build/features/store/writers/StoreWriter.js +78 -8
  25. package/build/features/store/writers/StoreWriter.js.map +1 -1
  26. package/package.json +31 -31
  27. package/src/__tests__/behavioral/BootingWithBadFiles.test.ts +17 -2
  28. package/src/__tests__/behavioral/events/KeepingEventsInSync2.test.ts +1 -1
  29. package/src/__tests__/behavioral/skill/UpgradingASkill2.test.ts +1 -10
  30. package/src/__tests__/behavioral/{CreatingADataStore.test.ts → stores/CreatingADataStore.test.ts} +12 -6
  31. package/src/__tests__/behavioral/{KeepingDataStoresInSync.test.ts → stores/KeepingDataStoresInSync.test.ts} +2 -2
  32. package/src/cli.ts +2 -2
  33. package/src/features/node/NodeFeature.ts +0 -3
  34. package/src/features/store/actions/SyncAction.ts +2 -1
  35. package/src/features/store/writers/StoreWriter.ts +30 -0
  36. package/build/__tests__/behavioral/CreatingADataStore.test.js.map +0 -1
  37. package/build/__tests__/behavioral/KeepingDataStoresInSync.test.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/features/node/NodeFeature.ts"],"names":["NodeFeature","options","nodeFeatureOptionsSchema","universalDevDependencies","universalScripts","universalFileDescriptions","diskUtil","resolvePath","__dirname","doesFileExist","cwd","emitter","on","payload","featureCode","actionCode","handleUpgrade","ui","startLoading","Service","execute","summaryLines","errors","destination","resolveDestination","doesDirExist","createDir","files","name","path","action","Writer","writeNodeModule","written","push","installScripts","pkg","set","value","namesUtil","toKebab","description","unset","Store","setCurrentSkillsNamespace","scriptUpdater","ScriptUpdater","FromFeature","update","AbstractFeature"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AAEA;;AACA;;AAMA;;AACA;;AACA;;;;;;;;;;IAgBqBA,W;;;;;AAoBpB,uBAAmBC,OAAnB,EAA2C;AAAA;;AAAA;AAC1C,8BAAMA,OAAN;AAD0C,6FAjBhB,MAiBgB;AAAA,qGAhBrB,gBAgBqB;AAAA,oGAftB,EAesB;AAAA,qGAdA,EAcA;AAAA,sGAbpBC,8BAaoB;AAAA,gJAZVC,oCAYU;AAAA,kHATvCC,4BASuC;AAAA,6IALvC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abs/spruce-core-schemas'\nimport { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport nodeFeatureOptionsSchema from '#spruce/schemas/spruceCli/v2020_07_22/nodeFeatureOptions.schema'\nimport { FileDescription, GeneratedFile } from '../../types/cli.types'\nimport ScriptUpdater from '../../updaters/ScriptUpdater'\nimport AbstractFeature, { FeatureDependency } from '../AbstractFeature'\nimport {\n\tActionOptions,\n\tFeatureActionResponse,\n\tFeatureCode,\n} from '../features.types'\nimport universalDevDependencies from '../universalDevDependencies'\nimport universalFileDescriptions from '../universalFileDescriptions'\nimport universalScripts from '../universalScripts'\n\ntype OptionsSchema =\n\tSpruceSchemas.SpruceCli.v2020_07_22.NodeFeatureOptionsSchema\ntype Options = SpruceSchemas.SpruceCli.v2020_07_22.NodeFeatureOptions\n\ndeclare module '../../features/features.types' {\n\tinterface FeatureMap {\n\t\tnode: NodeFeature\n\t}\n\n\tinterface FeatureOptionsMap {\n\t\tnode: SchemaValues<OptionsSchema>\n\t}\n}\n\nexport default class NodeFeature<\n\tS extends OptionsSchema = OptionsSchema\n> extends AbstractFeature<S> {\n\tpublic code: FeatureCode = 'node'\n\tpublic nameReadable = 'nodejs support'\n\tpublic description = ''\n\tpublic dependencies: FeatureDependency[] = []\n\tpublic optionsSchema = nodeFeatureOptionsSchema as S\n\tpublic packageDependencies = [...universalDevDependencies]\n\n\tpublic scripts = {\n\t\t...universalScripts,\n\t}\n\n\tpublic readonly fileDescriptions: FileDescription[] = [\n\t\t...universalFileDescriptions,\n\t]\n\n\tpublic actionsDir = diskUtil.resolvePath(__dirname, 'actions')\n\n\tpublic constructor(options: ActionOptions) {\n\t\tsuper(options)\n\n\t\tvoid this.emitter.on('feature.did-execute', async (payload) => {\n\t\t\tif (payload.featureCode === 'node' && payload.actionCode === 'upgrade') {\n\t\t\t\treturn this.handleUpgrade()\n\t\t\t}\n\n\t\t\treturn {}\n\t\t})\n\t}\n\tprivate async handleUpgrade(): Promise<FeatureActionResponse> {\n\t\ttry {\n\t\t\tthis.ui.startLoading('Cleaning build...')\n\t\t\tawait this.Service('command').execute('yarn clean.build')\n\n\t\t\tthis.ui.startLoading('Applying lint rules to all files...')\n\t\t\tawait this.Service('command').execute('yarn fix.lint')\n\n\t\t\tthis.ui.startLoading('Rebuilding...')\n\t\t\tawait this.Service('command').execute('yarn build.dev')\n\n\t\t\treturn {\n\t\t\t\tsummaryLines: [\n\t\t\t\t\t'Build cleared.',\n\t\t\t\t\t'Lint rules applied to source.',\n\t\t\t\t\t'Code rebuilt successfully.',\n\t\t\t\t],\n\t\t\t}\n\t\t} catch (err) {\n\t\t\treturn {\n\t\t\t\terrors: [err],\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic async beforePackageInstall(options: Options) {\n\t\tconst destination = this.resolveDestination(options)\n\n\t\tif (!diskUtil.doesDirExist(destination)) {\n\t\t\tdiskUtil.createDir(destination)\n\t\t}\n\n\t\tconst files: GeneratedFile[] = [\n\t\t\t{\n\t\t\t\tname: 'package.json',\n\t\t\t\tpath: diskUtil.resolvePath(destination, 'package.json'),\n\t\t\t\taction: 'generated',\n\t\t\t},\n\t\t]\n\n\t\tawait this.Service('command', destination).execute('yarn init -y')\n\n\t\tconst written = await this.Writer('node').writeNodeModule(destination)\n\n\t\tfiles.push(...written)\n\n\t\tawait this.installScripts(destination)\n\n\t\treturn { files, cwd: destination }\n\t}\n\n\tprivate resolveDestination(options: Options) {\n\t\treturn diskUtil.resolvePath(this.cwd, options.destination ?? '')\n\t}\n\n\tpublic async afterPackageInstall(\n\t\toptions: S extends Schema ? SchemaValues<S> : undefined\n\t) {\n\t\tconst cwd = this.resolveDestination(options)\n\t\tconst pkg = this.Service('pkg', cwd)\n\n\t\tpkg.set({ path: 'name', value: namesUtil.toKebab(options.name) })\n\t\tpkg.set({ path: 'description', value: options.description })\n\t\tpkg.set({ path: 'version', value: '0.0.1' })\n\n\t\tpkg.unset('main')\n\t\tpkg.unset('license')\n\n\t\tawait this.Store('skill', { cwd }).setCurrentSkillsNamespace(options.name)\n\n\t\treturn {}\n\t}\n\n\tprivate async installScripts(destination = this.cwd) {\n\t\tconst scriptUpdater = ScriptUpdater.FromFeature(this, {\n\t\t\tcwd: destination,\n\t\t})\n\n\t\tawait scriptUpdater.update()\n\t}\n\n\tpublic isInstalled = async (): Promise<boolean> => {\n\t\treturn diskUtil.doesFileExist(\n\t\t\tdiskUtil.resolvePath(this.cwd, 'package.json')\n\t\t)\n\t}\n}\n"],"file":"NodeFeature.js"}
1
+ {"version":3,"sources":["../../../src/features/node/NodeFeature.ts"],"names":["NodeFeature","options","nodeFeatureOptionsSchema","universalDevDependencies","universalScripts","universalFileDescriptions","diskUtil","resolvePath","__dirname","doesFileExist","cwd","emitter","on","payload","featureCode","actionCode","handleUpgrade","ui","startLoading","Service","execute","summaryLines","errors","destination","resolveDestination","doesDirExist","createDir","files","name","path","action","Writer","writeNodeModule","written","push","installScripts","pkg","set","value","namesUtil","toKebab","description","unset","Store","setCurrentSkillsNamespace","scriptUpdater","ScriptUpdater","FromFeature","update","AbstractFeature"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AAEA;;AACA;;AAMA;;AACA;;AACA;;;;;;;;;;IAgBqBA,W;;;;;AAoBpB,uBAAmBC,OAAnB,EAA2C;AAAA;;AAAA;AAC1C,8BAAMA,OAAN;AAD0C,6FAjBhB,MAiBgB;AAAA,qGAhBrB,gBAgBqB;AAAA,oGAftB,EAesB;AAAA,qGAdA,EAcA;AAAA,sGAbpBC,8BAaoB;AAAA,gJAZVC,oCAYU;AAAA,kHATvCC,4BASuC;AAAA,6IALvCC,qCAKuC;AAAA,mGAFvBC,2BAASC,WAAT,CAAqBC,SAArB,EAAgC,SAAhC,CAEuB;AAAA,+LAyFtB;AAAA;AAAA;AAAA;AAAA;AAAA,+CACbF,2BAASG,aAAT,CACNH,2BAASC,WAAT,CAAqB,MAAKG,GAA1B,EAA+B,cAA/B,CADM,CADa;;AAAA;AAAA;AAAA;AAA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C,OAAO,CAACwC;AAAtC,iBAAR;AACAL,gBAAAA,GAAG,CAACC,GAAJ,CAAQ;AAAER,kBAAAA,IAAI,EAAE,SAAR;AAAmBS,kBAAAA,KAAK,EAAE;AAA1B,iBAAR;AAEAF,gBAAAA,GAAG,CAACM,KAAJ,CAAU,MAAV;AACAN,gBAAAA,GAAG,CAACM,KAAJ,CAAU,SAAV;AAXD;AAAA,uBAaO,KAAKC,KAAL,CAAW,OAAX,EAAoB;AAAEjC,kBAAAA,GAAG,EAAHA;AAAF,iBAApB,EAA6BkC,yBAA7B,CAAuD3C,OAAO,CAAC2B,IAA/D,CAbP;;AAAA;AAAA,kDAeQ,EAfR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;0GAkBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA6BL,gBAAAA,WAA7B,8DAA2C,KAAKb,GAAhD;AACOmC,gBAAAA,aADP,GACuBC,0BAAcC,WAAd,CAA0B,IAA1B,EAAgC;AACrDrC,kBAAAA,GAAG,EAAEa;AADgD,iBAAhC,CADvB;AAAA;AAAA,uBAKOsB,aAAa,CAACG,MAAd,EALP;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAnGSC,4B","sourcesContent":["import { Schema, SchemaValues } from '@sprucelabs/schema'\nimport { SpruceSchemas } from '@sprucelabs/spruce-core-schemas'\nimport { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport nodeFeatureOptionsSchema from '#spruce/schemas/spruceCli/v2020_07_22/nodeFeatureOptions.schema'\nimport { FileDescription, GeneratedFile } from '../../types/cli.types'\nimport ScriptUpdater from '../../updaters/ScriptUpdater'\nimport AbstractFeature, { FeatureDependency } from '../AbstractFeature'\nimport {\n\tActionOptions,\n\tFeatureActionResponse,\n\tFeatureCode,\n} from '../features.types'\nimport universalDevDependencies from '../universalDevDependencies'\nimport universalFileDescriptions from '../universalFileDescriptions'\nimport universalScripts from '../universalScripts'\n\ntype OptionsSchema =\n\tSpruceSchemas.SpruceCli.v2020_07_22.NodeFeatureOptionsSchema\ntype Options = SpruceSchemas.SpruceCli.v2020_07_22.NodeFeatureOptions\n\ndeclare module '../../features/features.types' {\n\tinterface FeatureMap {\n\t\tnode: NodeFeature\n\t}\n\n\tinterface FeatureOptionsMap {\n\t\tnode: SchemaValues<OptionsSchema>\n\t}\n}\n\nexport default class NodeFeature<\n\tS extends OptionsSchema = OptionsSchema\n> extends AbstractFeature<S> {\n\tpublic code: FeatureCode = 'node'\n\tpublic nameReadable = 'nodejs support'\n\tpublic description = ''\n\tpublic dependencies: FeatureDependency[] = []\n\tpublic optionsSchema = nodeFeatureOptionsSchema as S\n\tpublic packageDependencies = [...universalDevDependencies]\n\n\tpublic scripts = {\n\t\t...universalScripts,\n\t}\n\n\tpublic readonly fileDescriptions: FileDescription[] = [\n\t\t...universalFileDescriptions,\n\t]\n\n\tpublic actionsDir = diskUtil.resolvePath(__dirname, 'actions')\n\n\tpublic constructor(options: ActionOptions) {\n\t\tsuper(options)\n\n\t\tvoid this.emitter.on('feature.did-execute', async (payload) => {\n\t\t\tif (payload.featureCode === 'node' && payload.actionCode === 'upgrade') {\n\t\t\t\treturn this.handleUpgrade()\n\t\t\t}\n\n\t\t\treturn {}\n\t\t})\n\t}\n\tprivate async handleUpgrade(): Promise<FeatureActionResponse> {\n\t\ttry {\n\t\t\tthis.ui.startLoading('Cleaning build...')\n\t\t\tawait this.Service('command').execute('yarn clean.build')\n\n\t\t\tthis.ui.startLoading('Rebuilding...')\n\t\t\tawait this.Service('command').execute('yarn build.dev')\n\n\t\t\treturn {\n\t\t\t\tsummaryLines: [\n\t\t\t\t\t'Build cleared.',\n\t\t\t\t\t'Lint rules applied to source.',\n\t\t\t\t\t'Code rebuilt successfully.',\n\t\t\t\t],\n\t\t\t}\n\t\t} catch (err) {\n\t\t\treturn {\n\t\t\t\terrors: [err],\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic async beforePackageInstall(options: Options) {\n\t\tconst destination = this.resolveDestination(options)\n\n\t\tif (!diskUtil.doesDirExist(destination)) {\n\t\t\tdiskUtil.createDir(destination)\n\t\t}\n\n\t\tconst files: GeneratedFile[] = [\n\t\t\t{\n\t\t\t\tname: 'package.json',\n\t\t\t\tpath: diskUtil.resolvePath(destination, 'package.json'),\n\t\t\t\taction: 'generated',\n\t\t\t},\n\t\t]\n\n\t\tawait this.Service('command', destination).execute('yarn init -y')\n\n\t\tconst written = await this.Writer('node').writeNodeModule(destination)\n\n\t\tfiles.push(...written)\n\n\t\tawait this.installScripts(destination)\n\n\t\treturn { files, cwd: destination }\n\t}\n\n\tprivate resolveDestination(options: Options) {\n\t\treturn diskUtil.resolvePath(this.cwd, options.destination ?? '')\n\t}\n\n\tpublic async afterPackageInstall(\n\t\toptions: S extends Schema ? SchemaValues<S> : undefined\n\t) {\n\t\tconst cwd = this.resolveDestination(options)\n\t\tconst pkg = this.Service('pkg', cwd)\n\n\t\tpkg.set({ path: 'name', value: namesUtil.toKebab(options.name) })\n\t\tpkg.set({ path: 'description', value: options.description })\n\t\tpkg.set({ path: 'version', value: '0.0.1' })\n\n\t\tpkg.unset('main')\n\t\tpkg.unset('license')\n\n\t\tawait this.Store('skill', { cwd }).setCurrentSkillsNamespace(options.name)\n\n\t\treturn {}\n\t}\n\n\tprivate async installScripts(destination = this.cwd) {\n\t\tconst scriptUpdater = ScriptUpdater.FromFeature(this, {\n\t\t\tcwd: destination,\n\t\t})\n\n\t\tawait scriptUpdater.update()\n\t}\n\n\tpublic isInstalled = async (): Promise<boolean> => {\n\t\treturn diskUtil.doesFileExist(\n\t\t\tdiskUtil.resolvePath(this.cwd, 'package.json')\n\t\t)\n\t}\n}\n"],"file":"NodeFeature.js"}
@@ -68,7 +68,7 @@ var SyncAction = /*#__PURE__*/function (_AbstractAction) {
68
68
  key: "execute",
69
69
  value: function () {
70
70
  var _execute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_options) {
71
- var stores, files, destination, builder, templateItems;
71
+ var stores, files, destination, builder, templateItems, writer;
72
72
  return _regenerator["default"].wrap(function _callee$(_context) {
73
73
  while (1) {
74
74
  switch (_context.prev = _context.next) {
@@ -82,39 +82,40 @@ var SyncAction = /*#__PURE__*/function (_AbstractAction) {
82
82
  files = [];
83
83
 
84
84
  if (!(stores.length > 0)) {
85
- _context.next = 12;
85
+ _context.next = 13;
86
86
  break;
87
87
  }
88
88
 
89
89
  destination = _spruceSkillUtils.diskUtil.resolveHashSprucePath(this.cwd, 'stores');
90
90
  builder = new _StoreTemplateItemBuilder["default"]();
91
91
  templateItems = builder.buildTemplateItems(stores, destination);
92
- _context.next = 11;
93
- return this.Writer('store').writeTypes(destination, {
92
+ writer = this.Writer('store');
93
+ _context.next = 12;
94
+ return writer.writeTypesAndMap(destination, {
94
95
  stores: templateItems
95
96
  });
96
97
 
97
- case 11:
98
+ case 12:
98
99
  files = _context.sent;
99
100
 
100
- case 12:
101
+ case 13:
101
102
  return _context.abrupt("return", {
102
103
  files: files
103
104
  });
104
105
 
105
- case 15:
106
- _context.prev = 15;
106
+ case 16:
107
+ _context.prev = 16;
107
108
  _context.t0 = _context["catch"](0);
108
109
  return _context.abrupt("return", {
109
110
  errors: [_context.t0]
110
111
  });
111
112
 
112
- case 18:
113
+ case 19:
113
114
  case "end":
114
115
  return _context.stop();
115
116
  }
116
117
  }
117
- }, _callee, this, [[0, 15]]);
118
+ }, _callee, this, [[0, 16]]);
118
119
  }));
119
120
 
120
121
  function execute(_x) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/features/store/actions/SyncAction.ts"],"names":["optionsSchema","id","description","fields","SyncAction","_options","Store","fetchStores","stores","files","length","destination","diskUtil","resolveHashSprucePath","cwd","builder","StoreTemplateItemBuilder","templateItems","buildTemplateItems","Writer","writeTypes","errors","AbstractAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,aAAa,GAAG,yBAAY;AACjCC,EAAAA,EAAE,EAAE,sBAD6B;AAEjCC,EAAAA,WAAW,EACV,uEAHgC;AAIjCC,EAAAA,MAAM,EAAE;AAJyB,CAAZ,CAAtB;;IAUqBC,U;;;;;;;;;;;;;;;sGACGJ,a;uGACC,CAAC,aAAD,C;0GAEvB,2D;;;;;;;mGAED,iBAAqBK,QAArB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAEuB,KAAKC,KAAL,CAAW,OAAX,EAAoBC,WAApB,EAFvB;;AAAA;AAEQC,gBAAAA,MAFR;AAIMC,gBAAAA,KAJN,GAI+B,EAJ/B;;AAAA,sBAMMD,MAAM,CAACE,MAAP,GAAgB,CANtB;AAAA;AAAA;AAAA;;AAOSC,gBAAAA,WAPT,GAOuBC,2BAASC,qBAAT,CAA+B,KAAKC,GAApC,EAAyC,QAAzC,CAPvB;AAQSC,gBAAAA,OART,GAQmB,IAAIC,oCAAJ,EARnB;AASSC,gBAAAA,aATT,GASyBF,OAAO,CAACG,kBAAR,CAA2BV,MAA3B,EAAmCG,WAAnC,CATzB;AAAA;AAAA,uBAWiB,KAAKQ,MAAL,CAAY,OAAZ,EAAqBC,UAArB,CAAgCT,WAAhC,EAA6C;AAC1DH,kBAAAA,MAAM,EAAES;AADkD,iBAA7C,CAXjB;;AAAA;AAWGR,gBAAAA,KAXH;;AAAA;AAAA,iDAgBS;AACNA,kBAAAA,KAAK,EAALA;AADM,iBAhBT;;AAAA;AAAA;AAAA;AAAA,iDAoBS;AACNY,kBAAAA,MAAM,EAAE;AADF,iBApBT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EANuCC,2B","sourcesContent":["import { buildSchema, SchemaValues } from '@sprucelabs/schema'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { GeneratedFile } from '../../../types/cli.types'\nimport AbstractAction from '../../AbstractAction'\nimport StoreTemplateItemBuilder from '../templateItemBuilders/StoreTemplateItemBuilder'\n\nconst optionsSchema = buildSchema({\n\tid: 'syncDataStoreOptions',\n\tdescription:\n\t\t\"Only needed if you change a store's name, manually add or remove one.\",\n\tfields: {},\n})\n\ntype OptionsSchema = typeof optionsSchema\ntype Options = SchemaValues<OptionsSchema>\n\nexport default class SyncAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema = optionsSchema\n\tpublic commandAliases = ['sync.stores']\n\tpublic invocationMessage =\n\t\t'Generating store types and setting up store factory... 💿'\n\n\tpublic async execute(_options: Options) {\n\t\ttry {\n\t\t\tconst stores = await this.Store('store').fetchStores()\n\n\t\t\tlet files: GeneratedFile[] = []\n\n\t\t\tif (stores.length > 0) {\n\t\t\t\tconst destination = diskUtil.resolveHashSprucePath(this.cwd, 'stores')\n\t\t\t\tconst builder = new StoreTemplateItemBuilder()\n\t\t\t\tconst templateItems = builder.buildTemplateItems(stores, destination)\n\n\t\t\t\tfiles = await this.Writer('store').writeTypes(destination, {\n\t\t\t\t\tstores: templateItems,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tfiles,\n\t\t\t}\n\t\t} catch (err) {\n\t\t\treturn {\n\t\t\t\terrors: [err],\n\t\t\t}\n\t\t}\n\t}\n}\n"],"file":"SyncAction.js"}
1
+ {"version":3,"sources":["../../../../src/features/store/actions/SyncAction.ts"],"names":["optionsSchema","id","description","fields","SyncAction","_options","Store","fetchStores","stores","files","length","destination","diskUtil","resolveHashSprucePath","cwd","builder","StoreTemplateItemBuilder","templateItems","buildTemplateItems","writer","Writer","writeTypesAndMap","errors","AbstractAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,aAAa,GAAG,yBAAY;AACjCC,EAAAA,EAAE,EAAE,sBAD6B;AAEjCC,EAAAA,WAAW,EACV,uEAHgC;AAIjCC,EAAAA,MAAM,EAAE;AAJyB,CAAZ,CAAtB;;IAUqBC,U;;;;;;;;;;;;;;;sGACGJ,a;uGACC,CAAC,aAAD,C;0GAEvB,2D;;;;;;;mGAED,iBAAqBK,QAArB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAEuB,KAAKC,KAAL,CAAW,OAAX,EAAoBC,WAApB,EAFvB;;AAAA;AAEQC,gBAAAA,MAFR;AAIMC,gBAAAA,KAJN,GAI+B,EAJ/B;;AAAA,sBAMMD,MAAM,CAACE,MAAP,GAAgB,CANtB;AAAA;AAAA;AAAA;;AAOSC,gBAAAA,WAPT,GAOuBC,2BAASC,qBAAT,CAA+B,KAAKC,GAApC,EAAyC,QAAzC,CAPvB;AAQSC,gBAAAA,OART,GAQmB,IAAIC,oCAAJ,EARnB;AASSC,gBAAAA,aATT,GASyBF,OAAO,CAACG,kBAAR,CAA2BV,MAA3B,EAAmCG,WAAnC,CATzB;AAWSQ,gBAAAA,MAXT,GAWkB,KAAKC,MAAL,CAAY,OAAZ,CAXlB;AAAA;AAAA,uBAYiBD,MAAM,CAACE,gBAAP,CAAwBV,WAAxB,EAAqC;AAClDH,kBAAAA,MAAM,EAAES;AAD0C,iBAArC,CAZjB;;AAAA;AAYGR,gBAAAA,KAZH;;AAAA;AAAA,iDAiBS;AACNA,kBAAAA,KAAK,EAALA;AADM,iBAjBT;;AAAA;AAAA;AAAA;AAAA,iDAqBS;AACNa,kBAAAA,MAAM,EAAE;AADF,iBArBT;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EANuCC,2B","sourcesContent":["import { buildSchema, SchemaValues } from '@sprucelabs/schema'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { GeneratedFile } from '../../../types/cli.types'\nimport AbstractAction from '../../AbstractAction'\nimport StoreTemplateItemBuilder from '../templateItemBuilders/StoreTemplateItemBuilder'\n\nconst optionsSchema = buildSchema({\n\tid: 'syncDataStoreOptions',\n\tdescription:\n\t\t\"Only needed if you change a store's name, manually add or remove one.\",\n\tfields: {},\n})\n\ntype OptionsSchema = typeof optionsSchema\ntype Options = SchemaValues<OptionsSchema>\n\nexport default class SyncAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema = optionsSchema\n\tpublic commandAliases = ['sync.stores']\n\tpublic invocationMessage =\n\t\t'Generating store types and setting up store factory... 💿'\n\n\tpublic async execute(_options: Options) {\n\t\ttry {\n\t\t\tconst stores = await this.Store('store').fetchStores()\n\n\t\t\tlet files: GeneratedFile[] = []\n\n\t\t\tif (stores.length > 0) {\n\t\t\t\tconst destination = diskUtil.resolveHashSprucePath(this.cwd, 'stores')\n\t\t\t\tconst builder = new StoreTemplateItemBuilder()\n\t\t\t\tconst templateItems = builder.buildTemplateItems(stores, destination)\n\n\t\t\t\tconst writer = this.Writer('store')\n\t\t\t\tfiles = await writer.writeTypesAndMap(destination, {\n\t\t\t\t\tstores: templateItems,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tfiles,\n\t\t\t}\n\t\t} catch (err) {\n\t\t\treturn {\n\t\t\t\terrors: [err],\n\t\t\t}\n\t\t}\n\t}\n}\n"],"file":"SyncAction.js"}
@@ -3,7 +3,13 @@ import AbstractWriter from '../../../writers/AbstractWriter';
3
3
  export default class StoreWriter extends AbstractWriter {
4
4
  writeStore(destination: string, options: StoreTemplateOptions): Promise<import("@sprucelabs/mercury-types").SpruceSchemas.SpruceCli.v2020_07_22.GeneratedFile[]>;
5
5
  writePlugin(cwd: string): Promise<import("../../../writers/AbstractWriter").WriteResults>;
6
+ writeTypesAndMap(destination: string, options: {
7
+ stores: StoreTemplateItem[];
8
+ }): Promise<import("@sprucelabs/mercury-types").SpruceSchemas.SpruceCli.v2020_07_22.GeneratedFile[]>;
6
9
  writeTypes(destination: string, options: {
7
10
  stores: StoreTemplateItem[];
8
11
  }): Promise<import("../../../writers/AbstractWriter").WriteResults>;
12
+ writeMap(destination: string, options: {
13
+ stores: StoreTemplateItem[];
14
+ }): Promise<import("../../../writers/AbstractWriter").WriteResults>;
9
15
  }
@@ -9,6 +9,10 @@ exports["default"] = void 0;
9
9
 
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
11
 
12
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
+
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
+
12
16
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
17
 
14
18
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -104,37 +108,103 @@ var StoreWriter = /*#__PURE__*/function (_AbstractWriter) {
104
108
  return results;
105
109
  }
106
110
  }, {
107
- key: "writeTypes",
111
+ key: "writeTypesAndMap",
108
112
  value: function () {
109
- var _writeTypes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(destination, options) {
110
- var file, typesContent, files;
113
+ var _writeTypesAndMap = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(destination, options) {
114
+ var _yield$Promise$all, _yield$Promise$all2, types, map;
115
+
111
116
  return _regenerator["default"].wrap(function _callee2$(_context2) {
112
117
  while (1) {
113
118
  switch (_context2.prev = _context2.next) {
119
+ case 0:
120
+ _context2.next = 2;
121
+ return Promise.all([this.writeTypes(destination, options), this.writeMap(destination, options)]);
122
+
123
+ case 2:
124
+ _yield$Promise$all = _context2.sent;
125
+ _yield$Promise$all2 = (0, _slicedToArray2["default"])(_yield$Promise$all, 2);
126
+ types = _yield$Promise$all2[0];
127
+ map = _yield$Promise$all2[1];
128
+ return _context2.abrupt("return", [].concat((0, _toConsumableArray2["default"])(types), (0, _toConsumableArray2["default"])(map)));
129
+
130
+ case 7:
131
+ case "end":
132
+ return _context2.stop();
133
+ }
134
+ }
135
+ }, _callee2, this);
136
+ }));
137
+
138
+ function writeTypesAndMap(_x3, _x4) {
139
+ return _writeTypesAndMap.apply(this, arguments);
140
+ }
141
+
142
+ return writeTypesAndMap;
143
+ }()
144
+ }, {
145
+ key: "writeTypes",
146
+ value: function () {
147
+ var _writeTypes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(destination, options) {
148
+ var file, typesContent, files;
149
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
150
+ while (1) {
151
+ switch (_context3.prev = _context3.next) {
114
152
  case 0:
115
153
  file = _spruceSkillUtils.diskUtil.resolvePath(destination, 'stores.types.ts');
116
154
  typesContent = this.templates.storeTypes(options);
117
155
  files = this.writeFileIfChangedMixinResults(file, typesContent, 'The type merging for so the StoreFactory properly types you stores.');
118
- _context2.next = 5;
156
+ _context3.next = 5;
119
157
  return this.lint(file);
120
158
 
121
159
  case 5:
122
- return _context2.abrupt("return", files);
160
+ return _context3.abrupt("return", files);
123
161
 
124
162
  case 6:
125
163
  case "end":
126
- return _context2.stop();
164
+ return _context3.stop();
127
165
  }
128
166
  }
129
- }, _callee2, this);
167
+ }, _callee3, this);
130
168
  }));
131
169
 
132
- function writeTypes(_x3, _x4) {
170
+ function writeTypes(_x5, _x6) {
133
171
  return _writeTypes.apply(this, arguments);
134
172
  }
135
173
 
136
174
  return writeTypes;
137
175
  }()
176
+ }, {
177
+ key: "writeMap",
178
+ value: function () {
179
+ var _writeMap = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(destination, options) {
180
+ var file, mapContent, files;
181
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
182
+ while (1) {
183
+ switch (_context4.prev = _context4.next) {
184
+ case 0:
185
+ file = _spruceSkillUtils.diskUtil.resolvePath(destination, 'stores.ts');
186
+ mapContent = this.templates.stores(options);
187
+ files = this.writeFileIfChangedMixinResults(file, mapContent, 'A reference to all your data stores for easy inclusion.');
188
+ _context4.next = 5;
189
+ return this.lint(file);
190
+
191
+ case 5:
192
+ return _context4.abrupt("return", files);
193
+
194
+ case 6:
195
+ case "end":
196
+ return _context4.stop();
197
+ }
198
+ }
199
+ }, _callee4, this);
200
+ }));
201
+
202
+ function writeMap(_x7, _x8) {
203
+ return _writeMap.apply(this, arguments);
204
+ }
205
+
206
+ return writeMap;
207
+ }()
138
208
  }]);
139
209
  return StoreWriter;
140
210
  }(_AbstractWriter2["default"]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/features/store/writers/StoreWriter.ts"],"names":["StoreWriter","destination","options","namePascalPlural","files","filename","fileDest","diskUtil","resolvePath","doesFileExist","SpruceError","code","contents","templates","store","writeFile","lint","push","action","name","path","cwd","resolveHashSprucePath","pluginContents","storePlugin","results","writeFileIfChangedMixinResults","file","typesContent","storeTypes","AbstractWriter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAKA;;AAEA;;;;;;IAEqBA,W;;;;;;;;;;;;;sGACpB,iBAAwBC,WAAxB,EAA6CC,OAA7C;AAAA;AAAA;AAAA;AAAA;AAAA;AACSC,gBAAAA,gBADT,GAC8BD,OAD9B,CACSC,gBADT;AAGOC,gBAAAA,KAHP,GAGgC,EAHhC;AAKOC,gBAAAA,QALP,aAKqBF,gBALrB;AAOOG,gBAAAA,QAPP,GAOkBC,2BAASC,WAAT,CAChBP,WADgB,EAEhB,KAFgB,EAGhB,QAHgB,EAIhBI,QAJgB,CAPlB;;AAAA,qBAcKE,2BAASE,aAAT,CAAuBH,QAAvB,CAdL;AAAA;AAAA;AAAA;;AAAA,sBAeQ,IAAII,uBAAJ,CAAgB;AAAEC,kBAAAA,IAAI,EAAE;AAAR,iBAAhB,CAfR;;AAAA;AAkBOC,gBAAAA,QAlBP,GAkBkB,KAAKC,SAAL,CAAeC,KAAf,CAAqBZ,OAArB,CAlBlB;;AAoBCK,2CAASQ,SAAT,CAAmBT,QAAnB,EAA6BM,QAA7B;;AApBD;AAAA,uBAsBO,KAAKI,IAAL,CAAUV,QAAV,CAtBP;;AAAA;AAwBCF,gBAAAA,KAAK,CAACa,IAAN,CAAW;AACVC,kBAAAA,MAAM,EAAE,WADE;AAEVC,kBAAAA,IAAI,EAAEd,QAFI;AAGVe,kBAAAA,IAAI,EAAEd;AAHI,iBAAX;AAxBD,iDA8BQF,KA9BR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAiCA,qBAAmBiB,GAAnB,EAAgC;AAC/B,UAAMpB,WAAW,GAAGM,2BAASe,qBAAT,CACnBD,GADmB,EAEnB,UAFmB,EAGnB,iBAHmB,CAApB;;AAMA,UAAME,cAAc,GAAG,KAAKV,SAAL,CAAeW,WAAf,EAAvB;AAEA,UAAMC,OAAO,GAAG,KAAKC,8BAAL,CACfzB,WADe,EAEfsB,cAFe,EAGf,mFAHe,CAAhB;AAMA,aAAOE,OAAP;AACA;;;;sGAED,kBACCxB,WADD,EAECC,OAFD;AAAA;AAAA;AAAA;AAAA;AAAA;AAIOyB,gBAAAA,IAJP,GAIcpB,2BAASC,WAAT,CAAqBP,WAArB,EAAkC,iBAAlC,CAJd;AAMO2B,gBAAAA,YANP,GAMsB,KAAKf,SAAL,CAAegB,UAAf,CAA0B3B,OAA1B,CANtB;AAQOE,gBAAAA,KARP,GAQe,KAAKsB,8BAAL,CACbC,IADa,EAEbC,YAFa,EAGb,qEAHa,CARf;AAAA;AAAA,uBAcO,KAAKZ,IAAL,CAAUW,IAAV,CAdP;;AAAA;AAAA,kDAgBQvB,KAhBR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EApDwC0B,2B","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport {\n\tStoreTemplateItem,\n\tStoreTemplateOptions,\n} from '@sprucelabs/spruce-templates'\nimport SpruceError from '../../../errors/SpruceError'\nimport { GeneratedFile } from '../../../types/cli.types'\nimport AbstractWriter from '../../../writers/AbstractWriter'\n\nexport default class StoreWriter extends AbstractWriter {\n\tpublic async writeStore(destination: string, options: StoreTemplateOptions) {\n\t\tconst { namePascalPlural } = options\n\n\t\tconst files: GeneratedFile[] = []\n\n\t\tconst filename = `${namePascalPlural}.store.ts`\n\n\t\tconst fileDest = diskUtil.resolvePath(\n\t\t\tdestination,\n\t\t\t'src',\n\t\t\t'stores',\n\t\t\tfilename\n\t\t)\n\n\t\tif (diskUtil.doesFileExist(fileDest)) {\n\t\t\tthrow new SpruceError({ code: 'STORE_EXISTS' })\n\t\t}\n\n\t\tconst contents = this.templates.store(options)\n\n\t\tdiskUtil.writeFile(fileDest, contents)\n\n\t\tawait this.lint(fileDest)\n\n\t\tfiles.push({\n\t\t\taction: 'generated',\n\t\t\tname: filename,\n\t\t\tpath: fileDest,\n\t\t})\n\n\t\treturn files\n\t}\n\n\tpublic writePlugin(cwd: string) {\n\t\tconst destination = diskUtil.resolveHashSprucePath(\n\t\t\tcwd,\n\t\t\t'features',\n\t\t\t'store.plugin.ts'\n\t\t)\n\n\t\tconst pluginContents = this.templates.storePlugin()\n\n\t\tconst results = this.writeFileIfChangedMixinResults(\n\t\t\tdestination,\n\t\t\tpluginContents,\n\t\t\t'Loads all your data stores and connects you to any databases you have configured.'\n\t\t)\n\n\t\treturn results\n\t}\n\n\tpublic async writeTypes(\n\t\tdestination: string,\n\t\toptions: { stores: StoreTemplateItem[] }\n\t) {\n\t\tconst file = diskUtil.resolvePath(destination, 'stores.types.ts')\n\n\t\tconst typesContent = this.templates.storeTypes(options)\n\n\t\tconst files = this.writeFileIfChangedMixinResults(\n\t\t\tfile,\n\t\t\ttypesContent,\n\t\t\t'The type merging for so the StoreFactory properly types you stores.'\n\t\t)\n\n\t\tawait this.lint(file)\n\n\t\treturn files\n\t}\n}\n"],"file":"StoreWriter.js"}
1
+ {"version":3,"sources":["../../../../src/features/store/writers/StoreWriter.ts"],"names":["StoreWriter","destination","options","namePascalPlural","files","filename","fileDest","diskUtil","resolvePath","doesFileExist","SpruceError","code","contents","templates","store","writeFile","lint","push","action","name","path","cwd","resolveHashSprucePath","pluginContents","storePlugin","results","writeFileIfChangedMixinResults","Promise","all","writeTypes","writeMap","types","map","file","typesContent","storeTypes","mapContent","stores","AbstractWriter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAKA;;AAEA;;;;;;IAEqBA,W;;;;;;;;;;;;;sGACpB,iBAAwBC,WAAxB,EAA6CC,OAA7C;AAAA;AAAA;AAAA;AAAA;AAAA;AACSC,gBAAAA,gBADT,GAC8BD,OAD9B,CACSC,gBADT;AAGOC,gBAAAA,KAHP,GAGgC,EAHhC;AAKOC,gBAAAA,QALP,aAKqBF,gBALrB;AAOOG,gBAAAA,QAPP,GAOkBC,2BAASC,WAAT,CAChBP,WADgB,EAEhB,KAFgB,EAGhB,QAHgB,EAIhBI,QAJgB,CAPlB;;AAAA,qBAcKE,2BAASE,aAAT,CAAuBH,QAAvB,CAdL;AAAA;AAAA;AAAA;;AAAA,sBAeQ,IAAII,uBAAJ,CAAgB;AAAEC,kBAAAA,IAAI,EAAE;AAAR,iBAAhB,CAfR;;AAAA;AAkBOC,gBAAAA,QAlBP,GAkBkB,KAAKC,SAAL,CAAeC,KAAf,CAAqBZ,OAArB,CAlBlB;;AAoBCK,2CAASQ,SAAT,CAAmBT,QAAnB,EAA6BM,QAA7B;;AApBD;AAAA,uBAsBO,KAAKI,IAAL,CAAUV,QAAV,CAtBP;;AAAA;AAwBCF,gBAAAA,KAAK,CAACa,IAAN,CAAW;AACVC,kBAAAA,MAAM,EAAE,WADE;AAEVC,kBAAAA,IAAI,EAAEd,QAFI;AAGVe,kBAAAA,IAAI,EAAEd;AAHI,iBAAX;AAxBD,iDA8BQF,KA9BR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAiCA,qBAAmBiB,GAAnB,EAAgC;AAC/B,UAAMpB,WAAW,GAAGM,2BAASe,qBAAT,CACnBD,GADmB,EAEnB,UAFmB,EAGnB,iBAHmB,CAApB;;AAMA,UAAME,cAAc,GAAG,KAAKV,SAAL,CAAeW,WAAf,EAAvB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bO,IADa,EAEbG,UAFa,EAGb,yDAHa,CAPf;AAAA;AAAA,uBAaO,KAAKpB,IAAL,CAAUiB,IAAV,CAbP;;AAAA;AAAA,kDAeQ7B,KAfR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAnFwCkC,2B","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport {\n\tStoreTemplateItem,\n\tStoreTemplateOptions,\n} from '@sprucelabs/spruce-templates'\nimport SpruceError from '../../../errors/SpruceError'\nimport { GeneratedFile } from '../../../types/cli.types'\nimport AbstractWriter from '../../../writers/AbstractWriter'\n\nexport default class StoreWriter extends AbstractWriter {\n\tpublic async writeStore(destination: string, options: StoreTemplateOptions) {\n\t\tconst { namePascalPlural } = options\n\n\t\tconst files: GeneratedFile[] = []\n\n\t\tconst filename = `${namePascalPlural}.store.ts`\n\n\t\tconst fileDest = diskUtil.resolvePath(\n\t\t\tdestination,\n\t\t\t'src',\n\t\t\t'stores',\n\t\t\tfilename\n\t\t)\n\n\t\tif (diskUtil.doesFileExist(fileDest)) {\n\t\t\tthrow new SpruceError({ code: 'STORE_EXISTS' })\n\t\t}\n\n\t\tconst contents = this.templates.store(options)\n\n\t\tdiskUtil.writeFile(fileDest, contents)\n\n\t\tawait this.lint(fileDest)\n\n\t\tfiles.push({\n\t\t\taction: 'generated',\n\t\t\tname: filename,\n\t\t\tpath: fileDest,\n\t\t})\n\n\t\treturn files\n\t}\n\n\tpublic writePlugin(cwd: string) {\n\t\tconst destination = diskUtil.resolveHashSprucePath(\n\t\t\tcwd,\n\t\t\t'features',\n\t\t\t'store.plugin.ts'\n\t\t)\n\n\t\tconst pluginContents = this.templates.storePlugin()\n\n\t\tconst results = this.writeFileIfChangedMixinResults(\n\t\t\tdestination,\n\t\t\tpluginContents,\n\t\t\t'Loads all your data stores and connects you to any databases you have configured.'\n\t\t)\n\n\t\treturn results\n\t}\n\n\tpublic async writeTypesAndMap(\n\t\tdestination: string,\n\t\toptions: { stores: StoreTemplateItem[] }\n\t) {\n\t\tconst [types, map] = await Promise.all([\n\t\t\tthis.writeTypes(destination, options),\n\t\t\tthis.writeMap(destination, options),\n\t\t])\n\n\t\treturn [...types, ...map]\n\t}\n\n\tpublic async writeTypes(\n\t\tdestination: string,\n\t\toptions: { stores: StoreTemplateItem[] }\n\t) {\n\t\tconst file = diskUtil.resolvePath(destination, 'stores.types.ts')\n\n\t\tconst typesContent = this.templates.storeTypes(options)\n\n\t\tconst files = this.writeFileIfChangedMixinResults(\n\t\t\tfile,\n\t\t\ttypesContent,\n\t\t\t'The type merging for so the StoreFactory properly types you stores.'\n\t\t)\n\n\t\tawait this.lint(file)\n\n\t\treturn files\n\t}\n\n\tpublic async writeMap(\n\t\tdestination: string,\n\t\toptions: { stores: StoreTemplateItem[] }\n\t) {\n\t\tconst file = diskUtil.resolvePath(destination, 'stores.ts')\n\t\tconst mapContent = this.templates.stores(options)\n\n\t\tconst files = this.writeFileIfChangedMixinResults(\n\t\t\tfile,\n\t\t\tmapContent,\n\t\t\t'A reference to all your data stores for easy inclusion.'\n\t\t)\n\n\t\tawait this.lint(file)\n\n\t\treturn files\n\t}\n}\n"],"file":"StoreWriter.js"}
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  ]
19
19
  },
20
20
  "license": "MIT",
21
- "version": "14.28.3",
21
+ "version": "14.28.7",
22
22
  "bin": {
23
23
  "spruce": "./build/index.js"
24
24
  },
@@ -76,25 +76,25 @@
76
76
  "@babel/plugin-proposal-decorators": "^7.16.4",
77
77
  "@babel/runtime": "^7.16.3",
78
78
  "@jest/reporters": "^27.4.2",
79
- "@sprucelabs/error": "^5.0.310",
80
- "@sprucelabs/heartwood-view-controllers": "^51.6.12",
81
- "@sprucelabs/jest-json-reporter": "^6.0.260",
82
- "@sprucelabs/mercury-client": "^17.4.7",
83
- "@sprucelabs/mercury-event-emitter": "^17.4.7",
84
- "@sprucelabs/mercury-types": "^26.1.964",
85
- "@sprucelabs/schema": "^25.4.53",
86
- "@sprucelabs/spruce-core-schemas": "^22.6.228",
87
- "@sprucelabs/spruce-event-plugin": "^17.0.0",
88
- "@sprucelabs/spruce-event-utils": "^17.1.240",
89
- "@sprucelabs/spruce-skill-booter": "^17.0.0",
90
- "@sprucelabs/spruce-skill-utils": "^22.1.34",
91
- "@sprucelabs/spruce-templates": "^14.28.3",
79
+ "@sprucelabs/error": "^5.0.317",
80
+ "@sprucelabs/heartwood-view-controllers": "^51.6.51",
81
+ "@sprucelabs/jest-json-reporter": "^6.0.265",
82
+ "@sprucelabs/mercury-client": "^17.4.29",
83
+ "@sprucelabs/mercury-event-emitter": "^17.4.29",
84
+ "@sprucelabs/mercury-types": "^26.1.992",
85
+ "@sprucelabs/schema": "^25.4.67",
86
+ "@sprucelabs/spruce-core-schemas": "^22.6.250",
87
+ "@sprucelabs/spruce-event-plugin": "^17.0.4",
88
+ "@sprucelabs/spruce-event-utils": "^17.1.272",
89
+ "@sprucelabs/spruce-skill-booter": "^17.0.4",
90
+ "@sprucelabs/spruce-skill-utils": "^22.1.50",
91
+ "@sprucelabs/spruce-templates": "^14.28.7",
92
92
  "cfonts": "^2.10.0",
93
93
  "chalk": "^4.1.2",
94
94
  "chokidar": "^3.5.2",
95
95
  "cli-table3": "^0.6.0",
96
96
  "commander": "^7.2.0",
97
- "core-js": "^3.19.2",
97
+ "core-js": "^3.19.3",
98
98
  "emphasize": "^4.2.0",
99
99
  "fs-extra": "^10.0.0",
100
100
  "gifwrap": "SimenB/gifwrap#patch-1",
@@ -117,18 +117,18 @@
117
117
  "uuid": "^8.3.2"
118
118
  },
119
119
  "devDependencies": {
120
- "@sprucelabs/data-stores": "^7.1.42",
121
- "@sprucelabs/jest-sheets-reporter": "^1.2.265",
122
- "@sprucelabs/mercury-core-events": "^1.6.179",
123
- "@sprucelabs/resolve-path-aliases": "^1.0.234",
124
- "@sprucelabs/spruce-conversation-plugin": "^17.0.0",
125
- "@sprucelabs/spruce-deploy-plugin": "^17.0.0",
126
- "@sprucelabs/spruce-store-plugin": "^17.0.0",
127
- "@sprucelabs/spruce-test-fixtures": "^17.0.0",
128
- "@sprucelabs/test": "^7.7.243",
129
- "@sprucelabs/test-utils": "^3.0.293",
120
+ "@sprucelabs/data-stores": "^7.2.0",
121
+ "@sprucelabs/jest-sheets-reporter": "^1.2.268",
122
+ "@sprucelabs/mercury-core-events": "^1.6.215",
123
+ "@sprucelabs/resolve-path-aliases": "^1.0.236",
124
+ "@sprucelabs/spruce-conversation-plugin": "^17.0.4",
125
+ "@sprucelabs/spruce-deploy-plugin": "^17.0.4",
126
+ "@sprucelabs/spruce-store-plugin": "^17.0.4",
127
+ "@sprucelabs/spruce-test-fixtures": "^17.0.4",
128
+ "@sprucelabs/test": "^7.7.248",
129
+ "@sprucelabs/test-utils": "^3.0.301",
130
130
  "@types/blessed": "^0.1.19",
131
- "@types/eslint": "^8.2.0",
131
+ "@types/eslint": "^8.2.1",
132
132
  "@types/fs-extra": "^9.0.13",
133
133
  "@types/inflection": "^1.13.0",
134
134
  "@types/inquirer": "^8.1.3",
@@ -142,7 +142,7 @@
142
142
  "@types/rimraf": "^3.0.2",
143
143
  "@types/semver": "^7.3.9",
144
144
  "@types/sha1": "^1.1.3",
145
- "@types/slug": "^5.0.2",
145
+ "@types/slug": "^5.0.3",
146
146
  "@types/superagent": "^4.1.13",
147
147
  "@types/terminal-kit": "^1.28.4",
148
148
  "@types/uuid": "^8.3.3",
@@ -150,17 +150,17 @@
150
150
  "concurrently": "^6.4.0",
151
151
  "conventional-changelog-sprucelabs": "^1.1.2",
152
152
  "dotenv": "^10.0.0",
153
- "eslint": "^8.3.0",
153
+ "eslint": "^8.4.0",
154
154
  "eslint-config-spruce": "^10.10.16",
155
155
  "find-process": "^1.4.7",
156
156
  "jest": "^27.4.3",
157
157
  "jest-circus": "^27.4.2",
158
158
  "jest-junit": "^13.0.0",
159
159
  "jest-reporters": "^0.0.2",
160
- "prettier": "^2.5.0",
160
+ "prettier": "^2.5.1",
161
161
  "ps-node": "^0.1.6",
162
162
  "rimraf": "^3.0.2",
163
- "ts-jest": "^27.0.7",
163
+ "ts-jest": "^27.1.0",
164
164
  "ts-node": "^10.4.0",
165
165
  "tsc-watch": "^4.5.0",
166
166
  "tsconfig-paths": "^3.12.0",
@@ -595,5 +595,5 @@
595
595
  "ora"
596
596
  ]
597
597
  },
598
- "gitHead": "577201f4219eae0b53cce07dc9401d28adcf2497"
598
+ "gitHead": "7e3efcf5136eb41be381f196473cd3526c59ca9d"
599
599
  }
@@ -7,7 +7,23 @@ export default class BootingWithBadFilesTest extends AbstractCliTest {
7
7
  @test()
8
8
  protected static async bootingWithAEmptySchemaThrowsErrorWithNameOfBadSchema() {
9
9
  await this.FeatureFixture().installCachedFeatures('schemas')
10
+ const bootResults = await this.breakSchemaAndBoot()
11
+ assert.isTruthy(bootResults.errors)
12
+ assert.doesInclude(bootResults.errors[0].message, 'location.schema.ts')
13
+ }
14
+
15
+ @test()
16
+ protected static async disablesSchemaCheckingWithFlag() {
17
+ await this.FeatureFixture().installCachedFeatures('schemas')
18
+ diskUtil.writeFile(
19
+ this.resolvePath('.env'),
20
+ 'SHOULD_VALIDATE_SCHEMAS_ON_BOOT=false'
21
+ )
22
+ const bootResults = await this.breakSchemaAndBoot()
23
+ assert.isFalsy(bootResults.errors)
24
+ }
10
25
 
26
+ private static async breakSchemaAndBoot() {
11
27
  const results = await this.Action('schema', 'sync').execute({})
12
28
 
13
29
  const match = testUtil.assertFileByNameInGeneratedFiles(
@@ -20,8 +36,7 @@ export default class BootingWithBadFilesTest extends AbstractCliTest {
20
36
  const bootResults = await this.Action('skill', 'boot').execute({
21
37
  local: true,
22
38
  })
23
- assert.isTruthy(bootResults.errors)
24
39
 
25
- assert.doesInclude(bootResults.errors[0].message, 'location.schema.ts')
40
+ return bootResults
26
41
  }
27
42
  }
@@ -79,7 +79,7 @@ export default class KeepingEventsInSyncTest extends AbstractEventTest {
79
79
 
80
80
  await this.Service('build').build()
81
81
 
82
- const health = await cli.checkHealth({ isRunningLocally: false })
82
+ const health = await cli.checkHealth({ shouldRunOnSourceFiles: false })
83
83
 
84
84
  assert.isTruthy(health.skill)
85
85
  assert.isFalsy(health.skill.errors)
@@ -84,7 +84,7 @@ export default class UpgradingASkill2Test extends AbstractCliTest {
84
84
  }
85
85
 
86
86
  @test()
87
- protected static async callsCleanFixLintAndBuildDev() {
87
+ protected static async callsCleanFixAndBuildDev() {
88
88
  await this.FeatureFixture().installCachedFeatures('skills')
89
89
 
90
90
  let wasCleanBuildCalled = false
@@ -92,7 +92,6 @@ export default class UpgradingASkill2Test extends AbstractCliTest {
92
92
  return {}
93
93
  }
94
94
 
95
- let wasFixLintCalled = false
96
95
  CommandService.setMockResponse('yarn clean.build', {
97
96
  code: 0,
98
97
  callback: () => {
@@ -100,13 +99,6 @@ export default class UpgradingASkill2Test extends AbstractCliTest {
100
99
  },
101
100
  })
102
101
 
103
- CommandService.setMockResponse('yarn fix.lint', {
104
- code: 0,
105
- callback: () => {
106
- wasFixLintCalled = true
107
- },
108
- })
109
-
110
102
  let wasBuildDevCalled = false
111
103
 
112
104
  CommandService.setMockResponse('yarn build.dev', {
@@ -121,7 +113,6 @@ export default class UpgradingASkill2Test extends AbstractCliTest {
121
113
  assert.isFalsy(results.errors)
122
114
  assert.isTrue(wasCleanBuildCalled)
123
115
  assert.isTrue(wasBuildDevCalled)
124
- assert.isTrue(wasFixLintCalled)
125
116
  }
126
117
 
127
118
  @test()
@@ -2,9 +2,9 @@ import { diskUtil } from '@sprucelabs/spruce-skill-utils'
2
2
  import { test, assert } from '@sprucelabs/test'
3
3
  import { errorAssertUtil } from '@sprucelabs/test-utils'
4
4
  import '@sprucelabs/spruce-store-plugin'
5
- import CommandService from '../../services/CommandService'
6
- import AbstractSkillTest from '../../tests/AbstractSkillTest'
7
- import testUtil from '../../tests/utilities/test.utility'
5
+ import CommandService from '../../../services/CommandService'
6
+ import AbstractSkillTest from '../../../tests/AbstractSkillTest'
7
+ import testUtil from '../../../tests/utilities/test.utility'
8
8
 
9
9
  export default class CreatingDataStoresTest extends AbstractSkillTest {
10
10
  protected static skillCacheKey = 'stores'
@@ -16,7 +16,7 @@ export default class CreatingDataStoresTest extends AbstractSkillTest {
16
16
 
17
17
  @test()
18
18
  protected static async getsNoStoresBackFromHealthCheck() {
19
- const health = await this.cli.checkHealth({ isRunningLocally: true })
19
+ const health = await this.cli.checkHealth({ shouldRunOnSourceFiles: true })
20
20
 
21
21
  assert.isFalsy(health.skill.errors)
22
22
  assert.isTruthy(health.store)
@@ -43,9 +43,15 @@ export default class CreatingDataStoresTest extends AbstractSkillTest {
43
43
  await this.Service('typeChecker').check(path)
44
44
  }
45
45
 
46
+ @test()
47
+ protected static async generatesAMapFile() {
48
+ const file = this.resolveHashSprucePath('stores', 'stores.ts')
49
+ assert.isTrue(diskUtil.doesFileExist(file))
50
+ }
51
+
46
52
  @test()
47
53
  protected static async getsOneStoresBackFromHealthCheck() {
48
- const health = await this.cli.checkHealth({ isRunningLocally: true })
54
+ const health = await this.cli.checkHealth({ shouldRunOnSourceFiles: true })
49
55
  assert.isTruthy(health.store)
50
56
  assert.isFalsy(health.store.errors)
51
57
  assert.isLength(health.store.stores, 1)
@@ -72,7 +78,7 @@ export default class CreatingDataStoresTest extends AbstractSkillTest {
72
78
 
73
79
  @test()
74
80
  protected static async getsSecondStoresBackFromHealthCheck() {
75
- const health = await this.cli.checkHealth({ isRunningLocally: true })
81
+ const health = await this.cli.checkHealth({ shouldRunOnSourceFiles: true })
76
82
 
77
83
  assert.isTruthy(health.store)
78
84
  assert.isFalsy(health.store.errors)
@@ -1,8 +1,8 @@
1
1
  import { diskUtil } from '@sprucelabs/spruce-skill-utils'
2
2
  import { test, assert } from '@sprucelabs/test'
3
3
  import { errorAssertUtil } from '@sprucelabs/test-utils'
4
- import AbstractSkillTest from '../../tests/AbstractSkillTest'
5
- import testUtil from '../../tests/utilities/test.utility'
4
+ import AbstractSkillTest from '../../../tests/AbstractSkillTest'
5
+ import testUtil from '../../../tests/utilities/test.utility'
6
6
 
7
7
  export default class KeepingDataStoresInSyncTest extends AbstractSkillTest {
8
8
  protected static skillCacheKey = 'stores'
package/src/cli.ts CHANGED
@@ -45,7 +45,7 @@ import { argParserUtil } from './utilities/argParser.utility'
45
45
  import WriterFactory from './writers/WriterFactory'
46
46
 
47
47
  interface HealthOptions {
48
- isRunningLocally?: boolean
48
+ shouldRunOnSourceFiles?: boolean
49
49
  }
50
50
 
51
51
  export interface CliInterface extends MercuryEventEmitter<GlobalEventContract> {
@@ -153,7 +153,7 @@ export default class Cli implements CliInterface {
153
153
  try {
154
154
  const commandService = this.serviceFactory.Service(this.cwd, 'command')
155
155
  const command =
156
- options?.isRunningLocally === false
156
+ options?.shouldRunOnSourceFiles === false
157
157
  ? 'yarn health'
158
158
  : 'yarn health.local'
159
159
  const results = await commandService.execute(command)
@@ -64,9 +64,6 @@ export default class NodeFeature<
64
64
  this.ui.startLoading('Cleaning build...')
65
65
  await this.Service('command').execute('yarn clean.build')
66
66
 
67
- this.ui.startLoading('Applying lint rules to all files...')
68
- await this.Service('command').execute('yarn fix.lint')
69
-
70
67
  this.ui.startLoading('Rebuilding...')
71
68
  await this.Service('command').execute('yarn build.dev')
72
69
 
@@ -31,7 +31,8 @@ export default class SyncAction extends AbstractAction<OptionsSchema> {
31
31
  const builder = new StoreTemplateItemBuilder()
32
32
  const templateItems = builder.buildTemplateItems(stores, destination)
33
33
 
34
- files = await this.Writer('store').writeTypes(destination, {
34
+ const writer = this.Writer('store')
35
+ files = await writer.writeTypesAndMap(destination, {
35
36
  stores: templateItems,
36
37
  })
37
38
  }
@@ -59,6 +59,18 @@ export default class StoreWriter extends AbstractWriter {
59
59
  return results
60
60
  }
61
61
 
62
+ public async writeTypesAndMap(
63
+ destination: string,
64
+ options: { stores: StoreTemplateItem[] }
65
+ ) {
66
+ const [types, map] = await Promise.all([
67
+ this.writeTypes(destination, options),
68
+ this.writeMap(destination, options),
69
+ ])
70
+
71
+ return [...types, ...map]
72
+ }
73
+
62
74
  public async writeTypes(
63
75
  destination: string,
64
76
  options: { stores: StoreTemplateItem[] }
@@ -77,4 +89,22 @@ export default class StoreWriter extends AbstractWriter {
77
89
 
78
90
  return files
79
91
  }
92
+
93
+ public async writeMap(
94
+ destination: string,
95
+ options: { stores: StoreTemplateItem[] }
96
+ ) {
97
+ const file = diskUtil.resolvePath(destination, 'stores.ts')
98
+ const mapContent = this.templates.stores(options)
99
+
100
+ const files = this.writeFileIfChangedMixinResults(
101
+ file,
102
+ mapContent,
103
+ 'A reference to all your data stores for easy inclusion.'
104
+ )
105
+
106
+ await this.lint(file)
107
+
108
+ return files
109
+ }
80
110
  }