domain-driver 0.0.3 → 0.0.5

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/src/index.ts CHANGED
@@ -1,16 +1,75 @@
1
1
  #!/usr/bin/env node
2
2
  import { makeFeature } from './commands/feature';
3
+ import { makeComponent } from './commands/component';
4
+ import { makeHook } from './commands/hook';
5
+ import { makeService } from './commands/service';
6
+ import { makeSchema } from './commands/schema';
7
+ import { makeRepository } from './commands/repository';
8
+ import { makeContainer } from './commands/container';
3
9
 
4
- const [,, command, name] = process.argv;
10
+ const [,, command, feature, name] = process.argv;
5
11
 
6
- if (!command || !name) {
7
- console.error('Usage: domain-driver make:feature <name>');
12
+ if (!command || !feature) {
13
+ console.error('Usage: domain-driver <command> [options]');
8
14
  process.exit(1);
9
15
  }
10
16
 
11
- if (command === 'make:feature') {
12
- makeFeature(name);
13
- } else {
14
- console.error(`Unknown command: ${command}`);
15
- process.exit(1);
17
+ switch (command) {
18
+ case 'make:feature':
19
+ const all = process.argv.includes('-a') || process.argv.includes('-A');
20
+ makeFeature(feature, all).then(() => {});
21
+ break;
22
+
23
+ case 'make:component':
24
+ if (!name) {
25
+ console.error('Usage: domain-driver make:component <feature> <name> [client|server]');
26
+ process.exit(1);
27
+ }
28
+ const type = (process.argv[5] as 'client' | 'server') || 'client';
29
+ makeComponent(feature, name, type);
30
+ break;
31
+
32
+ case 'make:hook':
33
+ if (!name) {
34
+ console.error('Usage: domain-driver make:hook <feature> <name>');
35
+ process.exit(1);
36
+ }
37
+ makeHook(feature, name);
38
+ break;
39
+
40
+ case 'make:service':
41
+ if (!name) {
42
+ console.error('Usage: domain-driver make:service <feature> <name>');
43
+ process.exit(1);
44
+ }
45
+ makeService(feature, name);
46
+ break;
47
+
48
+ case 'make:schema':
49
+ if (!name) {
50
+ console.error('Usage: domain-driver make:schema <feature> <name>');
51
+ process.exit(1);
52
+ }
53
+ makeSchema(feature, name);
54
+ break;
55
+
56
+ case 'make:repository':
57
+ if (!name) {
58
+ console.error('Usage: domain-driver make:repository <feature> <name>');
59
+ process.exit(1);
60
+ }
61
+ makeRepository(feature, name);
62
+ break;
63
+
64
+ case 'make:container':
65
+ if (!name) {
66
+ console.error('Usage: domain-driver make:container <feature> <name>');
67
+ process.exit(1);
68
+ }
69
+ makeContainer(feature, name);
70
+ break;
71
+
72
+ default:
73
+ console.error(`Unknown command: ${command}`);
74
+ process.exit(1);
16
75
  }