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.
Files changed (136) hide show
  1. package/CHANGELOG.md +534 -8028
  2. package/README.md +33 -30
  3. package/autoloader.es6 +46 -48
  4. package/builder.es6 +66 -76
  5. package/cli/builder/bundles/bundle.js +57 -63
  6. package/cli/builder/bundles/controller.js +34 -38
  7. package/cli/builder/bundles/users-bundle/Command/fixtureTask.js +11 -12
  8. package/cli/builder/bundles/users-bundle/Command/usersCommand.js +23 -24
  9. package/cli/builder/bundles/users-bundle/Entity/mongoose/userEntity.js +25 -30
  10. package/cli/builder/bundles/users-bundle/Entity/sequelize/userEntity.js +42 -31
  11. package/cli/builder/bundles/users-bundle/Fixtures/users.js +24 -26
  12. package/cli/builder/bundles/users-bundle/Fixtures/usersFixtures.js +28 -29
  13. package/cli/builder/bundles/users-bundle/Resources/config/config.js +4 -3
  14. package/cli/builder/bundles/users-bundle/Resources/config/routing.js +2 -2
  15. package/cli/builder/bundles/users-bundle/Resources/config/security.js +9 -8
  16. package/cli/builder/bundles/users-bundle/Resources/config/webpack/webpack.dev.config.js +3 -3
  17. package/cli/builder/bundles/users-bundle/Resources/config/webpack/webpack.prod.config.js +4 -3
  18. package/cli/builder/bundles/users-bundle/Resources/config/webpack.config.js +74 -75
  19. package/cli/builder/bundles/users-bundle/Resources/scss/awesome/font-awesome.config.js +9 -9
  20. package/cli/builder/bundles/users-bundle/Resources/swagger/openapi/login.js +13 -13
  21. package/cli/builder/bundles/users-bundle/Resources/swagger/openapi/users.js +14 -14
  22. package/cli/builder/bundles/users-bundle/controller/api/graphql/graphqlController.js +13 -15
  23. package/cli/builder/bundles/users-bundle/controller/api/graphql/userResolver.js +29 -29
  24. package/cli/builder/bundles/users-bundle/controller/api/graphql/usertype.js +2 -2
  25. package/cli/builder/bundles/users-bundle/controller/api/openapi/loginApiController.js +34 -36
  26. package/cli/builder/bundles/users-bundle/controller/api/openapi/restUserController.js +32 -36
  27. package/cli/builder/bundles/users-bundle/controller/loginController.js +30 -34
  28. package/cli/builder/bundles/users-bundle/controller/usersController.js +54 -60
  29. package/cli/builder/bundles/users-bundle/package.json +27 -25
  30. package/cli/builder/bundles/users-bundle/pnpm-lock.yaml +4262 -0
  31. package/cli/builder/bundles/users-bundle/readme.md +7 -7
  32. package/cli/builder/bundles/users-bundle/services/usersService.js +97 -102
  33. package/cli/builder/bundles/users-bundle/src/providers/mongoose/userProvider.js +6 -8
  34. package/cli/builder/bundles/users-bundle/src/providers/sequelize/userProvider.js +9 -10
  35. package/cli/builder/bundles/users-bundle/tests/loginTest.js +119 -70
  36. package/cli/builder/bundles/users-bundle/usersBundle.js +2 -3
  37. package/cli/builder/microService/microService.js +139 -141
  38. package/cli/builder/microService/skeletons/package.json +23 -22
  39. package/cli/builder/project/project.js +228 -181
  40. package/cli/builder/project/skeletons/README.md +33 -30
  41. package/cli/builder/project/skeletons/bin/dev-deploy.sh +5 -0
  42. package/cli/builder/project/skeletons/bin/prod-deploy.sh +3 -0
  43. package/cli/builder/project/skeletons/config/config.js.skeleton +1 -0
  44. package/cli/builder/project/skeletons/config/pm2.config.js.skeleton +41 -17
  45. package/cli/builder/project/skeletons/eslintignore.skeleton +15 -0
  46. package/cli/builder/project/skeletons/eslintrc.js.skeleton +97 -0
  47. package/cli/builder/project/skeletons/gitignore.skeleton +1 -0
  48. package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.37.entity-user.js +137 -0
  49. package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.38.entity-session.js +97 -0
  50. package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.39.entity-requests.js +115 -0
  51. package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.40.entity-jwts.js +97 -0
  52. package/cli/builder/project/skeletons/migrations/migrations.skeleton.js +0 -2
  53. package/cli/builder/project/skeletons/package.json.twig +70 -0
  54. package/cli/builder/react/reactBuilder.js +59 -65
  55. package/cli/builder/sandbox/sandBoxBuilder.js +132 -134
  56. package/cli/builder/skeletons/app/appKernel.js +120 -2
  57. package/cli/builder/skeletons/config/config.js +1 -1
  58. package/cli/builder/skeletons/config/nodefony/framework-bundle.js +2 -1
  59. package/cli/builder/skeletons/config/nodefony/http-bundle.js +1 -0
  60. package/cli/builder/skeletons/config/nodefony/mongoose-bundle.js +38 -12
  61. package/cli/builder/skeletons/config/nodefony/monitoring-bundle.js +21 -2
  62. package/cli/builder/skeletons/config/nodefony/sequelize-bundle.js +122 -13
  63. package/cli/builder/skeletons/package.json.twig +57 -0
  64. package/cli/builder/skeletons/unittest/testFile.js +44 -45
  65. package/cli/builder/vue/skeletons/vue.config.js +84 -10
  66. package/cli/builder/vue/vueBuilder.js +116 -114
  67. package/cli/generate/generate.es6 +38 -39
  68. package/cli/install/install.js +45 -58
  69. package/cli/sequelize/sequelize.js +50 -39
  70. package/cli/start.js +353 -347
  71. package/cli/tools/pm2.es6 +55 -57
  72. package/cli/tools/tools.es6 +36 -37
  73. package/cli.es6 +280 -228
  74. package/container.es6 +51 -59
  75. package/error.es6 +25 -27
  76. package/fileClass.es6 +53 -55
  77. package/finder/file.es6 +5 -4
  78. package/finder/fileResult.es6 +23 -22
  79. package/finder/finder2.es6 +46 -54
  80. package/finder.es6 +88 -97
  81. package/kernel/annotations/annotations.es6 +44 -46
  82. package/kernel/api/api.es6 +6 -8
  83. package/kernel/api/graphqlApi.es6 +21 -21
  84. package/kernel/api/jsonApi.es6 +40 -45
  85. package/kernel/api/openApi.es6 +9 -11
  86. package/kernel/api/schemas/openApiSchema.js +61 -32
  87. package/kernel/babylon.es6 +31 -38
  88. package/kernel/bundle.es6 +252 -220
  89. package/kernel/cliKernel.es6 +157 -170
  90. package/kernel/command.es6 +17 -20
  91. package/kernel/commands/nodefonyCommand.es6 +111 -58
  92. package/kernel/commands/tasks/bundlesTask.es6 +14 -19
  93. package/kernel/controllers/controller.es6 +167 -180
  94. package/kernel/fixture.es6 +4 -7
  95. package/kernel/injections/injections.es6 +97 -103
  96. package/kernel/kernel.es6 +476 -384
  97. package/kernel/kernelWatcher.es6 +64 -54
  98. package/kernel/orm/entity.es6 +10 -12
  99. package/kernel/orm/orm.es6 +68 -48
  100. package/kernel/reader.es6 +45 -47
  101. package/kernel/security/encoder.es6 +8 -6
  102. package/kernel/security/factories/factory.es6 +34 -37
  103. package/kernel/security/factories/passeportFactory.es6 +13 -14
  104. package/kernel/security/provider.es6 +11 -13
  105. package/kernel/security/providers/chainProvider.es6 +13 -28
  106. package/kernel/security/providers/memoryProvider.es6 +7 -11
  107. package/kernel/security/providers/providerManager.es6 +11 -14
  108. package/kernel/security/providers/userEntityProvider.es6 +7 -8
  109. package/kernel/security/role.es6 +3 -3
  110. package/kernel/security/secureArea.es6 +143 -149
  111. package/kernel/security/tokens/token.es6 +30 -32
  112. package/kernel/security/user.es6 +19 -19
  113. package/kernel/serviceRealTime.es6 +5 -7
  114. package/kernel/services/connectionsService.es6 +20 -22
  115. package/kernel/services/cron/cronService.es6 +14 -16
  116. package/kernel/task.es6 +20 -26
  117. package/kernel/templates.es6 +4 -5
  118. package/kernel/templating/twig.es6 +56 -47
  119. package/kernel/tests/cliTest.js +7 -11
  120. package/kernel/tests/containerTest.js +25 -37
  121. package/kernel/tests/kernelTest.js +9 -16
  122. package/nodefony.es6 +279 -256
  123. package/notificationsCenter.es6 +28 -20
  124. package/package.json +40 -40
  125. package/protocol.es6 +19 -21
  126. package/protocols/bayeux.es6 +35 -38
  127. package/protocols/jsonRpc/jsonrpc.es6 +12 -14
  128. package/result.es6 +11 -12
  129. package/service.es6 +62 -62
  130. package/syslog/pdu.es6 +99 -91
  131. package/syslog/syslog.es6 +101 -102
  132. package/watcher.es6 +21 -20
  133. package/cli/builder/project/skeletons/jshintignore.skeleton +0 -1
  134. package/cli/builder/project/skeletons/jshintrc.skeleton +0 -60
  135. package/cli/builder/project/skeletons/package.json.skeleton +0 -52
  136. package/cli/builder/skeletons/package.json +0 -61
@@ -1,13 +1,13 @@
1
1
  <p align="center">
2
2
  <img src="https://github.com/nodefony/nodefony/raw/master/src/nodefony/bundles/framework-bundle/Resources/public/images/nodefony-logo.png"><br>
3
3
  </p>
4
- <h1 align="center">NODEFONY V6</h1>
4
+ <h1 align="center">NODEFONY V7</h1>
5
5
 
6
6
  [![npm package](https://nodei.co/npm/nodefony.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/nodefony)
7
7
 
8
8
  [![Issues Status](https://img.shields.io/github/issues/nodefony/nodefony.svg)](https://github.com/nodefony/nodefony/issues) [![Build Status](https://github.com/nodefony/nodefony/workflows/nodefony/badge.svg)](https://github.com/nodefony/nodefony/actions) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/495/badge)](https://bestpractices.coreinfrastructure.org/projects/495)
9
9
 
10
- Nodefony is Node.js full-stack web framework.
10
+ Nodefony is Node.js full-stack web framework.
11
11
 
12
12
  Nodefony can be used to develop a complete solution to create a Fullstack Web Application, Secure Api, or Microservices.
13
13
 
@@ -64,7 +64,7 @@ Nodefony can be used to develop a complete solution to create a Fullstack Web Ap
64
64
  - [Passport](http://passportjs.org/) Simple, unobtrusive authentication for Node.js .
65
65
  - ~~[Angular](https://github.com/angular/angular-cli) Experimental Bundle Generator ( Angular cli no longer allows the ejection of a webpack config)~~
66
66
 
67
- **Nodefony 6 adds the following features** :
67
+ **Nodefony 7 adds the following features** :
68
68
 
69
69
  - [React](https://github.com/facebookincubator/create-react-app) Experimental Bundle Generator ( Now an React Project can be merge into a Nodefony Bundle )
70
70
  - [Vue.js](https://vuejs.org) Experimental Bundle Generator ( Now an Vue.js Project can be merge into a Nodefony Bundle )
@@ -74,10 +74,12 @@ Nodefony can be used to develop a complete solution to create a Fullstack Web Ap
74
74
 
75
75
  Evolution priorities for the next version will focus on robustness, unit testing, documentation and security.
76
76
 
77
+ You can follow Nodefony build with github actions at **<https://github.com/nodefony/nodefony/actions>**
77
78
 
78
- #### Nodefony is ported with ECMAScript 6 ( Class, Inheritance ).
79
+ ## Nodefony implement modules with CommonJS and ECMAScript 6 ( Class, Inheritance ).
80
+ The development framework will not be ported to typescript, but will wait for the version with type syntax in Emacsript
79
81
 
80
- You can follow Nodefony build with github actions at **<https://github.com/nodefony/nodefony/actions>**
82
+ **[proposal-type-annotations](https://github.com/tc39/proposal-type-annotations)**
81
83
 
82
84
  ## **Resources for Newcomers**
83
85
 
@@ -97,7 +99,7 @@ You can follow Nodefony build with github actions at **<https://github.com/nodef
97
99
 
98
100
  - **[Node.js](https://nodejs.org/)** ® is a Platform built on Chrome's JavaScript runtime ( >= 8 )
99
101
 
100
- - **[npm](https://www.npmjs.com/)** or **[yarn](https://yarnpkg.com/lang/en/)** Packages Manager for javascript application
102
+ - **[npm](https://www.npmjs.com/)** or **[yarn](https://yarnpkg.com/lang/en/)** or **[pnpm](https://pnpm.io/cli/install)** Packages Manager for javascript application
101
103
 
102
104
  - **[nvm](https://github.com/nvm-sh/nvm/)** Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
103
105
 
@@ -125,9 +127,9 @@ You can follow Nodefony build with github actions at **<https://github.com/nodef
125
127
 
126
128
  - ~~[ELECTRON](https://github.com/nodefony/nodefony-electron) Experimental Nodefony Electron ( Now an Electron Context can be use in Nodefony Project )~~
127
129
 
128
- - EMBEDDED SYSTEM ( Very difficult : large memory footprint )
130
+ - EMBEDDED SYSTEM ( Very difficult : large memory footprint )
129
131
 
130
- ## <a name="install"></a> Linux or OSX Installation (Recommanded)
132
+ ## <a name="install"></a> Linux or OSX Installation
131
133
 
132
134
  **[NVM](https://github.com/nvm-sh/nvm#installation-and-update) Installation (Node Version Manager )** :
133
135
  - [NVM](https://github.com/creationix/nvm) Node Version Manager - Simple bash script to manage multiple active node.js versions
@@ -139,7 +141,7 @@ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
139
141
  wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
140
142
 
141
143
  $ source ~/.bashrc # or source ~/.bash_profile
142
- $ nvm ls-remote # show all remote versions
144
+ $ nvm ls-remote # show all remote versions
143
145
  $ nvm ls # show local versions
144
146
  ```
145
147
 
@@ -195,7 +197,7 @@ C:\Users\myuser\AppData\Roaming\npm\bin
195
197
  **Cli command when use Global installation**
196
198
  ```bash
197
199
  $ nodefony -v
198
- 6.0.0
200
+ 7.0.0
199
201
  ```
200
202
 
201
203
  **Cli command when By using yarn or npm in trunk**
@@ -209,7 +211,8 @@ npm run nodefony
209
211
  **By using npx**
210
212
  ***note: npx is included with npm > v5.2 or can be installed separately.***
211
213
  ```bash
212
- npx nodefony
214
+ npx nodefony -v
215
+ 7.0.0-beta.10
213
216
  ```
214
217
 
215
218
  **The long way with the full path**
@@ -242,17 +245,17 @@ YOU CAN USE CLI NO INTERACTIVE (nodefony with args) :
242
245
  ```bash
243
246
  # CLI generate project name : myproject
244
247
 
245
- $ nodefony create myproject
248
+ $ npx nodefony create myproject
246
249
  $ cd myproject
247
250
  ```
248
251
 
249
252
  **Cli Help** :
250
253
 
251
254
  ```bash
252
- $ nodefony -h
255
+ $ npx nodefony -h
253
256
 
254
- nodefony
255
- create [-i] name [path] Create New Nodefony Project
257
+ nodefony
258
+ create [-i] name [path] Create New Nodefony Project
256
259
  ```
257
260
 
258
261
  ## <a name="buildstarter"></a> Build Project with Github Starter :
@@ -263,7 +266,7 @@ nodefony
263
266
  ```bash
264
267
  $ git clone https://github.com/nodefony/nodefony-starter.git
265
268
  $ cd nodefony
266
- $ nodefony build
269
+ $ npx nodefony build
267
270
  ...
268
271
  ...
269
272
  $ npm start
@@ -287,7 +290,7 @@ nodefony
287
290
  drwxr-xr-x 12 cci staff 384 29 mar 11:01 web
288
291
  -rw-r--r-- 1 cci staff 542660 27 mar 19:24 yarn.lock
289
292
 
290
- $ nodefony
293
+ $ npx nodefony
291
294
 
292
295
  ? Nodefony CLI : (Use arrow keys)
293
296
  ❯ Build Project
@@ -304,7 +307,7 @@ nodefony
304
307
  **Starting Development Servers** :
305
308
 
306
309
  ```bash
307
- $ nodefony dev
310
+ $ npx nodefony dev
308
311
 
309
312
  # TO STOP
310
313
  $ <ctrl-c>
@@ -312,7 +315,7 @@ $ <ctrl-c>
312
315
  **Starting Development Servers in Debug Mode (-d)** :
313
316
 
314
317
  ```bash
315
- $ nodefony -d dev
318
+ $ npx nodefony -d dev
316
319
 
317
320
  # TO STOP
318
321
  $ <ctrl-c>
@@ -323,14 +326,14 @@ OR YOU CAN USE CLI INTERACTIVE MODE (nodefony without args)
323
326
  _ _ ___ ____ _____ _____ ___ _ _ __ __
324
327
  | \ | | / _ \ | _ \ | ____| | ___| / _ \ | \ | | \ \ / /
325
328
  | \| | | | | | | | | | | _| | |_ | | | | | \| | \ V /
326
- | |\ | | |_| | | |_| | | |___ | _| | |_| | | |\ | | |
327
- |_| \_| \___/ |____/ |_____| |_| \___/ |_| \_| |_|
329
+ | |\ | | |_| | | |_| | | |___ | _| | |_| | | |\ | | |
330
+ |_| \_| \___/ |____/ |_____| |_| \___/ |_| \_| |_|
328
331
 
329
332
  Version : 4.0.0 Platform : linux Process : nodefony PID : 31635
330
333
 
331
334
  Fri Jul 27 2018 17:01:11 INFO nodefony : WELCOME PROJECT : myproject 1.0.0
332
335
 
333
- ? Nodefony CLI :
336
+ ? Nodefony CLI :
334
337
  ❯ Start Servers Development
335
338
  Start Servers Pre-Production
336
339
  Start Servers Production
@@ -362,23 +365,23 @@ $ npx --node-options=--inspect nodefony dev
362
365
 
363
366
  **Starting a Nodefony project with [PM2](http://pm2.keymetrics.io/)** :
364
367
  ```bash
365
- $ nodefony prod
368
+ $ npx nodefony prod
366
369
  or
367
- $ nodefony start
370
+ $ npx nodefony start
368
371
  ```
369
372
  Tools PM2 You can see PM2 config : config/pm2.config.js
370
373
  ```bash
371
374
  # To See log
372
- $ nodefony logs
375
+ $ npx nodefony logs
373
376
 
374
377
  # To List Status of Production projects
375
- $ nodefony list
378
+ $ npx nodefony list
376
379
 
377
380
  # TO KILL PM2 DEAMON
378
- $ nodefony kill
381
+ $ npx nodefony kill
379
382
 
380
383
  # TO STOP APPLICATION WITHOUT KILL PM2 DEAMON
381
- $ nodefony stop
384
+ $ npx nodefony stop
382
385
 
383
386
  # YOU can use all pm2 command by using
384
387
  $ yarn pm2 monit
@@ -390,7 +393,7 @@ $ npm run pm2 logs --lines 200
390
393
 
391
394
  **Checking a Nodefony Project Pre-Production (Usefull to check Clusters Node)** :
392
395
  ```bash
393
- $ nodefony preprod
396
+ $ npx nodefony preprod
394
397
  ```
395
398
 
396
399
  ## <a name="https"></a>Serving a Nodefony project with HTTPS or WSS
@@ -591,7 +594,7 @@ class defaultController extends nodefony.Controller {
591
594
  indexAction() {
592
595
  return this.render("hello-bundle::index.html.twig", {
593
596
  name: this.bundle.name,
594
- description: this.bundle.package.description
597
+ description: this.bundle.package.description
595
598
  });
596
599
  }
597
600
  }
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+
3
+ npx nodefony sequelize:revert
4
+ rm -rf ./app/Resources/databases/nodefony.db
5
+ npx nodefony build
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ npx nodefony build
@@ -171,6 +171,7 @@ module.exports = {
171
171
  *
172
172
  * npm
173
173
  * yarn
174
+ * pnpm
174
175
  */
175
176
  packageManager: "{{packageManager}}"
176
177
 
@@ -3,13 +3,37 @@ const path = require("path");
3
3
 
4
4
  const package = require(path.resolve("package.json"));
5
5
  const name = package.name;
6
- const logFile = path.resolve("tmp", `${name}.log`);
7
6
  const script = process.argv[1] || "nodefony";
8
7
 
9
- /**
10
- * Application configuration section
11
- * http://pm2.keymetrics.io/docs/usage/application-declaration/
12
- */
8
+ // options - An object with the following options (additional descriptions of these options are here):
9
+
10
+ // name - An arbitrary name that can be used to interact with (e.g. restart) the process later in other commands. Defaults to the script name without its extension (eg "testScript" for "testScript.js").
11
+ // script - The path of the script to run.
12
+ // args - A string or array of strings composed of arguments to pass to the script.
13
+ // interpreterArgs - A string or array of strings composed of arguments to call the interpreter process with. Eg “–harmony” or [”–harmony”,”–debug”]. Only applies if interpreter is something other than “none” (its “node” by default).
14
+ // cwd - The working directory to start the process with.
15
+ // output - (Default: "~/.pm2/logs/app_name-out.log") The path to a file to append stdout output to. Can be the same file as error.
16
+ // error - (Default: "~/.pm2/logs/app_name-error.err") The path to a file to append stderr output to. Can be the same file as output.
17
+ // logDateFormat - The display format for log timestamps (eg “YYYY-MM-DD HH:mm Z”). The format is a moment display format.
18
+ // pid - (Default: "~/.pm2/pids/app_name-id.pid") The path to a file to write the pid of the started process. The file will be overwritten. Note that the file is not used in any way by pm2 and so the user is free to manipulate or remove that file at any time. The file will be deleted when the process is stopped or the daemon killed.
19
+ // minUptime - The minimum uptime of the script before it’s considered successfully started.
20
+ // maxRestarts - The maximum number of times in a row a script will be restarted if it exits in less than minUptime.
21
+ // maxMemoryRestart - If sets and script’s memory usage goes about the configured number, pm2 restarts the script. Uses human-friendly suffixes: ‘K’ for kilobytes, ‘M’ for megabytes, ‘G’ for gigabytes’, etc. Eg “150M”.
22
+ // killTimeout - (Default: 1600) The number of milliseconds to wait after a stop or restart command issues a SIGINT signal to kill the script forcibly with a SIGKILL signal.
23
+ // restartDelay - (Default: 0) Number of milliseconds to wait before restarting a script that has exited.
24
+ // interpreter - (Default: 'node') The interpreter for your script (eg “python”, “ruby”, “bash”, etc). The value “none” will execute the ‘script’ as a binary executable.
25
+ // execMode - (Default: 'fork') If sets to ‘cluster’, will enable clustering (running multiple instances of the script). See here for more details.
26
+ // instances - (Default: 1) How many instances of script to create. Only relevant in exec_mode ‘cluster’.
27
+ // mergeLogs - (Default: false) If true, merges the log files for all instances of script into one stderr log and one stdout log. Only applies in ‘cluster’ mode. For example, if you have 4 instances of ‘test.js’ started via pm2, normally you would have 4 stdout log files and 4 stderr log files, but with this option set to true you would only have one stdout file and one stderr file.
28
+ // watch - If set to true, the application will be restarted on change of the script file.
29
+ // force (Default: false) By default, pm2 will only start a script if that script isn’t already running (a script is a path to an application, not the name of an application already running). If force is set to true, pm2 will start a new instance of that script.
30
+ // autorestart (Default true). If false, pm2 will not attempt to restart it following successful completion or process failure.
31
+ // cron
32
+ // executeCommand
33
+ // write
34
+ // sourceMapSupport
35
+ // disableSourceMapSupport
36
+
13
37
  module.exports = {
14
38
  apps: [{
15
39
  name: name,
@@ -17,22 +41,22 @@ module.exports = {
17
41
  args: "pm2",
18
42
  //node_args : "--expose-gc",
19
43
  watch: false,
20
- exec_mode: "cluster",
21
- instances: cpu,
22
- max_memory_restart: "1024M",
44
+ execMode: "cluster",
45
+ instances: cpu, //5,
46
+ maxMemoryRestart: "1024M",
23
47
  autorestart: true,
24
- max_restarts: 10,
25
- // Log in one file
26
- //log_file : logFile,
27
- // Log in separate files
28
- out_file: path.resolve("tmp", `${name}.log`),
29
- error_file: path.resolve("tmp", `${name}.error`),
30
- // Merge clusters
31
- merge_logs: true,
48
+ restartDelay:2000,
49
+ maxRestarts: 5,
50
+ minUptime:60*1000,
51
+ //log_file : "./tmp/nodefony.log",
52
+ output: path.resolve("tmp", `${name}.log`),
53
+ error: path.resolve("tmp", `${name}.log`),
54
+ mergeLogs: true,
32
55
  env: {
33
56
  "NODE_ENV": "production",
34
57
  "MODE_START": "PM2",
35
- "NODEFONY_DEBUG": false
58
+ "NODEFONY_DEBUG": false,
59
+ "NODEFONY_ENV_APP": "production"
36
60
  }
37
61
  }]
38
62
  };
@@ -0,0 +1,15 @@
1
+ assets
2
+ **/assets/**
3
+ app/Resources/public/assets/
4
+ app/Resources/views/base.html.twig
5
+ config/generatedConfig.yml
6
+ app/Resources/databases/*
7
+ web/*
8
+
9
+ node_modules
10
+ **/node_modules/**
11
+
12
+ **/workbox-*
13
+ **/hot/*
14
+ **/service-worker.js
15
+
@@ -0,0 +1,97 @@
1
+ module.exports = {
2
+ root: true,
3
+ env: {
4
+ browser: true,
5
+ node: true,
6
+ commonjs: true,
7
+ es2021: true
8
+ },
9
+ // Extends: ["standard"],
10
+ extends: [
11
+ "plugin:vue/vue3-essential",
12
+ // 'eslint:recommended',
13
+ "eslint:all"
14
+ // 'standard'
15
+ ],
16
+ plugins: ["prettier"],
17
+ overrides: [],
18
+ parserOptions: {
19
+ ecmaVersion: "latest",
20
+ sourceType: "module"
21
+ },
22
+ globals: {
23
+ nodefony: true,
24
+ kernel: true,
25
+ process: true,
26
+ require: true,
27
+ console: true,
28
+ module: true,
29
+ exports: true,
30
+ yaml: true,
31
+ util: true,
32
+ fs: true,
33
+ path: true,
34
+ cluster: true,
35
+ xmlParser: true,
36
+ async: true,
37
+ crypto: true,
38
+ Sequelize: true,
39
+ url: true,
40
+ http: true,
41
+ https: true,
42
+ pm2: true,
43
+ WebSocketServer: true,
44
+ nodedomain: true,
45
+ dns: true,
46
+ Promise: true,
47
+ zone: true,
48
+ it: true,
49
+ describe: true,
50
+ before: true,
51
+ beforeEach: true,
52
+ BlueBird: true,
53
+ twig: true,
54
+ shell: true,
55
+ clc: true,
56
+ notDefinded: true,
57
+ varNotExit: true,
58
+ window: true,
59
+ document: true,
60
+ navigator: true,
61
+ stage: true,
62
+ $: true,
63
+ jQuery: true,
64
+ Rx: true,
65
+ inquirer: true,
66
+ workbox: true
67
+ },
68
+ rules: {
69
+ "no-console": process.env.NODE_ENV === "production"
70
+ ? "warn"
71
+ : "off",
72
+ "no-debugger": process.env.NODE_ENV === "production"
73
+ ? "warn"
74
+ : "off",
75
+ "quotes": ["error", "double"],
76
+ "max-len": ["error", {"code": 150}],
77
+ "padded-blocks": ["error", "never"],
78
+ "id-length": ["error", {min: 1}],
79
+ "indent": ["error", 2],
80
+ "function-call-argument-newline": ["error", "consistent"],
81
+ "array-bracket-newline": ["error", "consistent"],
82
+ "quote-props": [0],
83
+ "no-return-await": [0],
84
+ "sort-keys": [0],
85
+ "array-element-newline": [0],
86
+ "dot-location": [0],
87
+ "multiline-comment-style": [0],
88
+ "capitalized-comments": [0],
89
+ "max-lines-per-function": ["warn", 100],
90
+ "no-await-in-loop": [0],
91
+ "max-statements": ["warn", 20],
92
+ "no-magic-numbers": [0],
93
+ "sort-vars": ["off"],
94
+ "no-ternary": ["off"],
95
+ "multiline-ternary": ["error", "always-multiline"]
96
+ }
97
+ };
@@ -11,6 +11,7 @@ app/Resources/databases/*
11
11
  node_modules/**
12
12
  **/node_modules/**
13
13
  npm-debug.log
14
+ pnpm-lock.yaml
14
15
  *.[oa]
15
16
 
16
17
  config/certificates/**/*
@@ -0,0 +1,137 @@
1
+ 'use strict';
2
+ const {
3
+ Sequelize,
4
+ DataTypes,
5
+ Model
6
+ } = require('sequelize');
7
+
8
+ class Migrate extends nodefony.Service {
9
+ constructor(kernel) {
10
+ super("Migrate", kernel.container);
11
+ this.entityName = "user"
12
+ }
13
+
14
+ async up({
15
+ name,
16
+ context: queryInterface
17
+ }) {
18
+ let descriptions = null
19
+ try {
20
+ descriptions = await queryInterface.describeTable(this.entityName)
21
+ } catch (e) {
22
+ this.log(`Migrate file : ${name}`)
23
+ }
24
+ const exist = await queryInterface.tableExists(this.entityName)
25
+ if (exist) {
26
+ this.log(`Entity ${this.entityName} already exist`);
27
+ return descriptions
28
+ }
29
+ let transaction = null
30
+ try {
31
+ transaction = await queryInterface.sequelize.transaction();
32
+ let res = await queryInterface.createTable(this.entityName, {
33
+ username: {
34
+ type: DataTypes.STRING(126),
35
+ primaryKey: true,
36
+ unique: true,
37
+ allowNull: false
38
+ },
39
+ password: {
40
+ type: DataTypes.STRING(256),
41
+ allowNull: false
42
+ },
43
+ "2fa": {
44
+ type: DataTypes.BOOLEAN,
45
+ defaultValue: false
46
+ },
47
+ "2fa-token": DataTypes.STRING(256),
48
+ enabled: {
49
+ type: DataTypes.BOOLEAN,
50
+ defaultValue: true
51
+ },
52
+ userNonExpired: {
53
+ type: DataTypes.BOOLEAN,
54
+ defaultValue: true
55
+ },
56
+ credentialsNonExpired: {
57
+ type: DataTypes.BOOLEAN,
58
+ defaultValue: true
59
+ },
60
+ accountNonLocked: {
61
+ type: DataTypes.BOOLEAN,
62
+ defaultValue: true
63
+ },
64
+ email: {
65
+ type: DataTypes.STRING,
66
+ //primaryKey: true,
67
+ unique: true,
68
+ allowNull: false,
69
+ },
70
+ name: {
71
+ type: DataTypes.STRING,
72
+ allowNull: true
73
+ },
74
+ surname: {
75
+ type: DataTypes.STRING,
76
+ allowNull: true
77
+ },
78
+ lang: {
79
+ type: DataTypes.STRING,
80
+ defaultValue: "en_en"
81
+ },
82
+ roles: {
83
+ type: DataTypes.JSON,
84
+ defaultValue: ["ROLE_USER"]
85
+ },
86
+ gender: {
87
+ type: DataTypes.STRING,
88
+ defaultValue: "none"
89
+ },
90
+ url: {
91
+ type: DataTypes.STRING,
92
+ allowNull: true
93
+ },
94
+ image: DataTypes.STRING,
95
+ createdAt: {
96
+ allowNull: false,
97
+ type: DataTypes.DATE
98
+ },
99
+ updatedAt: {
100
+ allowNull: false,
101
+ type: DataTypes.DATE
102
+ }
103
+ }, {
104
+ transaction
105
+ });
106
+ await transaction.commit();
107
+ return await queryInterface.addIndex(this.entityName, {
108
+ unique: true,
109
+ fields: ['email']
110
+ })
111
+ } catch (e) {
112
+ if (transaction && !transaction.finished) {
113
+ this.log(e, "ERROR")
114
+ this.log(`Rollback transaction on table ${this.entityName}`);
115
+ await transaction.rollback();
116
+ }
117
+ this.log("Rollback Transaction already finished", "WARNING")
118
+ throw e
119
+ }
120
+ }
121
+
122
+ async down({
123
+ name,
124
+ context: queryInterface,
125
+ context: sequelize
126
+ }) {
127
+ try {
128
+ const descriptions = await queryInterface.describeTable(this.entityName)
129
+ return await queryInterface.dropTable(this.entityName);
130
+ } catch (e) {
131
+ this.log(`Entity ${this.entityName} not exist`, "WARNING")
132
+ throw e
133
+ }
134
+ }
135
+ }
136
+
137
+ module.exports = new Migrate(kernel);
@@ -0,0 +1,97 @@
1
+ 'use strict';
2
+ const {
3
+ Sequelize,
4
+ DataTypes,
5
+ Model
6
+ } = require('sequelize');
7
+
8
+ class Migrate extends nodefony.Service {
9
+ constructor(kernel) {
10
+ super("Migrate", kernel.container);
11
+ this.entityName = "sessions"
12
+ }
13
+
14
+ async up({
15
+ name,
16
+ context: queryInterface
17
+ }) {
18
+ let descriptions = null
19
+ try {
20
+ descriptions = await queryInterface.describeTable(this.entityName)
21
+ } catch (e) {
22
+ this.log(`Migrate file : ${name}`)
23
+ }
24
+ const exist = await queryInterface.tableExists(this.entityName)
25
+ if (exist) {
26
+ this.log(`Entity ${this.entityName} already exist`);
27
+ return descriptions
28
+ }
29
+ let transaction = null
30
+ try {
31
+ transaction = await queryInterface.sequelize.transaction();
32
+ let res = await queryInterface.createTable(this.entityName, {
33
+ session_id: {
34
+ type: DataTypes.STRING(126),
35
+ primaryKey: true
36
+ },
37
+ context: {
38
+ type: DataTypes.STRING(126),
39
+ defaultValue: "default"
40
+ },
41
+ Attributes: {
42
+ type: DataTypes.JSON
43
+ },
44
+ flashBag: {
45
+ type: DataTypes.JSON
46
+ },
47
+ metaBag: {
48
+ type: DataTypes.JSON,
49
+ },
50
+ createdAt: {
51
+ allowNull: false,
52
+ type: DataTypes.DATE
53
+ },
54
+ updatedAt: {
55
+ allowNull: false,
56
+ type: DataTypes.DATE
57
+ },
58
+ username: {
59
+ type: DataTypes.STRING(126),
60
+ references: {
61
+ model: 'user',
62
+ key: 'username'
63
+ },
64
+ onUpdate: "CASCADE",
65
+ onDelete: "CASCADE",
66
+ },
67
+ }, {
68
+ transaction
69
+ });
70
+ return await transaction.commit();
71
+ } catch (e) {
72
+ if (transaction && !transaction.finished) {
73
+ this.log(e, "ERROR")
74
+ this.log(`Rollback transaction on table ${this.entityName}`);
75
+ await transaction.rollback();
76
+ }
77
+ this.log("Rollback Transaction already finished", "WARNING")
78
+ throw e
79
+ }
80
+ }
81
+
82
+ async down({
83
+ name,
84
+ context: queryInterface,
85
+ context: sequelize
86
+ }) {
87
+ try {
88
+ const descriptions = await queryInterface.describeTable(this.entityName)
89
+ return await queryInterface.dropTable(this.entityName);
90
+ } catch (e) {
91
+ this.log(`Entity ${this.entityName} not exist`, "WARNING")
92
+ throw e
93
+ }
94
+ }
95
+ }
96
+
97
+ module.exports = new Migrate(kernel);