@foal/cli 5.1.3 → 5.2.1
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/lib/cli.d.ts +6 -0
- package/lib/cli.js +208 -0
- package/lib/commands/connectors/connect-angular/connect-angular-command.service.d.ts +15 -0
- package/lib/commands/connectors/connect-angular/connect-angular-command.service.js +66 -0
- package/lib/commands/connectors/connect-angular/index.d.ts +1 -0
- package/lib/commands/connectors/connect-angular/index.js +5 -0
- package/lib/commands/connectors/connect-react/connect-react-command.service.d.ts +15 -0
- package/lib/commands/connectors/connect-react/connect-react-command.service.js +47 -0
- package/lib/commands/connectors/connect-react/index.d.ts +1 -0
- package/lib/commands/connectors/connect-react/index.js +5 -0
- package/lib/commands/connectors/connect-vue/connect-vue-command.service.d.ts +15 -0
- package/lib/commands/connectors/connect-vue/connect-vue-command.service.js +51 -0
- package/lib/commands/connectors/connect-vue/index.d.ts +1 -0
- package/lib/commands/connectors/connect-vue/index.js +5 -0
- package/lib/commands/connectors/index.d.ts +3 -0
- package/lib/commands/connectors/index.js +9 -0
- package/lib/commands/create-secret/create-secret-command.service.d.ts +7 -0
- package/lib/commands/create-secret/create-secret-command.service.js +16 -0
- package/lib/commands/create-secret/index.d.ts +1 -0
- package/lib/commands/create-secret/index.js +5 -0
- package/lib/commands/generators/create-app/create-app-command.service.d.ts +25 -0
- package/lib/commands/generators/create-app/create-app-command.service.js +151 -0
- package/lib/commands/generators/create-app/index.d.ts +1 -0
- package/lib/commands/generators/create-app/index.js +5 -0
- package/lib/commands/generators/create-controller/create-controller-command.service.d.ts +19 -0
- package/lib/commands/generators/create-controller/create-controller-command.service.js +53 -0
- package/lib/commands/generators/create-controller/index.d.ts +1 -0
- package/lib/commands/generators/create-controller/index.js +5 -0
- package/lib/commands/generators/create-entity/create-entity-command.service.d.ts +17 -0
- package/lib/commands/generators/create-entity/create-entity-command.service.js +42 -0
- package/lib/commands/generators/create-entity/index.d.ts +1 -0
- package/lib/commands/generators/create-entity/index.js +5 -0
- package/lib/commands/generators/create-hook/create-hook-command.service.d.ts +17 -0
- package/lib/commands/generators/create-hook/create-hook-command.service.js +40 -0
- package/lib/commands/generators/create-hook/index.d.ts +1 -0
- package/lib/commands/generators/create-hook/index.js +5 -0
- package/lib/commands/generators/create-rest-api/create-rest-api-command.service.d.ts +21 -0
- package/lib/commands/generators/create-rest-api/create-rest-api-command.service.js +80 -0
- package/lib/commands/generators/create-rest-api/index.d.ts +1 -0
- package/lib/commands/generators/create-rest-api/index.js +5 -0
- package/lib/commands/generators/create-script/create-script-command.service.d.ts +17 -0
- package/lib/commands/generators/create-script/create-script-command.service.js +28 -0
- package/lib/commands/generators/create-script/index.d.ts +1 -0
- package/lib/commands/generators/create-script/index.js +5 -0
- package/lib/commands/generators/create-service/create-service-command.service.d.ts +17 -0
- package/lib/commands/generators/create-service/create-service-command.service.js +40 -0
- package/lib/commands/generators/create-service/index.d.ts +1 -0
- package/lib/commands/generators/create-service/index.js +5 -0
- package/lib/commands/generators/index.d.ts +7 -0
- package/lib/commands/generators/index.js +17 -0
- package/lib/commands/index.d.ts +6 -0
- package/lib/commands/index.js +23 -0
- package/lib/commands/rmdir/index.d.ts +1 -0
- package/lib/commands/rmdir/index.js +5 -0
- package/lib/commands/rmdir/rmdir-command.service.d.ts +12 -0
- package/lib/commands/rmdir/rmdir-command.service.js +29 -0
- package/lib/commands/run-script/index.d.ts +1 -0
- package/lib/commands/run-script/index.js +5 -0
- package/lib/commands/run-script/run-script-command.service.d.ts +10 -0
- package/lib/commands/run-script/run-script-command.service.js +79 -0
- package/lib/commands/upgrade/index.d.ts +1 -0
- package/lib/commands/upgrade/index.js +5 -0
- package/lib/commands/upgrade/upgrade-command.service.d.ts +24 -0
- package/lib/commands/upgrade/upgrade-command.service.js +49 -0
- package/lib/index.d.ts +1 -6
- package/lib/index.js +1 -157
- package/lib/services/crypto/crypto.service.d.ts +11 -0
- package/lib/services/crypto/crypto.service.js +20 -0
- package/lib/services/crypto/index.d.ts +1 -0
- package/lib/services/crypto/index.js +5 -0
- package/lib/services/file-system/file-system.service.d.ts +24 -0
- package/lib/services/file-system/file-system.service.js +89 -0
- package/lib/services/file-system/index.d.ts +1 -0
- package/lib/services/file-system/index.js +5 -0
- package/lib/{generate/file-system.d.ts → services/generator/generator.d.ts} +34 -41
- package/lib/{generate/file-system.js → services/generator/generator.js} +82 -112
- package/lib/services/generator/index.d.ts +1 -0
- package/lib/services/generator/index.js +6 -0
- package/lib/services/index.d.ts +5 -0
- package/lib/services/index.js +14 -0
- package/lib/services/logger/index.d.ts +1 -0
- package/lib/services/logger/index.js +5 -0
- package/lib/services/logger/logger.service.d.ts +8 -0
- package/lib/services/logger/logger.service.js +39 -0
- package/lib/services/util/index.d.ts +1 -0
- package/lib/services/util/index.js +5 -0
- package/lib/services/util/util.service.d.ts +12 -0
- package/lib/services/util/util.service.js +33 -0
- package/package.json +6 -9
- package/templates/file-system/test-template.txt +1 -0
- package/lib/create-secret/create-secret.d.ts +0 -7
- package/lib/create-secret/create-secret.js +0 -15
- package/lib/create-secret/index.d.ts +0 -1
- package/lib/create-secret/index.js +0 -5
- package/lib/generate/generators/angular/connect-angular.d.ts +0 -1
- package/lib/generate/generators/angular/connect-angular.js +0 -52
- package/lib/generate/generators/angular/index.d.ts +0 -1
- package/lib/generate/generators/angular/index.js +0 -5
- package/lib/generate/generators/app/create-app.d.ts +0 -7
- package/lib/generate/generators/app/create-app.js +0 -134
- package/lib/generate/generators/app/index.d.ts +0 -1
- package/lib/generate/generators/app/index.js +0 -5
- package/lib/generate/generators/controller/create-controller.d.ts +0 -4
- package/lib/generate/generators/controller/create-controller.js +0 -39
- package/lib/generate/generators/controller/index.d.ts +0 -1
- package/lib/generate/generators/controller/index.js +0 -5
- package/lib/generate/generators/entity/create-entity.d.ts +0 -3
- package/lib/generate/generators/entity/create-entity.js +0 -28
- package/lib/generate/generators/entity/index.d.ts +0 -1
- package/lib/generate/generators/entity/index.js +0 -5
- package/lib/generate/generators/hook/create-hook.d.ts +0 -3
- package/lib/generate/generators/hook/create-hook.js +0 -26
- package/lib/generate/generators/hook/index.d.ts +0 -1
- package/lib/generate/generators/hook/index.js +0 -5
- package/lib/generate/generators/index.d.ts +0 -11
- package/lib/generate/generators/index.js +0 -27
- package/lib/generate/generators/react/connect-react.d.ts +0 -1
- package/lib/generate/generators/react/connect-react.js +0 -33
- package/lib/generate/generators/react/index.d.ts +0 -1
- package/lib/generate/generators/react/index.js +0 -5
- package/lib/generate/generators/rest-api/create-rest-api.d.ts +0 -5
- package/lib/generate/generators/rest-api/create-rest-api.js +0 -63
- package/lib/generate/generators/rest-api/index.d.ts +0 -1
- package/lib/generate/generators/rest-api/index.js +0 -5
- package/lib/generate/generators/script/create-script.d.ts +0 -3
- package/lib/generate/generators/script/create-script.js +0 -15
- package/lib/generate/generators/script/index.d.ts +0 -1
- package/lib/generate/generators/script/index.js +0 -5
- package/lib/generate/generators/service/create-service.d.ts +0 -3
- package/lib/generate/generators/service/create-service.js +0 -26
- package/lib/generate/generators/service/index.d.ts +0 -1
- package/lib/generate/generators/service/index.js +0 -5
- package/lib/generate/generators/upgrade/index.d.ts +0 -1
- package/lib/generate/generators/upgrade/index.js +0 -5
- package/lib/generate/generators/upgrade/upgrade.d.ts +0 -8
- package/lib/generate/generators/upgrade/upgrade.js +0 -34
- package/lib/generate/generators/vue/connect-vue.d.ts +0 -1
- package/lib/generate/generators/vue/connect-vue.js +0 -37
- package/lib/generate/generators/vue/index.d.ts +0 -1
- package/lib/generate/generators/vue/index.js +0 -5
- package/lib/generate/index.d.ts +0 -1
- package/lib/generate/index.js +0 -17
- package/lib/rmdir/index.d.ts +0 -1
- package/lib/rmdir/index.js +0 -5
- package/lib/rmdir/rmdir.util.d.ts +0 -8
- package/lib/rmdir/rmdir.util.js +0 -24
- package/lib/run/get-command-line-arguments.util.d.ts +0 -1
- package/lib/run/get-command-line-arguments.util.js +0 -21
- package/lib/run/index.d.ts +0 -1
- package/lib/run/index.js +0 -5
- package/lib/run/run-script.d.ts +0 -7
- package/lib/run/run-script.js +0 -76
- /package/lib/{generate → commands/generators}/utils/get-names.d.ts +0 -0
- /package/lib/{generate → commands/generators}/utils/get-names.js +0 -0
- /package/lib/{generate → commands/generators}/utils/index.d.ts +0 -0
- /package/lib/{generate → commands/generators}/utils/index.js +0 -0
- /package/lib/{generate → commands/generators}/utils/init-git-repo.d.ts +0 -0
- /package/lib/{generate → commands/generators}/utils/init-git-repo.js +0 -0
- /package/lib/{generate → commands/generators}/utils/install-dependencies.d.ts +0 -0
- /package/lib/{generate → commands/generators}/utils/install-dependencies.js +0 -0
- /package/lib/{generate → commands/generators}/utils/logger.d.ts +0 -0
- /package/lib/{generate → commands/generators}/utils/logger.js +0 -0
- /package/lib/{generate → commands/generators}/utils/mkdir-if-does-not-exist.d.ts +0 -0
- /package/lib/{generate → commands/generators}/utils/mkdir-if-does-not-exist.js +0 -0
- /package/lib/{generate → commands/generators}/utils/rm-dir-and-files-if-exist.d.ts +0 -0
- /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
|
|
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 "
|
|
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
|
|
19
|
+
* @class Generator
|
|
18
20
|
*/
|
|
19
|
-
export declare class
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
95
|
+
* @memberof Generator
|
|
91
96
|
*/
|
|
92
|
-
|
|
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
|
|
105
|
+
* @memberof Generator
|
|
101
106
|
*/
|
|
102
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
284
|
+
* @memberof Generator
|
|
292
285
|
*/
|
|
293
286
|
rmfile(path: string): void;
|
|
294
287
|
private isTestingEnvironment;
|