@foal/cli 5.1.3 → 5.2.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 (166) hide show
  1. package/lib/cli.d.ts +6 -0
  2. package/lib/cli.js +208 -0
  3. package/lib/commands/connectors/connect-angular/connect-angular-command.service.d.ts +15 -0
  4. package/lib/commands/connectors/connect-angular/connect-angular-command.service.js +66 -0
  5. package/lib/commands/connectors/connect-angular/index.d.ts +1 -0
  6. package/lib/commands/connectors/connect-angular/index.js +5 -0
  7. package/lib/commands/connectors/connect-react/connect-react-command.service.d.ts +15 -0
  8. package/lib/commands/connectors/connect-react/connect-react-command.service.js +47 -0
  9. package/lib/commands/connectors/connect-react/index.d.ts +1 -0
  10. package/lib/commands/connectors/connect-react/index.js +5 -0
  11. package/lib/commands/connectors/connect-vue/connect-vue-command.service.d.ts +15 -0
  12. package/lib/commands/connectors/connect-vue/connect-vue-command.service.js +51 -0
  13. package/lib/commands/connectors/connect-vue/index.d.ts +1 -0
  14. package/lib/commands/connectors/connect-vue/index.js +5 -0
  15. package/lib/commands/connectors/index.d.ts +3 -0
  16. package/lib/commands/connectors/index.js +9 -0
  17. package/lib/commands/create-secret/create-secret-command.service.d.ts +7 -0
  18. package/lib/commands/create-secret/create-secret-command.service.js +16 -0
  19. package/lib/commands/create-secret/index.d.ts +1 -0
  20. package/lib/commands/create-secret/index.js +5 -0
  21. package/lib/commands/generators/create-app/create-app-command.service.d.ts +25 -0
  22. package/lib/commands/generators/create-app/create-app-command.service.js +151 -0
  23. package/lib/commands/generators/create-app/index.d.ts +1 -0
  24. package/lib/commands/generators/create-app/index.js +5 -0
  25. package/lib/commands/generators/create-controller/create-controller-command.service.d.ts +19 -0
  26. package/lib/commands/generators/create-controller/create-controller-command.service.js +53 -0
  27. package/lib/commands/generators/create-controller/index.d.ts +1 -0
  28. package/lib/commands/generators/create-controller/index.js +5 -0
  29. package/lib/commands/generators/create-entity/create-entity-command.service.d.ts +17 -0
  30. package/lib/commands/generators/create-entity/create-entity-command.service.js +42 -0
  31. package/lib/commands/generators/create-entity/index.d.ts +1 -0
  32. package/lib/commands/generators/create-entity/index.js +5 -0
  33. package/lib/commands/generators/create-hook/create-hook-command.service.d.ts +17 -0
  34. package/lib/commands/generators/create-hook/create-hook-command.service.js +40 -0
  35. package/lib/commands/generators/create-hook/index.d.ts +1 -0
  36. package/lib/commands/generators/create-hook/index.js +5 -0
  37. package/lib/commands/generators/create-rest-api/create-rest-api-command.service.d.ts +21 -0
  38. package/lib/commands/generators/create-rest-api/create-rest-api-command.service.js +80 -0
  39. package/lib/commands/generators/create-rest-api/index.d.ts +1 -0
  40. package/lib/commands/generators/create-rest-api/index.js +5 -0
  41. package/lib/commands/generators/create-script/create-script-command.service.d.ts +17 -0
  42. package/lib/commands/generators/create-script/create-script-command.service.js +28 -0
  43. package/lib/commands/generators/create-script/index.d.ts +1 -0
  44. package/lib/commands/generators/create-script/index.js +5 -0
  45. package/lib/commands/generators/create-service/create-service-command.service.d.ts +17 -0
  46. package/lib/commands/generators/create-service/create-service-command.service.js +40 -0
  47. package/lib/commands/generators/create-service/index.d.ts +1 -0
  48. package/lib/commands/generators/create-service/index.js +5 -0
  49. package/lib/commands/generators/index.d.ts +7 -0
  50. package/lib/commands/generators/index.js +17 -0
  51. package/lib/commands/index.d.ts +6 -0
  52. package/lib/commands/index.js +23 -0
  53. package/lib/commands/rmdir/index.d.ts +1 -0
  54. package/lib/commands/rmdir/index.js +5 -0
  55. package/lib/commands/rmdir/rmdir-command.service.d.ts +12 -0
  56. package/lib/commands/rmdir/rmdir-command.service.js +29 -0
  57. package/lib/commands/run-script/index.d.ts +1 -0
  58. package/lib/commands/run-script/index.js +5 -0
  59. package/lib/commands/run-script/run-script-command.service.d.ts +10 -0
  60. package/lib/commands/run-script/run-script-command.service.js +79 -0
  61. package/lib/commands/upgrade/index.d.ts +1 -0
  62. package/lib/commands/upgrade/index.js +5 -0
  63. package/lib/commands/upgrade/upgrade-command.service.d.ts +24 -0
  64. package/lib/commands/upgrade/upgrade-command.service.js +49 -0
  65. package/lib/index.d.ts +1 -6
  66. package/lib/index.js +1 -157
  67. package/lib/services/crypto/crypto.service.d.ts +11 -0
  68. package/lib/services/crypto/crypto.service.js +20 -0
  69. package/lib/services/crypto/index.d.ts +1 -0
  70. package/lib/services/crypto/index.js +5 -0
  71. package/lib/services/file-system/file-system.service.d.ts +24 -0
  72. package/lib/services/file-system/file-system.service.js +89 -0
  73. package/lib/services/file-system/index.d.ts +1 -0
  74. package/lib/services/file-system/index.js +5 -0
  75. package/lib/{generate/file-system.d.ts → services/generator/generator.d.ts} +34 -41
  76. package/lib/{generate/file-system.js → services/generator/generator.js} +82 -112
  77. package/lib/services/generator/index.d.ts +1 -0
  78. package/lib/services/generator/index.js +6 -0
  79. package/lib/services/index.d.ts +5 -0
  80. package/lib/services/index.js +14 -0
  81. package/lib/services/logger/index.d.ts +1 -0
  82. package/lib/services/logger/index.js +5 -0
  83. package/lib/services/logger/logger.service.d.ts +8 -0
  84. package/lib/services/logger/logger.service.js +39 -0
  85. package/lib/services/util/index.d.ts +1 -0
  86. package/lib/services/util/index.js +5 -0
  87. package/lib/services/util/util.service.d.ts +12 -0
  88. package/lib/services/util/util.service.js +33 -0
  89. package/package.json +5 -8
  90. package/templates/file-system/test-template.txt +1 -0
  91. package/lib/create-secret/create-secret.d.ts +0 -7
  92. package/lib/create-secret/create-secret.js +0 -15
  93. package/lib/create-secret/index.d.ts +0 -1
  94. package/lib/create-secret/index.js +0 -5
  95. package/lib/generate/generators/angular/connect-angular.d.ts +0 -1
  96. package/lib/generate/generators/angular/connect-angular.js +0 -52
  97. package/lib/generate/generators/angular/index.d.ts +0 -1
  98. package/lib/generate/generators/angular/index.js +0 -5
  99. package/lib/generate/generators/app/create-app.d.ts +0 -7
  100. package/lib/generate/generators/app/create-app.js +0 -134
  101. package/lib/generate/generators/app/index.d.ts +0 -1
  102. package/lib/generate/generators/app/index.js +0 -5
  103. package/lib/generate/generators/controller/create-controller.d.ts +0 -4
  104. package/lib/generate/generators/controller/create-controller.js +0 -39
  105. package/lib/generate/generators/controller/index.d.ts +0 -1
  106. package/lib/generate/generators/controller/index.js +0 -5
  107. package/lib/generate/generators/entity/create-entity.d.ts +0 -3
  108. package/lib/generate/generators/entity/create-entity.js +0 -28
  109. package/lib/generate/generators/entity/index.d.ts +0 -1
  110. package/lib/generate/generators/entity/index.js +0 -5
  111. package/lib/generate/generators/hook/create-hook.d.ts +0 -3
  112. package/lib/generate/generators/hook/create-hook.js +0 -26
  113. package/lib/generate/generators/hook/index.d.ts +0 -1
  114. package/lib/generate/generators/hook/index.js +0 -5
  115. package/lib/generate/generators/index.d.ts +0 -11
  116. package/lib/generate/generators/index.js +0 -27
  117. package/lib/generate/generators/react/connect-react.d.ts +0 -1
  118. package/lib/generate/generators/react/connect-react.js +0 -33
  119. package/lib/generate/generators/react/index.d.ts +0 -1
  120. package/lib/generate/generators/react/index.js +0 -5
  121. package/lib/generate/generators/rest-api/create-rest-api.d.ts +0 -5
  122. package/lib/generate/generators/rest-api/create-rest-api.js +0 -63
  123. package/lib/generate/generators/rest-api/index.d.ts +0 -1
  124. package/lib/generate/generators/rest-api/index.js +0 -5
  125. package/lib/generate/generators/script/create-script.d.ts +0 -3
  126. package/lib/generate/generators/script/create-script.js +0 -15
  127. package/lib/generate/generators/script/index.d.ts +0 -1
  128. package/lib/generate/generators/script/index.js +0 -5
  129. package/lib/generate/generators/service/create-service.d.ts +0 -3
  130. package/lib/generate/generators/service/create-service.js +0 -26
  131. package/lib/generate/generators/service/index.d.ts +0 -1
  132. package/lib/generate/generators/service/index.js +0 -5
  133. package/lib/generate/generators/upgrade/index.d.ts +0 -1
  134. package/lib/generate/generators/upgrade/index.js +0 -5
  135. package/lib/generate/generators/upgrade/upgrade.d.ts +0 -8
  136. package/lib/generate/generators/upgrade/upgrade.js +0 -34
  137. package/lib/generate/generators/vue/connect-vue.d.ts +0 -1
  138. package/lib/generate/generators/vue/connect-vue.js +0 -37
  139. package/lib/generate/generators/vue/index.d.ts +0 -1
  140. package/lib/generate/generators/vue/index.js +0 -5
  141. package/lib/generate/index.d.ts +0 -1
  142. package/lib/generate/index.js +0 -17
  143. package/lib/rmdir/index.d.ts +0 -1
  144. package/lib/rmdir/index.js +0 -5
  145. package/lib/rmdir/rmdir.util.d.ts +0 -8
  146. package/lib/rmdir/rmdir.util.js +0 -24
  147. package/lib/run/get-command-line-arguments.util.d.ts +0 -1
  148. package/lib/run/get-command-line-arguments.util.js +0 -21
  149. package/lib/run/index.d.ts +0 -1
  150. package/lib/run/index.js +0 -5
  151. package/lib/run/run-script.d.ts +0 -7
  152. package/lib/run/run-script.js +0 -76
  153. /package/lib/{generate → commands/generators}/utils/get-names.d.ts +0 -0
  154. /package/lib/{generate → commands/generators}/utils/get-names.js +0 -0
  155. /package/lib/{generate → commands/generators}/utils/index.d.ts +0 -0
  156. /package/lib/{generate → commands/generators}/utils/index.js +0 -0
  157. /package/lib/{generate → commands/generators}/utils/init-git-repo.d.ts +0 -0
  158. /package/lib/{generate → commands/generators}/utils/init-git-repo.js +0 -0
  159. /package/lib/{generate → commands/generators}/utils/install-dependencies.d.ts +0 -0
  160. /package/lib/{generate → commands/generators}/utils/install-dependencies.js +0 -0
  161. /package/lib/{generate → commands/generators}/utils/logger.d.ts +0 -0
  162. /package/lib/{generate → commands/generators}/utils/logger.js +0 -0
  163. /package/lib/{generate → commands/generators}/utils/mkdir-if-does-not-exist.d.ts +0 -0
  164. /package/lib/{generate → commands/generators}/utils/mkdir-if-does-not-exist.js +0 -0
  165. /package/lib/{generate → commands/generators}/utils/rm-dir-and-files-if-exist.d.ts +0 -0
  166. /package/lib/{generate → commands/generators}/utils/rm-dir-and-files-if-exist.js +0 -0
@@ -1,5 +1,7 @@
1
+ import { FileSystemService } from '../file-system';
2
+ import { LoggerService } from '../logger';
1
3
  /**
2
- * Error thrown by the FileSystem which aims to be pretty
4
+ * Error thrown by the Generator which aims to be pretty
3
5
  * printed without the stacktrace.
4
6
  *
5
7
  * @export
@@ -10,21 +12,24 @@ export declare class ClientError extends Error {
10
12
  readonly name = "ClientError";
11
13
  }
12
14
  /**
13
- * This class provides more methods that Node std "fs".
15
+ * This class provides more methods that Node std "generator".
14
16
  * It also allows to create an isolated directory during directory.
15
17
  *
16
18
  * @export
17
- * @class FileSystem
19
+ * @class Generator
18
20
  */
19
- export declare class FileSystem {
21
+ export declare class Generator {
22
+ private readonly fileSystem;
23
+ private readonly logger;
20
24
  currentDir: string;
21
25
  private readonly testDir;
22
26
  private logs;
27
+ constructor(fileSystem: FileSystemService, logger: LoggerService);
23
28
  /**
24
29
  * Do not show create and update logs.
25
30
  *
26
31
  * @returns {this}
27
- * @memberof FileSystem
32
+ * @memberof Generator
28
33
  */
29
34
  hideLogs(): this;
30
35
  /**
@@ -32,7 +37,7 @@ export declare class FileSystem {
32
37
  *
33
38
  * @param {string} path - Relative path of the directory.
34
39
  * @returns {this}
35
- * @memberof FileSystem
40
+ * @memberof Generator
36
41
  */
37
42
  cd(path: string): this;
38
43
  /**
@@ -43,7 +48,7 @@ export declare class FileSystem {
43
48
  * as dependency.
44
49
  *
45
50
  * @returns {this}
46
- * @memberof FileSystem
51
+ * @memberof Generator
47
52
  */
48
53
  cdProjectRootDir(): this;
49
54
  /**
@@ -51,7 +56,7 @@ export declare class FileSystem {
51
56
  *
52
57
  * @param {string} path - The path relative to the client directory.
53
58
  * @returns {boolean}
54
- * @memberof FileSystem
59
+ * @memberof Generator
55
60
  */
56
61
  exists(path: string): boolean;
57
62
  /**
@@ -60,7 +65,7 @@ export declare class FileSystem {
60
65
  *
61
66
  * @param {string} path - The path relative to the client directory.
62
67
  * @returns {this}
63
- * @memberof FileSystem
68
+ * @memberof Generator
64
69
  */
65
70
  ensureDir(path: string): this;
66
71
  /**
@@ -70,7 +75,7 @@ export declare class FileSystem {
70
75
  * @param {boolean} condition - The condition.
71
76
  * @param {string} path - The path relative to the client directory.
72
77
  * @returns {this}
73
- * @memberof FileSystem
78
+ * @memberof Generator
74
79
  */
75
80
  ensureDirOnlyIf(condition: boolean, path: string): this;
76
81
  /**
@@ -78,7 +83,7 @@ export declare class FileSystem {
78
83
  *
79
84
  * @param {string} path - The path relative to the client directory.
80
85
  * @returns {this}
81
- * @memberof FileSystem
86
+ * @memberof Generator
82
87
  */
83
88
  ensureFile(path: string): this;
84
89
  /**
@@ -87,9 +92,9 @@ export declare class FileSystem {
87
92
  * @param {string} src - The source path relative to the `templates/` directory.
88
93
  * @param {string} dest - The destination path relative to the client directory.
89
94
  * @returns {this}
90
- * @memberof FileSystem
95
+ * @memberof Generator
91
96
  */
92
- copy(src: string, dest: string): this;
97
+ copyTemplate(src: string, dest: string): this;
93
98
  /**
94
99
  * Copies a file from the `templates` directory if the condition is true.
95
100
  *
@@ -97,9 +102,9 @@ export declare class FileSystem {
97
102
  * @param {string} src - The source path relative to the `templates/` directory.
98
103
  * @param {string} dest - The destination path relative to the client directory.
99
104
  * @returns {this}
100
- * @memberof FileSystem
105
+ * @memberof Generator
101
106
  */
102
- copyOnlyIf(condition: boolean, src: string, dest: string): this;
107
+ copyTemplateOnlyIf(condition: boolean, src: string, dest: string): this;
103
108
  /**
104
109
  * Copies and renders a template from the `templates` directory.
105
110
  *
@@ -107,7 +112,7 @@ export declare class FileSystem {
107
112
  * @param {string} dest - The destination path relative to the client directory.
108
113
  * @param {*} locals - The template variables.
109
114
  * @returns {this}
110
- * @memberof FileSystem
115
+ * @memberof Generator
111
116
  */
112
117
  render(src: string, dest: string, locals: any): this;
113
118
  /**
@@ -118,7 +123,7 @@ export declare class FileSystem {
118
123
  * @param {string} dest - The destination path relative to the client directory.
119
124
  * @param {*} locals - The template variables.
120
125
  * @returns {this}
121
- * @memberof FileSystem
126
+ * @memberof Generator
122
127
  */
123
128
  renderOnlyIf(condition: boolean, src: string, dest: string, locals: any): this;
124
129
  /**
@@ -127,7 +132,7 @@ export declare class FileSystem {
127
132
  * @param {string} path - The path relative to the client directory.
128
133
  * @param {(content: string) => string} callback - The callback that modifies the content.
129
134
  * @returns {this}
130
- * @memberof FileSystem
135
+ * @memberof Generator
131
136
  */
132
137
  modify(path: string, callback: (content: string) => string): this;
133
138
  /**
@@ -137,7 +142,7 @@ export declare class FileSystem {
137
142
  * @param {string} path - The path relative to the client directory.
138
143
  * @param {(content: string) => string} callback - The callback that modifies the content.
139
144
  * @returns {this}
140
- * @memberof FileSystem
145
+ * @memberof Generator
141
146
  */
142
147
  modifyOnlyfIf(condition: boolean, path: string, callback: (content: string) => string): this;
143
148
  /**
@@ -147,7 +152,7 @@ export declare class FileSystem {
147
152
  * @param {string} specifier - The import specifier.
148
153
  * @param {string} source - The import source.
149
154
  * @returns {this}
150
- * @memberof FileSystem
155
+ * @memberof Generator
151
156
  */
152
157
  addNamedExportIn(path: string, specifier: string, source: string): this;
153
158
  /**
@@ -160,7 +165,7 @@ export declare class FileSystem {
160
165
  * @param {string} specifier - The import specifier.
161
166
  * @param {string} source - The import source.
162
167
  * @returns {this}
163
- * @memberof FileSystem
168
+ * @memberof Generator
164
169
  */
165
170
  addOrExtendNamedImportIn(path: string, specifier: string, source: string, options?: {
166
171
  logs: boolean;
@@ -175,7 +180,7 @@ export declare class FileSystem {
175
180
  * @param {string} propertyName - The property name.
176
181
  * @param {string} element - The item to add to the array.
177
182
  * @returns {this}
178
- * @memberof FileSystem
183
+ * @memberof Generator
179
184
  */
180
185
  addOrExtendClassArrayPropertyIn(path: string, propertyName: string, element: string, options?: {
181
186
  logs: boolean;
@@ -186,7 +191,7 @@ export declare class FileSystem {
186
191
  *
187
192
  * @param {string} name - The name of the dependency.
188
193
  * @returns {boolean}
189
- * @memberof FileSystem
194
+ * @memberof Generator
190
195
  */
191
196
  projectHasDependency(name: string): boolean;
192
197
  /**
@@ -228,24 +233,12 @@ export declare class FileSystem {
228
233
  /************************
229
234
  Testing Methods
230
235
  ************************/
231
- /**
232
- * Creates the test client directory. Sets current directory to none.
233
- *
234
- * @memberof FileSystem
235
- */
236
- setUp(): void;
237
- /**
238
- * Empties and removes the test client directory. Sets current directory to none.
239
- *
240
- * @memberof FileSystem
241
- */
242
- tearDown(): void;
243
236
  /**
244
237
  * Throws an error if the file or directory does not exist.
245
238
  *
246
239
  * @param {string} path - The path relative to the client directory.
247
240
  * @returns {this}
248
- * @memberof FileSystem
241
+ * @memberof Generator
249
242
  */
250
243
  assertExists(path: string): this;
251
244
  /**
@@ -253,14 +246,14 @@ export declare class FileSystem {
253
246
  *
254
247
  * @param {string} path - The path relative to the client directory.
255
248
  * @returns {this}
256
- * @memberof FileSystem
249
+ * @memberof Generator
257
250
  */
258
251
  assertNotExists(path: string): this;
259
252
  /**
260
253
  * Throws an error if the directory is not empty.
261
254
  *
262
255
  * @param {string} path - The path relative to the client directory.
263
- * @memberof FileSystem
256
+ * @memberof Generator
264
257
  */
265
258
  assertEmptyDir(path: string): void;
266
259
  /**
@@ -270,7 +263,7 @@ export declare class FileSystem {
270
263
  * @param {string} expected - The path relative to the `specs/` directory.
271
264
  * @param {{ binary: boolean }} [{ binary }={ binary: true }] - Specify if the file is binary.
272
265
  * @returns {this}
273
- * @memberof FileSystem
266
+ * @memberof Generator
274
267
  */
275
268
  assertEqual(actual: string, expected: string, { binary }?: {
276
269
  binary: boolean;
@@ -281,14 +274,14 @@ export declare class FileSystem {
281
274
  * @param {string} src - The source path relative to the `fixtures/` directory.
282
275
  * @param {string} dest - The destination path relative to the client directory.
283
276
  * @returns {this}
284
- * @memberof FileSystem
277
+ * @memberof Generator
285
278
  */
286
279
  copyFixture(src: string, dest: string): this;
287
280
  /**
288
281
  * Removes a file.
289
282
  *
290
283
  * @param {string} path - The path relative to the client directory.
291
- * @memberof FileSystem
284
+ * @memberof Generator
292
285
  */
293
286
  rmfile(path: string): void;
294
287
  private isTestingEnvironment;