@runium/cli 0.0.1 → 0.0.3

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 (79) hide show
  1. package/build.js +21 -0
  2. package/lib/app.js +2 -2
  3. package/lib/commands/plugin/plugin-add.js +1 -1
  4. package/lib/commands/plugin/plugin-disable.js +1 -1
  5. package/lib/commands/plugin/plugin-enable.js +1 -1
  6. package/lib/commands/plugin/plugin-remove.js +1 -1
  7. package/lib/commands/plugin/plugin.js +1 -1
  8. package/lib/commands/project/project-add.js +1 -1
  9. package/lib/commands/project/project-command.js +1 -1
  10. package/lib/commands/project/project-start.js +1 -1
  11. package/lib/commands/project/project-state-command.js +1 -1
  12. package/lib/commands/project/project-status.js +1 -1
  13. package/lib/commands/project/project-stop.js +1 -1
  14. package/lib/commands/project/project-validate.js +4 -1
  15. package/lib/commands/project/project.js +1 -1
  16. package/lib/commands/runium-command.js +1 -1
  17. package/lib/constants/error-code.js +1 -1
  18. package/lib/index.js +1 -1
  19. package/lib/macros/date.js +1 -0
  20. package/lib/macros/index.js +1 -1
  21. package/lib/macros/path.js +1 -1
  22. package/lib/package.json +3 -2
  23. package/lib/services/command.js +1 -0
  24. package/lib/services/config.js +1 -1
  25. package/lib/services/file.js +1 -0
  26. package/lib/services/index.js +1 -1
  27. package/lib/services/output.js +3 -3
  28. package/lib/services/plugin-context.js +1 -1
  29. package/lib/services/plugin.js +1 -1
  30. package/lib/services/profile.js +1 -1
  31. package/lib/services/project.js +1 -1
  32. package/lib/services/shutdown.js +1 -1
  33. package/lib/utils/get-version.js +1 -0
  34. package/lib/utils/index.js +1 -1
  35. package/lib/validation/create-validator.js +1 -0
  36. package/lib/validation/get-config-schema.js +1 -0
  37. package/lib/validation/get-error-messages.js +1 -0
  38. package/lib/validation/get-plugin-schema.js +1 -0
  39. package/lib/validation/index.js +1 -0
  40. package/package.json +5 -2
  41. package/src/app.ts +35 -20
  42. package/src/commands/plugin/plugin-add.ts +2 -2
  43. package/src/commands/plugin/plugin-disable.ts +1 -1
  44. package/src/commands/plugin/plugin-enable.ts +2 -2
  45. package/src/commands/plugin/plugin-remove.ts +1 -1
  46. package/src/commands/plugin/plugin.ts +11 -16
  47. package/src/commands/project/project-add.ts +23 -5
  48. package/src/commands/project/project-command.ts +8 -1
  49. package/src/commands/project/project-start.ts +18 -12
  50. package/src/commands/project/project-state-command.ts +4 -19
  51. package/src/commands/project/project-status.ts +16 -3
  52. package/src/commands/project/project-stop.ts +5 -1
  53. package/src/commands/project/project-validate.ts +23 -10
  54. package/src/commands/project/project.ts +13 -18
  55. package/src/commands/runium-command.ts +18 -16
  56. package/src/constants/error-code.ts +15 -2
  57. package/src/global.d.ts +6 -0
  58. package/src/index.ts +5 -2
  59. package/src/macros/date.ts +15 -0
  60. package/src/macros/index.ts +6 -1
  61. package/src/macros/path.ts +17 -2
  62. package/src/services/command.ts +171 -0
  63. package/src/services/config.ts +47 -4
  64. package/src/services/file.ts +272 -0
  65. package/src/services/index.ts +2 -0
  66. package/src/services/output.ts +5 -1
  67. package/src/services/plugin-context.ts +68 -9
  68. package/src/services/plugin.ts +122 -18
  69. package/src/services/profile.ts +37 -49
  70. package/src/services/project.ts +31 -3
  71. package/src/services/shutdown.ts +25 -8
  72. package/src/utils/get-version.ts +13 -0
  73. package/src/utils/index.ts +1 -0
  74. package/src/validation/create-validator.ts +27 -0
  75. package/src/validation/get-config-schema.ts +59 -0
  76. package/src/validation/get-error-messages.ts +35 -0
  77. package/src/validation/get-plugin-schema.ts +137 -0
  78. package/src/validation/index.ts +4 -0
  79. package/tsconfig.json +8 -10
@@ -0,0 +1,137 @@
1
+ import { ID_REGEX } from '@runium/core';
2
+
3
+ /**
4
+ * Get plugin schema with function validation
5
+ */
6
+ export function getPluginSchema(): object {
7
+ return {
8
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
9
+ $id: 'https://runium.dev/schemas/plugin.json',
10
+ title: 'Runium Plugin',
11
+ type: 'object',
12
+ properties: {
13
+ name: {
14
+ type: 'string',
15
+ minLength: 2,
16
+ pattern: ID_REGEX.source,
17
+ },
18
+ options: {
19
+ type: 'object',
20
+ description: 'Plugin configuration options',
21
+ },
22
+ project: {
23
+ type: 'object',
24
+ description: 'Project-level plugin definitions',
25
+ properties: {
26
+ macros: {
27
+ type: 'object',
28
+ description: 'Macro definitions for config file expansion',
29
+ additionalProperties: {
30
+ instanceof: 'Function',
31
+ },
32
+ },
33
+ tasks: {
34
+ type: 'object',
35
+ description: 'Task constructor definitions',
36
+ additionalProperties: {
37
+ instanceof: 'Function',
38
+ },
39
+ },
40
+ actions: {
41
+ type: 'object',
42
+ description: 'Action function definitions',
43
+ additionalProperties: {
44
+ instanceof: 'Function',
45
+ },
46
+ },
47
+ triggers: {
48
+ type: 'object',
49
+ description: 'Trigger constructor definitions',
50
+ additionalProperties: {
51
+ instanceof: 'Function',
52
+ },
53
+ },
54
+ validationSchema: {
55
+ type: 'object',
56
+ description: 'JSON Schema extension for project config validation',
57
+ additionalProperties: true,
58
+ },
59
+ },
60
+ additionalProperties: false,
61
+ },
62
+ app: {
63
+ type: 'object',
64
+ description: 'Application-level plugin definitions',
65
+ properties: {
66
+ commands: {
67
+ type: 'array',
68
+ description: 'Command constructor definitions',
69
+ items: {
70
+ instanceof: 'Function',
71
+ },
72
+ },
73
+ },
74
+ additionalProperties: false,
75
+ },
76
+ hooks: {
77
+ type: 'object',
78
+ description: 'Lifecycle hooks for app and project events',
79
+ properties: {
80
+ app: {
81
+ type: 'object',
82
+ description: 'Application lifecycle hooks',
83
+ properties: {
84
+ afterInit: {
85
+ instanceof: 'Function',
86
+ description: 'Hook called after app initialization',
87
+ },
88
+ beforeExit: {
89
+ instanceof: 'Function',
90
+ description: 'Hook called before app exit',
91
+ },
92
+ beforeCommandRun: {
93
+ instanceof: 'Function',
94
+ description: 'Hook called before command execution',
95
+ },
96
+ afterCommandRun: {
97
+ instanceof: 'Function',
98
+ description: 'Hook called after command execution',
99
+ },
100
+ },
101
+ additionalProperties: false,
102
+ },
103
+ project: {
104
+ type: 'object',
105
+ description: 'Project lifecycle hooks',
106
+ properties: {
107
+ beforeConfigRead: {
108
+ instanceof: 'Function',
109
+ description: 'Hook called before reading config file',
110
+ },
111
+ afterConfigRead: {
112
+ instanceof: 'Function',
113
+ description: 'Hook called after reading config file content',
114
+ },
115
+ afterConfigMacrosApply: {
116
+ instanceof: 'Function',
117
+ description: 'Hook called after applying macros to config',
118
+ },
119
+ afterConfigParse: {
120
+ instanceof: 'Function',
121
+ description: 'Hook called after parsing config',
122
+ },
123
+ beforeStart: {
124
+ instanceof: 'Function',
125
+ description: 'Hook called before project starts',
126
+ },
127
+ },
128
+ additionalProperties: false,
129
+ },
130
+ },
131
+ additionalProperties: false,
132
+ },
133
+ },
134
+ required: ['name'],
135
+ additionalProperties: false,
136
+ };
137
+ }
@@ -0,0 +1,4 @@
1
+ export { createValidator } from './create-validator.js';
2
+ export { getConfigSchema } from './get-config-schema.js';
3
+ export { getErrorMessages } from './get-error-messages.js';
4
+ export { getPluginSchema } from './get-plugin-schema.js';
package/tsconfig.json CHANGED
@@ -27,14 +27,12 @@
27
27
  "@services/*": ["src/services/*"],
28
28
  "@services": ["src/services/index.js"],
29
29
  "@utils/*": ["src/utils/*"],
30
- "@utils": ["src/utils/index.js"]
31
- }
30
+ "@utils": ["src/utils/index.js"],
31
+ "@validation/*": ["src/validation/*"],
32
+ "@validation": ["src/validation/index.js"]
33
+ },
34
+ "types": ["node", "@runium/types-core"]
32
35
  },
33
- "include": [
34
- "src/**/*"
35
- ],
36
- "exclude": [
37
- "node_modules",
38
- "lib/**/*"
39
- ]
40
- }
36
+ "include": ["src/**/*"],
37
+ "exclude": ["lib/**/*"]
38
+ }