nodefony 7.0.0-beta.2 → 7.0.0-beta.21
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/CHANGELOG.md +534 -8028
- package/README.md +33 -30
- package/autoloader.es6 +46 -48
- package/builder.es6 +66 -76
- package/cli/builder/bundles/bundle.js +57 -63
- package/cli/builder/bundles/controller.js +34 -38
- package/cli/builder/bundles/users-bundle/Command/fixtureTask.js +11 -12
- package/cli/builder/bundles/users-bundle/Command/usersCommand.js +23 -24
- package/cli/builder/bundles/users-bundle/Entity/mongoose/userEntity.js +25 -30
- package/cli/builder/bundles/users-bundle/Entity/sequelize/userEntity.js +42 -31
- package/cli/builder/bundles/users-bundle/Fixtures/users.js +24 -26
- package/cli/builder/bundles/users-bundle/Fixtures/usersFixtures.js +28 -29
- package/cli/builder/bundles/users-bundle/Resources/config/config.js +4 -3
- package/cli/builder/bundles/users-bundle/Resources/config/routing.js +2 -2
- package/cli/builder/bundles/users-bundle/Resources/config/security.js +9 -8
- package/cli/builder/bundles/users-bundle/Resources/config/webpack/webpack.dev.config.js +3 -3
- package/cli/builder/bundles/users-bundle/Resources/config/webpack/webpack.prod.config.js +4 -3
- package/cli/builder/bundles/users-bundle/Resources/config/webpack.config.js +74 -75
- package/cli/builder/bundles/users-bundle/Resources/scss/awesome/font-awesome.config.js +9 -9
- package/cli/builder/bundles/users-bundle/Resources/swagger/openapi/login.js +13 -13
- package/cli/builder/bundles/users-bundle/Resources/swagger/openapi/users.js +14 -14
- package/cli/builder/bundles/users-bundle/controller/api/graphql/graphqlController.js +13 -15
- package/cli/builder/bundles/users-bundle/controller/api/graphql/userResolver.js +29 -29
- package/cli/builder/bundles/users-bundle/controller/api/graphql/usertype.js +2 -2
- package/cli/builder/bundles/users-bundle/controller/api/openapi/loginApiController.js +34 -36
- package/cli/builder/bundles/users-bundle/controller/api/openapi/restUserController.js +32 -36
- package/cli/builder/bundles/users-bundle/controller/loginController.js +30 -34
- package/cli/builder/bundles/users-bundle/controller/usersController.js +54 -60
- package/cli/builder/bundles/users-bundle/package.json +27 -25
- package/cli/builder/bundles/users-bundle/pnpm-lock.yaml +4262 -0
- package/cli/builder/bundles/users-bundle/readme.md +7 -7
- package/cli/builder/bundles/users-bundle/services/usersService.js +97 -102
- package/cli/builder/bundles/users-bundle/src/providers/mongoose/userProvider.js +6 -8
- package/cli/builder/bundles/users-bundle/src/providers/sequelize/userProvider.js +9 -10
- package/cli/builder/bundles/users-bundle/tests/loginTest.js +119 -70
- package/cli/builder/bundles/users-bundle/usersBundle.js +2 -3
- package/cli/builder/microService/microService.js +139 -141
- package/cli/builder/microService/skeletons/package.json +23 -22
- package/cli/builder/project/project.js +228 -181
- package/cli/builder/project/skeletons/README.md +33 -30
- package/cli/builder/project/skeletons/bin/dev-deploy.sh +5 -0
- package/cli/builder/project/skeletons/bin/prod-deploy.sh +3 -0
- package/cli/builder/project/skeletons/config/config.js.skeleton +1 -0
- package/cli/builder/project/skeletons/config/pm2.config.js.skeleton +41 -17
- package/cli/builder/project/skeletons/eslintignore.skeleton +15 -0
- package/cli/builder/project/skeletons/eslintrc.js.skeleton +97 -0
- package/cli/builder/project/skeletons/gitignore.skeleton +1 -0
- package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.37.entity-user.js +137 -0
- package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.38.entity-session.js +97 -0
- package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.39.entity-requests.js +115 -0
- package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.40.entity-jwts.js +97 -0
- package/cli/builder/project/skeletons/migrations/migrations.skeleton.js +0 -2
- package/cli/builder/project/skeletons/package.json.twig +70 -0
- package/cli/builder/react/reactBuilder.js +59 -65
- package/cli/builder/sandbox/sandBoxBuilder.js +132 -134
- package/cli/builder/skeletons/app/appKernel.js +120 -2
- package/cli/builder/skeletons/config/config.js +1 -1
- package/cli/builder/skeletons/config/nodefony/framework-bundle.js +2 -1
- package/cli/builder/skeletons/config/nodefony/http-bundle.js +1 -0
- package/cli/builder/skeletons/config/nodefony/mongoose-bundle.js +38 -12
- package/cli/builder/skeletons/config/nodefony/monitoring-bundle.js +21 -2
- package/cli/builder/skeletons/config/nodefony/sequelize-bundle.js +122 -13
- package/cli/builder/skeletons/package.json.twig +57 -0
- package/cli/builder/skeletons/unittest/testFile.js +44 -45
- package/cli/builder/vue/skeletons/vue.config.js +84 -10
- package/cli/builder/vue/vueBuilder.js +116 -114
- package/cli/generate/generate.es6 +38 -39
- package/cli/install/install.js +45 -58
- package/cli/sequelize/sequelize.js +50 -39
- package/cli/start.js +353 -347
- package/cli/tools/pm2.es6 +55 -57
- package/cli/tools/tools.es6 +36 -37
- package/cli.es6 +280 -228
- package/container.es6 +51 -59
- package/error.es6 +25 -27
- package/fileClass.es6 +53 -55
- package/finder/file.es6 +5 -4
- package/finder/fileResult.es6 +23 -22
- package/finder/finder2.es6 +46 -54
- package/finder.es6 +88 -97
- package/kernel/annotations/annotations.es6 +44 -46
- package/kernel/api/api.es6 +6 -8
- package/kernel/api/graphqlApi.es6 +21 -21
- package/kernel/api/jsonApi.es6 +40 -45
- package/kernel/api/openApi.es6 +9 -11
- package/kernel/api/schemas/openApiSchema.js +61 -32
- package/kernel/babylon.es6 +31 -38
- package/kernel/bundle.es6 +252 -220
- package/kernel/cliKernel.es6 +157 -170
- package/kernel/command.es6 +17 -20
- package/kernel/commands/nodefonyCommand.es6 +111 -58
- package/kernel/commands/tasks/bundlesTask.es6 +14 -19
- package/kernel/controllers/controller.es6 +167 -180
- package/kernel/fixture.es6 +4 -7
- package/kernel/injections/injections.es6 +97 -103
- package/kernel/kernel.es6 +476 -384
- package/kernel/kernelWatcher.es6 +64 -54
- package/kernel/orm/entity.es6 +10 -12
- package/kernel/orm/orm.es6 +68 -48
- package/kernel/reader.es6 +45 -47
- package/kernel/security/encoder.es6 +8 -6
- package/kernel/security/factories/factory.es6 +34 -37
- package/kernel/security/factories/passeportFactory.es6 +13 -14
- package/kernel/security/provider.es6 +11 -13
- package/kernel/security/providers/chainProvider.es6 +13 -28
- package/kernel/security/providers/memoryProvider.es6 +7 -11
- package/kernel/security/providers/providerManager.es6 +11 -14
- package/kernel/security/providers/userEntityProvider.es6 +7 -8
- package/kernel/security/role.es6 +3 -3
- package/kernel/security/secureArea.es6 +143 -149
- package/kernel/security/tokens/token.es6 +30 -32
- package/kernel/security/user.es6 +19 -19
- package/kernel/serviceRealTime.es6 +5 -7
- package/kernel/services/connectionsService.es6 +20 -22
- package/kernel/services/cron/cronService.es6 +14 -16
- package/kernel/task.es6 +20 -26
- package/kernel/templates.es6 +4 -5
- package/kernel/templating/twig.es6 +56 -47
- package/kernel/tests/cliTest.js +7 -11
- package/kernel/tests/containerTest.js +25 -37
- package/kernel/tests/kernelTest.js +9 -16
- package/nodefony.es6 +279 -256
- package/notificationsCenter.es6 +28 -20
- package/package.json +40 -40
- package/protocol.es6 +19 -21
- package/protocols/bayeux.es6 +35 -38
- package/protocols/jsonRpc/jsonrpc.es6 +12 -14
- package/result.es6 +11 -12
- package/service.es6 +62 -62
- package/syslog/pdu.es6 +99 -91
- package/syslog/syslog.es6 +101 -102
- package/watcher.es6 +21 -20
- package/cli/builder/project/skeletons/jshintignore.skeleton +0 -1
- package/cli/builder/project/skeletons/jshintrc.skeleton +0 -60
- package/cli/builder/project/skeletons/package.json.skeleton +0 -52
- package/cli/builder/skeletons/package.json +0 -61
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
class SandBox extends nodefony.Builder {
|
|
2
|
-
constructor(cli, cmd, args, options = {}) {
|
|
2
|
+
constructor (cli, cmd, args, options = {}) {
|
|
3
3
|
super(cli, cmd, args);
|
|
4
4
|
this.sandboxSkeleton = path.resolve(__dirname, "skeletons");
|
|
5
5
|
this.force = true;
|
|
6
6
|
nodefony.extend(true, this.response, {
|
|
7
7
|
addons: {
|
|
8
|
-
webpack:
|
|
8
|
+
webpack: false,
|
|
9
9
|
bootstrap: false,
|
|
10
10
|
command: false,
|
|
11
11
|
unittest: false,
|
|
@@ -17,13 +17,13 @@ class SandBox extends nodefony.Builder {
|
|
|
17
17
|
this.setEnv("development");
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
async interaction() {
|
|
20
|
+
async interaction () {
|
|
21
21
|
this.cli.reset();
|
|
22
22
|
await this.cli.showAsciify("SandBox");
|
|
23
|
-
|
|
24
|
-
type:
|
|
25
|
-
message:
|
|
26
|
-
name:
|
|
23
|
+
const promtOptions = [{
|
|
24
|
+
type: "checkbox",
|
|
25
|
+
message: "Select addons",
|
|
26
|
+
name: "addons",
|
|
27
27
|
pageSize: 10,
|
|
28
28
|
choices: [{
|
|
29
29
|
name: "Annotations",
|
|
@@ -33,7 +33,7 @@ class SandBox extends nodefony.Builder {
|
|
|
33
33
|
name: "Webpack",
|
|
34
34
|
checked: this.response.addons.webpack
|
|
35
35
|
}, {
|
|
36
|
-
name:
|
|
36
|
+
name: "Bootstrap",
|
|
37
37
|
checked: this.response.addons.bootstrap
|
|
38
38
|
}, {
|
|
39
39
|
name: "Command",
|
|
@@ -44,16 +44,16 @@ class SandBox extends nodefony.Builder {
|
|
|
44
44
|
message: "Add Unit Tests Matrice",
|
|
45
45
|
checked: this.response.addons.unittest
|
|
46
46
|
}, {
|
|
47
|
-
name:
|
|
47
|
+
name: "Progressive Web App (PWA) Workbox",
|
|
48
48
|
checked: this.response.addons.workbox
|
|
49
49
|
}, {
|
|
50
|
-
name:
|
|
50
|
+
name: "Build Matrice C++ Binding",
|
|
51
51
|
checked: this.response.addons.binding
|
|
52
52
|
}]
|
|
53
53
|
}];
|
|
54
54
|
return this.cli.prompt(promtOptions)
|
|
55
55
|
.then((response) => {
|
|
56
|
-
|
|
56
|
+
const addons = {
|
|
57
57
|
webpack: false,
|
|
58
58
|
bootstrap: false,
|
|
59
59
|
command: false,
|
|
@@ -65,27 +65,27 @@ class SandBox extends nodefony.Builder {
|
|
|
65
65
|
if (response.addons.length) {
|
|
66
66
|
for (let i = 0; i < response.addons.length; i++) {
|
|
67
67
|
switch (response.addons[i]) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
68
|
+
case "Bootstrap":
|
|
69
|
+
addons.bootstrap = true;
|
|
70
|
+
break;
|
|
71
|
+
case "Annotations":
|
|
72
|
+
addons.annotations = true;
|
|
73
|
+
break;
|
|
74
|
+
case "Command":
|
|
75
|
+
addons.command = true;
|
|
76
|
+
break;
|
|
77
|
+
case "Unit Tests":
|
|
78
|
+
addons.unittest = true;
|
|
79
|
+
break;
|
|
80
|
+
case "Progressive Web App (PWA) Workbox":
|
|
81
|
+
addons.workbox = true;
|
|
82
|
+
break;
|
|
83
|
+
case "Build Matrice C++ Binding":
|
|
84
|
+
addons.binding = true;
|
|
85
|
+
break;
|
|
86
|
+
case "Webpack":
|
|
87
|
+
addons.webpack = true;
|
|
88
|
+
break;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -98,75 +98,74 @@ class SandBox extends nodefony.Builder {
|
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
createBuilder(response) {
|
|
101
|
+
createBuilder (response) {
|
|
102
102
|
switch (this.cli.response.command) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
case "project":
|
|
104
|
+
this.response.packageName = "app";
|
|
105
|
+
this.response.shortName = "app";
|
|
106
|
+
return this.builderProject(response);
|
|
107
|
+
default:
|
|
108
|
+
if (!this.response.bundle) {
|
|
109
|
+
this.cli.response.command = "project";
|
|
110
|
+
return this.createBuilder(response);
|
|
111
|
+
}
|
|
112
|
+
this.response.packageName = this.response.name;
|
|
113
|
+
this.response.shortName = this.response.name;
|
|
114
|
+
return this.builderBundle(response);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
builderProject() {
|
|
118
|
+
builderProject () {
|
|
119
119
|
try {
|
|
120
|
-
|
|
120
|
+
const obj = {
|
|
121
121
|
name: "app",
|
|
122
122
|
type: "directory",
|
|
123
123
|
childs: [{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
124
|
+
name: "package.json",
|
|
125
|
+
type: "file",
|
|
126
|
+
skeleton: path.resolve(this.globalSkeleton, "package.json.twig"),
|
|
127
|
+
params: this.response
|
|
128
|
+
}, {
|
|
129
|
+
name: "appKernel.js",
|
|
130
|
+
type: "file",
|
|
131
|
+
skeleton: path.resolve(this.globalSkeleton, "app", "appKernel.js"),
|
|
132
|
+
params: this.response
|
|
133
|
+
}, {
|
|
134
|
+
name: "Entity",
|
|
135
|
+
type: "directory",
|
|
136
|
+
childs: [{
|
|
137
|
+
name: "sequelize",
|
|
135
138
|
type: "directory",
|
|
136
139
|
childs: [{
|
|
137
|
-
name: "
|
|
138
|
-
type: "
|
|
139
|
-
childs: [{
|
|
140
|
-
name: ".gitignore",
|
|
141
|
-
type: "file"
|
|
142
|
-
}]
|
|
143
|
-
},{
|
|
144
|
-
name: "mongoose",
|
|
145
|
-
type: "directory",
|
|
146
|
-
childs: [{
|
|
147
|
-
name: ".gitignore",
|
|
148
|
-
type: "file"
|
|
149
|
-
}]
|
|
140
|
+
name: ".gitignore",
|
|
141
|
+
type: "file"
|
|
150
142
|
}]
|
|
151
|
-
},{
|
|
152
|
-
name: "
|
|
143
|
+
}, {
|
|
144
|
+
name: "mongoose",
|
|
153
145
|
type: "directory",
|
|
154
146
|
childs: [{
|
|
155
147
|
name: ".gitignore",
|
|
156
148
|
type: "file"
|
|
157
149
|
}]
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
150
|
+
}]
|
|
151
|
+
}, {
|
|
152
|
+
name: "services",
|
|
153
|
+
type: "directory",
|
|
154
|
+
childs: [{
|
|
155
|
+
name: ".gitignore",
|
|
156
|
+
type: "file"
|
|
157
|
+
}]
|
|
158
|
+
},
|
|
159
|
+
this.generateController(),
|
|
160
|
+
this.generateConfig(this.response.addons.webpack, true),
|
|
161
|
+
this.generateRessources(),
|
|
162
|
+
this.generateCommand(),
|
|
163
|
+
this.generateUnitTest()]
|
|
165
164
|
};
|
|
166
165
|
if (this.response.addons.binding) {
|
|
167
166
|
obj.childs.push({
|
|
168
167
|
name: "build",
|
|
169
|
-
type: "directory"
|
|
168
|
+
type: "directory"
|
|
170
169
|
});
|
|
171
170
|
obj.childs.push({
|
|
172
171
|
name: "binding.gyp",
|
|
@@ -183,12 +182,12 @@ class SandBox extends nodefony.Builder {
|
|
|
183
182
|
}
|
|
184
183
|
}
|
|
185
184
|
|
|
186
|
-
builderBundle() {
|
|
187
|
-
|
|
185
|
+
builderBundle () {
|
|
186
|
+
const bundle = [];
|
|
188
187
|
bundle.push({
|
|
189
188
|
name: "package.json",
|
|
190
189
|
type: "file",
|
|
191
|
-
skeleton: path.resolve(this.globalSkeleton, "package.json"),
|
|
190
|
+
skeleton: path.resolve(this.globalSkeleton, "package.json.twig"),
|
|
192
191
|
params: this.response
|
|
193
192
|
});
|
|
194
193
|
bundle.push({
|
|
@@ -203,7 +202,7 @@ class SandBox extends nodefony.Builder {
|
|
|
203
202
|
if (this.response.addons.binding) {
|
|
204
203
|
bundle.push({
|
|
205
204
|
name: "build",
|
|
206
|
-
type: "directory"
|
|
205
|
+
type: "directory"
|
|
207
206
|
});
|
|
208
207
|
bundle.push({
|
|
209
208
|
name: "binding.gyp",
|
|
@@ -223,7 +222,7 @@ class SandBox extends nodefony.Builder {
|
|
|
223
222
|
name: ".gitignore",
|
|
224
223
|
type: "file"
|
|
225
224
|
}]
|
|
226
|
-
},{
|
|
225
|
+
}, {
|
|
227
226
|
name: "mongoose",
|
|
228
227
|
type: "directory",
|
|
229
228
|
childs: [{
|
|
@@ -237,8 +236,8 @@ class SandBox extends nodefony.Builder {
|
|
|
237
236
|
return bundle;
|
|
238
237
|
}
|
|
239
238
|
|
|
240
|
-
generateDoc() {
|
|
241
|
-
|
|
239
|
+
generateDoc () {
|
|
240
|
+
const doc = {
|
|
242
241
|
name: "doc",
|
|
243
242
|
type: "directory",
|
|
244
243
|
childs: []
|
|
@@ -246,8 +245,8 @@ class SandBox extends nodefony.Builder {
|
|
|
246
245
|
return doc;
|
|
247
246
|
}
|
|
248
247
|
|
|
249
|
-
generateConfig(webpack = false, project =false) {
|
|
250
|
-
|
|
248
|
+
generateConfig (webpack = false, project = false) {
|
|
249
|
+
const childs = [{
|
|
251
250
|
name: "config.js",
|
|
252
251
|
type: "file",
|
|
253
252
|
skeleton: path.resolve(this.globalSkeleton, "config", "config.js"),
|
|
@@ -268,7 +267,7 @@ class SandBox extends nodefony.Builder {
|
|
|
268
267
|
path: path.resolve(this.globalSkeleton, "config", "services.js")
|
|
269
268
|
}];
|
|
270
269
|
|
|
271
|
-
if (
|
|
270
|
+
if (project) {
|
|
272
271
|
childs.push({
|
|
273
272
|
name: "nodefony",
|
|
274
273
|
type: "copy",
|
|
@@ -278,10 +277,10 @@ class SandBox extends nodefony.Builder {
|
|
|
278
277
|
}
|
|
279
278
|
});
|
|
280
279
|
}
|
|
281
|
-
|
|
280
|
+
const config = {
|
|
282
281
|
name: "config",
|
|
283
282
|
type: "directory",
|
|
284
|
-
childs
|
|
283
|
+
childs
|
|
285
284
|
};
|
|
286
285
|
if (webpack) {
|
|
287
286
|
config.childs.push({
|
|
@@ -302,8 +301,8 @@ class SandBox extends nodefony.Builder {
|
|
|
302
301
|
return config;
|
|
303
302
|
}
|
|
304
303
|
|
|
305
|
-
generateController(directory = "controller") {
|
|
306
|
-
|
|
304
|
+
generateController (directory = "controller") {
|
|
305
|
+
const controller = {
|
|
307
306
|
name: directory,
|
|
308
307
|
type: "directory",
|
|
309
308
|
childs: []
|
|
@@ -312,7 +311,7 @@ class SandBox extends nodefony.Builder {
|
|
|
312
311
|
if (this.cli.response.command === "project") {
|
|
313
312
|
this.response.controllerName = "appController";
|
|
314
313
|
controller.childs.push({
|
|
315
|
-
name:
|
|
314
|
+
name: "appController.js",
|
|
316
315
|
type: "file",
|
|
317
316
|
skeleton: path.resolve(this.globalSkeleton, "controller", "controllerClass.js"),
|
|
318
317
|
params: this.response
|
|
@@ -331,8 +330,8 @@ class SandBox extends nodefony.Builder {
|
|
|
331
330
|
return controller;
|
|
332
331
|
}
|
|
333
332
|
|
|
334
|
-
generateCommand() {
|
|
335
|
-
|
|
333
|
+
generateCommand () {
|
|
334
|
+
const command = {
|
|
336
335
|
name: "Command",
|
|
337
336
|
type: "directory",
|
|
338
337
|
childs: []
|
|
@@ -346,13 +345,13 @@ class SandBox extends nodefony.Builder {
|
|
|
346
345
|
}
|
|
347
346
|
this.response.commandName = name;
|
|
348
347
|
command.childs.push({
|
|
349
|
-
name: name
|
|
348
|
+
name: `${name}Command.js`,
|
|
350
349
|
type: "file",
|
|
351
350
|
skeleton: path.resolve(this.globalSkeleton, "command", "commandClass.js"),
|
|
352
351
|
params: this.response
|
|
353
352
|
});
|
|
354
353
|
command.childs.push({
|
|
355
|
-
name: name
|
|
354
|
+
name: `${name}Task.js`,
|
|
356
355
|
type: "file",
|
|
357
356
|
skeleton: path.resolve(this.globalSkeleton, "command", "taskClass.js"),
|
|
358
357
|
params: this.response
|
|
@@ -361,8 +360,8 @@ class SandBox extends nodefony.Builder {
|
|
|
361
360
|
return command;
|
|
362
361
|
}
|
|
363
362
|
|
|
364
|
-
generateUnitTest() {
|
|
365
|
-
|
|
363
|
+
generateUnitTest () {
|
|
364
|
+
const unit = {
|
|
366
365
|
name: "tests",
|
|
367
366
|
type: "directory",
|
|
368
367
|
childs: []
|
|
@@ -378,7 +377,7 @@ class SandBox extends nodefony.Builder {
|
|
|
378
377
|
this.response.testName = name;
|
|
379
378
|
if (this.response.addons.unittest) {
|
|
380
379
|
unit.childs.push({
|
|
381
|
-
name: name
|
|
380
|
+
name: `${name}Test.js`,
|
|
382
381
|
type: "file",
|
|
383
382
|
skeleton: path.resolve(this.globalSkeleton, "unittest", "testFile.js"),
|
|
384
383
|
params: this.response
|
|
@@ -387,8 +386,8 @@ class SandBox extends nodefony.Builder {
|
|
|
387
386
|
return unit;
|
|
388
387
|
}
|
|
389
388
|
|
|
390
|
-
generateRessources() {
|
|
391
|
-
|
|
389
|
+
generateRessources () {
|
|
390
|
+
const resources = {
|
|
392
391
|
name: "Resources",
|
|
393
392
|
type: "directory",
|
|
394
393
|
childs: []
|
|
@@ -409,7 +408,7 @@ class SandBox extends nodefony.Builder {
|
|
|
409
408
|
}
|
|
410
409
|
// views
|
|
411
410
|
resources.childs.push(this.generateViews());
|
|
412
|
-
//translations
|
|
411
|
+
// translations
|
|
413
412
|
resources.childs.push({
|
|
414
413
|
name: "translations",
|
|
415
414
|
type: "copy",
|
|
@@ -418,9 +417,9 @@ class SandBox extends nodefony.Builder {
|
|
|
418
417
|
recurse: true
|
|
419
418
|
}
|
|
420
419
|
});
|
|
421
|
-
//public
|
|
420
|
+
// public
|
|
422
421
|
resources.childs.push(this.generatePublic());
|
|
423
|
-
//js
|
|
422
|
+
// js
|
|
424
423
|
resources.childs.push({
|
|
425
424
|
name: "js",
|
|
426
425
|
type: "directory",
|
|
@@ -431,7 +430,7 @@ class SandBox extends nodefony.Builder {
|
|
|
431
430
|
params: this.response
|
|
432
431
|
}]
|
|
433
432
|
});
|
|
434
|
-
//css
|
|
433
|
+
// css
|
|
435
434
|
resources.childs.push(this.generateCss());
|
|
436
435
|
|
|
437
436
|
if (this.response.addons.workbox) {
|
|
@@ -439,7 +438,7 @@ class SandBox extends nodefony.Builder {
|
|
|
439
438
|
name: "templates",
|
|
440
439
|
type: "directory",
|
|
441
440
|
childs: [{
|
|
442
|
-
name:
|
|
441
|
+
name: "index.html.twig",
|
|
443
442
|
type: "file",
|
|
444
443
|
skeleton: path.resolve(this.sandboxSkeleton, "workbox", "templates", "index.html.twig"),
|
|
445
444
|
params: this.response
|
|
@@ -449,7 +448,7 @@ class SandBox extends nodefony.Builder {
|
|
|
449
448
|
name: "workers",
|
|
450
449
|
type: "directory",
|
|
451
450
|
childs: [{
|
|
452
|
-
name:
|
|
451
|
+
name: "service-worker.js",
|
|
453
452
|
type: "file",
|
|
454
453
|
skeleton: path.resolve(this.sandboxSkeleton, "workbox", "workers", "service-worker.js"),
|
|
455
454
|
params: this.response
|
|
@@ -459,8 +458,8 @@ class SandBox extends nodefony.Builder {
|
|
|
459
458
|
return resources;
|
|
460
459
|
}
|
|
461
460
|
|
|
462
|
-
generateViews() {
|
|
463
|
-
|
|
461
|
+
generateViews () {
|
|
462
|
+
const views = {
|
|
464
463
|
name: "views",
|
|
465
464
|
type: "directory",
|
|
466
465
|
childs: [{
|
|
@@ -488,9 +487,9 @@ class SandBox extends nodefony.Builder {
|
|
|
488
487
|
return views;
|
|
489
488
|
}
|
|
490
489
|
|
|
491
|
-
generateCss() {
|
|
490
|
+
generateCss () {
|
|
492
491
|
if (this.response.addons.bootstrap) {
|
|
493
|
-
|
|
492
|
+
const scss = {
|
|
494
493
|
name: "scss",
|
|
495
494
|
type: "directory",
|
|
496
495
|
childs: [{
|
|
@@ -515,23 +514,22 @@ class SandBox extends nodefony.Builder {
|
|
|
515
514
|
params: this.response
|
|
516
515
|
});
|
|
517
516
|
return scss;
|
|
518
|
-
} else {
|
|
519
|
-
let css = {
|
|
520
|
-
name: "css",
|
|
521
|
-
type: "directory",
|
|
522
|
-
childs: [{
|
|
523
|
-
name: this.cli.response.command === "project" ? "app.css" : `${this.response.name}.css`,
|
|
524
|
-
type: "file",
|
|
525
|
-
skeleton: path.resolve(this.sandboxSkeleton, "Resources", "css", "entry.css"),
|
|
526
|
-
params: this.response
|
|
527
|
-
}]
|
|
528
|
-
};
|
|
529
|
-
return css;
|
|
530
517
|
}
|
|
518
|
+
const css = {
|
|
519
|
+
name: "css",
|
|
520
|
+
type: "directory",
|
|
521
|
+
childs: [{
|
|
522
|
+
name: this.cli.response.command === "project" ? "app.css" : `${this.response.name}.css`,
|
|
523
|
+
type: "file",
|
|
524
|
+
skeleton: path.resolve(this.sandboxSkeleton, "Resources", "css", "entry.css"),
|
|
525
|
+
params: this.response
|
|
526
|
+
}]
|
|
527
|
+
};
|
|
528
|
+
return css;
|
|
531
529
|
}
|
|
532
530
|
|
|
533
|
-
generatePublic() {
|
|
534
|
-
|
|
531
|
+
generatePublic () {
|
|
532
|
+
const publicWeb = {
|
|
535
533
|
name: "public",
|
|
536
534
|
type: "directory",
|
|
537
535
|
childs: []
|
|
@@ -539,7 +537,7 @@ class SandBox extends nodefony.Builder {
|
|
|
539
537
|
publicWeb.childs.push({
|
|
540
538
|
name: "favicon.ico",
|
|
541
539
|
type: "copy",
|
|
542
|
-
path: path.resolve(this.globalSkeleton, "Resources", "public", "favicon.ico")
|
|
540
|
+
path: path.resolve(this.globalSkeleton, "Resources", "public", "favicon.ico")
|
|
543
541
|
});
|
|
544
542
|
if (this.response.addons.workbox) {
|
|
545
543
|
publicWeb.childs.push({
|
|
@@ -555,7 +553,7 @@ class SandBox extends nodefony.Builder {
|
|
|
555
553
|
childs: [{
|
|
556
554
|
name: this.cli.response.command === "project" ? "app-logo.png" : `${this.response.shortName}-logo.png`,
|
|
557
555
|
type: "copy",
|
|
558
|
-
path: path.resolve(this.globalSkeleton, "Resources", "public", "images", "app-logo.png")
|
|
556
|
+
path: path.resolve(this.globalSkeleton, "Resources", "public", "images", "app-logo.png")
|
|
559
557
|
}]
|
|
560
558
|
});
|
|
561
559
|
if (!this.response.addons.webpack) {
|
|
@@ -587,8 +585,8 @@ class SandBox extends nodefony.Builder {
|
|
|
587
585
|
return publicWeb;
|
|
588
586
|
}
|
|
589
587
|
|
|
590
|
-
generateBinding() {
|
|
591
|
-
|
|
588
|
+
generateBinding () {
|
|
589
|
+
const src = {
|
|
592
590
|
name: "src",
|
|
593
591
|
type: "directory",
|
|
594
592
|
childs: []
|
|
@@ -598,7 +596,7 @@ class SandBox extends nodefony.Builder {
|
|
|
598
596
|
name: "addon",
|
|
599
597
|
type: "directory",
|
|
600
598
|
childs: [{
|
|
601
|
-
name: this.response.shortName
|
|
599
|
+
name: `${this.response.shortName}.cc`,
|
|
602
600
|
type: "file",
|
|
603
601
|
skeleton: path.resolve(this.globalSkeleton, "binding", "binding.cc"),
|
|
604
602
|
params: this.response
|
|
@@ -2,14 +2,132 @@
|
|
|
2
2
|
* ENTRY POINT FRAMEWORK APP KERNEL
|
|
3
3
|
*/
|
|
4
4
|
"use strict;";
|
|
5
|
+
const blue = clc.blueBright.bold;
|
|
6
|
+
const green = clc.green;
|
|
7
|
+
const yellow = clc.yellow.bold;
|
|
8
|
+
const magenta = clc.magenta.bold;
|
|
9
|
+
const reset = clc.reset; // '\x1b[0m';
|
|
10
|
+
|
|
5
11
|
module.exports = class appKernel extends nodefony.kernel {
|
|
6
12
|
constructor(environment, cli, settings) {
|
|
7
13
|
// kernel constructor
|
|
8
14
|
super(environment, cli, settings);
|
|
9
|
-
|
|
15
|
+
this.appEnvironment = this.getAppEnvironment()
|
|
16
|
+
if (this.appEnvironment.environment === 'development') {
|
|
17
|
+
this.once("onPreRegister", () => {
|
|
18
|
+
/*if (this.type === "SERVER") {
|
|
19
|
+
return this.showBanner()
|
|
20
|
+
}*/
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
{% if addons.workbox %}
|
|
24
|
+
this.on("onServeStatic", (res, path, name) => {
|
|
10
25
|
if (name === "web" && path.match(/.*service-worker.js$/)){
|
|
11
26
|
res.setHeader('Service-Worker-Allowed', '/');
|
|
12
27
|
}
|
|
13
|
-
});
|
|
28
|
+
});
|
|
29
|
+
{% endif %}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
showBanner() {
|
|
33
|
+
let banner = `App Environment`
|
|
34
|
+
for (let ele in this.appEnvironment) {
|
|
35
|
+
let module = this.appEnvironment[ele]
|
|
36
|
+
switch (ele) {
|
|
37
|
+
case "environment":
|
|
38
|
+
banner = ` ${magenta(" Environement")} : ${green(module)}`;
|
|
39
|
+
console.log(banner)
|
|
40
|
+
this.cli.blankLine();
|
|
41
|
+
break;
|
|
42
|
+
case "vault":
|
|
43
|
+
banner = `Module : ${green(ele)} Vault : ${blue(module.active)}`;
|
|
44
|
+
this.log(banner);
|
|
45
|
+
break
|
|
46
|
+
default:
|
|
47
|
+
banner = `Module : ${green(ele)} `;
|
|
48
|
+
if (module.vault) {
|
|
49
|
+
banner += `Vault : ${blue(module.vault.active)}`
|
|
50
|
+
}
|
|
51
|
+
this.log(banner);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
this.cli.blankLine();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
getAppEnvironment() {
|
|
58
|
+
const environment = this.getVariableEnvironment()
|
|
59
|
+
return {
|
|
60
|
+
environment: environment,
|
|
61
|
+
database: this.getDatabaseEnvironment(environment),
|
|
62
|
+
vault: this.getVaultEnvironment(environment)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getVariableEnvironment() {
|
|
67
|
+
if (process.env.NODEFONY_ENV_APP) {
|
|
68
|
+
return process.env.NODEFONY_ENV_APP
|
|
69
|
+
}
|
|
70
|
+
const production = process.env.NODE_ENV === "production"
|
|
71
|
+
const development = process.env.NODE_ENV === "development"
|
|
72
|
+
if (production) {
|
|
73
|
+
return 'production'
|
|
74
|
+
}
|
|
75
|
+
if (development) {
|
|
76
|
+
return 'development'
|
|
77
|
+
}
|
|
78
|
+
return 'development'
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* VAULT BUNDLE */
|
|
82
|
+
getVaultEnvironment(environment) {
|
|
83
|
+
switch (environment) {
|
|
84
|
+
case 'production':
|
|
85
|
+
return {
|
|
86
|
+
active: true,
|
|
87
|
+
prepareAuth: false,
|
|
88
|
+
getVaultCredentialsApprole: this.getVaultCredentialsApprole(environment)
|
|
89
|
+
}
|
|
90
|
+
case 'development':
|
|
91
|
+
default:
|
|
92
|
+
return {
|
|
93
|
+
active: true,
|
|
94
|
+
prepareAuth: true,
|
|
95
|
+
getVaultCredentialsApprole: this.getVaultCredentialsApprole(environment)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
getDatabaseEnvironment(environment) {
|
|
100
|
+
switch (environment) {
|
|
101
|
+
case 'production':
|
|
102
|
+
return {
|
|
103
|
+
vault: {
|
|
104
|
+
active: true,
|
|
105
|
+
path: "nodefony/data/postgresql/connector/nodefony"
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
case 'development':
|
|
109
|
+
default:
|
|
110
|
+
return {
|
|
111
|
+
vault: {
|
|
112
|
+
active: false,
|
|
113
|
+
path: "nodefony/data/sqlite/connector/nodefony"
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
getVaultCredentialsApprole(environment) {
|
|
120
|
+
switch (environment) {
|
|
121
|
+
case 'production':
|
|
122
|
+
return async () => {
|
|
123
|
+
return {
|
|
124
|
+
role_id: "",
|
|
125
|
+
secret_id: ""
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
case 'development':
|
|
129
|
+
default:
|
|
130
|
+
return null
|
|
131
|
+
}
|
|
14
132
|
}
|
|
15
133
|
};
|
|
@@ -74,6 +74,7 @@ module.exports = {
|
|
|
74
74
|
port: kernel.settings.system.httpsPort
|
|
75
75
|
},
|
|
76
76
|
session: {
|
|
77
|
+
applyTransaction: true, // sequelize transaction session entity (no effective for sqlite)
|
|
77
78
|
start: false, // false || true || Session Context Name (waf)
|
|
78
79
|
name: "nodefony",
|
|
79
80
|
handler: "orm", // files | orm | memcached
|