@sprucelabs/spruce-templates 20.0.6 → 21.0.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.
Files changed (28) hide show
  1. package/build/addons/hasNoneCoreSchemaTemplateItems.addon.js +2 -2
  2. package/build/addons/importRelatedSchemas.addon.js +3 -1
  3. package/build/index.d.ts +1 -1
  4. package/build/index.js +9 -6
  5. package/build/templates/directories/skill/eslint.config.mjs +3 -0
  6. package/build/templates/directories/skill/src/.spruce/errors/options.types.ts +4 -2
  7. package/build/templates/directories/skill/src/.spruce/features/event.plugin.ts +1 -1
  8. package/build/templates/directories/skill/src/.spruce/skill.ts +3 -4
  9. package/build/templates/directories/skill/src/errors/SpruceError.ts.hbs +12 -12
  10. package/build/templates/directories/skill/src/index.ts +21 -21
  11. package/build/templates/directories/skill/tsconfig.json +3 -4
  12. package/build/templates/directories/vscode/.vscode/settings.json +17 -20
  13. package/build/templates/typescript/error/error.plugin.ts.hbs +60 -61
  14. package/build/templates/typescript/event/listeners.ts.hbs +1 -1
  15. package/build/templates/typescript/schema/core.schemas.types.ts.hbs +5 -6
  16. package/build/templates/typescript/schema/schema.plugin.ts.hbs +94 -95
  17. package/build/templates/typescript/schema/schemas.types.ts.hbs +2 -0
  18. package/build/templates/typescript/view/views.ts.hbs +4 -1
  19. package/build/types/templates.types.d.ts +8 -18
  20. package/build/utilities/DirectoryTemplateUtility.d.ts +3 -3
  21. package/build/utilities/DirectoryTemplateUtility.js +2 -4
  22. package/build/utilities/importExtractor.utility.js +0 -1
  23. package/build/utilities/templateImporter.utility.js +0 -1
  24. package/build/utilities/templateItem.utility.d.ts +1 -5
  25. package/build/utilities/templateItem.utility.js +0 -1
  26. package/package.json +9 -9
  27. package/build/templates/directories/skill/.eslintignore +0 -3
  28. package/build/templates/directories/skill/.eslintrc.js +0 -3
@@ -6,6 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const spruce_skill_utils_1 = require("@sprucelabs/spruce-skill-utils");
7
7
  const handlebars_1 = __importDefault(require("handlebars"));
8
8
  handlebars_1.default.registerHelper('hasNonCoreSchemaTemplateItems', function (schemaTemplateItems) {
9
- return (schemaTemplateItems.filter((i) => i.namespace !== spruce_skill_utils_1.CORE_NAMESPACE).length >
10
- 0);
9
+ return (schemaTemplateItems.filter((i) => i.namespace !== spruce_skill_utils_1.CORE_NAMESPACE)
10
+ .length > 0);
11
11
  });
@@ -28,7 +28,9 @@ handlebars_1.default.registerHelper('importRelatedSchemas', function (schema, op
28
28
  t.schema.version === idWithVersion.version &&
29
29
  t.schema.namespace === idWithVersion.namespace);
30
30
  if (matched) {
31
- imports.push(`import ${matched.nameCamel}Schema${matched.schema.version ? `_${matched.schema.version}` : ''} from '${matched.destinationDir}/${(0, lodash_1.camelCase)(matched.namespace)}${matched.schema.version ? `/${matched.schema.version}` : ''}/${matched.id}.schema'`);
31
+ imports.push(`import ${matched.nameCamel}Schema${matched.schema.version
32
+ ? `_${matched.schema.version}`
33
+ : ''} from '${matched.destinationDir}/${(0, lodash_1.camelCase)(matched.namespace)}${matched.schema.version ? `/${matched.schema.version}` : ''}/${matched.id}.schema'`);
32
34
  }
33
35
  });
34
36
  }
package/build/index.d.ts CHANGED
@@ -53,7 +53,7 @@ export declare const templates: {
53
53
  fieldTemplateItems: FieldTemplateItem[];
54
54
  }): string;
55
55
  launchConfig(): string;
56
- vsCodeSettings(): string;
56
+ vsCodeSettings(): Promise<string>;
57
57
  listener(options: EventListenerOptions): string;
58
58
  listeners(options: {
59
59
  listeners: ListenerTemplateItem[];
package/build/index.js CHANGED
@@ -127,9 +127,13 @@ exports.templates = {
127
127
  const template = templateImporter_utility_1.default.getTemplate('vscode/launch.json');
128
128
  return template({});
129
129
  },
130
- vsCodeSettings() {
131
- const template = templateImporter_utility_1.default.getTemplate('vscode/settings.json');
132
- return template({});
130
+ async vsCodeSettings() {
131
+ const files = await exports.templates.directoryTemplate({
132
+ kind: templates_types_1.DirectoryTemplateCode.VsCode,
133
+ context: {},
134
+ });
135
+ const settings = files.find((f) => f.filename === 'settings.json');
136
+ return settings.contents;
133
137
  },
134
138
  listener(options) {
135
139
  const template = templateImporter_utility_1.default.getTemplate('event/listener.ts.hbs');
@@ -207,9 +211,8 @@ exports.templates = {
207
211
  }
208
212
  const filesToCheck = await DirectoryTemplateUtility_1.default.filesInTemplate(kind);
209
213
  let filesMissing = false;
210
- for (let i = 0; i < filesToCheck.length; i += 1) {
211
- const file = filesToCheck[i].path;
212
- if (!fs_1.default.existsSync(file)) {
214
+ for (const file of filesToCheck) {
215
+ if (!fs_1.default.existsSync(file.path)) {
213
216
  filesMissing = true;
214
217
  break;
215
218
  }
@@ -0,0 +1,3 @@
1
+ import eslintConfigSpruce from 'eslint-config-spruce'
2
+
3
+ export default eslintConfigSpruce
@@ -1,4 +1,6 @@
1
- type ErrorOptions = { code: 'NO_ERRORS_CREATED', friendlyMessage?: string }
1
+ interface ErrorOptions {
2
+ code: 'NO_ERRORS_CREATED'
3
+ friendlyMessage?: string
4
+ }
2
5
 
3
6
  export default ErrorOptions
4
-
@@ -1 +1 @@
1
- export { plugin as default } from '@sprucelabs/spruce-event-plugin'
1
+ export { plugin as default } from '@sprucelabs/spruce-event-plugin'
@@ -1,9 +1,8 @@
1
1
  import pathUtil from 'path'
2
2
  import Skill from '@sprucelabs/spruce-skill-booter'
3
3
 
4
-
5
4
  export default new Skill({
6
- rootDir: pathUtil.join(__dirname, '..', '..'),
7
- activeDir: pathUtil.join(__dirname, '..'),
8
- hashSpruceDir: pathUtil.join(__dirname, '..', '.spruce'),
5
+ rootDir: pathUtil.join(__dirname, '..', '..'),
6
+ activeDir: pathUtil.join(__dirname, '..'),
7
+ hashSpruceDir: pathUtil.join(__dirname, '..', '.spruce'),
9
8
  })
@@ -2,19 +2,19 @@ import AbstractSpruceError from '@sprucelabs/error'
2
2
  import ErrorOptions from '#spruce/errors/options.types'
3
3
 
4
4
  export default class SpruceError extends AbstractSpruceError<ErrorOptions> {
5
- public friendlyMessage(): string {
6
- const { options } = this
7
- let message
5
+ public friendlyMessage(): string {
6
+ const { options } = this
7
+ let message
8
8
 
9
- switch (options?.code) {
10
- default:
11
- message = super.friendlyMessage()
12
- }
9
+ switch (options?.code) {
10
+ default:
11
+ message = super.friendlyMessage()
12
+ }
13
13
 
14
- const fullMessage = options.friendlyMessage
15
- ? options.friendlyMessage
16
- : message
14
+ const fullMessage = options.friendlyMessage
15
+ ? options.friendlyMessage
16
+ : message
17
17
 
18
- return fullMessage
19
- }
18
+ return fullMessage
19
+ }
20
20
  }
@@ -1,9 +1,9 @@
1
1
  // AUTO-GENERATED. ALL CHANGES WILL BE OVERWRITTEN
2
2
  import AbstractSpruceError from '@sprucelabs/error'
3
3
  import {
4
- HEALTH_DIVIDER,
5
- ERROR_DIVIDER,
6
- pluginUtil,
4
+ HEALTH_DIVIDER,
5
+ ERROR_DIVIDER,
6
+ pluginUtil,
7
7
  } from '@sprucelabs/spruce-skill-utils'
8
8
  // @ts-ignore
9
9
  import skill from '#spruce/skill'
@@ -11,25 +11,25 @@ import skill from '#spruce/skill'
11
11
  const isHealthCheck = !!process.argv.find((arg) => arg === '--health')
12
12
 
13
13
  async function run() {
14
- await pluginUtil.import([skill], skill.hashSpruceDir)
14
+ await pluginUtil.import([skill], skill.hashSpruceDir)
15
15
 
16
- if (isHealthCheck) {
17
- const health = await skill.checkHealth()
18
- console.log(HEALTH_DIVIDER)
19
- console.log(JSON.stringify(health))
20
- console.log(HEALTH_DIVIDER)
21
- } else {
22
- await skill.execute()
23
- }
16
+ if (isHealthCheck) {
17
+ const health = await skill.checkHealth()
18
+ console.log(HEALTH_DIVIDER)
19
+ console.log(JSON.stringify(health))
20
+ console.log(HEALTH_DIVIDER)
21
+ } else {
22
+ await skill.execute()
23
+ }
24
24
  }
25
25
 
26
26
  run()
27
- .then(() => {})
28
- .catch((err) => {
29
- if (err instanceof AbstractSpruceError && process.env.IS_CLI) {
30
- console.error(ERROR_DIVIDER + err.toJson() + ERROR_DIVIDER)
31
- } else {
32
- console.error(err.stack ?? err.message)
33
- }
34
- process.exit(1)
35
- })
27
+ .then(() => {})
28
+ .catch((err) => {
29
+ if (err instanceof AbstractSpruceError && process.env.IS_CLI) {
30
+ console.error(ERROR_DIVIDER + err.toJson() + ERROR_DIVIDER)
31
+ } else {
32
+ console.error(err.stack ?? err.message)
33
+ }
34
+ process.exit(1)
35
+ })
@@ -3,11 +3,10 @@
3
3
  "skipLibCheck": true,
4
4
  "module": "commonjs",
5
5
  "esModuleInterop": true,
6
- "target": "ES2017",
6
+ "target": "ES2022",
7
7
  "lib": [
8
8
  "DOM",
9
- "es2017",
10
- "ES2020"
9
+ "ES2022"
11
10
  ],
12
11
  "declaration": true,
13
12
  "noImplicitAny": true,
@@ -37,4 +36,4 @@
37
36
  "build",
38
37
  "esm"
39
38
  ]
40
- }
39
+ }
@@ -2,7 +2,6 @@
2
2
  "debug.node.autoAttach": "on",
3
3
  "git.ignoreLimitWarning": true,
4
4
  "javascript.validate.enable": false,
5
- "editor.formatOnSave": true,
6
5
  "files.watcherExclude": {
7
6
  "**/.git/objects/**": true,
8
7
  "**/.git/subtree-cache/**": true,
@@ -15,13 +14,6 @@
15
14
  "**/.next/**": true
16
15
  },
17
16
  "editor.maxTokenizationLineLength": 20000000,
18
- "eslint.enable": true,
19
- "eslint.validate": [
20
- "javascript",
21
- "javascriptreact",
22
- "typescript",
23
- "typescriptreact"
24
- ],
25
17
  "[javascript]": {
26
18
  "editor.formatOnSave": false
27
19
  },
@@ -37,18 +29,7 @@
37
29
  "[handlebars]": {
38
30
  "editor.formatOnSave": false
39
31
  },
40
- "eslint.options": {
41
- "extensions": [
42
- ".js",
43
- ".jsx",
44
- ".ts",
45
- ".tsx"
46
- ]
47
- },
48
32
  "typescript.tsdk": "node_modules/typescript/lib",
49
- "editor.codeActionsOnSave": {
50
- "source.fixAll.eslint": true
51
- },
52
33
  "cSpell.ignorePaths": [
53
34
  "**/package-lock.json",
54
35
  "**/node_modules/**",
@@ -66,5 +47,21 @@
66
47
  ],
67
48
  "debug.javascript.unmapMissingSources": true,
68
49
  "javascript.preferences.importModuleSpecifier": "relative",
69
- "typescript.preferences.importModuleSpecifier": "relative"
50
+ "typescript.preferences.importModuleSpecifier": "relative",
51
+ "eslint.experimental.useFlatConfig": true,
52
+ "eslint.enable": true,
53
+ "eslint.validate": [
54
+ "javascript",
55
+ "javascriptreact",
56
+ "typescript",
57
+ "typescriptreact"
58
+ ],
59
+ "eslint.workingDirectories": [
60
+ "./"
61
+ ],
62
+ "typescript.validate.enable": false,
63
+ "editor.formatOnSave": false,
64
+ "editor.codeActionsOnSave": {
65
+ "source.fixAll.eslint": "always"
66
+ }
70
67
  }
@@ -1,79 +1,78 @@
1
- import globby from "@sprucelabs/globby";
1
+ import globby from '@sprucelabs/globby'
2
2
  import {
3
- ErrorHealthCheckItem,
4
- SkillFeature,
5
- Skill,
6
- diskUtil,
7
- HASH_SPRUCE_DIR_NAME,
8
- BootCallback
9
- } from "@sprucelabs/spruce-skill-utils";
3
+ ErrorHealthCheckItem,
4
+ SkillFeature,
5
+ Skill,
6
+ diskUtil,
7
+ HASH_SPRUCE_DIR_NAME,
8
+ BootCallback,
9
+ } from '@sprucelabs/spruce-skill-utils'
10
10
 
11
11
  class ErrorSkillFeature implements SkillFeature {
12
- private skill: Skill;
13
- private _isBooted = false
14
- private bootHandler?: BootCallback;
12
+ private skill: Skill
13
+ private _isBooted = false
14
+ private bootHandler?: BootCallback
15
15
 
16
+ public constructor(skill: Skill) {
17
+ this.skill = skill
18
+ }
16
19
 
17
- public constructor(skill: Skill) {
18
- this.skill = skill;
19
- }
20
+ public onBoot(cb: BootCallback) {
21
+ this.bootHandler = cb
22
+ }
20
23
 
21
- public onBoot(cb: BootCallback) {
22
- this.bootHandler = cb
23
- }
24
+ public execute = async () => {
25
+ this._isBooted = true
26
+ void this.bootHandler?.()
27
+ }
24
28
 
25
- public execute = async () => {
26
- this._isBooted = true
27
- this.bootHandler?.()
28
- };
29
+ public checkHealth = async () => {
30
+ const errorFiles = await this.getErrors()
29
31
 
30
- public checkHealth = async () => {
31
- const errorFiles = await this.getErrors()
32
+ const errors = errorFiles.map((path) => {
33
+ const schema = require(path).default
32
34
 
33
- const errors = errorFiles.map(path => {
34
- const schema = require(path).default
35
+ return {
36
+ id: schema.id,
37
+ name: schema.name,
38
+ description: schema.description,
39
+ }
40
+ })
35
41
 
36
- return {
37
- id: schema.id,
38
- name: schema.name,
39
- description: schema.description
40
- }
41
- })
42
+ const health: ErrorHealthCheckItem = {
43
+ status: 'passed',
44
+ errorSchemas: errors,
45
+ }
42
46
 
43
- const health: ErrorHealthCheckItem = {
44
- status: "passed",
45
- errorSchemas: errors,
46
- };
47
+ return health
48
+ }
47
49
 
48
- return health;
49
- };
50
+ public isInstalled = async () => {
51
+ return true
52
+ }
50
53
 
51
- public isInstalled = async () => {
52
- return true
53
- };
54
+ public async destroy() {
55
+ this._isBooted = false
56
+ }
54
57
 
55
- public async destroy() {
56
- this._isBooted = false
57
- }
58
+ public isBooted() {
59
+ return this._isBooted
60
+ }
58
61
 
59
- public isBooted() {
60
- return this._isBooted
61
- }
62
-
63
- private async getErrors() {
64
- const schemaFiles = await globby(
65
- diskUtil.resolvePath(
66
- this.skill.activeDir,
67
- HASH_SPRUCE_DIR_NAME,
68
- "errors",
69
- "**/*.schema.[t|j]s"
70
- )
71
- );
72
- return schemaFiles
73
- }
62
+ private async getErrors() {
63
+ const schemaFiles = await globby(
64
+ diskUtil.resolvePath(
65
+ this.skill.activeDir,
66
+ HASH_SPRUCE_DIR_NAME,
67
+ 'errors',
68
+ '**/*.schema.[t|j]s'
69
+ )
70
+ )
71
+ return schemaFiles
72
+ }
74
73
  }
75
74
 
76
75
  export default (skill: Skill) => {
77
- const feature = new ErrorSkillFeature(skill);
78
- skill.registerFeature("error", feature);
79
- };
76
+ const feature = new ErrorSkillFeature(skill)
77
+ skill.registerFeature('error', feature)
78
+ }
@@ -12,4 +12,4 @@ const listeners: EventFeatureListener[] = [
12
12
  {{/each}}
13
13
  ]
14
14
 
15
- export default listeners
15
+ export default listeners
@@ -1,18 +1,17 @@
1
- /* eslint-disable @typescript-eslint/no-namespace */
2
- /* eslint-disable no-redeclare */
3
-
4
1
  import { default as SchemaEntity } from '@sprucelabs/schema'
5
2
  {{#each imports}}
6
3
  import * as {{importAs}} from '{{package}}'
7
4
  {{/each}}
8
-
9
-
10
-
11
5
  {{#each schemaTemplateItems}}
12
6
 
13
7
  {{#each imports}}
14
8
  {{{this}}}
15
9
  {{/each}}
10
+ {{/each}}
11
+
12
+
13
+
14
+ {{#each schemaTemplateItems}}
16
15
 
17
16
  export declare namespace {{../globalSchemaNamespace}}.{{namespace}}{{#if (isDefined schema.version)}}.{{schema.version}}{{/if}} {
18
17
 
@@ -1,102 +1,101 @@
1
- import fs from "fs";
2
- import globby from "@sprucelabs/globby";
3
- import pathUtil from "path";
1
+ import fs from 'fs'
2
+ import pathUtil from 'path'
3
+ import globby from '@sprucelabs/globby'
4
4
  import { SchemaError } from '@sprucelabs/schema'
5
5
  import {
6
- SchemaHealthCheckItem,
7
- SkillFeature,
8
- Skill,
9
- diskUtil,
10
- HASH_SPRUCE_DIR_NAME,
11
- BootCallback
12
- } from "@sprucelabs/spruce-skill-utils";
6
+ SchemaHealthCheckItem,
7
+ SkillFeature,
8
+ Skill,
9
+ diskUtil,
10
+ HASH_SPRUCE_DIR_NAME,
11
+ BootCallback,
12
+ } from '@sprucelabs/spruce-skill-utils'
13
13
 
14
14
  class SchemaFeature implements SkillFeature {
15
- private skill: Skill;
16
- private _isBooted = false
17
- private bootHandler?: BootCallback;
18
-
19
- public constructor(skill: Skill) {
20
- this.skill = skill;
21
- }
22
-
23
- public onBoot(cb: BootCallback) {
24
- this.bootHandler = cb
25
- }
26
-
27
- public execute = async () => {
28
- if (process.env.SHOULD_VALIDATE_SCHEMAS_ON_BOOT !== 'false') {
29
- await this.loadSchemas();
30
- }
31
- this._isBooted = true
32
- this.bootHandler?.()
33
- };
34
-
35
- public checkHealth = async () => {
36
- const schemas = await this.loadSchemas()
37
-
38
- const health: SchemaHealthCheckItem = {
39
- status: "passed",
40
- schemas,
41
- };
42
-
43
- return health;
44
- };
45
-
46
- public async destroy() {
47
- this._isBooted = false
48
- }
49
-
50
- public isInstalled = async () => {
51
- const schemaPath = pathUtil.join(
52
- this.skill.rootDir,
53
- "node_modules",
54
- "@sprucelabs/schema"
55
- );
56
-
57
- const isSchemaInstalled = fs.existsSync(schemaPath);
58
-
59
- return isSchemaInstalled;
60
- };
61
-
62
- public isBooted() {
63
- return this._isBooted
64
- }
65
-
66
- private async loadSchemas() {
67
- const schemaFiles = await globby(
68
- diskUtil.resolvePath(
69
- this.skill.activeDir,
70
- HASH_SPRUCE_DIR_NAME,
71
- "schemas",
72
- "**/*.schema.[t|j]s"
73
- )
74
- );
75
-
76
- return schemaFiles
77
- .map(file => {
78
- try {
79
-
80
- const schema = require(file).default
81
- return {
82
- id: schema.id,
83
- name: schema.name,
84
- version: schema.version,
85
- namespace: schema.namespace ?? '***MISSING***',
86
- description: schema.description,
87
- }
88
- } catch (err:any) {
89
- throw new SchemaError({
90
- //@ts-ignore
91
- code: 'FAILED_LOADING_SCHEMA',
92
- originalError: err,
93
- friendlyMessage: `Error importing schema from: ${file}.` })
94
- }
95
- });
96
- }
15
+ private skill: Skill
16
+ private _isBooted = false
17
+ private bootHandler?: BootCallback
18
+
19
+ public constructor(skill: Skill) {
20
+ this.skill = skill
21
+ }
22
+
23
+ public onBoot(cb: BootCallback) {
24
+ this.bootHandler = cb
25
+ }
26
+
27
+ public execute = async () => {
28
+ if (process.env.SHOULD_VALIDATE_SCHEMAS_ON_BOOT !== 'false') {
29
+ await this.loadSchemas()
30
+ }
31
+ this._isBooted = true
32
+ void this.bootHandler?.()
33
+ }
34
+
35
+ public checkHealth = async () => {
36
+ const schemas = await this.loadSchemas()
37
+
38
+ const health: SchemaHealthCheckItem = {
39
+ status: 'passed',
40
+ schemas,
41
+ }
42
+
43
+ return health
44
+ }
45
+
46
+ public async destroy() {
47
+ this._isBooted = false
48
+ }
49
+
50
+ public isInstalled = async () => {
51
+ const schemaPath = pathUtil.join(
52
+ this.skill.rootDir,
53
+ 'node_modules',
54
+ '@sprucelabs/schema'
55
+ )
56
+
57
+ const isSchemaInstalled = fs.existsSync(schemaPath)
58
+
59
+ return isSchemaInstalled
60
+ }
61
+
62
+ public isBooted() {
63
+ return this._isBooted
64
+ }
65
+
66
+ private async loadSchemas() {
67
+ const schemaFiles = await globby(
68
+ diskUtil.resolvePath(
69
+ this.skill.activeDir,
70
+ HASH_SPRUCE_DIR_NAME,
71
+ 'schemas',
72
+ '**/*.schema.[t|j]s'
73
+ )
74
+ )
75
+
76
+ return schemaFiles.map((file) => {
77
+ try {
78
+ const schema = require(file).default
79
+ return {
80
+ id: schema.id,
81
+ name: schema.name,
82
+ version: schema.version,
83
+ namespace: schema.namespace ?? '***MISSING***',
84
+ description: schema.description,
85
+ }
86
+ } catch (err: any) {
87
+ throw new SchemaError({
88
+ //@ts-ignore
89
+ code: 'FAILED_LOADING_SCHEMA',
90
+ originalError: err,
91
+ friendlyMessage: `Error importing schema from: ${file}.`,
92
+ })
93
+ }
94
+ })
95
+ }
97
96
  }
98
97
 
99
98
  export default (skill: Skill) => {
100
- const feature = new SchemaFeature(skill);
101
- skill.registerFeature("schema", feature);
102
- };
99
+ const feature = new SchemaFeature(skill)
100
+ skill.registerFeature('schema', feature)
101
+ }
@@ -1,5 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-namespace */
2
2
  /* eslint-disable no-redeclare */
3
+ /* eslint-disable @typescript-eslint/no-unused-vars */
4
+ /* eslint-disable import/order */
3
5
 
4
6
  export { SpruceSchemas } from '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schemas.types'
5
7
 
@@ -65,6 +65,9 @@ declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.typ
65
65
  }
66
66
 
67
67
  //@ts-ignore
68
- if(typeof heartwood === 'function') { heartwood(vcs, pluginsByName) }
68
+ if(typeof heartwood === 'function') {
69
+ //@ts-ignore
70
+ heartwood(vcs, pluginsByName)
71
+ }
69
72
 
70
73
  export default vcs
@@ -49,22 +49,14 @@ export interface ErrorOptions {
49
49
  export interface ErrorTemplateItem extends SchemaTemplateItem {
50
50
  code: string;
51
51
  }
52
- export interface ValueTypes {
53
- [namespace: string]: {
54
- [schemaId: string]: {
55
- [version: string]: {
56
- [fieldName: string]: {
57
- valueTypes: {
58
- value: string;
59
- type: string;
60
- schemaType: string;
61
- };
62
- valueTypeGeneratorType?: string;
63
- };
64
- };
65
- };
52
+ export type ValueTypes = Record<string, Record<string, Record<string, Record<string, {
53
+ valueTypes: {
54
+ value: string;
55
+ type: string;
56
+ schemaType: string;
66
57
  };
67
- }
58
+ valueTypeGeneratorType?: string;
59
+ }>>>>;
68
60
  export interface TestOptions {
69
61
  namePascal: string;
70
62
  nameCamel: string;
@@ -94,9 +86,7 @@ export interface EventContractTemplateItem extends EventContract {
94
86
  imports: SchemaImport[];
95
87
  version: string;
96
88
  isLocal: boolean;
97
- eventSignatures: {
98
- [eventName: string]: EventSignatureTemplateItem;
99
- };
89
+ eventSignatures: Record<string, EventSignatureTemplateItem>;
100
90
  }
101
91
  export interface EventPayloadOptions {
102
92
  nameCamel: string;
@@ -1,7 +1,4 @@
1
1
  import { DirectoryTemplateCode, DirectoryTemplateContextMap, DirectoryTemplateFile } from '../types/templates.types';
2
- type DirectoryTemplateWithContent = DirectoryTemplateFile & {
3
- contents: string;
4
- };
5
2
  export default class DirectoryTemplateUtility {
6
3
  static filesInTemplate(code: DirectoryTemplateCode): Promise<DirectoryTemplateFile[]>;
7
4
  static build<K extends DirectoryTemplateCode>(options: {
@@ -12,4 +9,7 @@ export default class DirectoryTemplateUtility {
12
9
  }): Promise<DirectoryTemplateWithContent[]>;
13
10
  private static loadFileDetails;
14
11
  }
12
+ type DirectoryTemplateWithContent = DirectoryTemplateFile & {
13
+ contents: string;
14
+ };
15
15
  export {};
@@ -13,8 +13,7 @@ class DirectoryTemplateUtility {
13
13
  const files = await (0, globby_1.default)(path_1.default.join(__dirname, '../templates/directories', code), {
14
14
  dot: true,
15
15
  });
16
- for (let i = 0; i < files.length; i += 1) {
17
- const file = files[i];
16
+ for (const file of files) {
18
17
  const isDefinitionFile = file.search('.d.ts') > -1;
19
18
  if (!isDefinitionFile) {
20
19
  const templateFile = this.loadFileDetails(code, file);
@@ -27,8 +26,7 @@ class DirectoryTemplateUtility {
27
26
  const builtFiles = [];
28
27
  const { kind, context } = options;
29
28
  const files = await this.filesInTemplate(kind);
30
- for (let i = 0; i < files.length; i += 1) {
31
- const file = files[i];
29
+ for (const file of files) {
32
30
  const { isHandlebarsTemplate, path } = file;
33
31
  let contents = fs_1.default.readFileSync(path).toString();
34
32
  if (isHandlebarsTemplate) {
@@ -33,6 +33,5 @@ const importExtractorUtil = {
33
33
  });
34
34
  return (0, uniq_1.default)(imports);
35
35
  },
36
- // eslint-disable-next-line no-undef
37
36
  };
38
37
  exports.default = importExtractorUtil;
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const fs_1 = __importDefault(require("fs"));
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const handlebars_1 = __importDefault(require("handlebars"));
9
- // eslint-disable-next-line no-undef
10
9
  const templateCache = {};
11
10
  const templatePath = path_1.default.join(__dirname, '..', 'templates', 'typescript');
12
11
  const templateImportUtil = {
@@ -1,10 +1,6 @@
1
1
  import { SchemaTemplateItem, FieldTemplateItem } from '@sprucelabs/schema';
2
2
  declare const templateItemUtil: {
3
- readonly groupSchemaTemplatesByNamespaceAndName: (schemaTemplateItems: SchemaTemplateItem[]) => {
4
- [namespace: string]: {
5
- [name: string]: SchemaTemplateItem[];
6
- };
7
- };
3
+ readonly groupSchemaTemplatesByNamespaceAndName: (schemaTemplateItems: SchemaTemplateItem[]) => Record<string, Record<string, SchemaTemplateItem[]>>;
8
4
  readonly groupFieldItemsByNamespace: (fieldTemplateItems: FieldTemplateItem[]) => void;
9
5
  };
10
6
  export default templateItemUtil;
@@ -23,6 +23,5 @@ const templateItemUtil = {
23
23
  fieldTemplatesByType[item.camelType].push(item);
24
24
  });
25
25
  },
26
- // eslint-disable-next-line no-undef
27
26
  };
28
27
  exports.default = templateItemUtil;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "20.0.6",
6
+ "version": "21.0.0",
7
7
  "files": [
8
8
  "build/**/*",
9
9
  "tsconfig.json",
@@ -56,10 +56,10 @@
56
56
  "watch.tsc": "tsc -w"
57
57
  },
58
58
  "dependencies": {
59
- "@sprucelabs/mercury-types": "^46.0.300",
60
- "@sprucelabs/schema": "^29.4.60",
61
- "@sprucelabs/spruce-event-utils": "^38.1.42",
62
- "@sprucelabs/spruce-skill-utils": "^30.4.29",
59
+ "@sprucelabs/mercury-types": "^47.0.2",
60
+ "@sprucelabs/schema": "^30.0.4",
61
+ "@sprucelabs/spruce-event-utils": "^40.0.2",
62
+ "@sprucelabs/spruce-skill-utils": "^31.0.5",
63
63
  "fs-extra": "^10.1.0",
64
64
  "handlebars": "^4.7.8",
65
65
  "lodash": "^4.17.21",
@@ -68,15 +68,15 @@
68
68
  "devDependencies": {
69
69
  "@types/fs-extra": "^9.0.13",
70
70
  "@types/lodash": "^4.17.0",
71
- "@types/node": "^20.12.4",
71
+ "@types/node": "^20.12.7",
72
72
  "chokidar-cli": "^3.0.0",
73
73
  "concurrently": "^8.2.2",
74
- "conventional-changelog-sprucelabs": "^1.1.2",
74
+ "conventional-changelog-sprucelabs": "^2.0.1",
75
75
  "prettier": "^3.2.5",
76
- "typescript": "^5.4.4"
76
+ "typescript": "^5.4.5"
77
77
  },
78
78
  "yarn-upgrade-all": {
79
79
  "ignore": []
80
80
  },
81
- "gitHead": "485d137e0e46ebc382bbfbd2e7919a291f659b26"
81
+ "gitHead": "285a2a10f3a72d222007d41dcbdde633d91387c7"
82
82
  }
@@ -1,3 +0,0 @@
1
- build
2
- esm
3
- node_modules
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- extends: 'spruce',
3
- }