@joystick.js/cli-canary 0.0.0-canary.162 → 0.0.0-canary.1621

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 (584) hide show
  1. package/.build/getFilesToBuild.js +1 -1
  2. package/.build/index.js +3 -3
  3. package/LICENSE.md +59 -0
  4. package/README.md +45 -4
  5. package/dist/cli.js +1 -76
  6. package/dist/commands/build/definition.js +1 -0
  7. package/dist/commands/build/index.js +1 -0
  8. package/dist/commands/create/build_package_json.js +1 -0
  9. package/dist/commands/create/definition.js +1 -0
  10. package/dist/commands/create/index.js +2 -0
  11. package/dist/commands/create/template/api/index.js +6 -0
  12. package/dist/commands/create/template/email/base.css +9 -0
  13. package/dist/commands/create/template/email/base.html +10 -0
  14. package/dist/commands/create/template/email/reset_password.js +20 -0
  15. package/dist/commands/create/template/i18n/en-US.js +14 -0
  16. package/dist/commands/create/template/index.client.js +1 -0
  17. package/dist/commands/create/template/index.css +34 -0
  18. package/dist/{functions/create/templates → commands/create/template}/index.html +2 -3
  19. package/dist/{functions/create/templates → commands/create/template}/index.server.js +6 -6
  20. package/dist/commands/create/template/public/apple-touch-icon-152x152.png +0 -0
  21. package/dist/commands/create/template/public/favicon.ico +0 -0
  22. package/dist/commands/create/template/public/joystick_logo.webp +0 -0
  23. package/dist/{functions/create/templates → commands/create/template}/public/manifest.json +4 -4
  24. package/dist/commands/create/template/public/splash-screen-1024x1024.png +0 -0
  25. package/{src/functions/create/templates → dist/commands/create/template}/ui/components/button/index.js +14 -6
  26. package/{src/functions/create/templates → dist/commands/create/template}/ui/layouts/app/index.js +2 -2
  27. package/dist/commands/create/template/ui/pages/error/index.js +50 -0
  28. package/dist/commands/create/template/ui/pages/index/index.js +121 -0
  29. package/dist/commands/help/definition.js +1 -0
  30. package/dist/commands/help/index.js +19 -0
  31. package/dist/commands/index.js +1 -0
  32. package/dist/commands/logout/definition.js +1 -0
  33. package/dist/commands/logout/index.js +3 -0
  34. package/dist/commands/push/cdn_mirrors.js +1 -0
  35. package/dist/commands/push/check_if_settings_valid.js +1 -0
  36. package/dist/commands/push/create_version.js +1 -0
  37. package/dist/commands/push/definition.js +1 -0
  38. package/dist/commands/push/get_app_domain.js +1 -0
  39. package/dist/commands/push/get_deployment.js +1 -0
  40. package/dist/commands/push/get_provision_domain.js +1 -0
  41. package/dist/commands/push/get_session_token.js +1 -0
  42. package/dist/commands/push/get_settings_file.js +1 -0
  43. package/dist/commands/push/handle_initial_deployment.js +1 -0
  44. package/dist/commands/push/handle_version_deployment.js +1 -0
  45. package/dist/commands/push/index.js +8 -0
  46. package/dist/commands/push/prompts/confirm_deployment.js +17 -0
  47. package/dist/commands/push/prompts/session_token.js +5 -0
  48. package/dist/commands/push/upload_build_to_cdn.js +1 -0
  49. package/dist/commands/push/validate_deployment.js +1 -0
  50. package/dist/commands/push/validate_push_config.js +1 -0
  51. package/dist/commands/start/definition.js +1 -0
  52. package/dist/commands/start/index.js +1 -0
  53. package/dist/commands/test/definition.js +1 -0
  54. package/dist/commands/test/index.js +1 -0
  55. package/dist/commands/update/definition.js +1 -0
  56. package/dist/commands/update/index.js +1 -0
  57. package/dist/commands/use/definition.js +1 -0
  58. package/dist/commands/use/index.js +1 -0
  59. package/dist/index.js +1 -7
  60. package/dist/lib/build/browser_path_exclusions.js +1 -0
  61. package/dist/lib/build/browser_paths.js +1 -0
  62. package/dist/lib/build/build_files.js +3 -0
  63. package/dist/lib/build/copy_paths.js +1 -0
  64. package/dist/lib/build/get_code_frame.js +1 -0
  65. package/dist/lib/build/get_file_operation.js +1 -0
  66. package/dist/lib/build/get_files_to_build.js +1 -0
  67. package/dist/lib/build/get_path_platform.js +1 -0
  68. package/dist/lib/build/get_platform_safe_path.js +1 -0
  69. package/dist/lib/build/get_tar_ignore_list.js +2 -0
  70. package/dist/lib/build/index.js +3 -0
  71. package/dist/lib/build/master_ignore_list.js +1 -0
  72. package/dist/lib/build/minify_file.js +1 -0
  73. package/dist/lib/build/node_paths.js +1 -0
  74. package/dist/lib/build/on_warn.js +10 -0
  75. package/dist/lib/build/plugins/bootstrap_component.js +33 -0
  76. package/dist/lib/build/plugins/generate_file_dependency_map.js +1 -0
  77. package/dist/lib/build/plugins/index.js +1 -0
  78. package/dist/lib/build/plugins/set_component_id.js +2 -0
  79. package/dist/lib/build/plugins/update_file_map.js +1 -0
  80. package/dist/lib/build/plugins/warn_node_environment.js +3 -0
  81. package/dist/lib/cli_log.js +13 -0
  82. package/dist/lib/color_log.js +1 -0
  83. package/dist/lib/command_exists.js +1 -0
  84. package/dist/lib/constants.js +1 -4
  85. package/dist/lib/debounce.js +1 -0
  86. package/dist/lib/decrypt_buffer.js +1 -0
  87. package/dist/lib/development_server/ava_config.js +1 -0
  88. package/dist/lib/development_server/check_if_port_occupied.js +1 -0
  89. package/dist/lib/development_server/cleanup.js +1 -0
  90. package/dist/lib/development_server/databases/download_database_binary.js +1 -0
  91. package/dist/lib/development_server/databases/mongodb/available_query_parameters.js +1 -0
  92. package/dist/lib/development_server/databases/mongodb/build_connection_string.js +1 -0
  93. package/dist/lib/development_server/databases/mongodb/build_query_parameters.js +1 -0
  94. package/dist/lib/development_server/databases/mongodb/check_connection.js +2 -0
  95. package/dist/lib/development_server/databases/mongodb/connect.js +1 -0
  96. package/dist/lib/development_server/databases/mongodb/index.js +1 -0
  97. package/dist/lib/development_server/databases/mongodb/installers/linux.js +1 -0
  98. package/dist/lib/development_server/databases/mongodb/installers/macos.js +1 -0
  99. package/dist/lib/development_server/databases/mongodb/installers/windows.js +1 -0
  100. package/dist/lib/development_server/databases/postgresql/check_connection.js +2 -0
  101. package/dist/lib/development_server/databases/postgresql/connect.js +1 -0
  102. package/dist/lib/development_server/databases/postgresql/index.js +2 -0
  103. package/dist/lib/development_server/databases/postgresql/installers/linux.js +1 -0
  104. package/dist/lib/development_server/databases/postgresql/installers/macos.js +1 -0
  105. package/dist/lib/development_server/databases/postgresql/installers/windows.js +1 -0
  106. package/dist/lib/development_server/databases/provider_map.js +1 -0
  107. package/dist/lib/development_server/get_database_process_ids.js +1 -0
  108. package/dist/lib/development_server/get_translations.js +1 -0
  109. package/dist/lib/development_server/hmr_server.js +1 -0
  110. package/dist/lib/development_server/index.js +10 -0
  111. package/dist/lib/development_server/kill_process_ids.js +1 -0
  112. package/dist/lib/development_server/run_tests.js +2 -0
  113. package/dist/lib/development_server/start_app_server.js +1 -0
  114. package/dist/lib/development_server/start_databases.js +1 -0
  115. package/dist/lib/development_server/start_hmr_server.js +1 -0
  116. package/dist/lib/development_server/watch_for_changes/browser_path_exclusions.js +1 -0
  117. package/dist/lib/development_server/watch_for_changes/browser_paths.js +1 -0
  118. package/dist/lib/development_server/watch_for_changes/get_after_run_tasks.js +1 -0
  119. package/dist/lib/development_server/watch_for_changes/get_file_codependencies.js +1 -0
  120. package/dist/lib/development_server/watch_for_changes/get_platform_safe_path.js +1 -0
  121. package/dist/lib/development_server/watch_for_changes/index.js +1 -0
  122. package/dist/lib/development_server/watch_for_changes/node_paths.js +1 -0
  123. package/dist/lib/development_server/watch_for_changes/read_file_dependency_map.js +1 -0
  124. package/dist/lib/development_server/watch_for_changes/watch_paths.js +1 -0
  125. package/dist/lib/dynamic_import.js +1 -0
  126. package/dist/lib/encrypt_buffer.js +1 -0
  127. package/dist/lib/generate_id.js +1 -0
  128. package/dist/lib/get_files_in_path.js +1 -0
  129. package/dist/lib/get_platform_safe_path.js +1 -0
  130. package/dist/lib/get_process_id_from_port.js +2 -0
  131. package/dist/lib/is_valid_json_string.js +1 -0
  132. package/dist/lib/kill_port_process.js +1 -0
  133. package/dist/lib/kill_process_id.js +1 -0
  134. package/dist/lib/load_settings.js +1 -0
  135. package/dist/lib/loader.js +2 -82
  136. package/dist/lib/log_bars.js +1 -0
  137. package/dist/lib/node_path_polyfills.js +1 -0
  138. package/dist/lib/parse_args.js +1 -0
  139. package/dist/lib/parse_options.js +1 -0
  140. package/dist/lib/path_exists.js +1 -0
  141. package/dist/lib/rainbow_road.js +1 -0
  142. package/dist/lib/replace_in_files.js +1 -0
  143. package/dist/lib/required_files.js +1 -0
  144. package/dist/lib/serialize_query_parameters.js +1 -0
  145. package/dist/lib/types.js +1 -6
  146. package/dist/lib/unique_array.js +1 -0
  147. package/increment_version.js +3 -0
  148. package/package.json +19 -38
  149. package/src/cli.js +59 -51
  150. package/src/commands/build/definition.js +58 -0
  151. package/src/commands/build/index.js +7 -0
  152. package/src/commands/create/build_package_json.js +20 -0
  153. package/src/commands/create/definition.js +35 -0
  154. package/src/commands/create/index.js +71 -0
  155. package/src/commands/create/template/api/index.js +6 -0
  156. package/src/commands/create/template/email/base.css +9 -0
  157. package/src/commands/create/template/email/base.html +10 -0
  158. package/src/commands/create/template/email/reset_password.js +20 -0
  159. package/src/commands/create/template/i18n/en-US.js +14 -0
  160. package/src/commands/create/template/index.client.js +1 -0
  161. package/src/commands/create/template/index.css +34 -0
  162. package/src/{functions/create/templates → commands/create/template}/index.html +2 -3
  163. package/src/{functions/create/templates → commands/create/template}/index.server.js +6 -6
  164. package/src/commands/create/template/public/apple-touch-icon-152x152.png +0 -0
  165. package/src/commands/create/template/public/favicon.ico +0 -0
  166. package/src/commands/create/template/public/joystick_logo.webp +0 -0
  167. package/src/{functions/create/templates → commands/create/template}/public/manifest.json +4 -4
  168. package/src/commands/create/template/public/splash-screen-1024x1024.png +0 -0
  169. package/{dist/functions/create/templates → src/commands/create/template}/ui/components/button/index.js +14 -6
  170. package/{dist/functions/create/templates → src/commands/create/template}/ui/layouts/app/index.js +2 -2
  171. package/src/commands/create/template/ui/pages/error/index.js +50 -0
  172. package/src/commands/create/template/ui/pages/index/index.js +121 -0
  173. package/src/commands/help/definition.js +12 -0
  174. package/src/commands/help/index.js +48 -0
  175. package/src/commands/index.js +23 -0
  176. package/src/commands/logout/definition.js +10 -0
  177. package/src/commands/logout/index.js +20 -0
  178. package/src/commands/push/cdn_mirrors.js +7 -0
  179. package/src/commands/push/check_if_settings_valid.js +10 -0
  180. package/src/commands/push/create_version.js +20 -0
  181. package/src/commands/push/definition.js +43 -0
  182. package/src/commands/push/get_app_domain.js +11 -0
  183. package/src/commands/push/get_deployment.js +19 -0
  184. package/src/commands/push/get_provision_domain.js +9 -0
  185. package/src/commands/push/get_session_token.js +31 -0
  186. package/src/commands/push/get_settings_file.js +47 -0
  187. package/src/commands/push/handle_initial_deployment.js +24 -0
  188. package/src/commands/push/handle_version_deployment.js +23 -0
  189. package/src/commands/push/index.js +190 -0
  190. package/src/commands/push/prompts/confirm_deployment.js +73 -0
  191. package/src/commands/push/prompts/session_token.js +11 -0
  192. package/src/commands/push/upload_build_to_cdn.js +59 -0
  193. package/src/commands/push/validate_deployment.js +19 -0
  194. package/src/commands/push/validate_push_config.js +18 -0
  195. package/src/commands/start/definition.js +58 -0
  196. package/src/commands/start/index.js +11 -0
  197. package/src/commands/test/definition.js +28 -0
  198. package/src/commands/test/index.js +12 -0
  199. package/src/commands/update/definition.js +28 -0
  200. package/src/commands/update/index.js +29 -0
  201. package/src/commands/use/definition.js +19 -0
  202. package/src/commands/use/index.js +54 -0
  203. package/src/index.js +0 -0
  204. package/src/lib/build/browser_path_exclusions.js +8 -0
  205. package/src/lib/build/browser_paths.js +11 -0
  206. package/src/lib/build/build_files.js +163 -0
  207. package/src/{functions/start/filesToCopy.js → lib/build/copy_paths.js} +7 -5
  208. package/src/lib/build/get_code_frame.js +11 -0
  209. package/src/lib/build/get_file_operation.js +25 -0
  210. package/src/lib/build/get_files_to_build.js +41 -0
  211. package/src/lib/build/get_path_platform.js +32 -0
  212. package/src/lib/build/get_platform_safe_path.js +6 -0
  213. package/src/lib/build/get_tar_ignore_list.js +41 -0
  214. package/src/lib/build/index.js +137 -0
  215. package/src/lib/build/master_ignore_list.js +14 -0
  216. package/src/lib/build/minify_file.js +15 -0
  217. package/src/lib/build/node_paths.js +19 -0
  218. package/src/lib/build/on_warn.js +70 -0
  219. package/src/lib/build/plugins/bootstrap_component.js +191 -0
  220. package/src/lib/build/plugins/generate_file_dependency_map.js +20 -0
  221. package/src/lib/build/plugins/index.js +26 -0
  222. package/src/lib/build/plugins/set_component_id.js +89 -0
  223. package/src/lib/build/plugins/update_file_map.js +98 -0
  224. package/src/lib/build/plugins/warn_node_environment.js +20 -0
  225. package/src/lib/{CLILog.js → cli_log.js} +12 -8
  226. package/src/lib/color_log.js +7 -0
  227. package/src/lib/command_exists.js +16 -0
  228. package/src/lib/constants.js +11 -1
  229. package/src/lib/debounce.js +9 -0
  230. package/src/lib/decrypt_buffer.js +12 -0
  231. package/src/lib/development_server/ava_config.js +14 -0
  232. package/src/lib/development_server/check_if_port_occupied.js +31 -0
  233. package/src/lib/development_server/cleanup.js +15 -0
  234. package/src/lib/development_server/databases/download_database_binary.js +35 -0
  235. package/src/lib/{dev/databases/mongodb/availableQueryParameters.js → development_server/databases/mongodb/available_query_parameters.js} +3 -1
  236. package/src/lib/development_server/databases/mongodb/build_connection_string.js +36 -0
  237. package/src/lib/development_server/databases/mongodb/build_query_parameters.js +17 -0
  238. package/src/lib/development_server/databases/mongodb/check_connection.js +41 -0
  239. package/src/lib/development_server/databases/mongodb/connect.js +27 -0
  240. package/src/lib/development_server/databases/mongodb/index.js +102 -0
  241. package/src/lib/development_server/databases/mongodb/installers/linux.js +107 -0
  242. package/src/lib/development_server/databases/mongodb/installers/macos.js +109 -0
  243. package/src/lib/development_server/databases/mongodb/installers/windows.js +90 -0
  244. package/src/lib/development_server/databases/postgresql/check_connection.js +56 -0
  245. package/src/lib/development_server/databases/postgresql/connect.js +33 -0
  246. package/src/lib/development_server/databases/postgresql/index.js +157 -0
  247. package/src/lib/development_server/databases/postgresql/installers/linux.js +80 -0
  248. package/src/lib/development_server/databases/postgresql/installers/macos.js +91 -0
  249. package/src/lib/development_server/databases/postgresql/installers/windows.js +83 -0
  250. package/src/lib/development_server/databases/provider_map.js +15 -0
  251. package/src/lib/development_server/get_database_process_ids.js +28 -0
  252. package/src/lib/development_server/get_translations.js +85 -0
  253. package/src/lib/development_server/hmr_server.js +94 -0
  254. package/src/lib/development_server/index.js +436 -0
  255. package/src/lib/development_server/kill_process_ids.js +8 -0
  256. package/src/lib/development_server/run_tests.js +84 -0
  257. package/src/lib/development_server/start_app_server.js +55 -0
  258. package/src/lib/development_server/start_databases.js +108 -0
  259. package/src/lib/development_server/start_hmr_server.js +36 -0
  260. package/src/lib/development_server/watch_for_changes/browser_path_exclusions.js +8 -0
  261. package/src/lib/development_server/watch_for_changes/browser_paths.js +11 -0
  262. package/src/lib/development_server/watch_for_changes/get_after_run_tasks.js +36 -0
  263. package/src/lib/development_server/watch_for_changes/get_file_codependencies.js +53 -0
  264. package/src/lib/development_server/watch_for_changes/get_platform_safe_path.js +6 -0
  265. package/src/lib/development_server/watch_for_changes/index.js +222 -0
  266. package/src/lib/development_server/watch_for_changes/node_paths.js +17 -0
  267. package/src/lib/development_server/watch_for_changes/read_file_dependency_map.js +18 -0
  268. package/src/lib/development_server/watch_for_changes/watch_paths.js +22 -0
  269. package/src/lib/dynamic_import.js +6 -0
  270. package/src/lib/encrypt_buffer.js +10 -0
  271. package/src/lib/generate_id.js +15 -0
  272. package/src/lib/get_files_in_path.js +25 -0
  273. package/src/lib/get_platform_safe_path.js +8 -0
  274. package/src/lib/get_process_id_from_port.js +26 -0
  275. package/src/lib/is_valid_json_string.js +10 -0
  276. package/src/lib/kill_port_process.js +12 -0
  277. package/src/lib/kill_process_id.js +19 -0
  278. package/src/lib/load_settings.js +43 -0
  279. package/src/lib/loader.js +4 -77
  280. package/src/lib/log_bars.js +7 -0
  281. package/src/lib/node_path_polyfills.js +23 -0
  282. package/src/lib/parse_args.js +16 -0
  283. package/src/lib/parse_options.js +16 -0
  284. package/src/lib/path_exists.js +11 -0
  285. package/src/lib/{rainbowRoad.js → rainbow_road.js} +4 -2
  286. package/src/lib/replace_in_files.js +40 -0
  287. package/src/lib/{dev/requiredFiles.js → required_files.js} +3 -1
  288. package/src/lib/serialize_query_parameters.js +7 -0
  289. package/src/lib/types.js +59 -2
  290. package/src/lib/unique_array.js +24 -0
  291. package/HMRNOTES.txt +0 -23
  292. package/_package.json +0 -56
  293. package/canary.js +0 -12
  294. package/dist/functions/build/getTarIgnoreList.js +0 -25
  295. package/dist/functions/build/index.js +0 -54
  296. package/dist/functions/create/buildPackageJSON.js +0 -20
  297. package/dist/functions/create/index.js +0 -193
  298. package/dist/functions/create/templates/api/index.js +0 -4
  299. package/dist/functions/create/templates/i18n/en-US.js +0 -4
  300. package/dist/functions/create/templates/index.client.js +0 -7
  301. package/dist/functions/create/templates/index.css +0 -20
  302. package/dist/functions/create/templates/public/apple-touch-icon-152x152.png +0 -0
  303. package/dist/functions/create/templates/public/favicon.ico +0 -0
  304. package/dist/functions/create/templates/public/splash-screen-1024x1024.png +0 -0
  305. package/dist/functions/create/templates/ui/pages/error/index.js +0 -31
  306. package/dist/functions/create/templates/ui/pages/index/index.js +0 -94
  307. package/dist/functions/index.js +0 -269
  308. package/dist/functions/logout/index.js +0 -20
  309. package/dist/functions/push/checkIfProvisionAvailable.js +0 -19
  310. package/dist/functions/push/deploy/index.js +0 -173
  311. package/dist/functions/push/deploy/initial.js +0 -100
  312. package/dist/functions/push/deploy/version.js +0 -100
  313. package/dist/functions/push/domains.js +0 -23
  314. package/dist/functions/push/getAvailableCDN.js +0 -23
  315. package/dist/functions/push/getDeployment.js +0 -41
  316. package/dist/functions/push/getDeploymentSummary.js +0 -38
  317. package/dist/functions/push/getInstanceSizeRegions.js +0 -37
  318. package/dist/functions/push/getInstanceSizesForRegion.js +0 -34
  319. package/dist/functions/push/getProviderInstanceSizes.js +0 -34
  320. package/dist/functions/push/getProviderRegions.js +0 -36
  321. package/dist/functions/push/getProvidersWithConnectionStatus.js +0 -20
  322. package/dist/functions/push/getSessionToken.js +0 -23
  323. package/dist/functions/push/getUserFromSessionToken.js +0 -37
  324. package/dist/functions/push/index.js +0 -210
  325. package/dist/functions/push/loginToCheatCode.js +0 -33
  326. package/dist/functions/push/pingProvisionAPI.js +0 -31
  327. package/dist/functions/push/prompts.js +0 -332
  328. package/dist/functions/push/providerMap.js +0 -11
  329. package/dist/functions/push/providers.js +0 -9
  330. package/dist/functions/reset/index.js +0 -0
  331. package/dist/functions/reset/reset.js +0 -127
  332. package/dist/functions/start/bootstrapLayoutComponent.js +0 -54
  333. package/dist/functions/start/bootstrapPageComponent.js +0 -51
  334. package/dist/functions/start/buildFile.js +0 -85
  335. package/dist/functions/start/buildFiles.js +0 -76
  336. package/dist/functions/start/buildPlugins.js +0 -183
  337. package/dist/functions/start/checkIfPortAvailable.js +0 -18
  338. package/dist/functions/start/cleanup/index.js +0 -18
  339. package/dist/functions/start/databases/mongodb/availableQueryParameters.js +0 -42
  340. package/dist/functions/start/databases/mongodb/buildConnectionString.js +0 -22
  341. package/dist/functions/start/databases/mongodb/buildQueryParameters.js +0 -14
  342. package/dist/functions/start/databases/mongodb/checkConnection.js +0 -35
  343. package/dist/functions/start/databases/mongodb/connect.js +0 -25
  344. package/dist/functions/start/databases/mongodb/index.js +0 -93
  345. package/dist/functions/start/databases/postgresql/checkConnection.js +0 -41
  346. package/dist/functions/start/databases/postgresql/connect.js +0 -27
  347. package/dist/functions/start/databases/postgresql/index.js +0 -106
  348. package/dist/functions/start/databases/redis.js +0 -0
  349. package/dist/functions/start/databases/startProvider.js +0 -16
  350. package/dist/functions/start/fileDependencyMapper.js +0 -22
  351. package/dist/functions/start/filesToCopy.js +0 -18
  352. package/dist/functions/start/generateId.js +0 -74
  353. package/dist/functions/start/getCodependenciesForFile.js +0 -64
  354. package/dist/functions/start/getFilesToBuild.js +0 -39
  355. package/dist/functions/start/getProcessIdFromPort.js +0 -60
  356. package/dist/functions/start/hmrServer.js +0 -66
  357. package/dist/functions/start/index.js +0 -11
  358. package/dist/functions/start/isWindows.js +0 -5
  359. package/dist/functions/start/minifyFile.js +0 -12
  360. package/dist/functions/start/onWarn.js +0 -63
  361. package/dist/functions/start/readFileDependencyMap.js +0 -16
  362. package/dist/functions/start/removeDeletedDependenciesFromMap.js +0 -18
  363. package/dist/functions/start/setComponentId.js +0 -46
  364. package/dist/functions/start/updateFileMap.js +0 -67
  365. package/dist/functions/test/index.js +0 -12
  366. package/dist/functions/update/index.js +0 -21
  367. package/dist/functions/use/index.js +0 -61
  368. package/dist/lib/CLILog.js +0 -49
  369. package/dist/lib/build/browserPathExclusions.js +0 -8
  370. package/dist/lib/build/browserPaths.js +0 -11
  371. package/dist/lib/build/buildFile.js +0 -84
  372. package/dist/lib/build/buildFiles.js +0 -240
  373. package/dist/lib/build/buildPlugins.js +0 -186
  374. package/dist/lib/build/getCodeFrame.js +0 -9
  375. package/dist/lib/build/minifyFile.js +0 -12
  376. package/dist/lib/build/nodePathExclusions.js +0 -7
  377. package/dist/lib/build/nodePaths.js +0 -12
  378. package/dist/lib/build/onWarn.js +0 -63
  379. package/dist/lib/build/removeDeletedDependenciesFromMap.js +0 -18
  380. package/dist/lib/build/setComponentId.js +0 -46
  381. package/dist/lib/build/updateFileMap.js +0 -67
  382. package/dist/lib/buildResolvePlugin.js +0 -21
  383. package/dist/lib/checkIfValidJSON.js +0 -11
  384. package/dist/lib/colorLog.js +0 -7
  385. package/dist/lib/dev/cleanup.js +0 -18
  386. package/dist/lib/dev/databases/mongodb/availableQueryParameters.js +0 -42
  387. package/dist/lib/dev/databases/mongodb/buildConnectionString.js +0 -22
  388. package/dist/lib/dev/databases/mongodb/buildQueryParameters.js +0 -14
  389. package/dist/lib/dev/databases/mongodb/checkConnection.js +0 -38
  390. package/dist/lib/dev/databases/mongodb/connect.js +0 -25
  391. package/dist/lib/dev/databases/mongodb/index.js +0 -93
  392. package/dist/lib/dev/databases/postgresql/checkConnection.js +0 -41
  393. package/dist/lib/dev/databases/postgresql/connect.js +0 -27
  394. package/dist/lib/dev/databases/postgresql/index.js +0 -106
  395. package/dist/lib/dev/databases/providerMap.js +0 -15
  396. package/dist/lib/dev/getCodependenciesForFile.js +0 -64
  397. package/dist/lib/dev/getFilesToBuild.js +0 -38
  398. package/dist/lib/dev/hmrServer.js +0 -66
  399. package/dist/lib/dev/index.js +0 -559
  400. package/dist/lib/dev/isWindows.js +0 -5
  401. package/dist/lib/dev/loadSettings.js +0 -79
  402. package/dist/lib/dev/readFileDependencyMap.js +0 -16
  403. package/dist/lib/dev/requiredFiles.js +0 -18
  404. package/dist/lib/dev/runBuild.js +0 -30
  405. package/dist/lib/dev/runTests.js +0 -96
  406. package/dist/lib/dev/startApp.js +0 -70
  407. package/dist/lib/dev/startDatabases.js +0 -109
  408. package/dist/lib/dev/startHMR.js +0 -55
  409. package/dist/lib/dev/tests.config.js +0 -6
  410. package/dist/lib/dev/updateFileMap.js +0 -67
  411. package/dist/lib/dev/validateProject.js +0 -0
  412. package/dist/lib/dev/watchlist.js +0 -15
  413. package/dist/lib/filesToCopy.js +0 -18
  414. package/dist/lib/generateId.js +0 -74
  415. package/dist/lib/getArgs.js +0 -14
  416. package/dist/lib/getOptions.js +0 -15
  417. package/dist/lib/getPlatformSafePath.js +0 -7
  418. package/dist/lib/getProcessIdFromPort.js +0 -60
  419. package/dist/lib/getProvider.js +0 -8
  420. package/dist/lib/help.js +0 -56
  421. package/dist/lib/isObject.js +0 -6
  422. package/dist/lib/isValidJSONString.js +0 -11
  423. package/dist/lib/isWindows.js +0 -5
  424. package/dist/lib/killProcesses.js +0 -0
  425. package/dist/lib/loadSettings.js +0 -33
  426. package/dist/lib/masterIgnoreList.js +0 -16
  427. package/dist/lib/nodeEnvironment.js +0 -9
  428. package/dist/lib/nodeEnvironments.js +0 -8
  429. package/dist/lib/parseCookiesFromLogin.js +0 -18
  430. package/dist/lib/rainbowRoad.js +0 -7
  431. package/dist/lib/readDirectorySync.js +0 -14
  432. package/dist/lib/regexes.js +0 -14
  433. package/dist/lib/replaceBackslashesWithForwardSlashes.js +0 -8
  434. package/dist/lib/replaceFileProtocol.js +0 -8
  435. package/dist/lib/serializeQueryParameters.js +0 -8
  436. package/dist/lib/settings.js +0 -4
  437. package/dist/lib/validateDatabasesFromSettings.js +0 -34
  438. package/dist/lib/wait.js +0 -8
  439. package/release.js +0 -40
  440. package/src/functions/build/getTarIgnoreList.js +0 -30
  441. package/src/functions/build/index.js +0 -63
  442. package/src/functions/create/buildPackageJSON.js +0 -18
  443. package/src/functions/create/index.js +0 -209
  444. package/src/functions/create/templates/api/index.js +0 -4
  445. package/src/functions/create/templates/i18n/en-US.js +0 -4
  446. package/src/functions/create/templates/index.client.js +0 -7
  447. package/src/functions/create/templates/index.css +0 -20
  448. package/src/functions/create/templates/public/apple-touch-icon-152x152.png +0 -0
  449. package/src/functions/create/templates/public/favicon.ico +0 -0
  450. package/src/functions/create/templates/public/splash-screen-1024x1024.png +0 -0
  451. package/src/functions/create/templates/ui/pages/error/index.js +0 -31
  452. package/src/functions/create/templates/ui/pages/index/index.js +0 -94
  453. package/src/functions/index.js +0 -269
  454. package/src/functions/logout/index.js +0 -20
  455. package/src/functions/push/checkIfProvisionAvailable.js +0 -20
  456. package/src/functions/push/deploy/index.js +0 -199
  457. package/src/functions/push/deploy/initial.js +0 -108
  458. package/src/functions/push/deploy/version.js +0 -108
  459. package/src/functions/push/domains.js +0 -23
  460. package/src/functions/push/getAvailableCDN.js +0 -27
  461. package/src/functions/push/getDeployment.js +0 -43
  462. package/src/functions/push/getDeploymentSummary.js +0 -39
  463. package/src/functions/push/getInstanceSizeRegions.js +0 -40
  464. package/src/functions/push/getInstanceSizesForRegion.js +0 -35
  465. package/src/functions/push/getProviderInstanceSizes.js +0 -35
  466. package/src/functions/push/getProviderRegions.js +0 -39
  467. package/src/functions/push/getProvidersWithConnectionStatus.js +0 -25
  468. package/src/functions/push/getSessionToken.js +0 -26
  469. package/src/functions/push/getUserFromSessionToken.js +0 -39
  470. package/src/functions/push/index.js +0 -245
  471. package/src/functions/push/loginToCheatCode.js +0 -34
  472. package/src/functions/push/pingProvisionAPI.js +0 -33
  473. package/src/functions/push/prompts.js +0 -276
  474. package/src/functions/push/providerMap.js +0 -8
  475. package/src/functions/push/providers.js +0 -6
  476. package/src/functions/reset/index.js +0 -0
  477. package/src/functions/reset/reset.js +0 -163
  478. package/src/functions/start/bootstrapLayoutComponent.js +0 -57
  479. package/src/functions/start/bootstrapPageComponent.js +0 -54
  480. package/src/functions/start/buildFile.js +0 -97
  481. package/src/functions/start/buildFiles.js +0 -101
  482. package/src/functions/start/buildPlugins.js +0 -215
  483. package/src/functions/start/checkIfPortAvailable.js +0 -21
  484. package/src/functions/start/cleanup/index.js +0 -23
  485. package/src/functions/start/databases/mongodb/availableQueryParameters.js +0 -39
  486. package/src/functions/start/databases/mongodb/buildConnectionString.js +0 -28
  487. package/src/functions/start/databases/mongodb/buildQueryParameters.js +0 -15
  488. package/src/functions/start/databases/mongodb/checkConnection.js +0 -36
  489. package/src/functions/start/databases/mongodb/connect.js +0 -25
  490. package/src/functions/start/databases/mongodb/index.js +0 -108
  491. package/src/functions/start/databases/postgresql/checkConnection.js +0 -43
  492. package/src/functions/start/databases/postgresql/connect.js +0 -27
  493. package/src/functions/start/databases/postgresql/index.js +0 -127
  494. package/src/functions/start/databases/redis.js +0 -0
  495. package/src/functions/start/databases/startProvider.js +0 -15
  496. package/src/functions/start/fileDependencyMapper.js +0 -24
  497. package/src/functions/start/generateId.js +0 -73
  498. package/src/functions/start/getCodependenciesForFile.js +0 -84
  499. package/src/functions/start/getFilesToBuild.js +0 -49
  500. package/src/functions/start/getProcessIdFromPort.js +0 -92
  501. package/src/functions/start/hmrServer.js +0 -78
  502. package/src/functions/start/index.js +0 -9
  503. package/src/functions/start/isWindows.js +0 -3
  504. package/src/functions/start/minifyFile.js +0 -10
  505. package/src/functions/start/onWarn.js +0 -68
  506. package/src/functions/start/readFileDependencyMap.js +0 -19
  507. package/src/functions/start/removeDeletedDependenciesFromMap.js +0 -19
  508. package/src/functions/start/setComponentId.js +0 -58
  509. package/src/functions/start/updateFileMap.js +0 -100
  510. package/src/functions/test/index.js +0 -10
  511. package/src/functions/update/index.js +0 -20
  512. package/src/functions/use/index.js +0 -62
  513. package/src/lib/build/browserPathExclusions.js +0 -6
  514. package/src/lib/build/browserPaths.js +0 -9
  515. package/src/lib/build/buildFile.js +0 -91
  516. package/src/lib/build/buildFiles.js +0 -273
  517. package/src/lib/build/buildPlugins.js +0 -222
  518. package/src/lib/build/getCodeFrame.js +0 -7
  519. package/src/lib/build/minifyFile.js +0 -10
  520. package/src/lib/build/nodePathExclusions.js +0 -5
  521. package/src/lib/build/nodePaths.js +0 -10
  522. package/src/lib/build/onWarn.js +0 -68
  523. package/src/lib/build/removeDeletedDependenciesFromMap.js +0 -19
  524. package/src/lib/build/setComponentId.js +0 -58
  525. package/src/lib/build/updateFileMap.js +0 -100
  526. package/src/lib/buildResolvePlugin.js +0 -32
  527. package/src/lib/checkIfValidJSON.js +0 -8
  528. package/src/lib/colorLog.js +0 -5
  529. package/src/lib/dev/cleanup.js +0 -26
  530. package/src/lib/dev/databases/mongodb/buildConnectionString.js +0 -28
  531. package/src/lib/dev/databases/mongodb/buildQueryParameters.js +0 -15
  532. package/src/lib/dev/databases/mongodb/checkConnection.js +0 -40
  533. package/src/lib/dev/databases/mongodb/connect.js +0 -25
  534. package/src/lib/dev/databases/mongodb/index.js +0 -108
  535. package/src/lib/dev/databases/postgresql/checkConnection.js +0 -43
  536. package/src/lib/dev/databases/postgresql/connect.js +0 -27
  537. package/src/lib/dev/databases/postgresql/index.js +0 -127
  538. package/src/lib/dev/databases/providerMap.js +0 -13
  539. package/src/lib/dev/getCodependenciesForFile.js +0 -84
  540. package/src/lib/dev/getFilesToBuild.js +0 -47
  541. package/src/lib/dev/hmrServer.js +0 -78
  542. package/src/lib/dev/index.js +0 -684
  543. package/src/lib/dev/isWindows.js +0 -3
  544. package/src/lib/dev/loadSettings.js +0 -90
  545. package/src/lib/dev/readFileDependencyMap.js +0 -19
  546. package/src/lib/dev/runBuild.js +0 -33
  547. package/src/lib/dev/runTests.js +0 -122
  548. package/src/lib/dev/startApp.js +0 -79
  549. package/src/lib/dev/startDatabases.js +0 -131
  550. package/src/lib/dev/startHMR.js +0 -62
  551. package/src/lib/dev/tests.config.js +0 -3
  552. package/src/lib/dev/updateFileMap.js +0 -100
  553. package/src/lib/dev/validateProject.js +0 -0
  554. package/src/lib/dev/watchlist.js +0 -13
  555. package/src/lib/filesToCopy.js +0 -15
  556. package/src/lib/generateId.js +0 -73
  557. package/src/lib/getArgs.js +0 -14
  558. package/src/lib/getOptions.js +0 -12
  559. package/src/lib/getProcessIdFromPort.js +0 -92
  560. package/src/lib/getProvider.js +0 -5
  561. package/src/lib/help.js +0 -56
  562. package/src/lib/isObject.js +0 -3
  563. package/src/lib/isValidJSONString.js +0 -8
  564. package/src/lib/killProcesses.js +0 -5
  565. package/src/lib/loadSettings.js +0 -40
  566. package/src/lib/masterIgnoreList.js +0 -13
  567. package/src/lib/nodeEnvironment.js +0 -6
  568. package/src/lib/nodeEnvironments.js +0 -8
  569. package/src/lib/parseCookiesFromLogin.js +0 -21
  570. package/src/lib/readDirectorySync.js +0 -13
  571. package/src/lib/regexes.js +0 -7
  572. package/src/lib/replaceBackslashesWithForwardSlashes.js +0 -8
  573. package/src/lib/replaceFileProtocol.js +0 -8
  574. package/src/lib/serializeQueryParameters.js +0 -5
  575. package/src/lib/settings.js +0 -1
  576. package/src/lib/validateDatabasesFromSettings.js +0 -37
  577. package/src/lib/wait.js +0 -5
  578. package/storage/.verdaccio-db.json +0 -1
  579. /package/{src/lib → .build}/getPlatformSafePath.js +0 -0
  580. /package/{src/lib → .build}/isWindows.js +0 -0
  581. /package/dist/{functions/create/templates → commands/create/template}/public/service-worker.js +0 -0
  582. /package/dist/{functions/create/templates → commands/create/template}/settings.development.json +0 -0
  583. /package/src/{functions/create/templates → commands/create/template}/public/service-worker.js +0 -0
  584. /package/src/{functions/create/templates → commands/create/template}/settings.development.json +0 -0
@@ -0,0 +1,121 @@
1
+ import joystick from "@joystick.js/ui";
2
+ import Button from "../../components/button/index.js";
3
+
4
+ const Index = joystick.component({
5
+ data: async (api = {}) => {
6
+ return {
7
+ stars: await api.fetch(
8
+ `https://api.github.com/repos/cheatcode/joystick`
9
+ ).then(async (response) => {
10
+ const repo = await response.json();
11
+ return repo?.stargazers_count;
12
+ }),
13
+ };
14
+ },
15
+ css: {
16
+ min: {
17
+ width: {
18
+ 0: `
19
+ .splash {
20
+ position: fixed;
21
+ inset: 0;
22
+ display: flex;
23
+ justify-content: center;
24
+ align-items: center;
25
+ }
26
+
27
+ .splash header {
28
+ text-align: center;
29
+ padding: 0px 30px;
30
+ }
31
+
32
+ .splash header img {
33
+ width: 100%;
34
+ max-width: 250px;
35
+ }
36
+
37
+ .splash header p {
38
+ color: #aaa;
39
+ font-size: 18px;
40
+ line-height: 26px;
41
+ margin-top: 30px;
42
+ }
43
+
44
+ .splash header ul {
45
+ margin-top: 40px;
46
+ list-style: none;
47
+ }
48
+
49
+ .splash header ul li {
50
+ width: 100%;
51
+ }
52
+
53
+ .splash header ul li:first-child {
54
+ margin-bottom: 20px;
55
+ }
56
+
57
+ .splash footer {
58
+ position: fixed;
59
+ bottom: 20px;
60
+ color: #444;
61
+ }
62
+
63
+ .splash footer a {
64
+ color: #444;
65
+ text-decoration: underline;
66
+ text-decoration-color: #222;
67
+ text-underline-offset: 2px;
68
+ }
69
+
70
+ .splash footer a:hover {
71
+ color: #fff;
72
+ text-decoration-color: var(--brand);
73
+ }
74
+ `,
75
+ 768: `
76
+ .splash header ul {
77
+ display: inline-flex;
78
+ }
79
+
80
+ .splash header ul li:first-child {
81
+ margin-bottom: 0px;
82
+ margin-right: 0px;
83
+ }
84
+ `,
85
+ }
86
+ }
87
+ },
88
+ render: ({ data, component, i18n }) => {
89
+ return `
90
+ <div class="splash">
91
+ <header>
92
+ <img src="/joystick_logo.webp" alt="Joystick" />
93
+ <p>A full-stack JavaScript framework for building web apps and websites.</p>
94
+ <ul>
95
+ <li>
96
+ ${component(Button, {
97
+ theme: "brand",
98
+ target: "_blank",
99
+ href: "https://github.com/cheatcode/joystick#tutorials",
100
+ label: i18n("buttons.get_started"),
101
+ })}
102
+ </li>
103
+ <li>
104
+ ${component(Button, {
105
+ theme: "github",
106
+ target: "_blank",
107
+ href: "https://github.com/cheatcode/joystick",
108
+ label: i18n("buttons.view_on_github", { stars: data.stars > 1000 ? `${data.stars / 1000}K` : data.stars }),
109
+ })}
110
+ </li>
111
+ </ul>
112
+ </header>
113
+ <footer>
114
+ <p>&copy; <a href="https://cheatcode.co">CheatCode</a> — Nullius in verba.</p>
115
+ </footer>
116
+ </div>
117
+ `;
118
+ },
119
+ });
120
+
121
+ export default Index;
@@ -0,0 +1 @@
1
+ import o from"./index.js";const[n,r,...s]=process.argv,t={description:"Output this help information",args:{},options:{},command:o};var e=t;export{e as default};
@@ -0,0 +1,19 @@
1
+ import r from"chalk";import{createRequire as n}from"module";import t from"../index.js";import s from"../../lib/rainbow_road.js";const p=n(import.meta.url),i=p("../../../package.json"),b=(o=5,e="")=>[...o-e.length>0?Array(o-e.length):""].map(()=>" ").join(""),l=(o={})=>Object.keys(o).map(e=>`<${e}>`).join(" "),m=(o={})=>Object.entries(o).map(([e,a])=>` ${a.flags&&Object.keys(a.flags).map(c=>r.magenta(c))?.reverse().join(", ")} ${r.gray(a.description)}`).join(`
2
+ `),$=()=>{console.log(`
3
+ ${s()}
4
+
5
+ ${r.yellowBright("@joystick.js/cli")} ${r.magenta(`(v${i.version})`)}
6
+
7
+ ${r.blue("Manage your Joystick app.")}
8
+
9
+ ${r.gray("https://docs.cheatcode.co/joystick/cli")}
10
+
11
+ ${s()}
12
+
13
+ ${Object.entries(t).map(([o,e])=>`
14
+ ${r.green(o)} ${r.gray(e.description)}
15
+
16
+ joystick ${o} ${r.yellow(l(e.args))}
17
+ ${e.options&&Object.keys(e.options).length>0?`
18
+ ${m(e.options)}
19
+ `:""}`).join("")}`)};var k=$;export{k as default};
@@ -0,0 +1 @@
1
+ import o from"./build/definition.js";import r from"./create/definition.js";import m from"./help/definition.js";import t from"./logout/definition.js";import p from"./push/definition.js";import f from"./start/definition.js";import i from"./test/definition.js";import e from"./update/definition.js";import s from"./use/definition.js";const u={build:o,create:r,help:m,logout:t,push:p,start:f,test:i,update:e,use:s};var j=u;export{j as default};
@@ -0,0 +1 @@
1
+ import o from"./index.js";const t={description:"Log out of your CheatCode Push account.",args:{},options:{},command:o};var n=t;export{n as default};
@@ -0,0 +1,3 @@
1
+ import s from"fs";import t from"os";import e from"../../lib/color_log.js";import n from"../../lib/path_exists.js";const{unlink:i}=s.promises,r=async(m={},p={})=>{const o=`${t.homedir()}/.push/session_token`;return await n(o)&&(await i(o,"utf-8"),e(`
2
+ \u2714 Logged out
3
+ `,"greenBright")),!0};var c=r;export{c as default};
@@ -0,0 +1 @@
1
+ const s=["https://push-versions-1.cheatcode.co","https://push-versions-2.cheatcode.co","https://push-versions-3.cheatcode.co"];var o=s;export{o as default};
@@ -0,0 +1 @@
1
+ const t=(e="")=>{try{return JSON.parse(e),!0}catch{return!1}};var c=t;export{c as default};
@@ -0,0 +1 @@
1
+ import a from"node-fetch";const t=(e={})=>a(`${e?.push_provision_domain}/api/versions/${e?.domain}`,{method:"POST",headers:{"Content-Type":"application/json","x-push-session-token":e?.session_token},body:JSON.stringify(e?.body)})?.then(async n=>(await n.json())?.data).catch(n=>{console.warn(n)});var r=t;export{r as default};
@@ -0,0 +1 @@
1
+ import n from"./index.js";const[i,o,...e]=process.argv,s={description:"Deploy your Joystick app using Push.",args:{},options:{environment:{flags:{"-e":{set:!!e.includes("-e"),value:!!e.includes("-e")&&e[e.indexOf("-e")+1],parent:"push"},"--environment":{set:!!e.includes("--environment"),value:!!e.includes("--environment")&&e[e.indexOf("--environment")+1],parent:"push"}},description:"The value you want to use for NODE_ENV in the deployed app (e.g., staging or production). Default is production."},provision_server:{flags:{"-s":{set:!!e.includes("-s"),value:!!e.includes("-s")&&e[e.indexOf("-s")+1],parent:"push"},"--server":{set:!!e.includes("--server"),value:!!e.includes("--server")&&e[e.indexOf("--server")+1],parent:"push"}},description:"The Push provision server to target (development or production)."}},command:n};var t=s;export{t as default};
@@ -0,0 +1 @@
1
+ const o=(t="production")=>({development:"http://localhost:2600",staging:"https://staging.push.cheatcode.co",production:"https://push.cheatcode.co"})[t];var e=o;export{e as default};
@@ -0,0 +1 @@
1
+ import a from"node-fetch";const n=(e={})=>a(`${e?.push_provision_domain}/api/deployments/${e?.domain}`,{method:"GET",headers:{"x-push-session-token":e?.session_token,Accept:"application/json"}})?.then(async t=>(await t.json())?.data).catch(t=>{console.warn(t)});var c=n;export{c as default};
@@ -0,0 +1 @@
1
+ const t=(o="production")=>({development:"http://localhost:2603",staging:"https://staging.provision.cheatcode.co",production:"https://provision.cheatcode.co"})[o];var e=t;export{e as default};
@@ -0,0 +1 @@
1
+ import i from"os";import n from"fs";import r from"inquirer";import e from"../../lib/path_exists.js";import p from"./prompts/session_token.js";const{readFile:m,mkdir:a,writeFile:_}=n.promises,f=async()=>{const s=i.homedir(),t=`${s}/.push/session_token`;if(await e(t))return m(t,"utf-8");const{session_token:o}=await r.prompt(p());if(o)return await e(`${s}/.push`)||await a(`${s}/.push`),await _(`${s}/.push/session_token`,o),o};var x=f;export{x as default};
@@ -0,0 +1 @@
1
+ import n from"fs";import i from"../../lib/cli_log.js";import o from"../../lib/is_valid_json_string.js";import r from"../../lib/path_exists.js";const{readFile:a}=n.promises,c=async(t="")=>{const s=`settings.${t}.json`;return await r(s)?a(s):(i(`Could not find a ${s} in your project. Double-check this exists and try again.`,{level:"danger",docs:"https://cheatcode.co/docs/push/config"}),process.exit(0))},_=async t=>{const s=`settings.${t?.environment}.json`,e=await c(t?.environment);return o(e)?JSON.parse(e):(i(`${s} contains invalid JSON. Double-check the syntax and try again.`,{level:"danger",docs:"https://cheatcode.co/docs/push/config"}),process.exit(0))};var m=_;export{m as default};
@@ -0,0 +1 @@
1
+ import t from"node-fetch";const a=async(e={})=>t(`${e?.push_provision_domain}/api/deployments/${e?.deployment?.domain}`,{method:"POST",headers:{"x-push-session-token":e?.session_token,"Content-Type":"application/json"},body:JSON.stringify({environment:e?.environment,build_timestamp:e?.build_timestamp,domain:e?.deployment?.domain,deployment_id:e?.deployment?._id})}).then(async n=>(await n.json())?.data).catch(n=>{console.warn(n)});var m=a;export{m as default};
@@ -0,0 +1 @@
1
+ import t from"node-fetch";const a=async(e={})=>t(`${e?.push_provision_domain}/api/deployments/${e?.deployment?.domain}`,{method:"PUT",headers:{"x-push-session-token":e?.session_token,"Content-Type":"application/json"},body:JSON.stringify({build_timestamp:e?.build_timestamp,domain:e?.deployment?.domain,deployment_id:e?.deployment?._id})}).then(async n=>(await n.json())?.data).catch(n=>{console.warn(n)});var i=a;export{i as default};
@@ -0,0 +1,8 @@
1
+ import m from"chalk";import u from"inquirer";import g from"../../lib/build/index.js";import c from"../../lib/cli_log.js";import h from"./prompts/confirm_deployment.js";import y from"./create_version.js";import w from"./get_app_domain.js";import v from"./get_deployment.js";import $ from"./get_provision_domain.js";import b from"./get_settings_file.js";import k from"./get_session_token.js";import x from"./handle_initial_deployment.js";import S from"./handle_version_deployment.js";import j from"../../lib/loader.js";import D from"./upload_build_to_cdn.js";import B from"./validate_deployment.js";import O from"./validate_push_config.js";const _=(r="",s="",e={})=>{let t="";for(let o=0;o<e?.errors?.length;o+=1){const n=e?.errors[o];r==="push_config"&&(t+=`${m.yellowBright(`> ${n.field}`)}
2
+ `),t+=`${n?.error}
3
+ ${o+1===e?.errors?.length?"":`
4
+ `}`}c(`${s?`${m.yellowBright(s)}
5
+
6
+
7
+ `:""}${t}`,{level:"danger",docs:{push_config:"https://cheatcode.co/docs/push/config",deployment:"https://cheatcode.co/docs/push/subscription"}[r]}),process.exit(0)},q=async()=>{const r=await k();return r||(c(data?.error?.message,{level:"danger",docs:"https://cheatcode.co/docs/push/cli#authentication"}),process.exit(0))},A=(r="")=>(c(`settings.${r}.json must contain a push config object. Add this following the docs link below and try again.`,{level:"danger",docs:"https://cheatcode.co/docs/push/config"}),process.exit(0)),I=async(r={},s={})=>{process.loader=new j,process.loader.print("Starting deployment...");const e=await q(),t=s?.environment||"production",o=await b({environment:t});if(!o?.push)return A(t);const n=$(s?.provision_server),l=w(s?.provision_server),i=await v({domain:o?.push?.domain,session_token:e,push_provision_domain:n});let p;i?.status==="undeployed"&&(p=await O({push_provision_domain:n,push_config:o?.push}),p?.errors?.length>0&&_("push_config",`Push config in settings.${t}.json failed validation with the following errors:`,p));const d=await B({session_token:e,push_provision_domain:n,push_config:o?.push});d?.errors?.length>0&&_("deployment","Deployment failed validation with the following errors:",d);const{confirm_deployment:f}=i?.status==="undeployed"?await u.prompt(h(p?.instances)):{confirm_deployment:!0};if(f){i?.status==="undeployed"&&console.log(`
8
+ `);const a=new Date().toISOString();await g({environment:t,encrypt_build:!0,encryption_key:i?.deployment_secret,silence_confirmation:!0}),process.loader.print("Uploading version..."),await D(a,i,e);const J=await y({push_provision_domain:n,domain:o?.push?.domain,session_token:e,body:{settings:JSON.stringify(o),build_timestamp:a}});return process.loader.print("Deploying app..."),i?.status==="undeployed"?x({push_provision_domain:n,push_app_domain:l,session_token:e,environment:t,build_timestamp:a,deployment:i}):S({push_provision_domain:n,push_app_domain:l,session_token:e,environment:t,build_timestamp:a,deployment:i})}};var X=I;export{X as default};
@@ -0,0 +1,17 @@
1
+ import _ from"ascii-table";import e from"chalk";const s=(r,[l="",o=[]])=>{r.addRow(`${e.magenta(l)}
2
+ `);for(let t=0;t<o?.length;t+=1){const n=o[t];r.addRow(`${e.yellow(n?.provider)} (${e.green(n?.region)})`,`${e.white(n?.size)} $${e.green(n?.pricePerMonth)}/mo. x${e.blue(n?.quantity)} ${e.white("=")} $${e.green(n?.quantity*n?.pricePerMonth)}/mo.${t+1===o?.length?`
3
+ `:""}`)}},d=(r=[])=>Object.values(r)?.flatMap(o=>o)?.reduce((o=0,t={})=>(o+=t?.pricePerMonth*t?.quantity,o),0),h=(r={})=>{const l=d(r?.load_balancer),o=d(r?.app),t=l+o,n=new _;n.removeBorder(),n.addRow(`${e.blue("Load Balancer")}
4
+ `);const i=Object.entries(r?.load_balancer),c=Object.entries(r?.app);for(let a=0;a<i?.length;a+=1)s(n,i[a]);n.addRow(`
5
+ ${e.blue("App")}
6
+ `);for(let a=0;a<c?.length;a+=1)s(n,c[a]);n.addRow(e.white(`
7
+ ---
8
+ `)),n.addRow(e.green("Monthly Cost"),e.white(`$${e.green(t)}/mo.`)),n.addRow(e.green("Annual Cost"),e.white(`$${e.green(t*12)}/yr.`));const p=t>100;return[{name:"confirm_deployment",type:"confirm",prefix:"",message:`
9
+ ${e.greenBright(">")} Start deployment and provision these instances?`,suffix:`
10
+
11
+ ${n.toString()}
12
+ ${p?`
13
+
14
+ ${e.yellowBright(`!!! >>> These costs are ${e.magenta("high")}. Be absolutely ${e.magenta("CERTAIN")} you want to run this deployment. <<< !!!`)}
15
+
16
+ `:`
17
+ `}`}]};var g=h;export{g as default};
@@ -0,0 +1,5 @@
1
+ import e from"chalk";const o=()=>[{name:"session_token",type:"text",prefix:"",message:`
2
+ ${e.yellowBright(">")} To login to Push, paste your session token below:
3
+ `,suffix:` ${e.yellowBright("Find your session token here:")} https://push.cheatcode.co/account/profile
4
+
5
+ `}];var t=o;export{t as default};
@@ -0,0 +1 @@
1
+ import n from"node-fetch";import i from"form-data";import d from"fs";import m from"lodash";import c from"./cdn_mirrors.js";const{readFile:l}=d.promises,p=async()=>{const a=(await Promise.allSettled(c?.map(async t=>{const o=new AbortController;setTimeout(()=>o.abort(),2e3);const e=await n(`${t}/api/ping`,{signal:o.signal}).catch(r=>({status:503}));return{mirror:t,status:e.status}})))?.map(t=>t.value);return m.orderBy(a,["status","mirror"])[0]},u=async(a="",t={},o="")=>{const e=await p(),r=new i;return r.append("version_tar",await l(".build/build.encrypted.tar.gz"),`${a}.tar.gz`),r.append("build_timestamp",a),r.append("domain",t?.domain),r.append("deployment_id",t?._id),n(`${e?.mirror}/api/versions`,{method:"POST",headers:{...r.getHeaders(),"x-push-session-token":o},body:r}).then(async s=>(await s.json())?.data).catch(s=>{console.warn(s)})};var y=u;export{y as default};
@@ -0,0 +1 @@
1
+ import n from"node-fetch";const t=(a={})=>n(`${a?.push_provision_domain}/api/deployments/${a?.push_config?.domain}/validate`,{method:"POST",headers:{"Content-Type":"application/json","x-push-session-token":a?.session_token},body:JSON.stringify(a?.push_config)})?.then(async e=>(await e.json())?.data).catch(e=>{console.warn(e)});var i=t;export{i as default};
@@ -0,0 +1 @@
1
+ import n from"node-fetch";const o=(t={})=>n(`${t?.push_provision_domain}/api/validate/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t?.push_config)})?.then(async a=>(await a.json())?.data).catch(a=>{console.warn(a)});var c=o;export{c as default};
@@ -0,0 +1 @@
1
+ import n from"./index.js";const[r,i,...e]=process.argv,t={description:"Start an existing Joystick app.",args:{},options:{environment:{flags:{"-e":{set:!!e.includes("-e"),value:!!e.includes("-e")&&e[e.indexOf("-e")+1],parent:"start"},"--environment":{set:!!e.includes("--environment"),value:!!e.includes("--environment")&&e[e.indexOf("--environment")+1],parent:"start"}},description:"Environment to set for process.env.NODE_ENV."},port:{flags:{"-p":{set:!!e.includes("-p"),value:!!e.includes("-p")&&parseInt(e[e.indexOf("-p")+1],10),parent:"start"},"--port":{set:!!e.includes("--port"),value:!!e.includes("--port")&&parseInt(e[e.indexOf("--port")+1],10),parent:"start"}},description:"Port number to run the app on."},debug:{flags:{"-d":{set:!!e.includes("-d"),value:!!e.includes("-d"),parent:"start"},"--debug":{set:!!e.includes("--debug"),value:!!e.includes("--debug"),parent:"start"}},description:"Run the Joystick app's Node.js process in debug mode with --inspect."}},command:n};var o=t;export{o as default};
@@ -0,0 +1 @@
1
+ import r from"../../lib/development_server/index.js";const t=async(n={},e={})=>{await r({environment:e?.environment||"development",port:e?.port||2600,debug:!!e?.debug})};var m=t;export{m as default};
@@ -0,0 +1 @@
1
+ import s from"./index.js";const[a,i,...t]=process.argv,e={description:"Start an existing Joystick app and run its tests.",args:{},options:{watch:{flags:{"-w":{set:!!t.includes("-w"),value:!!t.includes("-w"),parent:"test"},"--watch":{set:!!t.includes("--watch"),value:!!t.includes("--watch"),parent:"test"}},description:"Run joystick test in watch mode."}},command:s};var c=e;export{c as default};
@@ -0,0 +1 @@
1
+ import e from"../../lib/development_server/index.js";const r=async(o={},t={})=>{await e({environment:"test",process,port:1977,watch:t?.watch})};var a=r;export{a as default};
@@ -0,0 +1 @@
1
+ import r from"./index.js";const[t,o,...e]=process.argv,a={description:"Update all Joystick packages to their latest version.",args:{},options:{release:{flags:{"-r":{set:!!e.includes("-r"),value:!!e.includes("-r")&&e[e.indexOf("-r")+1],parent:"create"},"--release":{set:!!e.includes("--release"),value:!!e.includes("--release")&&e[e.indexOf("--release")+1],parent:"create"}},description:"The release of Joystick to update (production or canary)."}},command:r};var i=a;export{i as default};
@@ -0,0 +1 @@
1
+ import"chalk";import e from"child_process";import s from"util";import c from"../../lib/color_log.js";import t from"../../lib/loader.js";const r=s.promisify(e.exec),i=async(n={},a={})=>{process.loader=new t,process.loader.print("Updating Joystick dependencies..."),process.loader.print(`Updating @joystick.js/node${a?.relase==="canary"?"-canary":""}...`),await r(`npm i @joystick.js/node${a?.relase==="canary"?"-canary":""}@latest`),process.loader.print(`Updating @joystick.js/test${a?.relase==="canary"?"-canary":""}...`),await r(`npm i @joystick.js/test${a?.relase==="canary"?"-canary":""}@latest`),process.loader.print(`Updating @joystick.js/ui${a?.relase==="canary"?"-canary":""}...`),await r(`npm i @joystick.js/ui${a?.relase==="canary"?"-canary":""}@latest`),process.loader.print(`Updating @joystick.js/cli${a?.relase==="canary"?"-canary":""}...`),await r(`npm i -g @joystick.js/cli${a?.relase==="canary"?"-canary":""}@latest`),c("\u2714 Joystick updated!","green"),process.exit(0)};var m=i;export{m as default};
@@ -0,0 +1 @@
1
+ import s from"./index.js";const[r,n,...e]=process.argv,o={description:"Decides which release of Joystick to use (production or canary).",args:{release:{set:!!e.includes("use")&&!!e[e.indexOf("use")+1],parent:"use",value:!!e.includes("use")&&e[e.indexOf("use")+1],description:"The release of Joystick to use (production or canary)."}},options:{},command:s};var t=o;export{t as default};
@@ -0,0 +1 @@
1
+ import c from"child_process";import o from"util";import n from"../../lib/loader.js";import e from"../../lib/replace_in_files.js";const s=o.promisify(c.exec),t=async(a={},r={})=>{const i=new n;a?.release==="canary"&&(await e(process.cwd(),{match:[/\.js$/],exclude:[/node_modules/],replace_regex:/(@joystick\.js\/node)(?!-)/g,replace_with:"@joystick.js/node-canary"}),await e(process.cwd(),{match:[/\.js$/],exclude:[/node_modules/],replace_regex:/(@joystick\.js\/ui)(?!-)/g,replace_with:"@joystick.js/ui-canary"}),i.print("Swapping production packages for canary versions..."),await s("npm uninstall @joystick.js/node && npm i @joystick.js/node-canary"),await s("npm uninstall @joystick.js/ui && npm i @joystick.js/ui-canary")),a?.release==="production"&&(await e(process.cwd(),{match:[/\.js$/],exclude:[/node_modules/],replace_regex:/(@joystick\.js\/node-canary)/g,replace_with:"@joystick.js/node"}),await e(process.cwd(),{match:[/\.js$/],exclude:[/node_modules/],replace_regex:/(@joystick.js\/ui-canary)/g,replace_with:"@joystick.js/ui"}),i.print("Swapping canary packages for production versions..."),await s("npm uninstall @joystick.js/node-canary && npm i @joystick.js/node"),await s("npm uninstall @joystick.js/ui-canary && npm i @joystick.js/ui"))};var y=t;export{y as default};
package/dist/index.js CHANGED
@@ -1,8 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import { spawn } from "child_process";
3
- import { fileURLToPath } from "url";
4
- import { dirname } from "path";
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = dirname(__filename);
7
- const args = process.argv.slice(2, process.argv.length);
8
- spawn("node", ["--no-warnings", `${__dirname}/cli.js`, ...args], { stdio: "inherit" });
2
+ import{spawn as r}from"child_process";import{fileURLToPath as o}from"url";import{dirname as n}from"path";const i=o(import.meta.url),e=n(i),s=process.argv.slice(2,process.argv.length);r("node",["--no-warnings",`${e}/cli.js`,...s],{stdio:"inherit"});
@@ -0,0 +1 @@
1
+ import t from"./get_platform_safe_path.js";const e=[t("lib/node"),t("tests/")];var s=e;export{s as default};
@@ -0,0 +1 @@
1
+ import e from"../get_platform_safe_path.js";const t=[e("email/"),e("lib/"),e("lib/browser"),e("ui/"),"index.client.js"];var i=t;export{i as default};
@@ -0,0 +1,3 @@
1
+ import u from"esbuild";import d from"esbuild-plugin-svg";import s from"./plugins/index.js";import f from"./get_code_frame.js";import p from"../build/minify_file.js";import h from"./on_warn.js";import b from"../path_exists.js";const w=async(r={},e="")=>{const n=r?.errors&&r?.errors[0],o=await b(e)?await f(e,{line:n?.location?.line,column:n?.location?.column}):null;return await h({file:e,stack:r?.stack,line:n?.location?.line,column:n?.location?.column,snippet:o,lineWithError:n?.location?.lineText?.trim(),message:n?.text}),o},v=(r={})=>{const e=r?.message?.split(":");return e[2]&&e[2]?.includes("No loader")?e[3]&&e[3]?.replace(`
2
+ `,"")||"":e[1]&&e[1]?.replace(`
3
+ `,"")||""},c=async(r={})=>{const e=v(r),n=await w(r,e);return{success:!1,path:e,error:{stack:r?.stack,snippet:n}}},g=(r=[],e={})=>u.build({allowOverwrite:!0,platform:"node",format:"esm",bundle:!1,sourcemap:!0,entryPoints:r?.map(n=>n.path),entryNames:"[dir]/[name]",outdir:e?.output_path||"./.joystick/build",outbase:"./",define:{"process.env.NODE_ENV":`'${e?.environment||"development"}'`},plugins:[s.warn_node_environment,s.generate_file_dependency_map]}),y=(r=[],e={})=>u.build({allowOverwrite:!0,target:"es2020",platform:"browser",format:"esm",bundle:!0,sourcemap:!0,entryPoints:r?.map(n=>n.path),entryNames:"[dir]/[name]",outbase:"./",outdir:e?.output_path||"./.joystick/build",define:{"process.env.NODE_ENV":`'${e?.environment||"development"}'`},loader:{".svg":"text"},plugins:[s.warn_node_environment,s.generate_file_dependency_map,s.bootstrap_component,d()]}),k=async r=>{const e=[".DS_Store"],n=r?.files?.filter(t=>!e?.some(i=>t?.path?.includes(i)))?.filter(t=>t?.platform==="node"),o=r?.files?.filter(t=>!e?.some(i=>t?.path?.includes(i)))?.filter(t=>t?.platform==="browser");let a=[],l=[];n?.length>0&&(a=[await g(n,r).then(()=>({success:!0})).catch(t=>c(t))]),o?.length>0&&(l=[await y(o,r).then(()=>({success:!0})).catch(t=>c(t))]);const m=a?.some(t=>!t?.success),_=l?.some(t=>!t?.success);return m||_?Promise.reject([...a,...l]):(r?.environment&&r?.environment!=="development"&&await Promise.all([...o,...n].map(t=>p(`${r?.output_path||"./.joystick/build"}/${t.path}`))),[...a,...l])};var D=k;export{D as default};
@@ -0,0 +1 @@
1
+ const e=[{path:"css",regex:new RegExp(process.platform==="win32"?/^css\\/:/^css\//)},{path:"i18n",regex:new RegExp(process.platform==="win32"?/^i18n\\/:/^i18n\//)},{path:"public",regex:new RegExp(process.platform==="win32"?/^public\\/:/^public\//)},{path:"private",regex:new RegExp(process.platform==="win32"?/^private\\/:/^private\//)},{path:"index.html",regex:new RegExp(/^index.html/)},{path:"index.css",regex:new RegExp(/^index.css/)},{path:"package.json",regex:new RegExp(/^package.json/)},{path:"package-lock.json",regex:new RegExp(/^package-lock.json/)},{path:"settings.development.json",regex:new RegExp(/^settings.development.json/)},{path:"settings.staging.json",regex:new RegExp(/^settings.staging.json/)},{path:"settings.test.json",regex:new RegExp(/^settings.test.json/)},{path:"settings.production.json",regex:new RegExp(/^settings.production.json/)},{path:".html",regex:new RegExp(/^([0-9a-zA-Z-._])+.html/)}];var t=e;export{t as default};
@@ -0,0 +1 @@
1
+ import r from"fs";import{codeFrameColumns as s}from"@babel/code-frame";const{readFile:a}=r.promises,m=async(t="",e={})=>{const o=await a(t,"utf-8");return s(o,{start:e})};var i=m;export{i as default};
@@ -0,0 +1 @@
1
+ import s from"./copy_paths.js";const r=(t="")=>s.some(e=>e.regex.test(t)),c=(t="")=>t==="js",_=(t="")=>{const e=t?.split(".")?.pop(),i=c(e),o=r(t);return!i||i&&o?"copy_file":"build_file"};var p=_;export{p as default};
@@ -0,0 +1 @@
1
+ import s from"fs";import l from"../get_files_in_path.js";import c from"./master_ignore_list.js";const{stat:p}=s.promises,u=async(i=[],o=[])=>{const n=await l("./",[]),_=c;return n.filter(e=>!o.some(t=>e.includes(t))).filter(e=>!i.some(t=>e.includes(t))).filter(e=>!_.some(t=>e.includes(t))).filter(e=>!s.lstatSync(e).isDirectory())};var x=u;export{x as default};
@@ -0,0 +1 @@
1
+ import t from"./browser_path_exclusions.js";import s from"./browser_paths.js";import n from"./node_paths.js";const _=(r="")=>n.some(e=>r.includes(e)),c=(r="")=>s.some(e=>r.includes(e))&&!t.some(e=>r.includes(e)),i=(r="")=>{const e=c(r),o=_(r);if(e)return"browser";if(o)return"node"};var f=i;export{f as default};
@@ -0,0 +1 @@
1
+ const r=(e="")=>process.platform==="win32"?e.replace("/","\\"):e;var t=r;export{t as default};
@@ -0,0 +1,2 @@
1
+ import r from"fs";import o from"./master_ignore_list.js";const s=(e=[])=>`{${[...((r.existsSync(".gitignore")?r.readFileSync(".gitignore","utf-8"):"")?.split(`
2
+ `)?.filter(t=>!t?.includes("#")&&t?.trim()!=="")||[])?.map(t=>`^${t}`),...(e||[])?.map(t=>`^${t}`),...(o||[])?.map(t=>`^${t}`),"*.tar","*.tar.gz","*.tar.xz"].filter((t,i,n)=>n.indexOf(t)===i)?.map(t=>`"${t}"`).join(",")}}`;var c=s;export{c as default};
@@ -0,0 +1,3 @@
1
+ import b from"chalk";import g from"child_process";import l from"fs";import{dirname as y}from"path";import w from"util";import $ from"./build_files.js";import x from"./get_files_to_build.js";import z from"./get_file_operation.js";import v from"./get_path_platform.js";import F from"./get_tar_ignore_list.js";import k from"../load_settings.js";import S from"../loader.js";import f from"../path_exists.js";import j from"../../lib/encrypt_buffer.js";const{mkdir:B,copyFile:P,readFile:A,writeFile:D,readdir:L}=l.promises,p=w.promisify(g.exec),q=async(i=[])=>{const r=[];for(let o=0;o<i?.length;o+=1){const e=i[o];if(l.existsSync(e))if(l.lstatSync(e).isDirectory()){const _=await L(e,{recursive:!0});r.push(...(_||[])?.map(s=>`${e}/${s}`))}else r.push(e)}return r},C=(i=[])=>i?.map(r=>({path:r,operation:z(r),platform:v(r)})),E=async(i={})=>{const r=new S,o=i?.type||"tar",e=i?.environment||"production";r.print(`Building app to ${o} for ${e}...`);const c=await k(e),_=c?.config?.build?.excluded_paths||c?.config?.build?.excludedPaths,s=await q(c?.config?.build?.copy_paths),m=await x(_,s),a=o==="tar"?".build/.tar":".build",u=C(m);await f(".build")&&await p("rm -rf .build");const d=[...u?.filter(t=>t?.operation==="copy_file"),...(s||[])?.map(t=>({path:t}))],h=u?.filter(t=>t?.operation==="build_file");for(let t=0;t<d?.length;t+=1){const n=d[t];l.lstatSync(n?.path).isFile()&&(await B(y(`${a}/${n?.path}`),{recursive:!0}),await P(n?.path,`${a}/${n?.path}`))}if(await $({files:h,environment:e,output_path:a}).catch(t=>{console.warn(t)}),o==="tar"){const t=F(c?.config?.build?.excludedPaths);await p(`cd ${a} && tar --exclude=${t} -czf ../build.tar.gz .`),await p(`rm -rf ${a}`)}if(o==="tar"&&i?.encrypt_build){const t=a?.replace("/.tar","/build.tar.gz"),n=j(await A(t),i?.encryption_key);await D(".build/build.encrypted.tar.gz",n)}i?.silence_confirmation||console.log(b.greenBright(`
2
+ \u2714 App built as ${o} to ${o==="tar"?a?.replace("/.tar","/build.tar.gz"):a}!
3
+ `)),await f(".build/component_id_cache.json")&&await p("rm -rf .build/component_id_cache.json")};var Y=E;export{Y as default};
@@ -0,0 +1 @@
1
+ const t=[".build",".DS_Store",".git",".joystick/build",".joystick/data",".push","node_modules","settings.development.json","settings.staging.json","settings.production.json"];var s=t;export{s as default};
@@ -0,0 +1 @@
1
+ import o from"fs";import f from"esbuild";import r from"../path_exists.js";const{readFile:s,writeFile:a}=o.promises,m=async(i="")=>{if(await r(i)){const t=await s(i,"utf-8"),e=await f.transform(t,{minify:!0});await a(i,e.code)}};var d=m;export{d as default};
@@ -0,0 +1 @@
1
+ import e from"./get_platform_safe_path.js";const s=[e("api/"),e("caches/"),e("cronJobs/"),e("cron_jobs/"),e("fixtures/"),e("indexes/"),e("lib/node"),e("queues/"),e("routes/"),e("tests/"),e("uploaders/"),e("websockets/"),"index.server.js"];var t=s;export{t as default};
@@ -0,0 +1,10 @@
1
+ import l from"chalk";import s from"../constants.js";import c from"./get_code_frame.js";import t from"../rainbow_road.js";const n=(o="")=>o.replace(s.OBJECT_REGEX,""),i=(o={})=>{const e=o?.snippet?.split(`
2
+ `);console.log(`
3
+ `),console.log(`${t()}
4
+ `),o.file&&console.log(l.yellowBright(`Build Error in ${o?.file}:
5
+ `)),e&&e.length>0&&e.forEach(r=>r.includes(`> ${o.line} |`)?console.log(` ${l.red(r)}`):console.log(` ${l.gray(r)}`)),o?.stack&&(console.log(l.magentaBright(`
6
+ Stack Trace:
7
+ `)),console.log(l.yellow(` ${n(o?.stack)}
8
+ `))),process.loader.error("Build error. Fix the error above to continue building your app."),console.log(`
9
+ `),console.log(`${t()}
10
+ `)},a=async(o={},e="")=>e&&e==="BUILD_ERROR"?{file:o?.file,snippet:o?.snippet?await c(o.file,{line:o?.line,column:o?.column}):"",stack:o?.stack,line:o?.line,character:o?.column,message:o?.message}:null,f=async o=>{const e=await a(o,"BUILD_ERROR");return e&&i(e),e};var d=f;export{d as default};
@@ -0,0 +1,33 @@
1
+ import"chalk";import k from"fs";import r from"../../get_platform_safe_path.js";import c from"../../constants.js";import j from"./set_component_id.js";import E from"../../path_exists.js";const{readFile:f,writeFile:g}=k.promises,x=(t="",o=[])=>{for(let _=0;_<o?.length;_+=1){const n=o[_];t=t.replace(`%example:${_}%`,n)}},$=(t="",o="",_="")=>t.replace(`${o};`,`if (
2
+ typeof window !== 'undefined' &&
3
+ window.__joystick_should_auto_mount__ === true &&
4
+ !window.__joystick_layout_url__ &&
5
+ window.__joystick_page_url__ &&
6
+ !window.__joystick_hmr_update__ &&
7
+ joystick &&
8
+ joystick.mount
9
+ ) {
10
+ joystick.mount(${_}, window.__joystick_ssr_props__ || {}, document.getElementById('app'));
11
+ }
12
+
13
+ export default ${_};
14
+ `),O=(t="",o="",_="")=>t.replace(`${o};`,`if (
15
+ typeof window !== 'undefined' &&
16
+ window.__joystick_should_auto_mount__ === true &&
17
+ window.__joystick_layout_url__ &&
18
+ window.__joystick_page_url__ &&
19
+ !window.__joystick_hmr_update__ &&
20
+ joystick &&
21
+ joystick.mount
22
+ ) {
23
+ (async () => {
24
+ const layout_component_file = await import(window.__joystick_layout_url__);
25
+ const page_component_file = await import(window.window.__joystick_page_url__);
26
+ const layout = layout_component_file.default;
27
+ const page = page_component_file.default;
28
+ joystick.mount(layout, Object.assign({ ...window.__joystick_ssr_props__ }, { page }), document.getElementById('app'));
29
+ })();
30
+ }
31
+
32
+ export default ${_};
33
+ `),X=(t="")=>t.replace(c.JOYSTICK_COMMENT_REGEX,""),y=(t="")=>{let o=0;return t.replace(c.EXAMPLE_CODE_REGEX,()=>`%example:${o++}%`)},w=(t="")=>t.match(c.EXAMPLE_CODE_REGEX)||[],P=(t=null)=>(t&&t.split(" ")||[])?.pop(),R=(t=!1,o=null)=>t&&!!o,C=(t="")=>{const o=t.match(c.EXPORT_DEFAULT_REGEX)||[];return o&&o[0]},h=(t="")=>{const o=t.match(c.JOYSTICK_UI_REGEX)||[];return!!o&&!!o[0]},u=(t="",o={})=>[r(t)].some(_=>o.path.includes(_)),G=(t="")=>[r("ui/"),r("email/")].some(o=>t.includes(o)),I=(t={})=>{t.onLoad({filter:/\.js$/},async(o={})=>{const _=u("ui/layouts",o),n=u("ui/pages",o),p=u("email/",o);if(_||n||p){let e=await f(r(o.path),"utf-8");const l=h(e),i=C(e),s=R(l,i),m=w(e),a=P(i);return e=y(e),e=X(e),e=a&&_?O(e,i,a):e,e=a&&n?$(e,i,a):e,x(e,m),{contents:e,loader:"js"}}}),t.onEnd(()=>new Promise(async o=>{for(let _=0;_<t?.initialOptions?.entryPoints?.length;_+=1){const n=t?.initialOptions?.entryPoints[_],p=G(n),d=await E(`${t?.initialOptions?.outdir}/${n}`);if(p&&d){let e=await f(`${t?.initialOptions?.outdir}/${n}`,"utf-8");const l=h(e),i=w(e);if(e=y(e),l){e=await j(e);for(let s=0;s<i?.length;s+=1){const m=i[s];e=e.replace(`%example:${s}%`,m)}await g(`${t?.initialOptions?.outdir}/${n}`,e)}}}o()}))};var B=I;export{B as default};
@@ -0,0 +1 @@
1
+ import p from"fs";import o from"../../get_platform_safe_path.js";import m from"./update_file_map.js";const{readFile:n}=p.promises,s=(a={})=>{a.onLoad({filter:/\.js$/},async e=>{if(!["node_modules",".joystick","?","commonjsHelpers.js"].some(t=>o(e.path).includes(t))){const t=await n(o(e.path),"utf-8");await m(o(e.path),t)}})};var c=s;export{c as default};
@@ -0,0 +1 @@
1
+ import n from"./bootstrap_component.js";import o from"./generate_file_dependency_map.js";import t from"./warn_node_environment.js";const p={bootstrap_component:{name:"bootstrap_component",setup(e){n(e)}},generate_file_dependency_map:{name:"generate_file_dependency_map",setup(e){o(e)}},warn_node_environment:{name:"warn_node_environment",setup(e){t(e)}}};var a=p;export{a as default};
@@ -0,0 +1,2 @@
1
+ import _ from"fs";import a from"../../generate_id.js";import r from"../../path_exists.js";const{readFile:p,writeFile:m}=_.promises,d=async(t=[],n={},o="")=>{for(let e=0;e<t.length;e+=1){const c=t[e];n[c.path]=c.component_id,await m(o,JSON.stringify(n))}},u=(t=[],n="")=>{let o=n;for(let e=0;e<t.length;e+=1){const c=t[e],i=c.source.replace(/\.component\(\{+(?!\n + _componentId)/g,()=>`.component({
2
+ _componentId: '${c.component_id}',`);o=o.replace(c.source,i)}return o},h=(t="",n=[],o={})=>n?.map((e,c)=>{const i=n[c+1],s=e.path.replace("// ","");return{path:s,component_id:o[s]||a(16),index:e.index,source:t.substring(e.index,i?i.index:t.length)}}),l=(t="")=>[...t?.matchAll(/\/\/ ui+.*/gi),...t?.matchAll(/\/\/ email+.*/gi)].map(n=>({path:n[0],index:n.index})),g=async(t="")=>{if(await r(t)){const o=await p(t,"utf-8");return JSON.parse(o)}return{}},x=()=>["development","test"].includes(process.env.NODE_ENV)?"./.joystick/build/component_id_cache.json":"./.build/component_id_cache.json",f=async(t="")=>{const n=x(),o=await g(n),e=l(t),c=h(t,e,o),i=u(c,t);return await d(c,o,n),i};var j=f;export{j as default};
@@ -0,0 +1 @@
1
+ import i from"fs";import l,{dirname as u}from"path";import*as d from"acorn";import f from"../../path_exists.js";const{readFile:S,writeFile:D}=i.promises,y=(r="",t={})=>(t?.body?.filter(e=>{const s=e&&e.type,n=e&&e.declarations||[],o=s==="VariableDeclaration",p=n.some(c=>{const _=c.type==="VariableDeclarator",m=c?.init?.callee?.name;return _&&m==="require"});return o&&p})).map(e=>{const s=e.declarations,n=s&&s[0],o=n?.init?.arguments[0]&&n.init.arguments[0]?.value;return{absolute_path:o?l.resolve(u(r),o):null}}),b=(r="",t={})=>(t?.body?.filter(({type:e})=>e==="ImportDeclaration")||[]).map(e=>({path:e?.source?.value,absolute_path:l.resolve(u(r),e?.source?.value)})),v=(r="",t={})=>{const a=b(r,t),e=y(r,t);return{imports:a,requires:e}},q=(r="")=>d.parse(r,{ecmaVersion:"latest",sourceType:"module"}),g=async()=>{const r=".joystick/build/file_map.json";if(await f(r)){const t=i.readFileSync(r,"utf-8");return t?JSON.parse(t):{}}return{}},h=async(r="",t="")=>{try{const a=await g(),e=q(t),s=e?v(r,e):[];a[r]=s,i.writeFileSync(".joystick/build/file_map.json",JSON.stringify(a,null,2))}catch{}};var V=h;export{V as default};
@@ -0,0 +1,3 @@
1
+ import n from"fs";import t from"chalk";const{readFile:r}=n.promises,a=(e={})=>{e.onLoad({filter:/\.js$/},async(o={})=>{(await r(o.path,"utf-8"))?.match(/process.env.NODE_ENV\s+=\s/gi)?.length&&console.warn(t.yellowBright(`
2
+ [WARNING] process.env.NODE_ENV should only be set via a CLI flag in development or via external environment variables in production.
3
+ `))})};var c=a;export{c as default};
@@ -0,0 +1,13 @@
1
+ import e from"chalk";import n from"./log_bars.js";const t=(g="",l={})=>{const d={info:"blue",success:"green",warning:"yellowBright",danger:"red"},r={info:"\u2771 Info",success:"\u2771 Ok",warning:"\u2771 Warning",danger:"\u2771 Error"},a=l.level?d[l.level]:"gray",$=l.level?r[l.level]:"Log",s=l.docs||"https://docs.cheatcode.co/joystick";if(console.log(`
2
+ ${l.padding||""}${n()}
3
+ `),console.log(`${l.padding||""}${e[a](`${$}:`)}
4
+ `),console.log(`${l.padding||""}${e.white(g)}
5
+ `),console.log(`${l.padding||""}${e.grey("---")}
6
+ `),console.log(`${l.padding||""}${e.white("Relevant Documentation:")}
7
+ `),console.log(`${l.padding||""}${e.blue(s)}
8
+ `),console.log(`${l.padding||""}${e.white("Stuck? Ask a Question:")}
9
+ `),console.log(`${l.padding||""}${e.blue("http://discord.cheatcode.co")}
10
+ `),l.tools&&Array.isArray(l.tools)){console.log(`${l.padding||""}${e.white("Helpful Tools:")}
11
+ `);for(let o=0;o<l?.tools?.length;o+=1){const c=l?.tools[o];console.log(`${l.padding||""}${e.blue(`${c.title} \u2014 ${c.url}`)}
12
+ `)}}console.log(`${l.padding||""}${n()}
13
+ `)};var h=t;export{h as default};
@@ -0,0 +1 @@
1
+ import r from"chalk";const t=(o="",l="blueBright")=>console.log(r[l](o));var c=t;export{c as default};
@@ -0,0 +1 @@
1
+ import t from"child_process";import c from"util";const s=c.promisify(t.exec),n=(e="")=>{const r=process.platform==="win32"?"where":"whereis";return s(`${r} ${e}`).then(()=>!0).catch(o=>(console.warn(o),!1))};var a=n;export{a as default};
@@ -1,4 +1 @@
1
- var constants_default = {};
2
- export {
3
- constants_default as default
4
- };
1
+ const E={EXAMPLE_CODE_REGEX:new RegExp(/\<example\>[^%]+\<\/example\>/g),EXPORT_DEFAULT_REGEX:new RegExp(/export default [a-zA-Z0-9]+/g),JOYSTICK_COMMENT_REGEX:new RegExp(/\<\!\-\-(.|\n|\r)*?-->/g),JOYSTICK_COMPONENT_REGEX:new RegExp(/\.component\(\{/g),JOYSTICK_UI_REGEX:new RegExp(/joystick-ui-test|joystick.js\/ui-canary|joystick.js\/ui/g),OBJECT_REGEX:new RegExp(/{([^;]*)}/g),SETTINGS_FILE_NAME_REGEX:new RegExp(/settings\.+[a-z]+\.json/g)};var e=E;export{e as default};
@@ -0,0 +1 @@
1
+ const r=(()=>{let e=0;return(t,o)=>{clearTimeout(e),e=setTimeout(t,o)}})();var u=r;export{u as default};
@@ -0,0 +1 @@
1
+ import c from"crypto";const a=(e,r)=>{const i=e.slice(0,16),s=e.slice(16),o=c.createHash("sha256").update(r).digest("hex").substring(0,32),t=c.createDecipheriv("aes256",o,i);return Buffer.concat([t.update(s),t.final()])};var p=a;export{p as default};
@@ -0,0 +1 @@
1
+ const e={files:["tests/**/*.test.js"],ignoredByWatcher:[".joystick","./uploads"],concurrency:1,cache:!1};var c=e;export{c as default};
@@ -0,0 +1 @@
1
+ import c from"net";const t=(e={})=>{e.end(),e.destroy(),e.unref()},r=(e=2600)=>new Promise(o=>{const n=new c.Socket;n.once("connect",()=>{t(n),o(!0)}),n.once("error",()=>{t(n),o(!1)}),n.connect({port:e,host:"127.0.0.1"},function(){})});var f=r;export{f as default};
@@ -0,0 +1 @@
1
+ import o from"./kill_process_ids.js";process.title="joystick_cleanup",process.on("message",async s=>{const e=JSON.parse(s)?.process_ids;o(e),process.exit()});
@@ -0,0 +1 @@
1
+ import n from"os";import m from"./mongodb/installers/macos.js";import i from"./mongodb/installers/windows.js";import l from"./mongodb/installers/linux.js";import p from"./postgresql/installers/macos.js";import e from"./postgresql/installers/windows.js";import a from"./postgresql/installers/linux.js";const t={darwin:{mongodb:m,postgresql:p},win32:{mongodb:i,postgresql:e},linux:{mongodb:l,postgresql:a}},d=async(r="")=>{const o=n.platform(),s=t[o]&&t[o][r];typeof s=="function"?await s():console.warn(`${r} not supported on ${o}`)};var u=d;export{u as default};
@@ -0,0 +1 @@
1
+ const e=["replicaSet","tls","ssl","tlsCertificateKeyFile","tlsCertificateKeyFilePassword","tlsCAFile","tlsAllowInvalidCertificates","tlsAllowInvalidHostnames","tlsInsecure","connectTimeoutMS","socketTimeoutMS","compressors","zlibCompressionLevel","maxPoolSize","minPoolSize","maxIdleTimeMS","waitQueueMultiple","waitQueueTimeoutMS","w","wtimeoutMS","journal","readConcernLevel","readPreference","maxStalenessSeconds","readPreferenceTags","authSource","authMechanism","authMechanismProperties","gssapiServiceName","localThresholdMS","serverSelectionTimeoutMS","serverSelectionTryOnce","heartbeatFrequencyMS","appName","retryReads","retryWrites","uuidRepresentation"];var t=e;export{t as default};
@@ -0,0 +1 @@
1
+ import e from"./build_query_parameters.js";import p from"../../../serialize_query_parameters.js";import $ from"../../../types.js";const d=(r={})=>{let s="mongodb://";r?.srv&&(s="mongodb+srv://"),r&&(r.username||r.password)&&(s=`${s}${r.username||r.password?`${r.username||""}${r.username&&r.password?":":""}${r.password||""}@`:""}`),r&&r.hosts&&$.is_array(r.hosts)&&(s=`${s}${r.hosts.map(a=>r?.srv?a.hostname:`${a.hostname}:${a.port}`).join(",")}`),r&&r.database&&(s=`${s}/${r.database}`);const m=e(r);return Object.keys(m)?.length>0&&(s=`${s}?${p(m)}`),s};var b=d;export{b as default};
@@ -0,0 +1 @@
1
+ import l from"./available_query_parameters.js";const u=(r={})=>{const t={};for(let e=0;e<l.length;e+=1){const a=l[e];r&&r[a]&&(t[a]=r[a])}return t};var m=u;export{m as default};
@@ -0,0 +1,2 @@
1
+ import{MongoClient as t}from"mongodb";import i from"fs";import r from"./build_connection_string.js";import s from"../../../color_log.js";const{readFile:a}=i.promises,l=async(e={},n={})=>{const c=r(e);try{const o={connectTimeoutMS:3e3,socketTimeoutMS:3e3,useNewUrlParser:!0,useUnifiedTopology:!0,ssl:!1,...n||{}};return n?.ca&&(o.ca=await a(n?.ca)),(await t.connect(c,o)).close(),!0}catch(o){console.warn(o),s(`
2
+ \u2716 Failed to connect to MongoDB. Please double-check connection settings and try again.`,"yellow"),process.exit(1)}};var d=l;export{d as default};
@@ -0,0 +1 @@
1
+ import e from"./check_connection.js";import a from"./index.js";const t=async(n={},c=2610)=>{const o=n.connection&&Object.keys(n.connection).length>0;return o&&await e(n.connection,n.options),{pid:o?null:await a(c),connection:o?n.connection:{hosts:[{hostname:"127.0.0.1",port:c}],database:"app",username:"",password:""}}};var m=t;export{m as default};
@@ -0,0 +1 @@
1
+ import i from"child_process";import f from"fs";import c from"os";import y from"../../../get_platform_safe_path.js";import u from"../../../get_process_id_from_port.js";import h from"../../../kill_port_process.js";import d from"../../../path_exists.js";const{rename:k,mkdir:w}=f.promises,b=()=>process.platform==="win32"?"mongosh.exe":"mongosh",j=()=>process.platform==="win32"?"mongod.exe":"mongod",$=(t=2610)=>new Promise(o=>{const s=j(),m=`${c.homedir()}/.joystick/databases/mongodb/bin/bin/${s}`,_=["--port",t,"--dbpath",y(`./.joystick/data/mongodb_${t}`),"--quiet","--replSet",`joystick_${t}`],n=i.spawn(m,_.filter(a=>!!a));n.stdout.on("data",async a=>{if((a?.toString()).includes("Waiting for connections")){const p=b(),l=`${c.homedir()}/.joystick/databases/mongodb/bin/bin/${p}`;i.exec(`${l} --eval "rs.initiate()" --verbose --port ${t}`,async(e,S,q)=>{e&&!e?.message?.includes("already initialized")&&console.log(e);const g=await u(t);return o(parseInt(g,10))})}}),n.stderr.on("data",async a=>{const r=a.toString();console.log(r)})}),x=async(t=2610)=>{const o=await d(".joystick/data/mongodb"),s=await d(`.joystick/data/mongodb_${t}`);return o&&!s&&await k(".joystick/data/mongodb",`.joystick/data/mongodb_${t}`),s||await w(`.joystick/data/mongodb_${t}`,{recursive:!0}),s},v=async(t=2610)=>{await x(t);try{return await h(t),await $(t)}catch(o){console.warn(o),process.exit(1)}};var D=v;export{D as default};
@@ -0,0 +1 @@
1
+ import o from"fs";import n from"path";import k from"os";import{promisify as w}from"util";import{pipeline as v}from"stream";import{execFile as D}from"child_process";const z=w(v),h=w(D),B=async(e=null)=>{const t=n.join(k.homedir(),".joystick","databases","mongodb"),i=n.join(t,"bin"),a=n.join(i,"bin");if(await C(t))return;await F(t,i,a);const p="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.2.tgz",l="https://downloads.mongodb.com/compass/mongosh-2.2.12-linux-x64.tgz",g=n.basename(new URL(p).pathname),m=n.join(t,g),b=n.basename(new URL(l).pathname),c=n.join(t,b);process.loader.print("MongoDB not found. Downloading... (this may take a few minutes)"),await u(p,m),await u(l,c),process.loader.print("Installing MongoDB..."),await h("tar",["-xzf",m,"-C",t]);const d=(await o.promises.readdir(t)).find(s=>s.startsWith("mongodb-"));if(!d)throw new Error("Could not find extracted MongoDB directory");const f=n.join(t,d,"bin"),y=await o.promises.readdir(f);for(const s of y)await o.promises.rename(n.join(f,s),n.join(a,s));const r=n.join(t,"mongosh_temp");await o.promises.mkdir(r,{recursive:!0}),await h("tar",["-xzf",c,"-C",r]);const _=(await o.promises.readdir(r)).find(s=>s.startsWith("mongosh-"));if(!_)throw new Error("Could not find mongosh directory in extracted contents");const x=n.join(r,_,"bin","mongosh"),j=n.join(a,"mongosh");await o.promises.copyFile(x,j),await o.promises.unlink(m),await o.promises.unlink(c),await o.promises.rm(r,{recursive:!0,force:!0}),await o.promises.rm(n.join(t,d),{recursive:!0,force:!0}),await M(a),process.loader.print("MongoDB installed!")},u=async(e,t)=>{const i=await fetch(e);if(!i.ok)throw new Error(`Failed to download: ${i.statusText}`);await z(i.body,o.createWriteStream(t))},C=async e=>{try{return await o.promises.access(e),!0}catch{return!1}},F=async(e,t,i)=>{await o.promises.mkdir(e,{recursive:!0}),await o.promises.mkdir(t,{recursive:!0}),await o.promises.mkdir(i,{recursive:!0})},M=async e=>{const t=await o.promises.readdir(e);for(const i of t)await o.promises.chmod(n.join(e,i),"755")};var P=B;export{P as default};
@@ -0,0 +1 @@
1
+ import o from"fs";import i from"path";import k from"os";import{promisify as w}from"util";import{pipeline as j}from"stream";import{execFile as v}from"child_process";const z=w(j),c=w(v),D=async(s=null)=>{const t=i.join(k.homedir(),".joystick","databases","mongodb"),n=i.join(t,"bin"),a=i.join(n,"bin");if(await F(t))return;await B(t,n,a);const d=(await M()).includes("ARM"),p=d?"https://fastdl.mongodb.org/osx/mongodb-macos-arm64-7.0.2.tgz":"https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-7.0.2.tgz",l=d?"https://downloads.mongodb.com/compass/mongosh-2.2.12-darwin-arm64.zip":"https://downloads.mongodb.com/compass/mongosh-2.2.12-darwin-x64.zip",h=i.basename(new URL(p).pathname),r=i.join(t,h),u=i.basename(new URL(l).pathname),m=i.join(t,u);process.loader.print("MongoDB not found. Downloading... (this may take a few minutes)"),await f(p,r),await f(l,m),process.loader.print("Installing MongoDB..."),await c("tar",["-xzf",r,"-C",n,"--strip-components=1"]);const e=i.join(t,"mongosh_temp");await o.promises.mkdir(e,{recursive:!0}),await c("unzip",["-q",m,"-d",e]);const _=(await o.promises.readdir(e)).find(x=>x.startsWith("mongosh-"));if(!_)throw new Error("Could not find mongosh directory in extracted contents");const b=i.join(e,_,"bin","mongosh"),y=i.join(a,"mongosh");await o.promises.copyFile(b,y),await o.promises.unlink(r),await o.promises.unlink(m),await o.promises.rm(e,{recursive:!0,force:!0}),await g(n),await g(a),process.loader.print("MongoDB installed!")},f=async(s,t)=>{const n=await fetch(s);if(!n.ok)throw new Error(`Failed to download: ${n.statusText}`);await z(n.body,o.createWriteStream(t))},F=async s=>{try{return await o.promises.access(s),!0}catch{return!1}},M=async()=>{const{stdout:s}=await c("sysctl",["-n","machdep.cpu.brand_string"]);return s.trim()},B=async(s,t,n)=>{await o.promises.mkdir(s,{recursive:!0}),await o.promises.mkdir(t,{recursive:!0}),await o.promises.mkdir(n,{recursive:!0})},g=async s=>{const t=await o.promises.readdir(s);for(const n of t)await o.promises.chmod(i.join(s,n),"755")};var I=D;export{I as default};
@@ -0,0 +1 @@
1
+ import e from"fs";import t from"path";import y from"os";import{promisify as p}from"util";import{pipeline as b}from"stream";import{execFile as x}from"child_process";const j=p(b),d=p(x),k=async()=>{const o=t.join(y.homedir(),".joystick","databases","mongodb"),i=t.join(o,"bin");if(await m(o))return;await v(o,i);const r="https://fastdl.mongodb.org/windows/mongodb-windows-x86_64-7.0.2.zip",l=t.basename(new URL(r).pathname),s=t.join(o,l);if(await m(s))return;process.loader.print("MongoDB not found. Downloading... (this may take a few minutes)"),await w(r,s),process.loader.print("Installing MongoDB...");const a=t.join(o,"temp");await d("powershell",["Expand-Archive","-Path",s,"-DestinationPath",a]);const h=(await e.promises.readdir(a))[0],f=t.join(a,h);await m(i)&&await e.promises.rm(i,{recursive:!0,force:!0}),await e.promises.cp(f,i,{recursive:!0});const _="https://downloads.mongodb.com/compass/mongosh-2.2.12-win32-x64.zip",c=t.join(o,"mongosh.zip");await w(_,c);const n=t.join(o,"mongosh_temp");await d("powershell",["Expand-Archive","-Path",c,"-DestinationPath",n]);const u=(await e.promises.readdir(n))[0],g=t.join(n,u,"bin","mongosh.exe");await e.promises.copyFile(g,t.join(i,"bin","mongosh.exe")),await e.promises.unlink(s),await e.promises.unlink(c),await e.promises.rm(a,{recursive:!0,force:!0}),await e.promises.rm(n,{recursive:!0,force:!0}),process.loader.print("MongoDB installed!")},w=async(o,i)=>{const r=await fetch(o);if(!r.ok)throw new Error(`Failed to download: ${r.statusText}`);await j(r.body,e.createWriteStream(i))},m=async o=>{try{return await e.promises.access(o),!0}catch{return!1}},v=async(o,i)=>{await e.promises.mkdir(o,{recursive:!0}),await e.promises.mkdir(i,{recursive:!0})};var M=k;export{M as default};
@@ -0,0 +1,2 @@
1
+ import a from"fs";import c from"pg";import n from"../../../color_log.js";const{Client:l}=c,{readFile:i}=a.promises,p=(s={})=>new Promise((t,e)=>{s.query("SELECT NOW()",o=>{o?e():t(),s.end()})}),d=async(s={},t={})=>{try{const e=s?.hosts&&s?.hosts[0],o={user:s?.username,host:e?.hostname,database:s?.database,password:s?.password,port:e?.port};t?.ssl?.ca&&(o.ssl={ca:await i(t?.ssl?.ca)});const r=new l(o);return r.connect(),await p(r),!0}catch(e){console.warn(e),n(`
2
+ \u2716 Failed to connect to PostgreSQL. Please double-check connection settings and try again.`,"yellow"),process.exit(1)}};var h=d;export{h as default};
@@ -0,0 +1 @@
1
+ import e from"os";import t from"./check_connection.js";import a from"./index.js";const r=async(o={},c=2610)=>{try{const n=o.connection&&Object.keys(o.connection).length>0;return n&&await t(o.connection,o.options),{pid:n?null:await a(c),connection:n?o.connection:{hosts:[{hostname:"127.0.0.1",port:c}],database:"app",username:(e.userInfo()||{}).username||"",password:""}}}catch(n){console.warn(n)}};var m=r;export{m as default};
@@ -0,0 +1,2 @@
1
+ import i from"child_process";import x from"fs";import q from"util";import I from"os";import g from"../../../get_platform_safe_path.js";import f from"../../../get_process_id_from_port.js";import y from"../../../path_exists.js";const o=q.promisify(i.exec),{rename:D}=x.promises,L=async(e=2610)=>{const t=await y(".joystick/data/postgresql");let s=await y(`.joystick/data/postgresql_${e}`);return t&&!s&&(await D(".joystick/data/postgresql",`.joystick/data/postgresql_${e}`),s=!0),s},K=()=>process.platform==="win32"?"createdb.exe":"createdb",N=()=>process.platform==="win32"?"postgres.exe":"postgres",R=()=>process.platform==="win32"?"initdb.exe":"initdb",S=()=>process.platform==="win32"?"pgctl.exe":"pgctl",A=async(e=2610)=>{try{const t=e,s=`${I.homedir()}/.joystick/databases/postgresql/bin/bin`,$=S(),u=R(),w=N(),j=K(),n=`${s}/${$}`,k=`${s}/${u}`,b=`${s}/${w}`,p=`${s}/${j}`;await L(e)||(process.platform==="linux"?(await o(`sudo -u postgres ./initdb -D ${process.cwd()}/.joystick/data/postgresql_${e} --no-locale`,{cwd:s}),await o("sudo chmod 755 /root"),await o(`sudo chmod 755 /root/${process.project_folder}`),await o(`sudo chmod 755 /root/${process.project_folder}/.joystick`),await o(`sudo chmod 700 /root/${process.project_folder}/.joystick/data/postgresql_${t}`),await o(`sudo chown -R postgres:postgres /root/${process.project_folder}/.joystick/data/postgresql_${t}`)):await o(`${k} -D .joystick/data/postgresql_${e} --no-locale`));const a=parseInt(await f(t),10);a&&(process.platform==="linux"?await o(`${n} kill KILL ${a}`):await o(`${n} kill KILL ${a}`));const d=process.platform==="linux"?i.spawn("sudo",["-u","postgres","./postgres",`-p ${t}`,"-D",g(`${process.cwd()}/.joystick/data/postgresql_${e}`),"-c log_destination=stderr -c logging_collector=off -c log_min_messages=WARNING"],{cwd:s,shell:"/bin/bash"}):i.spawn(b,[`-p ${t}`,"-D",g(`.joystick/data/postgresql_${e}`)]);return new Promise(_=>{d.stderr.on("data",async c=>{if((c?.toString()).includes("database system is ready to accept connections")){const m=(await f(t))?.replace(`
2
+ `,""),h=process.platform==="linux"?`sudo -u postgres ${p} -h 127.0.0.1 -p ${t} app`:`${p} -h 127.0.0.1 -p ${t} app`;o(h).then(()=>{_(parseInt(m,10))}).catch(({stderr:r})=>{r&&r.includes('database "app" already exists')?_(parseInt(m,10)):console.log(r)})}}),d.stdout.on("data",async c=>{const l=c?.toString();console.log(l)})})}catch(t){console.warn(t),process.exit(1)}};var H=A;export{H as default};
@@ -0,0 +1 @@
1
+ import{promisify as e}from"util";import{execFile as m,exec as y}from"child_process";import o from"fs";import w from"os";import i from"path";const r=e(m),_=e(y),u=e(o.mkdir),h=e(o.symlink),p=e(o.access),k=e(o.writeFile),b=async()=>{try{const t="16",g=`/usr/lib/postgresql/${t}/bin`,c=i.join(w.homedir(),".joystick","databases","postgresql","bin"),n=i.join(c,"bin"),l=i.join(n,"postgres");try{await p(l,o.constants.X_OK);return}catch{}process.loader.print("PostgreSQL not found. Installing... (this may take a few minutes)"),await r("sudo",["apt-get","install","-y","wget"]),await r("sudo",["sh","-c",'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list']);const{stdout:d}=await _("wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc"),a="/tmp/postgresql-ACCC4CF8.asc";await k(a,d),await r("sudo",["apt-key","add",a]),await r("rm",[a]),await r("sudo",["apt-get","update"]),await r("sudo",["apt-get","install","-y",`postgresql-${t}`,`postgresql-client-${t}`,`postgresql-server-dev-${t}`]),await u(c,{recursive:!0});try{await h(g,n)}catch(s){if(s.code!=="EEXIST")throw console.error("Error creating symlink:",s),s}try{await p(l,o.constants.X_OK)}catch(s){throw console.error("Error accessing PostgreSQL executable:",s),s}process.loader.print("PostgreSQL installed!")}catch(t){throw console.error("Error installing PostgreSQL:",t),t}};var E=b;export{E as default};