@joystick.js/cli-canary 0.0.0-canary.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 (231) hide show
  1. package/.build/getFilesToBuild.js +38 -0
  2. package/.build/index.js +69 -0
  3. package/HMRNOTES.txt +23 -0
  4. package/README.md +7 -0
  5. package/_package.json +55 -0
  6. package/canary.js +12 -0
  7. package/dist/cli.js +69 -0
  8. package/dist/functions/build/getTarIgnoreList.js +25 -0
  9. package/dist/functions/build/index.js +54 -0
  10. package/dist/functions/create/buildPackageJSON.js +20 -0
  11. package/dist/functions/create/index.js +193 -0
  12. package/dist/functions/create/templates/api/index.js +4 -0
  13. package/dist/functions/create/templates/i18n/en-US.js +4 -0
  14. package/dist/functions/create/templates/index.client.js +7 -0
  15. package/dist/functions/create/templates/index.css +20 -0
  16. package/dist/functions/create/templates/index.html +23 -0
  17. package/dist/functions/create/templates/index.server.js +21 -0
  18. package/dist/functions/create/templates/public/apple-touch-icon-152x152.png +0 -0
  19. package/dist/functions/create/templates/public/favicon.ico +0 -0
  20. package/dist/functions/create/templates/public/manifest.json +25 -0
  21. package/dist/functions/create/templates/public/service-worker.js +32 -0
  22. package/dist/functions/create/templates/public/splash-screen-1024x1024.png +0 -0
  23. package/dist/functions/create/templates/settings.development.json +27 -0
  24. package/dist/functions/create/templates/ui/components/button/index.js +50 -0
  25. package/dist/functions/create/templates/ui/layouts/app/index.js +13 -0
  26. package/dist/functions/create/templates/ui/pages/error/index.js +31 -0
  27. package/dist/functions/create/templates/ui/pages/index/index.js +94 -0
  28. package/dist/functions/index.js +243 -0
  29. package/dist/functions/logout/index.js +20 -0
  30. package/dist/functions/push/checkIfProvisionAvailable.js +19 -0
  31. package/dist/functions/push/deploy/index.js +173 -0
  32. package/dist/functions/push/deploy/initial.js +100 -0
  33. package/dist/functions/push/deploy/version.js +100 -0
  34. package/dist/functions/push/domains.js +23 -0
  35. package/dist/functions/push/getAvailableCDN.js +23 -0
  36. package/dist/functions/push/getDeployment.js +41 -0
  37. package/dist/functions/push/getDeploymentSummary.js +38 -0
  38. package/dist/functions/push/getInstanceSizeRegions.js +37 -0
  39. package/dist/functions/push/getInstanceSizesForRegion.js +34 -0
  40. package/dist/functions/push/getProviderInstanceSizes.js +34 -0
  41. package/dist/functions/push/getProviderRegions.js +36 -0
  42. package/dist/functions/push/getProvidersWithConnectionStatus.js +20 -0
  43. package/dist/functions/push/getSessionToken.js +23 -0
  44. package/dist/functions/push/getUserFromSessionToken.js +37 -0
  45. package/dist/functions/push/index.js +210 -0
  46. package/dist/functions/push/loginToCheatCode.js +33 -0
  47. package/dist/functions/push/pingProvisionAPI.js +31 -0
  48. package/dist/functions/push/prompts.js +332 -0
  49. package/dist/functions/push/providerMap.js +11 -0
  50. package/dist/functions/push/providers.js +9 -0
  51. package/dist/functions/reset/index.js +0 -0
  52. package/dist/functions/reset/reset.js +127 -0
  53. package/dist/functions/start/bootstrapLayoutComponent.js +54 -0
  54. package/dist/functions/start/bootstrapPageComponent.js +51 -0
  55. package/dist/functions/start/buildFile.js +85 -0
  56. package/dist/functions/start/buildFiles.js +76 -0
  57. package/dist/functions/start/buildPlugins.js +183 -0
  58. package/dist/functions/start/checkIfPortAvailable.js +18 -0
  59. package/dist/functions/start/cleanup/index.js +18 -0
  60. package/dist/functions/start/databases/mongodb/availableQueryParameters.js +42 -0
  61. package/dist/functions/start/databases/mongodb/buildConnectionString.js +22 -0
  62. package/dist/functions/start/databases/mongodb/buildQueryParameters.js +14 -0
  63. package/dist/functions/start/databases/mongodb/checkConnection.js +38 -0
  64. package/dist/functions/start/databases/mongodb/connect.js +25 -0
  65. package/dist/functions/start/databases/mongodb/index.js +93 -0
  66. package/dist/functions/start/databases/postgresql/checkConnection.js +41 -0
  67. package/dist/functions/start/databases/postgresql/connect.js +27 -0
  68. package/dist/functions/start/databases/postgresql/index.js +106 -0
  69. package/dist/functions/start/databases/redis.js +0 -0
  70. package/dist/functions/start/databases/startProvider.js +16 -0
  71. package/dist/functions/start/fileDependencyMapper.js +22 -0
  72. package/dist/functions/start/filesToCopy.js +18 -0
  73. package/dist/functions/start/generateId.js +74 -0
  74. package/dist/functions/start/getCodependenciesForFile.js +64 -0
  75. package/dist/functions/start/getFilesToBuild.js +39 -0
  76. package/dist/functions/start/getProcessIdFromPort.js +60 -0
  77. package/dist/functions/start/hmrServer.js +66 -0
  78. package/dist/functions/start/index.js +535 -0
  79. package/dist/functions/start/isWindows.js +5 -0
  80. package/dist/functions/start/minifyFile.js +12 -0
  81. package/dist/functions/start/onWarn.js +63 -0
  82. package/dist/functions/start/readFileDependencyMap.js +16 -0
  83. package/dist/functions/start/removeDeletedDependenciesFromMap.js +18 -0
  84. package/dist/functions/start/setComponentId.js +46 -0
  85. package/dist/functions/start/updateFileMap.js +67 -0
  86. package/dist/functions/update/index.js +21 -0
  87. package/dist/functions/use/index.js +61 -0
  88. package/dist/index.js +8 -0
  89. package/dist/lib/CLILog.js +49 -0
  90. package/dist/lib/buildResolvePlugin.js +21 -0
  91. package/dist/lib/checkIfValidJSON.js +11 -0
  92. package/dist/lib/colorLog.js +7 -0
  93. package/dist/lib/getArgs.js +14 -0
  94. package/dist/lib/getCodeFrame.js +10 -0
  95. package/dist/lib/getOptions.js +15 -0
  96. package/dist/lib/getPlatformSafePath.js +7 -0
  97. package/dist/lib/getProvider.js +8 -0
  98. package/dist/lib/help.js +56 -0
  99. package/dist/lib/isObject.js +6 -0
  100. package/dist/lib/isValidJSONString.js +11 -0
  101. package/dist/lib/isWindows.js +5 -0
  102. package/dist/lib/killProcesses.js +0 -0
  103. package/dist/lib/loadSettings.js +33 -0
  104. package/dist/lib/loader.js +82 -0
  105. package/dist/lib/masterIgnoreList.js +16 -0
  106. package/dist/lib/nodeEnvironment.js +9 -0
  107. package/dist/lib/nodeEnvironments.js +8 -0
  108. package/dist/lib/parseCookiesFromLogin.js +18 -0
  109. package/dist/lib/rainbowRoad.js +7 -0
  110. package/dist/lib/readDirectorySync.js +14 -0
  111. package/dist/lib/regexes.js +12 -0
  112. package/dist/lib/replaceBackslashesWithForwardSlashes.js +8 -0
  113. package/dist/lib/replaceFileProtocol.js +8 -0
  114. package/dist/lib/serializeQueryParameters.js +8 -0
  115. package/dist/lib/settings.js +4 -0
  116. package/dist/lib/validateDatabasesFromSettings.js +34 -0
  117. package/dist/lib/wait.js +8 -0
  118. package/package.json +54 -0
  119. package/release.js +40 -0
  120. package/src/cli.js +88 -0
  121. package/src/functions/build/getTarIgnoreList.js +30 -0
  122. package/src/functions/build/index.js +63 -0
  123. package/src/functions/create/buildPackageJSON.js +18 -0
  124. package/src/functions/create/index.js +209 -0
  125. package/src/functions/create/templates/api/index.js +4 -0
  126. package/src/functions/create/templates/i18n/en-US.js +4 -0
  127. package/src/functions/create/templates/index.client.js +7 -0
  128. package/src/functions/create/templates/index.css +20 -0
  129. package/src/functions/create/templates/index.html +23 -0
  130. package/src/functions/create/templates/index.server.js +21 -0
  131. package/src/functions/create/templates/public/apple-touch-icon-152x152.png +0 -0
  132. package/src/functions/create/templates/public/favicon.ico +0 -0
  133. package/src/functions/create/templates/public/manifest.json +25 -0
  134. package/src/functions/create/templates/public/service-worker.js +32 -0
  135. package/src/functions/create/templates/public/splash-screen-1024x1024.png +0 -0
  136. package/src/functions/create/templates/settings.development.json +27 -0
  137. package/src/functions/create/templates/ui/components/button/index.js +50 -0
  138. package/src/functions/create/templates/ui/layouts/app/index.js +13 -0
  139. package/src/functions/create/templates/ui/pages/error/index.js +31 -0
  140. package/src/functions/create/templates/ui/pages/index/index.js +94 -0
  141. package/src/functions/index.js +243 -0
  142. package/src/functions/logout/index.js +20 -0
  143. package/src/functions/push/checkIfProvisionAvailable.js +20 -0
  144. package/src/functions/push/deploy/index.js +199 -0
  145. package/src/functions/push/deploy/initial.js +108 -0
  146. package/src/functions/push/deploy/version.js +108 -0
  147. package/src/functions/push/domains.js +23 -0
  148. package/src/functions/push/getAvailableCDN.js +27 -0
  149. package/src/functions/push/getDeployment.js +43 -0
  150. package/src/functions/push/getDeploymentSummary.js +39 -0
  151. package/src/functions/push/getInstanceSizeRegions.js +40 -0
  152. package/src/functions/push/getInstanceSizesForRegion.js +35 -0
  153. package/src/functions/push/getProviderInstanceSizes.js +35 -0
  154. package/src/functions/push/getProviderRegions.js +39 -0
  155. package/src/functions/push/getProvidersWithConnectionStatus.js +25 -0
  156. package/src/functions/push/getSessionToken.js +26 -0
  157. package/src/functions/push/getUserFromSessionToken.js +39 -0
  158. package/src/functions/push/index.js +245 -0
  159. package/src/functions/push/loginToCheatCode.js +34 -0
  160. package/src/functions/push/pingProvisionAPI.js +33 -0
  161. package/src/functions/push/prompts.js +276 -0
  162. package/src/functions/push/providerMap.js +8 -0
  163. package/src/functions/push/providers.js +6 -0
  164. package/src/functions/reset/index.js +0 -0
  165. package/src/functions/reset/reset.js +163 -0
  166. package/src/functions/start/bootstrapLayoutComponent.js +57 -0
  167. package/src/functions/start/bootstrapPageComponent.js +54 -0
  168. package/src/functions/start/buildFile.js +97 -0
  169. package/src/functions/start/buildFiles.js +101 -0
  170. package/src/functions/start/buildPlugins.js +215 -0
  171. package/src/functions/start/checkIfPortAvailable.js +21 -0
  172. package/src/functions/start/cleanup/index.js +23 -0
  173. package/src/functions/start/databases/mongodb/availableQueryParameters.js +39 -0
  174. package/src/functions/start/databases/mongodb/buildConnectionString.js +28 -0
  175. package/src/functions/start/databases/mongodb/buildQueryParameters.js +15 -0
  176. package/src/functions/start/databases/mongodb/checkConnection.js +40 -0
  177. package/src/functions/start/databases/mongodb/connect.js +25 -0
  178. package/src/functions/start/databases/mongodb/index.js +108 -0
  179. package/src/functions/start/databases/postgresql/checkConnection.js +43 -0
  180. package/src/functions/start/databases/postgresql/connect.js +27 -0
  181. package/src/functions/start/databases/postgresql/index.js +127 -0
  182. package/src/functions/start/databases/redis.js +0 -0
  183. package/src/functions/start/databases/startProvider.js +15 -0
  184. package/src/functions/start/fileDependencyMapper.js +24 -0
  185. package/src/functions/start/filesToCopy.js +15 -0
  186. package/src/functions/start/generateId.js +73 -0
  187. package/src/functions/start/getCodependenciesForFile.js +84 -0
  188. package/src/functions/start/getFilesToBuild.js +49 -0
  189. package/src/functions/start/getProcessIdFromPort.js +92 -0
  190. package/src/functions/start/hmrServer.js +78 -0
  191. package/src/functions/start/index.js +688 -0
  192. package/src/functions/start/isWindows.js +3 -0
  193. package/src/functions/start/minifyFile.js +10 -0
  194. package/src/functions/start/onWarn.js +68 -0
  195. package/src/functions/start/readFileDependencyMap.js +19 -0
  196. package/src/functions/start/removeDeletedDependenciesFromMap.js +19 -0
  197. package/src/functions/start/setComponentId.js +58 -0
  198. package/src/functions/start/updateFileMap.js +100 -0
  199. package/src/functions/update/index.js +20 -0
  200. package/src/functions/use/index.js +62 -0
  201. package/src/index.js +13 -0
  202. package/src/lib/CLILog.js +40 -0
  203. package/src/lib/buildResolvePlugin.js +32 -0
  204. package/src/lib/checkIfValidJSON.js +8 -0
  205. package/src/lib/colorLog.js +5 -0
  206. package/src/lib/getArgs.js +14 -0
  207. package/src/lib/getCodeFrame.js +8 -0
  208. package/src/lib/getOptions.js +12 -0
  209. package/src/lib/getPlatformSafePath.js +6 -0
  210. package/src/lib/getProvider.js +5 -0
  211. package/src/lib/help.js +56 -0
  212. package/src/lib/isObject.js +3 -0
  213. package/src/lib/isValidJSONString.js +8 -0
  214. package/src/lib/isWindows.js +3 -0
  215. package/src/lib/killProcesses.js +5 -0
  216. package/src/lib/loadSettings.js +40 -0
  217. package/src/lib/loader.js +94 -0
  218. package/src/lib/masterIgnoreList.js +13 -0
  219. package/src/lib/nodeEnvironment.js +6 -0
  220. package/src/lib/nodeEnvironments.js +8 -0
  221. package/src/lib/parseCookiesFromLogin.js +21 -0
  222. package/src/lib/rainbowRoad.js +5 -0
  223. package/src/lib/readDirectorySync.js +13 -0
  224. package/src/lib/regexes.js +5 -0
  225. package/src/lib/replaceBackslashesWithForwardSlashes.js +8 -0
  226. package/src/lib/replaceFileProtocol.js +8 -0
  227. package/src/lib/serializeQueryParameters.js +5 -0
  228. package/src/lib/settings.js +1 -0
  229. package/src/lib/validateDatabasesFromSettings.js +37 -0
  230. package/src/lib/wait.js +5 -0
  231. package/storage/.verdaccio-db.json +1 -0
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "app",
3
+ "short_name": "app",
4
+ "start_url": ".",
5
+ "display": "standalone",
6
+ "background_color": "#fff",
7
+ "theme_color": "#ffcc00",
8
+ "description": "An awesome JavaScript app that's under development.",
9
+ "icons": [{
10
+ "src": "favicon.ico",
11
+ "sizes": "64x64",
12
+ "type": "image/x-icon"
13
+ }, {
14
+ "purpose": "any",
15
+ "src": "apple-touch-icon-152x152.png",
16
+ "sizes": "152x152",
17
+ "type": "image/png"
18
+ }, {
19
+ "purpose": "maskable",
20
+ "src": "splash-screen-1024x1024.png",
21
+ "sizes": "1024x1024",
22
+ "type": "image/png"
23
+ }],
24
+ "related_applications": []
25
+ }
@@ -0,0 +1,32 @@
1
+ const cacheName = "app-cache";
2
+ const cacheAssets = [];
3
+
4
+ self.addEventListener("install", (event) => {
5
+ event.waitUntil(
6
+ caches.open(cacheName).then((cache) => {
7
+ cache.addAll(cacheAssets).then(() => {
8
+ self.skipWaiting();
9
+ });
10
+ })
11
+ );
12
+ });
13
+
14
+ self.addEventListener("activate", (event) => {
15
+ event.waitUntil(
16
+ caches.keys().then((cacheNames) => {
17
+ cacheNames.map((cache) => {
18
+ if (cache !== cacheName) {
19
+ return caches.delete(cache);
20
+ }
21
+ });
22
+ })
23
+ );
24
+ });
25
+
26
+ self.addEventListener("fetch", (event) => {
27
+ event.respondWith(
28
+ caches.match(event.request).then((response) => {
29
+ return response || fetch(event.request);
30
+ })
31
+ );
32
+ });
@@ -0,0 +1,27 @@
1
+ {
2
+ "config": {
3
+ "databases": [
4
+ {
5
+ "provider": "mongodb",
6
+ "users": true,
7
+ "options": {}
8
+ }
9
+ ],
10
+ "i18n": {
11
+ "defaultLanguage": "en-US"
12
+ },
13
+ "middleware": {},
14
+ "email": {
15
+ "from": "",
16
+ "smtp": {
17
+ "host": "",
18
+ "port": 587,
19
+ "username": "",
20
+ "password": ""
21
+ }
22
+ }
23
+ },
24
+ "global": {},
25
+ "public": {},
26
+ "private": {}
27
+ }
@@ -0,0 +1,50 @@
1
+ import ui from "@joystick.js/ui";
2
+
3
+ const Button = ui.component({
4
+ css: `
5
+ .button {
6
+ display: inline-block;
7
+ background: #eee;
8
+ padding: 15px 20px;
9
+ border-radius: 3px;
10
+ text-decoration: none;
11
+ color: #333;
12
+ }
13
+
14
+ .button.brand {
15
+ background: var(--brand);
16
+ color: #333;
17
+ }
18
+
19
+ .button.github {
20
+ background: #333;
21
+ color: #fff;
22
+ padding: 0px 20px 0px 0px;
23
+ }
24
+
25
+ .button.github span {
26
+ display: inline-block;
27
+ margin-right: 20px;
28
+ font-weight: 500;
29
+ background: #000;
30
+ padding: 15px 20px;
31
+ border-radius: 3px 0px 0px 3px;
32
+ }
33
+ `,
34
+ render: ({ props, when }) => {
35
+ return `
36
+ ${when(
37
+ props?.href,
38
+ `<a href="${props.href}" class="button ${props.theme} ${
39
+ props.classes
40
+ }" target="${props.target || "_self"}">${props.label}</a>`
41
+ )}
42
+ ${when(
43
+ !props?.href,
44
+ `<button class="button ${props.theme} ${props.classes}">${props.label}</button>`
45
+ )}
46
+ `;
47
+ },
48
+ });
49
+
50
+ export default Button;
@@ -0,0 +1,13 @@
1
+ import ui from "@joystick.js/ui";
2
+
3
+ const App = ui.component({
4
+ render: ({ props, component }) => {
5
+ return `
6
+ <div>
7
+ ${component(props.page, props)}
8
+ </div>
9
+ `;
10
+ },
11
+ });
12
+
13
+ export default App;
@@ -0,0 +1,31 @@
1
+ import ui from "@joystick.js/ui";
2
+
3
+ const Error = ui.component({
4
+ css: `
5
+ .error {
6
+ text-align: center;
7
+ margin: 50px 0;
8
+ }
9
+
10
+ h4 {
11
+ font-size: 20px;
12
+ font-weight: bold;
13
+ }
14
+
15
+ p {
16
+ font-size: 16px;
17
+ color: #888;
18
+ margin-top: 15px;
19
+ }
20
+ `,
21
+ render: () => {
22
+ return `
23
+ <div class="error">
24
+ <h4>404 &mdash; Page Not Found</h4>
25
+ <p>Double-check the URL and try again.</p>
26
+ </div>
27
+ `;
28
+ },
29
+ });
30
+
31
+ export default Error;
@@ -0,0 +1,94 @@
1
+ import ui from "@joystick.js/ui";
2
+ import Button from "../../components/button";
3
+
4
+ const Index = ui.component({
5
+ state: {
6
+ stars: 0,
7
+ },
8
+ lifecycle: {
9
+ onMount: async (instance = {}) => {
10
+ const repo = await fetch(
11
+ `https://api.github.com/repos/cheatcode/joystick`
12
+ ).then(async (response) => {
13
+ return response.json();
14
+ });
15
+
16
+ instance.setState({ stars: repo?.stargazers_count });
17
+ },
18
+ },
19
+ css: `
20
+ .splash {
21
+ position: fixed;
22
+ inset: 0;
23
+ display: flex;
24
+ justify-content: center;
25
+ align-items: center;
26
+ }
27
+
28
+ .splash header {
29
+ text-align: center;
30
+ padding: 0px 30px;
31
+ }
32
+
33
+ .splash header p {
34
+ color: #888;
35
+ font-size: 18px;
36
+ line-height: 26px;
37
+ margin-top: 30px;
38
+ }
39
+
40
+ .splash header ul {
41
+ display: inline-flex;
42
+ margin-top: 30px;
43
+ }
44
+
45
+ .splash header ul li:first-child {
46
+ margin-right: 20px;
47
+ }
48
+
49
+ .splash footer {
50
+ position: fixed;
51
+ bottom: 20px;
52
+ color: #aaa;
53
+ }
54
+
55
+ .splash footer a {
56
+ color: #333;
57
+ text-decoration: underline;
58
+ text-decoration-color: var(--brand);
59
+ }
60
+ `,
61
+ render: ({ state, component, i18n }) => {
62
+ return `
63
+ <div class="splash">
64
+ <header>
65
+ <img src="https://cheatcode-assets.s3.amazonaws.com/joystick-logo.svg" alt="CheatCode" />
66
+ <p>A full-stack JavaScript framework for building web apps and websites.</p>
67
+ <ul>
68
+ <li>
69
+ ${component(Button, {
70
+ theme: "brand",
71
+ target: "_blank",
72
+ href: "https://github.com/cheatcode/joystick#tutorials",
73
+ label: i18n("get_started"),
74
+ })}
75
+ </li>
76
+ <li>
77
+ ${component(Button, {
78
+ theme: "github",
79
+ target: "_blank",
80
+ href: "https://github.com/cheatcode/joystick",
81
+ label: i18n("view_on_github", { stars: state.stars }),
82
+ })}
83
+ </li>
84
+ </ul>
85
+ </header>
86
+ <footer>
87
+ <p>&copy; <a href="https://cheatcode.co">CheatCode</a> — Nullius in verba.</p>
88
+ </footer>
89
+ </div>
90
+ `;
91
+ },
92
+ });
93
+
94
+ export default Index;
@@ -0,0 +1,243 @@
1
+ import build from "./build/index.js";
2
+ import create from "./create/index.js";
3
+ import logout from "./logout/index.js";
4
+ import start from "./start/index.js";
5
+ import update from "./update/index.js";
6
+ import use from "./use/index.js";
7
+ const [_node, _bin, ...rawArgs] = process.argv;
8
+ var functions_default = {
9
+ build: {
10
+ set: !!rawArgs.includes("build"),
11
+ description: "Build an existing Joystick app.",
12
+ args: {},
13
+ options: {
14
+ environment: {
15
+ flags: {
16
+ "-e": {
17
+ set: !!rawArgs.includes("-e"),
18
+ value: !!rawArgs.includes("-e") && rawArgs[rawArgs.indexOf("-e") + 1],
19
+ parent: "build"
20
+ },
21
+ "--environment": {
22
+ set: !!rawArgs.includes("--environment"),
23
+ value: !!rawArgs.includes("--environment") && rawArgs[rawArgs.indexOf("--environment") + 1],
24
+ parent: "build"
25
+ }
26
+ },
27
+ description: "The NODE_ENV you want to use for your build (default: production)."
28
+ },
29
+ outputPath: {
30
+ flags: {
31
+ "-o": {
32
+ set: !!rawArgs.includes("-o"),
33
+ value: !!rawArgs.includes("-o") && rawArgs[rawArgs.indexOf("-o") + 1],
34
+ parent: "build"
35
+ },
36
+ "--outputPath": {
37
+ set: !!rawArgs.includes("--outputPath"),
38
+ value: !!rawArgs.includes("--outputPath") && rawArgs[rawArgs.indexOf("--outputPath") + 1],
39
+ parent: "build"
40
+ }
41
+ },
42
+ description: "The path you want to build the output to."
43
+ },
44
+ type: {
45
+ flags: {
46
+ "-t": {
47
+ set: !!rawArgs.includes("-t"),
48
+ value: !!rawArgs.includes("-t") && rawArgs[rawArgs.indexOf("-t") + 1],
49
+ parent: "build"
50
+ },
51
+ "--type": {
52
+ set: !!rawArgs.includes("--type"),
53
+ value: !!rawArgs.includes("--type") && rawArgs[rawArgs.indexOf("--type") + 1],
54
+ parent: "build"
55
+ }
56
+ },
57
+ description: "The type of build you want to generate (tar or folder)."
58
+ },
59
+ continuousIntegration: {
60
+ flags: {
61
+ "-ci": {
62
+ set: !!rawArgs.includes("-ci"),
63
+ value: !!rawArgs.includes("-ci"),
64
+ parent: "build"
65
+ },
66
+ "--continuousIntegration": {
67
+ set: !!rawArgs.includes("--continuousIntegration"),
68
+ value: !!rawArgs.includes("--continuousIntegration"),
69
+ parent: "build"
70
+ }
71
+ },
72
+ description: "Is this build being run in a continuous integration environment?"
73
+ }
74
+ },
75
+ function: build
76
+ },
77
+ create: {
78
+ set: !!rawArgs.includes("create"),
79
+ description: "Create a new Joystick app.",
80
+ args: {
81
+ name: {
82
+ set: !!rawArgs.includes("create") && !!rawArgs[rawArgs.indexOf("create") + 1],
83
+ parent: "create",
84
+ value: !!rawArgs.includes("create") && rawArgs[rawArgs.indexOf("create") + 1],
85
+ description: "The name of the app to create."
86
+ }
87
+ },
88
+ options: {},
89
+ function: create
90
+ },
91
+ logout: {
92
+ set: !!rawArgs.includes("logout"),
93
+ description: "Log out of your CheatCode account.",
94
+ args: {},
95
+ options: {},
96
+ function: logout
97
+ },
98
+ // push: {
99
+ // set: !!rawArgs.includes('push'),
100
+ // description: 'Deploy your Joystick app.',
101
+ // args: {},
102
+ // options: {
103
+ // domain: {
104
+ // flags: {
105
+ // '-d': {
106
+ // set: !!rawArgs.includes('-d'),
107
+ // value: !!rawArgs.includes('-d') && rawArgs[rawArgs.indexOf('-d') + 1],
108
+ // parent: 'push',
109
+ // },
110
+ // '--domain': {
111
+ // set: !!rawArgs.includes('--domain'),
112
+ // value: !!rawArgs.includes('--domain') && rawArgs[rawArgs.indexOf('--domain') + 1],
113
+ // parent: 'push',
114
+ // },
115
+ // },
116
+ // description: 'The domain name you want to deploy your app to.',
117
+ // },
118
+ // environment: {
119
+ // flags: {
120
+ // '-e': {
121
+ // set: !!rawArgs.includes('-e'),
122
+ // value: !!rawArgs.includes('-e') && rawArgs[rawArgs.indexOf('-e') + 1],
123
+ // parent: 'push',
124
+ // },
125
+ // '--environment': {
126
+ // set: !!rawArgs.includes('--environment'),
127
+ // value: !!rawArgs.includes('--environment') && rawArgs[rawArgs.indexOf('--environment') + 1],
128
+ // parent: 'push',
129
+ // },
130
+ // },
131
+ // description: 'The value you want to use for NODE_ENV in the deployed app (e.g., staging or production). Default is production.',
132
+ // },
133
+ // server: {
134
+ // flags: {
135
+ // '-s': {
136
+ // set: !!rawArgs.includes('-s'),
137
+ // value: !!rawArgs.includes('-s') && rawArgs[rawArgs.indexOf('-s') + 1],
138
+ // parent: 'push',
139
+ // },
140
+ // '--server': {
141
+ // set: !!rawArgs.includes('--server'),
142
+ // value: !!rawArgs.includes('--server') && rawArgs[rawArgs.indexOf('--server') + 1],
143
+ // parent: 'push',
144
+ // },
145
+ // },
146
+ // description: 'The Push provision server to target (either "local" or "production").',
147
+ // },
148
+ // },
149
+ // function: push,
150
+ // },
151
+ start: {
152
+ set: !!rawArgs.includes("start"),
153
+ description: "Start an existing Joystick app.",
154
+ args: {},
155
+ options: {
156
+ environment: {
157
+ flags: {
158
+ "-e": {
159
+ set: !!rawArgs.includes("-e"),
160
+ value: !!rawArgs.includes("-e") && rawArgs[rawArgs.indexOf("-e") + 1],
161
+ parent: "start"
162
+ },
163
+ "--environment": {
164
+ set: !!rawArgs.includes("--environment"),
165
+ value: !!rawArgs.includes("--environment") && rawArgs[rawArgs.indexOf("--environment") + 1],
166
+ parent: "start"
167
+ }
168
+ },
169
+ description: "Environment to set for process.env.NODE_ENV."
170
+ },
171
+ logs: {
172
+ flags: {
173
+ "-l": {
174
+ set: !!rawArgs.includes("-l"),
175
+ value: !!rawArgs.includes("-l") && rawArgs[rawArgs.indexOf("-l") + 1],
176
+ parent: "start"
177
+ },
178
+ "--logs": {
179
+ set: !!rawArgs.includes("--logs"),
180
+ value: !!rawArgs.includes("--logs") && rawArgs[rawArgs.indexOf("--logs") + 1],
181
+ parent: "start"
182
+ }
183
+ },
184
+ description: "Path for storing logs."
185
+ },
186
+ port: {
187
+ flags: {
188
+ "-p": {
189
+ set: !!rawArgs.includes("-p"),
190
+ value: !!rawArgs.includes("-p") && parseInt(rawArgs[rawArgs.indexOf("-p") + 1], 10),
191
+ parent: "start"
192
+ },
193
+ "--port": {
194
+ set: !!rawArgs.includes("--port"),
195
+ value: !!rawArgs.includes("--port") && parseInt(rawArgs[rawArgs.indexOf("--port") + 1], 10),
196
+ parent: "start"
197
+ }
198
+ },
199
+ description: "Port number to run the app on."
200
+ },
201
+ debug: {
202
+ flags: {
203
+ "-d": {
204
+ set: !!rawArgs.includes("-d"),
205
+ value: !!rawArgs.includes("-d"),
206
+ parent: "start"
207
+ },
208
+ "--debug": {
209
+ set: !!rawArgs.includes("--debug"),
210
+ value: !!rawArgs.includes("--debug"),
211
+ parent: "start"
212
+ }
213
+ },
214
+ description: "Run the Joystick app's Node.js process in debug mode with --inspect."
215
+ }
216
+ },
217
+ function: start
218
+ },
219
+ update: {
220
+ set: !!rawArgs.includes("update"),
221
+ description: "Update all Joystick packages to their latest version.",
222
+ args: {},
223
+ options: {},
224
+ function: update
225
+ },
226
+ use: {
227
+ set: !!rawArgs.includes("use"),
228
+ description: "Decides which version of Joystick to use (production or canary).",
229
+ args: {
230
+ version: {
231
+ set: !!rawArgs.includes("use") && !!rawArgs[rawArgs.indexOf("use") + 1],
232
+ parent: "use",
233
+ value: !!rawArgs.includes("use") && rawArgs[rawArgs.indexOf("use") + 1],
234
+ description: "The version of Joystick to use."
235
+ }
236
+ },
237
+ options: {},
238
+ function: use
239
+ }
240
+ };
241
+ export {
242
+ functions_default as default
243
+ };
@@ -0,0 +1,20 @@
1
+ import os from "os";
2
+ import fs, { cp } from "fs";
3
+ import colorLog from "../../lib/colorLog.js";
4
+ var logout_default = async () => {
5
+ try {
6
+ const homeDirectory = os.homedir();
7
+ const sessionTokenPath = `${homeDirectory}/.cheatcode/session`;
8
+ const sessionTokenExists = fs.existsSync(sessionTokenPath);
9
+ if (sessionTokenExists) {
10
+ fs.unlinkSync(sessionTokenPath, "utf-8");
11
+ colorLog("\n\u2714 Logged out\n", "greenBright");
12
+ }
13
+ return true;
14
+ } catch (exception) {
15
+ throw new Error(`[logout] ${exception.message}`);
16
+ }
17
+ };
18
+ export {
19
+ logout_default as default
20
+ };
@@ -0,0 +1,19 @@
1
+ import pingProvisionAPI from "./pingProvisionAPI.js";
2
+ import CLILog from "../../lib/CLILog.js";
3
+ var checkIfProvisionAvailable_default = async () => {
4
+ const response = await pingProvisionAPI();
5
+ if (response !== "pong") {
6
+ CLILog(
7
+ "The Push Provision API is currently unavailable. Please try again in a few minutes.",
8
+ {
9
+ level: "danger",
10
+ docs: "https://cheatcode.co/docs/push/status"
11
+ }
12
+ );
13
+ process.exit(0);
14
+ }
15
+ return true;
16
+ };
17
+ export {
18
+ checkIfProvisionAvailable_default as default
19
+ };