@webqit/webflo 0.11.61-0 → 0.20.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.
Files changed (274) hide show
  1. package/.github/FUNDING.yml +12 -0
  2. package/.github/workflows/publish.yml +48 -0
  3. package/.gitignore +9 -7
  4. package/LICENSE +21 -21
  5. package/README.md +100 -2074
  6. package/docker/Dockerfile +42 -42
  7. package/docker/README.md +91 -91
  8. package/docker/package.json +2 -2
  9. package/package.json +95 -81
  10. package/site/-/_.md +139 -0
  11. package/site/-/docs.old.md +2010 -0
  12. package/site/.vitepress/cache/deps/@braintree_sanitize-url 2.js +93 -0
  13. package/site/.vitepress/cache/deps/@braintree_sanitize-url.js +93 -0
  14. package/site/.vitepress/cache/deps/@braintree_sanitize-url.js 2.map +7 -0
  15. package/site/.vitepress/cache/deps/@braintree_sanitize-url.js.map +7 -0
  16. package/site/.vitepress/cache/deps/_metadata 2.json +85 -0
  17. package/site/.vitepress/cache/deps/_metadata.json +85 -0
  18. package/site/.vitepress/cache/deps/chunk-BUSYA2B4 2.js +9 -0
  19. package/site/.vitepress/cache/deps/chunk-BUSYA2B4.js +9 -0
  20. package/site/.vitepress/cache/deps/chunk-BUSYA2B4.js 2.map +7 -0
  21. package/site/.vitepress/cache/deps/chunk-BUSYA2B4.js.map +7 -0
  22. package/site/.vitepress/cache/deps/chunk-Q2AYPHVK 2.js +9719 -0
  23. package/site/.vitepress/cache/deps/chunk-Q2AYPHVK.js +9719 -0
  24. package/site/.vitepress/cache/deps/chunk-Q2AYPHVK.js 2.map +7 -0
  25. package/site/.vitepress/cache/deps/chunk-Q2AYPHVK.js.map +7 -0
  26. package/site/.vitepress/cache/deps/chunk-QAXAIFA7 2.js +12705 -0
  27. package/site/.vitepress/cache/deps/chunk-QAXAIFA7.js +12705 -0
  28. package/site/.vitepress/cache/deps/chunk-QAXAIFA7.js 2.map +7 -0
  29. package/site/.vitepress/cache/deps/chunk-QAXAIFA7.js.map +7 -0
  30. package/site/.vitepress/cache/deps/cytoscape 2.js +30278 -0
  31. package/site/.vitepress/cache/deps/cytoscape-cose-bilkent 2.js +4710 -0
  32. package/site/.vitepress/cache/deps/cytoscape-cose-bilkent.js +4710 -0
  33. package/site/.vitepress/cache/deps/cytoscape-cose-bilkent.js 2.map +7 -0
  34. package/site/.vitepress/cache/deps/cytoscape-cose-bilkent.js.map +7 -0
  35. package/site/.vitepress/cache/deps/cytoscape.js +30278 -0
  36. package/site/.vitepress/cache/deps/cytoscape.js 2.map +7 -0
  37. package/site/.vitepress/cache/deps/cytoscape.js.map +7 -0
  38. package/site/.vitepress/cache/deps/dayjs 2.js +285 -0
  39. package/site/.vitepress/cache/deps/dayjs.js +285 -0
  40. package/site/.vitepress/cache/deps/dayjs.js 2.map +7 -0
  41. package/site/.vitepress/cache/deps/dayjs.js.map +7 -0
  42. package/site/.vitepress/cache/deps/debug 2.js +453 -0
  43. package/site/.vitepress/cache/deps/debug.js +453 -0
  44. package/site/.vitepress/cache/deps/debug.js 2.map +7 -0
  45. package/site/.vitepress/cache/deps/debug.js.map +7 -0
  46. package/site/.vitepress/cache/deps/package 2.json +3 -0
  47. package/site/.vitepress/cache/deps/package.json +3 -0
  48. package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api 2.js +4507 -0
  49. package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4507 -0
  50. package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api.js 2.map +7 -0
  51. package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
  52. package/site/.vitepress/cache/deps/vitepress___@vueuse_core 2.js +584 -0
  53. package/site/.vitepress/cache/deps/vitepress___@vueuse_core.js +584 -0
  54. package/site/.vitepress/cache/deps/vitepress___@vueuse_core.js 2.map +7 -0
  55. package/site/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
  56. package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap 2.js +1166 -0
  57. package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +1166 -0
  58. package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js 2.map +7 -0
  59. package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js.map +7 -0
  60. package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js 2.js +1667 -0
  61. package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +1667 -0
  62. package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js 2.map +7 -0
  63. package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js.map +7 -0
  64. package/site/.vitepress/cache/deps/vitepress___minisearch 2.js +1815 -0
  65. package/site/.vitepress/cache/deps/vitepress___minisearch.js +1815 -0
  66. package/site/.vitepress/cache/deps/vitepress___minisearch.js 2.map +7 -0
  67. package/site/.vitepress/cache/deps/vitepress___minisearch.js.map +7 -0
  68. package/site/.vitepress/cache/deps/vue 2.js +344 -0
  69. package/site/.vitepress/cache/deps/vue.js +344 -0
  70. package/site/.vitepress/cache/deps/vue.js 2.map +7 -0
  71. package/site/.vitepress/cache/deps/vue.js.map +7 -0
  72. package/site/.vitepress/config.ts +147 -0
  73. package/site/.vitepress/theme/custom.css +50 -0
  74. package/site/.vitepress/theme/index.ts +6 -0
  75. package/site/api/webflo-fetch/FormData.md +0 -0
  76. package/site/api/webflo-fetch/Headers.md +0 -0
  77. package/site/api/webflo-fetch/LiveResponse.md +0 -0
  78. package/site/api/webflo-fetch/Request.md +0 -0
  79. package/site/api/webflo-fetch/Response.md +0 -0
  80. package/site/api/webflo-fetch/fetch.md +0 -0
  81. package/site/api/webflo-routing/HttpCookies.md +0 -0
  82. package/site/api/webflo-routing/HttpEvent/respondWith.md +1 -0
  83. package/site/api/webflo-routing/HttpEvent/waitUntil.md +1 -0
  84. package/site/api/webflo-routing/HttpEvent/waitUntilNavigate.md +1 -0
  85. package/site/api/webflo-routing/HttpEvent.md +30 -0
  86. package/site/api/webflo-routing/HttpSession.md +0 -0
  87. package/site/api/webflo-routing/HttpState.md +0 -0
  88. package/site/api/webflo-routing/HttpUser.md +0 -0
  89. package/site/api/webflo-routing/handler/fetch.md +42 -0
  90. package/site/api/webflo-routing/handler/next.md +54 -0
  91. package/site/api/webflo-routing/handler.md +119 -0
  92. package/site/api.md +26 -0
  93. package/site/contributing.md +16 -0
  94. package/site/docs/advanced/lifecycles.md +20 -0
  95. package/site/docs/advanced/redirects.md +0 -0
  96. package/site/docs/advanced/routing.md +1 -0
  97. package/site/docs/advanced.md +9 -0
  98. package/site/docs/concepts/realtime.md +637 -0
  99. package/site/docs/concepts/rendering.md +60 -0
  100. package/site/docs/concepts/request-response.md +47 -0
  101. package/site/docs/concepts/routing.md +656 -0
  102. package/site/docs/concepts/state.md +44 -0
  103. package/site/docs/concepts/templates.md +48 -0
  104. package/site/docs/concepts.md +97 -0
  105. package/site/docs/getting-started.md +378 -0
  106. package/site/docs/tech-stack.md +56 -0
  107. package/site/docs.md +100 -0
  108. package/site/examples/pwa.md +10 -0
  109. package/site/examples/web.md +11 -0
  110. package/site/examples.md +10 -0
  111. package/site/faq.md +13 -0
  112. package/site/guides/guide-auth.md +13 -0
  113. package/site/guides/guide-file-upload.md +11 -0
  114. package/site/guides/guide-service-worker.md +10 -0
  115. package/site/guides/tutorial-1-todo.md +24 -0
  116. package/site/guides.md +15 -0
  117. package/site/index.md +39 -0
  118. package/site/public/img/brand/logo-670x670.png +0 -0
  119. package/site/recipes/realtime.md +11 -0
  120. package/site/recipes/streaming.md +15 -0
  121. package/site/reference/cli.md +11 -0
  122. package/site/reference/config.md +13 -0
  123. package/site/reference/tools.md +9 -0
  124. package/src/Context.js +71 -79
  125. package/src/config-pi/deployment/Env.js +55 -68
  126. package/src/config-pi/deployment/Layout.js +71 -63
  127. package/src/config-pi/deployment/Origins.js +139 -139
  128. package/src/config-pi/deployment/Proxy.js +74 -74
  129. package/src/config-pi/deployment/index.js +17 -17
  130. package/src/config-pi/index.js +15 -15
  131. package/src/config-pi/runtime/Client.js +108 -98
  132. package/src/config-pi/runtime/Server.js +157 -125
  133. package/src/config-pi/runtime/client/Worker.js +111 -134
  134. package/src/config-pi/runtime/client/index.js +11 -11
  135. package/src/config-pi/runtime/index.js +17 -17
  136. package/src/config-pi/runtime/server/Headers.js +74 -74
  137. package/src/config-pi/runtime/server/Redirects.js +69 -69
  138. package/src/config-pi/runtime/server/index.js +13 -13
  139. package/src/config-pi/static/Init.js +57 -0
  140. package/src/config-pi/static/Manifest.js +319 -319
  141. package/src/config-pi/static/Ssg.js +49 -49
  142. package/src/config-pi/static/index.js +15 -13
  143. package/src/deployment-pi/index.js +10 -10
  144. package/src/deployment-pi/origins/index.js +216 -216
  145. package/src/deployment-pi/util.js +161 -0
  146. package/src/index.js +13 -19
  147. package/src/init-pi/index.js +117 -0
  148. package/src/init-pi/templates/pwa/app/handler.server.js +8 -0
  149. package/src/init-pi/templates/pwa/app/page.html +7 -0
  150. package/src/init-pi/templates/pwa/package.json +19 -0
  151. package/src/init-pi/templates/pwa/public/assets/app.css +16 -0
  152. package/src/init-pi/templates/pwa/public/index.html +39 -0
  153. package/src/init-pi/templates/pwa/public/manifest.json +29 -0
  154. package/src/init-pi/templates/web/app/handler.server.js +8 -0
  155. package/src/init-pi/templates/web/app/page.html +7 -0
  156. package/src/init-pi/templates/web/package.json +19 -0
  157. package/src/init-pi/templates/web/public/assets/app.css +16 -0
  158. package/src/init-pi/templates/web/public/index.html +39 -0
  159. package/src/runtime-pi/WebfloRuntime.js +350 -0
  160. package/src/runtime-pi/index.js +6 -13
  161. package/src/runtime-pi/webflo-client/ClientSideCookies.js +17 -0
  162. package/src/runtime-pi/webflo-client/ClientSideWorkport.js +63 -0
  163. package/src/runtime-pi/webflo-client/DeviceCapabilities.js +213 -0
  164. package/src/runtime-pi/webflo-client/WebfloClient.js +500 -0
  165. package/src/runtime-pi/webflo-client/WebfloRootClient1.js +206 -0
  166. package/src/runtime-pi/webflo-client/WebfloRootClient2.js +113 -0
  167. package/src/runtime-pi/webflo-client/WebfloSubClient.js +118 -0
  168. package/src/runtime-pi/webflo-client/index.js +17 -0
  169. package/src/runtime-pi/webflo-client/webflo-codegen.js +469 -0
  170. package/src/runtime-pi/webflo-client/webflo-devmode.js +243 -0
  171. package/src/runtime-pi/webflo-client/webflo-embedded.js +50 -0
  172. package/src/runtime-pi/webflo-fetch/LiveResponse.js +437 -0
  173. package/src/runtime-pi/webflo-fetch/cookies.js +10 -0
  174. package/src/runtime-pi/webflo-fetch/fetch.js +16 -0
  175. package/src/runtime-pi/webflo-fetch/formdata.js +54 -0
  176. package/src/runtime-pi/webflo-fetch/headers.js +151 -0
  177. package/src/runtime-pi/webflo-fetch/index.js +5 -0
  178. package/src/runtime-pi/webflo-fetch/message.js +49 -0
  179. package/src/runtime-pi/webflo-fetch/request.js +62 -0
  180. package/src/runtime-pi/webflo-fetch/response.js +110 -0
  181. package/src/runtime-pi/webflo-fetch/util.js +28 -0
  182. package/src/runtime-pi/webflo-messaging/WQBroadcastChannel.js +10 -0
  183. package/src/runtime-pi/webflo-messaging/WQMessageChannel.js +26 -0
  184. package/src/runtime-pi/webflo-messaging/WQMessageEvent.js +87 -0
  185. package/src/runtime-pi/webflo-messaging/WQMessagePort.js +38 -0
  186. package/src/runtime-pi/webflo-messaging/WQRelayPort.js +47 -0
  187. package/src/runtime-pi/webflo-messaging/WQSockPort.js +113 -0
  188. package/src/runtime-pi/webflo-messaging/WQStarPort.js +104 -0
  189. package/src/runtime-pi/webflo-messaging/wq-message-port.js +404 -0
  190. package/src/runtime-pi/webflo-routing/HttpCookies.js +42 -0
  191. package/src/runtime-pi/webflo-routing/HttpEvent.js +112 -0
  192. package/src/runtime-pi/webflo-routing/HttpSession.js +11 -0
  193. package/src/runtime-pi/webflo-routing/HttpState.js +153 -0
  194. package/src/runtime-pi/webflo-routing/HttpUser.js +54 -0
  195. package/src/runtime-pi/webflo-routing/WebfloRouter.js +245 -0
  196. package/src/runtime-pi/webflo-server/ServerSideCookies.js +19 -0
  197. package/src/runtime-pi/webflo-server/ServerSideSession.js +38 -0
  198. package/src/runtime-pi/webflo-server/WebfloServer.js +937 -0
  199. package/src/runtime-pi/webflo-server/index.js +11 -0
  200. package/src/runtime-pi/webflo-server/messaging/Client.js +27 -0
  201. package/src/runtime-pi/webflo-server/messaging/ClientRequestRealtime.js +50 -0
  202. package/src/runtime-pi/webflo-server/messaging/Clients.js +25 -0
  203. package/src/runtime-pi/webflo-server/webflo-devmode.js +326 -0
  204. package/src/runtime-pi/{client → webflo-url}/Url.js +155 -205
  205. package/src/runtime-pi/webflo-url/index.js +1 -0
  206. package/src/runtime-pi/webflo-url/urlpattern.js +38 -0
  207. package/src/runtime-pi/{util-url.js → webflo-url/util.js} +109 -147
  208. package/src/runtime-pi/webflo-url/xURL.js +94 -0
  209. package/src/runtime-pi/webflo-worker/WebfloWorker.js +234 -0
  210. package/src/runtime-pi/webflo-worker/WorkerSideCookies.js +19 -0
  211. package/src/runtime-pi/webflo-worker/WorkerSideWorkport.js +18 -0
  212. package/src/runtime-pi/webflo-worker/index.js +11 -0
  213. package/src/services-pi/cert/http-auth-hook.js +22 -22
  214. package/src/services-pi/cert/http-cleanup-hook.js +22 -22
  215. package/src/services-pi/cert/index.js +79 -79
  216. package/src/services-pi/index.js +10 -8
  217. package/src/services-pi/push/index.js +23 -0
  218. package/src/util.js +10 -0
  219. package/src/{webflo.js → webflo-cli.js} +30 -30
  220. package/test/index.test.js +26 -26
  221. package/test/site/package.json +9 -9
  222. package/test/site/public/bundle.html +5 -5
  223. package/test/site/public/bundle.html.json +3 -3
  224. package/test/site/public/bundle.js +2 -2
  225. package/test/site/public/bundle.webflo.js +15 -15
  226. package/test/site/public/index.html +29 -29
  227. package/test/site/public/index1.html +34 -34
  228. package/test/site/public/page-2/bundle.html +4 -4
  229. package/test/site/public/page-2/bundle.js +2 -2
  230. package/test/site/public/page-2/index.html +45 -45
  231. package/test/site/public/page-2/main.html +2 -2
  232. package/test/site/public/page-4/subpage/bundle.js +2 -2
  233. package/test/site/public/page-4/subpage/index.html +30 -30
  234. package/test/site/public/sparoots.json +4 -4
  235. package/test/site/public/worker.js +3 -3
  236. package/test/site/server/index.js +15 -15
  237. package/src/runtime-pi/Application.js +0 -29
  238. package/src/runtime-pi/Cookies.js +0 -82
  239. package/src/runtime-pi/HttpEvent.js +0 -107
  240. package/src/runtime-pi/Router.js +0 -130
  241. package/src/runtime-pi/Runtime.js +0 -21
  242. package/src/runtime-pi/client/Application.js +0 -100
  243. package/src/runtime-pi/client/Context.js +0 -7
  244. package/src/runtime-pi/client/Router.js +0 -48
  245. package/src/runtime-pi/client/Runtime.js +0 -332
  246. package/src/runtime-pi/client/Workport.js +0 -178
  247. package/src/runtime-pi/client/createStorage.js +0 -57
  248. package/src/runtime-pi/client/generate.js +0 -472
  249. package/src/runtime-pi/client/index.js +0 -21
  250. package/src/runtime-pi/client/oohtml/full.js +0 -7
  251. package/src/runtime-pi/client/oohtml/namespacing.js +0 -7
  252. package/src/runtime-pi/client/oohtml/scripting.js +0 -8
  253. package/src/runtime-pi/client/oohtml/templating.js +0 -8
  254. package/src/runtime-pi/client/worker/Application.js +0 -44
  255. package/src/runtime-pi/client/worker/Context.js +0 -7
  256. package/src/runtime-pi/client/worker/Runtime.js +0 -269
  257. package/src/runtime-pi/client/worker/Workport.js +0 -86
  258. package/src/runtime-pi/client/worker/index.js +0 -21
  259. package/src/runtime-pi/server/Application.js +0 -116
  260. package/src/runtime-pi/server/Context.js +0 -16
  261. package/src/runtime-pi/server/Router.js +0 -159
  262. package/src/runtime-pi/server/Runtime.js +0 -557
  263. package/src/runtime-pi/server/index.js +0 -21
  264. package/src/runtime-pi/util-http.js +0 -86
  265. package/src/runtime-pi/xFormData.js +0 -24
  266. package/src/runtime-pi/xHeaders.js +0 -146
  267. package/src/runtime-pi/xRequest.js +0 -46
  268. package/src/runtime-pi/xRequestHeaders.js +0 -109
  269. package/src/runtime-pi/xResponse.js +0 -33
  270. package/src/runtime-pi/xResponseHeaders.js +0 -117
  271. package/src/runtime-pi/xURL.js +0 -105
  272. package/src/runtime-pi/xfetch.js +0 -23
  273. package/src/runtime-pi/xxHttpMessage.js +0 -102
  274. package/src/static-pi/index.js +0 -11
@@ -1,98 +1,108 @@
1
-
2
- /**
3
- * imports
4
- */
5
- import { Dotfile } from '@webqit/backpack';
6
-
7
- export default class Client extends Dotfile {
8
-
9
- // Base name
10
- get name() {
11
- return 'client';
12
- }
13
-
14
- // @desc
15
- static get ['@desc']() {
16
- return 'Client Runtime config.';
17
- }
18
-
19
- // Defaults merger
20
- withDefaults(config) {
21
- return this.merge({
22
- bundle_filename: 'bundle.js',
23
- public_base_url: '/',
24
- spa_routing: true,
25
- oohtml_support: 'full',
26
- service_worker_support: true,
27
- worker_scope: '/',
28
- worker_filename: 'worker.js',
29
- }, config, 'patch');
30
- }
31
-
32
- // Questions generator
33
- getSchema(config, choices = {}) {
34
- // Choices
35
- const CHOICES = this.merge({
36
- oohtml_support: [
37
- {value: 'full', title: 'Full'},
38
- {value: 'namespacing', title: 'namespacing'},
39
- {value: 'scripting', title: 'scripting'},
40
- {value: 'templating', title: 'templating'},
41
- {value: 'none', title: 'none'},
42
- ],
43
- }, choices, 'patch');
44
- // Questions
45
- return [
46
- {
47
- name: 'bundle_filename',
48
- type: 'text',
49
- message: 'Specify the bundle filename',
50
- initial: config.bundle_filename,
51
- },
52
- {
53
- name: 'public_base_url',
54
- type: 'text',
55
- message: '[public_base_url]: Enter the base-URL for public resource URLs',
56
- initial: DATA.public_base_url,
57
- validation: ['important'],
58
- },
59
- {
60
- name: 'spa_routing',
61
- type: 'toggle',
62
- message: '[spa_routing]: Enable Single Page Routing Mode',
63
- active: 'YES',
64
- inactive: 'NO',
65
- initial: config.spa_routing,
66
- validation: ['important'],
67
- },
68
- {
69
- name: 'oohtml_support',
70
- type: 'select',
71
- message: '[oohtml_support]: (Adds OOHTML to your app\'s bundle.) Specify OOHTML support level',
72
- choices: CHOICES.oohtml_support,
73
- initial: this.indexOfInitial(CHOICES.oohtml_support, config.oohtml_support),
74
- validation: ['important'],
75
- },
76
- {
77
- name: 'service_worker_support',
78
- type: 'toggle',
79
- message: 'Support Service Worker?',
80
- active: 'YES',
81
- inactive: 'NO',
82
- initial: config.service_worker_support,
83
- },
84
- {
85
- name: 'worker_scope',
86
- type: (prev, answers) => answers.service_worker_support ? 'text' : null,
87
- message: 'Specify the Service Worker scope',
88
- initial: config.worker_scope,
89
- },
90
- {
91
- name: 'worker_filename',
92
- type: (prev, answers) => answers.service_worker_support ? 'text' : null,
93
- message: 'Specify the Service Worker filename',
94
- initial: config.worker_filename,
95
- },
96
- ];
97
- }
98
- }
1
+
2
+ /**
3
+ * imports
4
+ */
5
+ import { Dotfile } from '@webqit/backpack';
6
+
7
+ export default class Client extends Dotfile {
8
+
9
+ // Base name
10
+ get name() {
11
+ return 'client';
12
+ }
13
+
14
+ // @desc
15
+ static get ['@desc']() {
16
+ return 'Client Runtime config.';
17
+ }
18
+
19
+ // Defaults merger
20
+ withDefaults(config) {
21
+ return this.merge({
22
+ filename: 'app.js',
23
+ public_base_url: '/',
24
+ copy_public_variables: true,
25
+ spa_routing: true,
26
+ capabilities: {
27
+ service_worker: false,
28
+ webpush: false,
29
+ custom_install: false,
30
+ exposed: ['display-mode', 'notifications'],
31
+ },
32
+ }, config, 'patch');
33
+ }
34
+
35
+ // Questions generator
36
+ getSchema(config, choices = {}) {
37
+ // Questions
38
+ return [
39
+ {
40
+ name: 'filename',
41
+ type: 'text',
42
+ message: 'Specify the bundle filename',
43
+ initial: config.filename,
44
+ },
45
+ {
46
+ name: 'public_base_url',
47
+ type: 'text',
48
+ message: '[public_base_url]: Enter the base-URL for public resource URLs',
49
+ initial: config.public_base_url,
50
+ validation: ['important'],
51
+ },
52
+ {
53
+ name: 'copy_public_variables',
54
+ type: 'toggle',
55
+ message: '[copy_public_variables]: Bundle public ENV variables?',
56
+ active: 'YES',
57
+ inactive: 'NO',
58
+ initial: config.copy_public_variables,
59
+ validation: ['important'],
60
+ },
61
+ {
62
+ name: 'spa_routing',
63
+ type: 'toggle',
64
+ message: '[spa_routing]: Enable Single Page Routing Mode',
65
+ active: 'YES',
66
+ inactive: 'NO',
67
+ initial: config.spa_routing,
68
+ validation: ['important'],
69
+ },
70
+ {
71
+ name: 'capabilities',
72
+ controls: {
73
+ name: 'capabilities',
74
+ },
75
+ initial: config.capabilities,
76
+ schema: [
77
+ {
78
+ name: 'service_worker',
79
+ type: 'toggle',
80
+ message: 'Enable service worker?',
81
+ active: 'YES',
82
+ inactive: 'NO',
83
+ },
84
+ {
85
+ name: 'webpush',
86
+ type: 'toggle',
87
+ message: 'Support push-notifications?',
88
+ active: 'YES',
89
+ inactive: 'NO',
90
+ },
91
+ {
92
+ name: 'custom_install',
93
+ type: 'toggle',
94
+ message: 'Enable custom PWA install prompt?',
95
+ active: 'YES',
96
+ inactive: 'NO',
97
+ },
98
+ {
99
+ name: 'exposed',
100
+ type: 'list',
101
+ message: 'Specify features exposed on capabilities.exposed',
102
+ initial: (config.exposed || []).join(', '),
103
+ }
104
+ ]
105
+ }
106
+ ];
107
+ }
108
+ }
@@ -1,125 +1,157 @@
1
-
2
- /**
3
- * imports
4
- */
5
- import { Dotfile } from '@webqit/backpack';
6
-
7
- export default class Server extends Dotfile {
8
-
9
- // Base name
10
- get name() {
11
- return 'server';
12
- }
13
-
14
- // @desc
15
- static get ['@desc']() {
16
- return 'Server Runtime config.';
17
- }
18
-
19
- // Defaults merger
20
- withDefaults(config) {
21
- return this.merge({
22
- port: process.env.PORT || 3000,
23
- domains: [],
24
- https: {
25
- port: process.env.SSL_PORT || 0,
26
- domains: [],
27
- keyfile: '/etc/letsencrypt/live/[domain]/privkey.pem',
28
- certfile: '/etc/letsencrypt/live/[domain]/fullchain.pem',
29
- force: false,
30
- },
31
- force_www: '',
32
- oohtml_support: 'full',
33
- }, config, 'patch');
34
- }
35
-
36
- // Questions generator
37
- getSchema(config, choices = {}) {
38
- // Choices
39
- const CHOICES = this.merge({
40
- force_www: [
41
- {value: '', title: 'do nothing'},
42
- {value: 'add',},
43
- {value: 'remove',},
44
- ],
45
- oohtml_support: [
46
- {value: 'full', title: 'full'},
47
- {value: 'namespacing', title: 'namespacing'},
48
- {value: 'scripting', title: 'scripting'},
49
- {value: 'templating', title: 'templating'},
50
- {value: 'none', title: 'none'},
51
- ],
52
- }, choices, 'patch');
53
- // Questions
54
- return [
55
- {
56
- name: 'port',
57
- type: 'number',
58
- message: '[port]: Enter port number',
59
- initial: config.port,
60
- validation: ['important'],
61
- },
62
- {
63
- name: 'domains',
64
- type: 'list',
65
- message: '[domains]: Enter a list of allowed domains if necessary (comma-separated)',
66
- validation: ['important'],
67
- },
68
- {
69
- name: 'force_www',
70
- type: 'select',
71
- message: '[force_www]: Force add/remove "www" on hostname?',
72
- choices: CHOICES.force_www,
73
- initial: this.indexOfInitial(CHOICES.force_www, config.force_www),
74
- },
75
- {
76
- name: 'https',
77
- controls: {
78
- name: 'https',
79
- },
80
- initial: config.https,
81
- schema: [
82
- {
83
- name: 'port',
84
- type: 'number',
85
- message: '[port]: Enter HTTPS port number',
86
- validation: ['important'],
87
- },
88
- {
89
- name: 'keyfile',
90
- type: 'text',
91
- message: '[keyfile]: Enter SSL KEY file',
92
- validation: ['important'],
93
- },
94
- {
95
- name: 'certfile',
96
- type: 'text',
97
- message: '[certfile]: Enter SSL CERT file',
98
- validation: ['important'],
99
- },
100
- {
101
- name: 'domains',
102
- type: 'list',
103
- message: '[domains]: Enter the CERT domains (comma-separated)',
104
- validation: ['important'],
105
- },
106
- {
107
- name: 'force',
108
- type: 'toggle',
109
- message: '[force]: Force HTTPS?',
110
- active: 'YES',
111
- inactive: 'NO',
112
- },
113
- ],
114
- },
115
- {
116
- name: 'oohtml_support',
117
- type: 'select',
118
- message: '[oohtml_support]: Specify OOHTML support level',
119
- choices: CHOICES.oohtml_support,
120
- initial: this.indexOfInitial(CHOICES.oohtml_support, config.oohtml_support),
121
- validation: ['important'],
122
- },
123
- ];
124
- }
125
- }
1
+
2
+ /**
3
+ * imports
4
+ */
5
+ import { Dotfile } from '@webqit/backpack';
6
+
7
+ export default class Server extends Dotfile {
8
+
9
+ // Base name
10
+ get name() {
11
+ return 'server';
12
+ }
13
+
14
+ // @desc
15
+ static get ['@desc']() {
16
+ return 'Server Runtime config.';
17
+ }
18
+
19
+ // Defaults merger
20
+ withDefaults(config) {
21
+ return this.merge({
22
+ port: process.env.PORT || 3000,
23
+ hostnames: [],
24
+ https: {
25
+ port: process.env.SSL_PORT || 0,
26
+ hostnames: [],
27
+ keyfile: '/etc/letsencrypt/live/[domain]/privkey.pem',
28
+ certfile: '/etc/letsencrypt/live/[domain]/fullchain.pem',
29
+ force: false,
30
+ },
31
+ force_www: '',
32
+ capabilities: {
33
+ database: false,
34
+ database_dialect: 'postgres',
35
+ redis: false,
36
+ webpush: false,
37
+ vapid_subject: 'mailto:foo@example.com',
38
+ },
39
+ }, config, 'patch');
40
+ }
41
+
42
+ // Questions generator
43
+ getSchema(config, choices = {}) {
44
+ // Choices
45
+ const CHOICES = this.merge({
46
+ force_www: [
47
+ {value: '', title: 'do nothing'},
48
+ {value: 'add',},
49
+ {value: 'remove',},
50
+ ],
51
+ }, choices, 'patch');
52
+ // Questions
53
+ return [
54
+ {
55
+ name: 'port',
56
+ type: 'number',
57
+ message: '[port]: Enter port number',
58
+ initial: config.port,
59
+ validation: ['important'],
60
+ },
61
+ {
62
+ name: 'hostnames',
63
+ type: 'list',
64
+ message: '[hostnames]: Enter a list of allowed hostnames if necessary (comma-separated)',
65
+ initial: (config.hostnames || []).join(', '),
66
+ validation: ['important'],
67
+ },
68
+ {
69
+ name: 'force_www',
70
+ type: 'select',
71
+ message: '[force_www]: Force add/remove "www" on hostname?',
72
+ choices: CHOICES.force_www,
73
+ initial: this.indexOfInitial(CHOICES.force_www, config.force_www),
74
+ },
75
+ {
76
+ name: 'https',
77
+ controls: {
78
+ name: 'https',
79
+ },
80
+ initial: config.https,
81
+ schema: [
82
+ {
83
+ name: 'port',
84
+ type: 'number',
85
+ message: '[port]: Enter HTTPS port number',
86
+ validation: ['important'],
87
+ },
88
+ {
89
+ name: 'keyfile',
90
+ type: 'text',
91
+ message: '[keyfile]: Enter SSL KEY file',
92
+ validation: ['important'],
93
+ },
94
+ {
95
+ name: 'certfile',
96
+ type: 'text',
97
+ message: '[certfile]: Enter SSL CERT file',
98
+ validation: ['important'],
99
+ },
100
+ {
101
+ name: 'hostnames',
102
+ type: 'list',
103
+ message: '[hostnames]: Enter the CERT hostnames (comma-separated)',
104
+ validation: ['important'],
105
+ },
106
+ {
107
+ name: 'force',
108
+ type: 'toggle',
109
+ message: '[force]: Force HTTPS?',
110
+ active: 'YES',
111
+ inactive: 'NO',
112
+ },
113
+ ],
114
+ },
115
+ {
116
+ name: 'capabilities',
117
+ controls: {
118
+ name: 'capabilities',
119
+ },
120
+ initial: config.capabilities,
121
+ schema: [
122
+ {
123
+ name: 'database',
124
+ type: 'toggle',
125
+ message: 'Add database integration?',
126
+ active: 'YES',
127
+ inactive: 'NO',
128
+ },
129
+ {
130
+ name: 'database_dialect',
131
+ type: (prev, answers) => !answers.database ? null : 'text',
132
+ message: 'Enter the database dialect (postgres for now)',
133
+ },
134
+ {
135
+ name: 'redis',
136
+ type: 'toggle',
137
+ message: 'Add redis integration?',
138
+ active: 'YES',
139
+ inactive: 'NO',
140
+ },
141
+ {
142
+ name: 'webpush',
143
+ type: 'toggle',
144
+ message: 'Add webpush integration?',
145
+ active: 'YES',
146
+ inactive: 'NO',
147
+ },
148
+ {
149
+ name: 'vapid_subject',
150
+ type: (prev, answers) => !answers.webpush ? null : 'text',
151
+ message: 'Enter the vapid_subject URL',
152
+ }
153
+ ]
154
+ },
155
+ ];
156
+ }
157
+ }