@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.
- package/.build/getFilesToBuild.js +38 -0
- package/.build/index.js +69 -0
- package/HMRNOTES.txt +23 -0
- package/README.md +7 -0
- package/_package.json +55 -0
- package/canary.js +12 -0
- package/dist/cli.js +69 -0
- package/dist/functions/build/getTarIgnoreList.js +25 -0
- package/dist/functions/build/index.js +54 -0
- package/dist/functions/create/buildPackageJSON.js +20 -0
- package/dist/functions/create/index.js +193 -0
- package/dist/functions/create/templates/api/index.js +4 -0
- package/dist/functions/create/templates/i18n/en-US.js +4 -0
- package/dist/functions/create/templates/index.client.js +7 -0
- package/dist/functions/create/templates/index.css +20 -0
- package/dist/functions/create/templates/index.html +23 -0
- package/dist/functions/create/templates/index.server.js +21 -0
- package/dist/functions/create/templates/public/apple-touch-icon-152x152.png +0 -0
- package/dist/functions/create/templates/public/favicon.ico +0 -0
- package/dist/functions/create/templates/public/manifest.json +25 -0
- package/dist/functions/create/templates/public/service-worker.js +32 -0
- package/dist/functions/create/templates/public/splash-screen-1024x1024.png +0 -0
- package/dist/functions/create/templates/settings.development.json +27 -0
- package/dist/functions/create/templates/ui/components/button/index.js +50 -0
- package/dist/functions/create/templates/ui/layouts/app/index.js +13 -0
- package/dist/functions/create/templates/ui/pages/error/index.js +31 -0
- package/dist/functions/create/templates/ui/pages/index/index.js +94 -0
- package/dist/functions/index.js +243 -0
- package/dist/functions/logout/index.js +20 -0
- package/dist/functions/push/checkIfProvisionAvailable.js +19 -0
- package/dist/functions/push/deploy/index.js +173 -0
- package/dist/functions/push/deploy/initial.js +100 -0
- package/dist/functions/push/deploy/version.js +100 -0
- package/dist/functions/push/domains.js +23 -0
- package/dist/functions/push/getAvailableCDN.js +23 -0
- package/dist/functions/push/getDeployment.js +41 -0
- package/dist/functions/push/getDeploymentSummary.js +38 -0
- package/dist/functions/push/getInstanceSizeRegions.js +37 -0
- package/dist/functions/push/getInstanceSizesForRegion.js +34 -0
- package/dist/functions/push/getProviderInstanceSizes.js +34 -0
- package/dist/functions/push/getProviderRegions.js +36 -0
- package/dist/functions/push/getProvidersWithConnectionStatus.js +20 -0
- package/dist/functions/push/getSessionToken.js +23 -0
- package/dist/functions/push/getUserFromSessionToken.js +37 -0
- package/dist/functions/push/index.js +210 -0
- package/dist/functions/push/loginToCheatCode.js +33 -0
- package/dist/functions/push/pingProvisionAPI.js +31 -0
- package/dist/functions/push/prompts.js +332 -0
- package/dist/functions/push/providerMap.js +11 -0
- package/dist/functions/push/providers.js +9 -0
- package/dist/functions/reset/index.js +0 -0
- package/dist/functions/reset/reset.js +127 -0
- package/dist/functions/start/bootstrapLayoutComponent.js +54 -0
- package/dist/functions/start/bootstrapPageComponent.js +51 -0
- package/dist/functions/start/buildFile.js +85 -0
- package/dist/functions/start/buildFiles.js +76 -0
- package/dist/functions/start/buildPlugins.js +183 -0
- package/dist/functions/start/checkIfPortAvailable.js +18 -0
- package/dist/functions/start/cleanup/index.js +18 -0
- package/dist/functions/start/databases/mongodb/availableQueryParameters.js +42 -0
- package/dist/functions/start/databases/mongodb/buildConnectionString.js +22 -0
- package/dist/functions/start/databases/mongodb/buildQueryParameters.js +14 -0
- package/dist/functions/start/databases/mongodb/checkConnection.js +38 -0
- package/dist/functions/start/databases/mongodb/connect.js +25 -0
- package/dist/functions/start/databases/mongodb/index.js +93 -0
- package/dist/functions/start/databases/postgresql/checkConnection.js +41 -0
- package/dist/functions/start/databases/postgresql/connect.js +27 -0
- package/dist/functions/start/databases/postgresql/index.js +106 -0
- package/dist/functions/start/databases/redis.js +0 -0
- package/dist/functions/start/databases/startProvider.js +16 -0
- package/dist/functions/start/fileDependencyMapper.js +22 -0
- package/dist/functions/start/filesToCopy.js +18 -0
- package/dist/functions/start/generateId.js +74 -0
- package/dist/functions/start/getCodependenciesForFile.js +64 -0
- package/dist/functions/start/getFilesToBuild.js +39 -0
- package/dist/functions/start/getProcessIdFromPort.js +60 -0
- package/dist/functions/start/hmrServer.js +66 -0
- package/dist/functions/start/index.js +535 -0
- package/dist/functions/start/isWindows.js +5 -0
- package/dist/functions/start/minifyFile.js +12 -0
- package/dist/functions/start/onWarn.js +63 -0
- package/dist/functions/start/readFileDependencyMap.js +16 -0
- package/dist/functions/start/removeDeletedDependenciesFromMap.js +18 -0
- package/dist/functions/start/setComponentId.js +46 -0
- package/dist/functions/start/updateFileMap.js +67 -0
- package/dist/functions/update/index.js +21 -0
- package/dist/functions/use/index.js +61 -0
- package/dist/index.js +8 -0
- package/dist/lib/CLILog.js +49 -0
- package/dist/lib/buildResolvePlugin.js +21 -0
- package/dist/lib/checkIfValidJSON.js +11 -0
- package/dist/lib/colorLog.js +7 -0
- package/dist/lib/getArgs.js +14 -0
- package/dist/lib/getCodeFrame.js +10 -0
- package/dist/lib/getOptions.js +15 -0
- package/dist/lib/getPlatformSafePath.js +7 -0
- package/dist/lib/getProvider.js +8 -0
- package/dist/lib/help.js +56 -0
- package/dist/lib/isObject.js +6 -0
- package/dist/lib/isValidJSONString.js +11 -0
- package/dist/lib/isWindows.js +5 -0
- package/dist/lib/killProcesses.js +0 -0
- package/dist/lib/loadSettings.js +33 -0
- package/dist/lib/loader.js +82 -0
- package/dist/lib/masterIgnoreList.js +16 -0
- package/dist/lib/nodeEnvironment.js +9 -0
- package/dist/lib/nodeEnvironments.js +8 -0
- package/dist/lib/parseCookiesFromLogin.js +18 -0
- package/dist/lib/rainbowRoad.js +7 -0
- package/dist/lib/readDirectorySync.js +14 -0
- package/dist/lib/regexes.js +12 -0
- package/dist/lib/replaceBackslashesWithForwardSlashes.js +8 -0
- package/dist/lib/replaceFileProtocol.js +8 -0
- package/dist/lib/serializeQueryParameters.js +8 -0
- package/dist/lib/settings.js +4 -0
- package/dist/lib/validateDatabasesFromSettings.js +34 -0
- package/dist/lib/wait.js +8 -0
- package/package.json +54 -0
- package/release.js +40 -0
- package/src/cli.js +88 -0
- package/src/functions/build/getTarIgnoreList.js +30 -0
- package/src/functions/build/index.js +63 -0
- package/src/functions/create/buildPackageJSON.js +18 -0
- package/src/functions/create/index.js +209 -0
- package/src/functions/create/templates/api/index.js +4 -0
- package/src/functions/create/templates/i18n/en-US.js +4 -0
- package/src/functions/create/templates/index.client.js +7 -0
- package/src/functions/create/templates/index.css +20 -0
- package/src/functions/create/templates/index.html +23 -0
- package/src/functions/create/templates/index.server.js +21 -0
- package/src/functions/create/templates/public/apple-touch-icon-152x152.png +0 -0
- package/src/functions/create/templates/public/favicon.ico +0 -0
- package/src/functions/create/templates/public/manifest.json +25 -0
- package/src/functions/create/templates/public/service-worker.js +32 -0
- package/src/functions/create/templates/public/splash-screen-1024x1024.png +0 -0
- package/src/functions/create/templates/settings.development.json +27 -0
- package/src/functions/create/templates/ui/components/button/index.js +50 -0
- package/src/functions/create/templates/ui/layouts/app/index.js +13 -0
- package/src/functions/create/templates/ui/pages/error/index.js +31 -0
- package/src/functions/create/templates/ui/pages/index/index.js +94 -0
- package/src/functions/index.js +243 -0
- package/src/functions/logout/index.js +20 -0
- package/src/functions/push/checkIfProvisionAvailable.js +20 -0
- package/src/functions/push/deploy/index.js +199 -0
- package/src/functions/push/deploy/initial.js +108 -0
- package/src/functions/push/deploy/version.js +108 -0
- package/src/functions/push/domains.js +23 -0
- package/src/functions/push/getAvailableCDN.js +27 -0
- package/src/functions/push/getDeployment.js +43 -0
- package/src/functions/push/getDeploymentSummary.js +39 -0
- package/src/functions/push/getInstanceSizeRegions.js +40 -0
- package/src/functions/push/getInstanceSizesForRegion.js +35 -0
- package/src/functions/push/getProviderInstanceSizes.js +35 -0
- package/src/functions/push/getProviderRegions.js +39 -0
- package/src/functions/push/getProvidersWithConnectionStatus.js +25 -0
- package/src/functions/push/getSessionToken.js +26 -0
- package/src/functions/push/getUserFromSessionToken.js +39 -0
- package/src/functions/push/index.js +245 -0
- package/src/functions/push/loginToCheatCode.js +34 -0
- package/src/functions/push/pingProvisionAPI.js +33 -0
- package/src/functions/push/prompts.js +276 -0
- package/src/functions/push/providerMap.js +8 -0
- package/src/functions/push/providers.js +6 -0
- package/src/functions/reset/index.js +0 -0
- package/src/functions/reset/reset.js +163 -0
- package/src/functions/start/bootstrapLayoutComponent.js +57 -0
- package/src/functions/start/bootstrapPageComponent.js +54 -0
- package/src/functions/start/buildFile.js +97 -0
- package/src/functions/start/buildFiles.js +101 -0
- package/src/functions/start/buildPlugins.js +215 -0
- package/src/functions/start/checkIfPortAvailable.js +21 -0
- package/src/functions/start/cleanup/index.js +23 -0
- package/src/functions/start/databases/mongodb/availableQueryParameters.js +39 -0
- package/src/functions/start/databases/mongodb/buildConnectionString.js +28 -0
- package/src/functions/start/databases/mongodb/buildQueryParameters.js +15 -0
- package/src/functions/start/databases/mongodb/checkConnection.js +40 -0
- package/src/functions/start/databases/mongodb/connect.js +25 -0
- package/src/functions/start/databases/mongodb/index.js +108 -0
- package/src/functions/start/databases/postgresql/checkConnection.js +43 -0
- package/src/functions/start/databases/postgresql/connect.js +27 -0
- package/src/functions/start/databases/postgresql/index.js +127 -0
- package/src/functions/start/databases/redis.js +0 -0
- package/src/functions/start/databases/startProvider.js +15 -0
- package/src/functions/start/fileDependencyMapper.js +24 -0
- package/src/functions/start/filesToCopy.js +15 -0
- package/src/functions/start/generateId.js +73 -0
- package/src/functions/start/getCodependenciesForFile.js +84 -0
- package/src/functions/start/getFilesToBuild.js +49 -0
- package/src/functions/start/getProcessIdFromPort.js +92 -0
- package/src/functions/start/hmrServer.js +78 -0
- package/src/functions/start/index.js +688 -0
- package/src/functions/start/isWindows.js +3 -0
- package/src/functions/start/minifyFile.js +10 -0
- package/src/functions/start/onWarn.js +68 -0
- package/src/functions/start/readFileDependencyMap.js +19 -0
- package/src/functions/start/removeDeletedDependenciesFromMap.js +19 -0
- package/src/functions/start/setComponentId.js +58 -0
- package/src/functions/start/updateFileMap.js +100 -0
- package/src/functions/update/index.js +20 -0
- package/src/functions/use/index.js +62 -0
- package/src/index.js +13 -0
- package/src/lib/CLILog.js +40 -0
- package/src/lib/buildResolvePlugin.js +32 -0
- package/src/lib/checkIfValidJSON.js +8 -0
- package/src/lib/colorLog.js +5 -0
- package/src/lib/getArgs.js +14 -0
- package/src/lib/getCodeFrame.js +8 -0
- package/src/lib/getOptions.js +12 -0
- package/src/lib/getPlatformSafePath.js +6 -0
- package/src/lib/getProvider.js +5 -0
- package/src/lib/help.js +56 -0
- package/src/lib/isObject.js +3 -0
- package/src/lib/isValidJSONString.js +8 -0
- package/src/lib/isWindows.js +3 -0
- package/src/lib/killProcesses.js +5 -0
- package/src/lib/loadSettings.js +40 -0
- package/src/lib/loader.js +94 -0
- package/src/lib/masterIgnoreList.js +13 -0
- package/src/lib/nodeEnvironment.js +6 -0
- package/src/lib/nodeEnvironments.js +8 -0
- package/src/lib/parseCookiesFromLogin.js +21 -0
- package/src/lib/rainbowRoad.js +5 -0
- package/src/lib/readDirectorySync.js +13 -0
- package/src/lib/regexes.js +5 -0
- package/src/lib/replaceBackslashesWithForwardSlashes.js +8 -0
- package/src/lib/replaceFileProtocol.js +8 -0
- package/src/lib/serializeQueryParameters.js +5 -0
- package/src/lib/settings.js +1 -0
- package/src/lib/validateDatabasesFromSettings.js +37 -0
- package/src/lib/wait.js +5 -0
- package/storage/.verdaccio-db.json +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import node from "@joystick.js/node";
|
|
2
|
+
import api from "./api";
|
|
3
|
+
|
|
4
|
+
node.app({
|
|
5
|
+
api,
|
|
6
|
+
routes: {
|
|
7
|
+
"/": (req, res) => {
|
|
8
|
+
res.render("ui/pages/index/index.js", {
|
|
9
|
+
layout: "ui/layouts/app/index.js",
|
|
10
|
+
});
|
|
11
|
+
},
|
|
12
|
+
"*": (req, res) => {
|
|
13
|
+
res.render("ui/pages/error/index.js", {
|
|
14
|
+
layout: "ui/layouts/app/index.js",
|
|
15
|
+
props: {
|
|
16
|
+
statusCode: 404,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
Binary file
|
|
@@ -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,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 — 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>© <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 push from './push/index.js';
|
|
5
|
+
import start from './start/index.js';
|
|
6
|
+
import update from './update/index.js';
|
|
7
|
+
import use from "./use/index.js";
|
|
8
|
+
|
|
9
|
+
const [_node, _bin, ...rawArgs] = process.argv;
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
build: {
|
|
13
|
+
set: !!rawArgs.includes('build'),
|
|
14
|
+
description: 'Build an existing Joystick app.',
|
|
15
|
+
args: {},
|
|
16
|
+
options: {
|
|
17
|
+
environment: {
|
|
18
|
+
flags: {
|
|
19
|
+
'-e': {
|
|
20
|
+
set: !!rawArgs.includes('-e'),
|
|
21
|
+
value: !!rawArgs.includes('-e') && rawArgs[rawArgs.indexOf('-e') + 1],
|
|
22
|
+
parent: 'build',
|
|
23
|
+
},
|
|
24
|
+
'--environment': {
|
|
25
|
+
set: !!rawArgs.includes('--environment'),
|
|
26
|
+
value: !!rawArgs.includes('--environment') && rawArgs[rawArgs.indexOf('--environment') + 1],
|
|
27
|
+
parent: 'build',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
description: 'The NODE_ENV you want to use for your build (default: production).',
|
|
31
|
+
},
|
|
32
|
+
outputPath: {
|
|
33
|
+
flags: {
|
|
34
|
+
'-o': {
|
|
35
|
+
set: !!rawArgs.includes('-o'),
|
|
36
|
+
value: !!rawArgs.includes('-o') && rawArgs[rawArgs.indexOf('-o') + 1],
|
|
37
|
+
parent: 'build',
|
|
38
|
+
},
|
|
39
|
+
'--outputPath': {
|
|
40
|
+
set: !!rawArgs.includes('--outputPath'),
|
|
41
|
+
value: !!rawArgs.includes('--outputPath') && rawArgs[rawArgs.indexOf('--outputPath') + 1],
|
|
42
|
+
parent: 'build',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
description: 'The path you want to build the output to.',
|
|
46
|
+
},
|
|
47
|
+
type: {
|
|
48
|
+
flags: {
|
|
49
|
+
'-t': {
|
|
50
|
+
set: !!rawArgs.includes('-t'),
|
|
51
|
+
value: !!rawArgs.includes('-t') && rawArgs[rawArgs.indexOf('-t') + 1],
|
|
52
|
+
parent: 'build',
|
|
53
|
+
},
|
|
54
|
+
'--type': {
|
|
55
|
+
set: !!rawArgs.includes('--type'),
|
|
56
|
+
value: !!rawArgs.includes('--type') && rawArgs[rawArgs.indexOf('--type') + 1],
|
|
57
|
+
parent: 'build',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
description: 'The type of build you want to generate (tar or folder).',
|
|
61
|
+
},
|
|
62
|
+
continuousIntegration: {
|
|
63
|
+
flags: {
|
|
64
|
+
'-ci': {
|
|
65
|
+
set: !!rawArgs.includes('-ci'),
|
|
66
|
+
value: !!rawArgs.includes('-ci'),
|
|
67
|
+
parent: 'build',
|
|
68
|
+
},
|
|
69
|
+
'--continuousIntegration': {
|
|
70
|
+
set: !!rawArgs.includes('--continuousIntegration'),
|
|
71
|
+
value: !!rawArgs.includes('--continuousIntegration'),
|
|
72
|
+
parent: 'build',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
description: 'Is this build being run in a continuous integration environment?',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
function: build,
|
|
79
|
+
},
|
|
80
|
+
create: {
|
|
81
|
+
set: !!rawArgs.includes('create'),
|
|
82
|
+
description: 'Create a new Joystick app.',
|
|
83
|
+
args: {
|
|
84
|
+
name: {
|
|
85
|
+
set: !!rawArgs.includes('create') && !!rawArgs[rawArgs.indexOf('create') + 1],
|
|
86
|
+
parent: 'create',
|
|
87
|
+
value: !!rawArgs.includes('create') && rawArgs[rawArgs.indexOf('create') + 1],
|
|
88
|
+
description: 'The name of the app to create.',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
options: {},
|
|
92
|
+
function: create,
|
|
93
|
+
},
|
|
94
|
+
logout: {
|
|
95
|
+
set: !!rawArgs.includes('logout'),
|
|
96
|
+
description: 'Log out of your CheatCode account.',
|
|
97
|
+
args: {},
|
|
98
|
+
options: {},
|
|
99
|
+
function: logout,
|
|
100
|
+
},
|
|
101
|
+
// push: {
|
|
102
|
+
// set: !!rawArgs.includes('push'),
|
|
103
|
+
// description: 'Deploy your Joystick app.',
|
|
104
|
+
// args: {},
|
|
105
|
+
// options: {
|
|
106
|
+
// domain: {
|
|
107
|
+
// flags: {
|
|
108
|
+
// '-d': {
|
|
109
|
+
// set: !!rawArgs.includes('-d'),
|
|
110
|
+
// value: !!rawArgs.includes('-d') && rawArgs[rawArgs.indexOf('-d') + 1],
|
|
111
|
+
// parent: 'push',
|
|
112
|
+
// },
|
|
113
|
+
// '--domain': {
|
|
114
|
+
// set: !!rawArgs.includes('--domain'),
|
|
115
|
+
// value: !!rawArgs.includes('--domain') && rawArgs[rawArgs.indexOf('--domain') + 1],
|
|
116
|
+
// parent: 'push',
|
|
117
|
+
// },
|
|
118
|
+
// },
|
|
119
|
+
// description: 'The domain name you want to deploy your app to.',
|
|
120
|
+
// },
|
|
121
|
+
// environment: {
|
|
122
|
+
// flags: {
|
|
123
|
+
// '-e': {
|
|
124
|
+
// set: !!rawArgs.includes('-e'),
|
|
125
|
+
// value: !!rawArgs.includes('-e') && rawArgs[rawArgs.indexOf('-e') + 1],
|
|
126
|
+
// parent: 'push',
|
|
127
|
+
// },
|
|
128
|
+
// '--environment': {
|
|
129
|
+
// set: !!rawArgs.includes('--environment'),
|
|
130
|
+
// value: !!rawArgs.includes('--environment') && rawArgs[rawArgs.indexOf('--environment') + 1],
|
|
131
|
+
// parent: 'push',
|
|
132
|
+
// },
|
|
133
|
+
// },
|
|
134
|
+
// description: 'The value you want to use for NODE_ENV in the deployed app (e.g., staging or production). Default is production.',
|
|
135
|
+
// },
|
|
136
|
+
// server: {
|
|
137
|
+
// flags: {
|
|
138
|
+
// '-s': {
|
|
139
|
+
// set: !!rawArgs.includes('-s'),
|
|
140
|
+
// value: !!rawArgs.includes('-s') && rawArgs[rawArgs.indexOf('-s') + 1],
|
|
141
|
+
// parent: 'push',
|
|
142
|
+
// },
|
|
143
|
+
// '--server': {
|
|
144
|
+
// set: !!rawArgs.includes('--server'),
|
|
145
|
+
// value: !!rawArgs.includes('--server') && rawArgs[rawArgs.indexOf('--server') + 1],
|
|
146
|
+
// parent: 'push',
|
|
147
|
+
// },
|
|
148
|
+
// },
|
|
149
|
+
// description: 'The Push provision server to target (either "local" or "production").',
|
|
150
|
+
// },
|
|
151
|
+
// },
|
|
152
|
+
// function: push,
|
|
153
|
+
// },
|
|
154
|
+
start: {
|
|
155
|
+
set: !!rawArgs.includes('start'),
|
|
156
|
+
description: 'Start an existing Joystick app.',
|
|
157
|
+
args: {},
|
|
158
|
+
options: {
|
|
159
|
+
environment: {
|
|
160
|
+
flags: {
|
|
161
|
+
'-e': {
|
|
162
|
+
set: !!rawArgs.includes('-e'),
|
|
163
|
+
value: !!rawArgs.includes('-e') && rawArgs[rawArgs.indexOf('-e') + 1],
|
|
164
|
+
parent: 'start'
|
|
165
|
+
},
|
|
166
|
+
'--environment': {
|
|
167
|
+
set: !!rawArgs.includes('--environment'),
|
|
168
|
+
value: !!rawArgs.includes('--environment') && rawArgs[rawArgs.indexOf('--environment') + 1],
|
|
169
|
+
parent: 'start'
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
description: 'Environment to set for process.env.NODE_ENV.',
|
|
173
|
+
},
|
|
174
|
+
logs: {
|
|
175
|
+
flags: {
|
|
176
|
+
'-l': {
|
|
177
|
+
set: !!rawArgs.includes('-l'),
|
|
178
|
+
value: !!rawArgs.includes('-l') && rawArgs[rawArgs.indexOf('-l') + 1],
|
|
179
|
+
parent: 'start'
|
|
180
|
+
},
|
|
181
|
+
'--logs': {
|
|
182
|
+
set: !!rawArgs.includes('--logs'),
|
|
183
|
+
value: !!rawArgs.includes('--logs') && rawArgs[rawArgs.indexOf('--logs') + 1],
|
|
184
|
+
parent: 'start'
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
description: 'Path for storing logs.',
|
|
188
|
+
},
|
|
189
|
+
port: {
|
|
190
|
+
flags: {
|
|
191
|
+
'-p': {
|
|
192
|
+
set: !!rawArgs.includes('-p'),
|
|
193
|
+
value: !!rawArgs.includes('-p') && parseInt(rawArgs[rawArgs.indexOf('-p') + 1], 10),
|
|
194
|
+
parent: 'start'
|
|
195
|
+
},
|
|
196
|
+
'--port': {
|
|
197
|
+
set: !!rawArgs.includes('--port'),
|
|
198
|
+
value: !!rawArgs.includes('--port') && parseInt(rawArgs[rawArgs.indexOf('--port') + 1], 10),
|
|
199
|
+
parent: 'start'
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
description: 'Port number to run the app on.',
|
|
203
|
+
},
|
|
204
|
+
debug: {
|
|
205
|
+
flags: {
|
|
206
|
+
'-d': {
|
|
207
|
+
set: !!rawArgs.includes('-d'),
|
|
208
|
+
value: !!rawArgs.includes('-d'),
|
|
209
|
+
parent: 'start'
|
|
210
|
+
},
|
|
211
|
+
'--debug': {
|
|
212
|
+
set: !!rawArgs.includes('--debug'),
|
|
213
|
+
value: !!rawArgs.includes('--debug'),
|
|
214
|
+
parent: 'start'
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
description: 'Run the Joystick app\'s Node.js process in debug mode with --inspect.',
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
function: start,
|
|
221
|
+
},
|
|
222
|
+
update: {
|
|
223
|
+
set: !!rawArgs.includes('update'),
|
|
224
|
+
description: 'Update all Joystick packages to their latest version.',
|
|
225
|
+
args: {},
|
|
226
|
+
options: {},
|
|
227
|
+
function: update,
|
|
228
|
+
},
|
|
229
|
+
use: {
|
|
230
|
+
set: !!rawArgs.includes('use'),
|
|
231
|
+
description: 'Decides which version of Joystick to use (production or canary).',
|
|
232
|
+
args: {
|
|
233
|
+
version: {
|
|
234
|
+
set: !!rawArgs.includes('use') && !!rawArgs[rawArgs.indexOf('use') + 1],
|
|
235
|
+
parent: 'use',
|
|
236
|
+
value: !!rawArgs.includes('use') && rawArgs[rawArgs.indexOf('use') + 1],
|
|
237
|
+
description: 'The version of Joystick to use.',
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
options: {},
|
|
241
|
+
function: use,
|
|
242
|
+
},
|
|
243
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import fs, { cp } from 'fs';
|
|
3
|
+
import colorLog from '../../lib/colorLog.js';
|
|
4
|
+
|
|
5
|
+
export default async () => {
|
|
6
|
+
try {
|
|
7
|
+
const homeDirectory = os.homedir();
|
|
8
|
+
const sessionTokenPath = `${homeDirectory}/.cheatcode/session`;
|
|
9
|
+
const sessionTokenExists = fs.existsSync(sessionTokenPath);
|
|
10
|
+
|
|
11
|
+
if (sessionTokenExists) {
|
|
12
|
+
fs.unlinkSync(sessionTokenPath, 'utf-8');
|
|
13
|
+
colorLog('\n✔ Logged out\n', 'greenBright');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return true;
|
|
17
|
+
} catch (exception) {
|
|
18
|
+
throw new Error(`[logout] ${exception.message}`);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import pingProvisionAPI from "./pingProvisionAPI.js";
|
|
2
|
+
import CLILog from "../../lib/CLILog.js";
|
|
3
|
+
|
|
4
|
+
export default async () => {
|
|
5
|
+
const response = await pingProvisionAPI();
|
|
6
|
+
|
|
7
|
+
if (response !== 'pong') {
|
|
8
|
+
CLILog(
|
|
9
|
+
'The Push Provision API is currently unavailable. Please try again in a few minutes.',
|
|
10
|
+
{
|
|
11
|
+
level: 'danger',
|
|
12
|
+
docs: 'https://cheatcode.co/docs/push/status'
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
process.exit(0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return true;
|
|
20
|
+
};
|