@joystick.js/cli-canary 0.0.0-canary.1750 → 0.0.0-canary.1752

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 (34) hide show
  1. package/.build/index.js +0 -1
  2. package/dist/commands/push_v2/index.js +2 -2
  3. package/dist/commands/push_v2/index.js.map +2 -2
  4. package/package.json +2 -2
  5. package/src/commands/push_v2/index.js +2 -2
  6. package/dist/commands/push_v2/Dockerfile +0 -47
  7. package/dist/commands/push_v2/build_docker_image.js +0 -2
  8. package/dist/commands/push_v2/build_docker_image.js.map +0 -7
  9. package/dist/commands/push_v2/cdn_mirrors.js +0 -2
  10. package/dist/commands/push_v2/cdn_mirrors.js.map +0 -7
  11. package/dist/commands/push_v2/create_version.js +0 -2
  12. package/dist/commands/push_v2/create_version.js.map +0 -7
  13. package/dist/commands/push_v2/handle_initial_deployment.js +0 -2
  14. package/dist/commands/push_v2/handle_initial_deployment.js.map +0 -7
  15. package/dist/commands/push_v2/handle_version_deployment.js +0 -2
  16. package/dist/commands/push_v2/handle_version_deployment.js.map +0 -7
  17. package/dist/commands/push_v2/prompts/confirm_deployment.js +0 -18
  18. package/dist/commands/push_v2/prompts/confirm_deployment.js.map +0 -7
  19. package/dist/commands/push_v2/prompts/session_token.js +0 -6
  20. package/dist/commands/push_v2/prompts/session_token.js.map +0 -7
  21. package/dist/commands/push_v2/validate_deployment.js +0 -2
  22. package/dist/commands/push_v2/validate_deployment.js.map +0 -7
  23. package/dist/commands/push_v2/validate_push_config.js +0 -2
  24. package/dist/commands/push_v2/validate_push_config.js.map +0 -7
  25. package/src/commands/push_v2/Dockerfile +0 -47
  26. package/src/commands/push_v2/build_docker_image.js +0 -78
  27. package/src/commands/push_v2/cdn_mirrors.js +0 -7
  28. package/src/commands/push_v2/create_version.js +0 -20
  29. package/src/commands/push_v2/handle_initial_deployment.js +0 -24
  30. package/src/commands/push_v2/handle_version_deployment.js +0 -23
  31. package/src/commands/push_v2/prompts/confirm_deployment.js +0 -73
  32. package/src/commands/push_v2/prompts/session_token.js +0 -11
  33. package/src/commands/push_v2/validate_deployment.js +0 -19
  34. package/src/commands/push_v2/validate_push_config.js +0 -18
package/.build/index.js CHANGED
@@ -46,7 +46,6 @@ const files = filesToBuild.map((path) => {
46
46
 
47
47
  const copyPaths = [
48
48
  getPlatformSafePath("commands/create/template"),
49
- getPlatformSafePath("commands/push_v2/Dockerfile"), // TODO: Convert to just push/Dockerfile.
50
49
  ];
51
50
 
52
51
  const isCopyPath = copyPaths.some((copyPath) => {
@@ -1,6 +1,6 @@
1
- import p from"../../lib/build/index.js";import n from"../../lib/cli_log.js";import c from"./get_deployment.js";import l from"./get_push_domain.js";import m from"./get_settings_file.js";import u from"./get_deployment_token.js";import y from"./upload_build_to_push.js";import h from"../../lib/loader.js";const _=async(r="")=>{const e=await u(r);return e||(n("Must pass a deployment token via the -t or --token flag, or, have an existing deployment token on your machine.",{level:"danger",docs:"https://cheatcode.co/docs/push/authentication"}),process.exit(0))},g=async(r={},e={})=>{if(!e?.domain)return n("Must pass a deployment via -d or --domain flag.",{level:"danger",docs:"https://cheatcode.co/docs/push/cli"}),process.exit(0);process.loader=new h,process.loader.print("Starting deployment...");const s=await _(e?.deployment_token),o=l(e?.push_server),t=await c({domain:e?.domain,deployment_token:s,push_domain:o});if(!t)return n(`Sorry, we couldn't find a deployment with the domain ${e?.domain} on your account. If you haven't created it yet, head over to the Push dashboard: https://push.cheatcode.co/deployments/create`,{level:"danger",docs:"https://cheatcode.co/docs/push/deployments/create-a-new-deployment"}),process.exit(0);const a=t?.environment||"production",i=new Date().toISOString(),d=await m({environment:a});await p({environment:a,encrypt_build:!0,encryption_key:t?.deployment_secret,silence_confirmation:!0}),process.loader.print("Deploying to Push..."),await y({build_timestamp:i,deployment:t,deployment_token:s,push_domain:o,settings:d}),console.log({deployment:t}),process.loader.print("Deploying test..."),console.log(t?.intial_deployment_completed?`
1
+ import p from"../../lib/build/index.js";import n from"../../lib/cli_log.js";import c from"./get_deployment.js";import l from"./get_push_domain.js";import m from"./get_settings_file.js";import u from"./get_deployment_token.js";import y from"./upload_build_to_push.js";import h from"../../lib/loader.js";const _=async(r="")=>{const e=await u(r);return e||(n("Must pass a deployment token via the -t or --token flag, or, have an existing deployment token on your machine.",{level:"danger",docs:"https://cheatcode.co/docs/push/authentication"}),process.exit(0))},g=async(r={},e={})=>{if(!e?.domain)return n("Must pass a deployment via -d or --domain flag.",{level:"danger",docs:"https://cheatcode.co/docs/push/cli"}),process.exit(0);process.loader=new h,process.loader.print("Starting deployment...");const s=await _(e?.deployment_token),o=l(e?.push_server),t=await c({domain:e?.domain,deployment_token:s,push_domain:o});if(!t)return n(`Sorry, we couldn't find a deployment with the domain ${e?.domain} on your account. If you haven't created it yet, head over to the Push dashboard: https://push.cheatcode.co/deployments/create`,{level:"danger",docs:"https://cheatcode.co/docs/push/deployments/create-a-new-deployment"}),process.exit(0);const a=t?.environment||"production",i=new Date().toISOString(),d=await m({environment:a});await p({environment:a,encrypt_build:!0,encryption_key:t?.deployment_secret,silence_confirmation:!0}),process.loader.print("Deploying to Push..."),await y({build_timestamp:i,deployment:t,deployment_token:s,push_domain:o,settings:d}),console.log("DEPLOYMENT",t),process.loader.print("Deploying..."),console.log(t?.intial_deployment_completed?`
2
2
  Monitor your deployment at ${o}/deployments/${t?._id}.
3
3
  `:`
4
4
  Finish your deployment's setup at ${o}/deployments/${t?._id}/setup.
5
- `)};var D=g;export{D as default};
5
+ `)};var M=g;export{M as default};
6
6
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/commands/push_v2/index.js"],
4
- "sourcesContent": ["import build from '../../lib/build/index.js';\nimport cli_log from '../../lib/cli_log.js';\nimport get_deployment from './get_deployment.js';\nimport get_push_domain from './get_push_domain.js';\nimport get_settings_file from './get_settings_file.js';\nimport get_deployment_token from './get_deployment_token.js';\nimport upload_build_to_push from './upload_build_to_push.js';\nimport Loader from '../../lib/loader.js';\n\nconst get_token_for_deployment = async (input_deployment_token = '') => {\n\tconst deployment_token = await get_deployment_token(input_deployment_token);\n\n\tif (!deployment_token) {\n cli_log(\n 'Must pass a deployment token via the -t or --token flag, or, have an existing deployment token on your machine.',\n {\n level: \"danger\",\n docs: \"https://cheatcode.co/docs/push/authentication\"\n }\n );\n\n return process.exit(0);\n\t}\n\n\treturn deployment_token;\n};\n\nconst push = async (args = {}, options = {}) => {\n\tif (!options?.domain) {\n cli_log(\n `Must pass a deployment via -d or --domain flag.`,\n {\n level: \"danger\",\n docs: \"https://cheatcode.co/docs/push/cli\"\n }\n );\n\n return process.exit(0);\t\n\t}\n\n\tprocess.loader = new Loader();\n\tprocess.loader.print('Starting deployment...');\n\n\tconst deployment_token = await get_token_for_deployment(options?.deployment_token);\n const push_domain = get_push_domain(options?.push_server);\n\n\tconst deployment = await get_deployment({\n\t\tdomain: options?.domain,\n\t\tdeployment_token,\n\t\tpush_domain,\n\t});\n\n\tif (!deployment) {\n cli_log(\n `Sorry, we couldn\\'t find a deployment with the domain ${options?.domain} on your account. If you haven\\'t created it yet, head over to the Push dashboard: https://push.cheatcode.co/deployments/create`,\n {\n level: \"danger\",\n docs: \"https://cheatcode.co/docs/push/deployments/create-a-new-deployment\"\n }\n );\n\n return process.exit(0);\t\t\n\t}\n\n\tconst environment = deployment?.environment || 'production';\n\tconst build_timestamp = new Date().toISOString();\n\tconst settings = await get_settings_file({ environment });\n\t\t\n\tawait build({\n\t\tenvironment,\n\t\tencrypt_build: true,\n\t\tencryption_key: deployment?.deployment_secret,\n\t\tsilence_confirmation: true,\n\t});\n\n\tprocess.loader.print('Deploying to Push...');\n\n\tawait upload_build_to_push({\n\t\tbuild_timestamp,\n\t\tdeployment,\n\t\tdeployment_token,\n\t\tpush_domain,\n\t\tsettings,\n\t});\n\n\tconsole.log({ deployment });\n\n\tprocess.loader.print('Deploying test...')\n\tconsole.log(deployment?.intial_deployment_completed ? `\\nMonitor your deployment at ${push_domain}/deployments/${deployment?._id}.\\n` : `\\nFinish your deployment's setup at ${push_domain}/deployments/${deployment?._id}/setup.\\n`);\n};\n\nexport default push;\n"],
5
- "mappings": "AAAA,OAAOA,MAAW,2BAClB,OAAOC,MAAa,uBACpB,OAAOC,MAAoB,sBAC3B,OAAOC,MAAqB,uBAC5B,OAAOC,MAAuB,yBAC9B,OAAOC,MAA0B,4BACjC,OAAOC,MAA0B,4BACjC,OAAOC,MAAY,sBAEnB,MAAMC,EAA2B,MAAOC,EAAyB,KAAO,CACvE,MAAMC,EAAmB,MAAML,EAAqBI,CAAsB,EAE1E,OAAKC,IACFT,EACE,kHACA,CACE,MAAO,SACP,KAAM,+CACR,CACF,EAEO,QAAQ,KAAK,CAAC,EAIzB,EAEMU,EAAO,MAAOC,EAAO,CAAC,EAAGC,EAAU,CAAC,IAAM,CAC/C,GAAI,CAACA,GAAS,OACX,OAAAZ,EACE,kDACA,CACE,MAAO,SACP,KAAM,oCACR,CACF,EAEO,QAAQ,KAAK,CAAC,EAGxB,QAAQ,OAAS,IAAIM,EACrB,QAAQ,OAAO,MAAM,wBAAwB,EAE7C,MAAMG,EAAmB,MAAMF,EAAyBK,GAAS,gBAAgB,EAC1EC,EAAcX,EAAgBU,GAAS,WAAW,EAEnDE,EAAa,MAAMb,EAAe,CACvC,OAAQW,GAAS,OACjB,iBAAAH,EACA,YAAAI,CACD,CAAC,EAED,GAAI,CAACC,EACF,OAAAd,EACE,wDAAyDY,GAAS,MAAM,iIACxE,CACE,MAAO,SACP,KAAM,oEACR,CACF,EAEO,QAAQ,KAAK,CAAC,EAGxB,MAAMG,EAAcD,GAAY,aAAe,aACzCE,EAAkB,IAAI,KAAK,EAAE,YAAY,EACzCC,EAAW,MAAMd,EAAkB,CAAE,YAAAY,CAAY,CAAC,EAExD,MAAMhB,EAAM,CACX,YAAAgB,EACA,cAAe,GACf,eAAgBD,GAAY,kBAC5B,qBAAsB,EACvB,CAAC,EAED,QAAQ,OAAO,MAAM,sBAAsB,EAE3C,MAAMT,EAAqB,CAC1B,gBAAAW,EACA,WAAAF,EACA,iBAAAL,EACA,YAAAI,EACA,SAAAI,CACD,CAAC,EAED,QAAQ,IAAI,CAAE,WAAAH,CAAW,CAAC,EAE1B,QAAQ,OAAO,MAAM,mBAAmB,EACxC,QAAQ,IAAIA,GAAY,4BAA8B;AAAA,6BAAgCD,CAAW,gBAAgBC,GAAY,GAAG;AAAA,EAAQ;AAAA,oCAAuCD,CAAW,gBAAgBC,GAAY,GAAG;AAAA,CAAW,CACrO,EAEA,IAAOI,EAAQR",
4
+ "sourcesContent": ["import build from '../../lib/build/index.js';\nimport cli_log from '../../lib/cli_log.js';\nimport get_deployment from './get_deployment.js';\nimport get_push_domain from './get_push_domain.js';\nimport get_settings_file from './get_settings_file.js';\nimport get_deployment_token from './get_deployment_token.js';\nimport upload_build_to_push from './upload_build_to_push.js';\nimport Loader from '../../lib/loader.js';\n\nconst get_token_for_deployment = async (input_deployment_token = '') => {\n\tconst deployment_token = await get_deployment_token(input_deployment_token);\n\n\tif (!deployment_token) {\n cli_log(\n 'Must pass a deployment token via the -t or --token flag, or, have an existing deployment token on your machine.',\n {\n level: \"danger\",\n docs: \"https://cheatcode.co/docs/push/authentication\"\n }\n );\n\n return process.exit(0);\n\t}\n\n\treturn deployment_token;\n};\n\nconst push = async (args = {}, options = {}) => {\n\tif (!options?.domain) {\n cli_log(\n `Must pass a deployment via -d or --domain flag.`,\n {\n level: \"danger\",\n docs: \"https://cheatcode.co/docs/push/cli\"\n }\n );\n\n return process.exit(0);\t\n\t}\n\n\tprocess.loader = new Loader();\n\tprocess.loader.print('Starting deployment...');\n\n\tconst deployment_token = await get_token_for_deployment(options?.deployment_token);\n const push_domain = get_push_domain(options?.push_server);\n\n\tconst deployment = await get_deployment({\n\t\tdomain: options?.domain,\n\t\tdeployment_token,\n\t\tpush_domain,\n\t});\n\n\tif (!deployment) {\n cli_log(\n `Sorry, we couldn\\'t find a deployment with the domain ${options?.domain} on your account. If you haven\\'t created it yet, head over to the Push dashboard: https://push.cheatcode.co/deployments/create`,\n {\n level: \"danger\",\n docs: \"https://cheatcode.co/docs/push/deployments/create-a-new-deployment\"\n }\n );\n\n return process.exit(0);\t\t\n\t}\n\n\tconst environment = deployment?.environment || 'production';\n\tconst build_timestamp = new Date().toISOString();\n\tconst settings = await get_settings_file({ environment });\n\t\t\n\tawait build({\n\t\tenvironment,\n\t\tencrypt_build: true,\n\t\tencryption_key: deployment?.deployment_secret,\n\t\tsilence_confirmation: true,\n\t});\n\n\tprocess.loader.print('Deploying to Push...');\n\n\tawait upload_build_to_push({\n\t\tbuild_timestamp,\n\t\tdeployment,\n\t\tdeployment_token,\n\t\tpush_domain,\n\t\tsettings,\n\t});\n\n\tconsole.log('DEPLOYMENT', deployment);\n\n\tprocess.loader.print('Deploying...')\n\tconsole.log(deployment?.intial_deployment_completed ? `\\nMonitor your deployment at ${push_domain}/deployments/${deployment?._id}.\\n` : `\\nFinish your deployment's setup at ${push_domain}/deployments/${deployment?._id}/setup.\\n`);\n};\n\nexport default push;\n"],
5
+ "mappings": "AAAA,OAAOA,MAAW,2BAClB,OAAOC,MAAa,uBACpB,OAAOC,MAAoB,sBAC3B,OAAOC,MAAqB,uBAC5B,OAAOC,MAAuB,yBAC9B,OAAOC,MAA0B,4BACjC,OAAOC,MAA0B,4BACjC,OAAOC,MAAY,sBAEnB,MAAMC,EAA2B,MAAOC,EAAyB,KAAO,CACvE,MAAMC,EAAmB,MAAML,EAAqBI,CAAsB,EAE1E,OAAKC,IACFT,EACE,kHACA,CACE,MAAO,SACP,KAAM,+CACR,CACF,EAEO,QAAQ,KAAK,CAAC,EAIzB,EAEMU,EAAO,MAAOC,EAAO,CAAC,EAAGC,EAAU,CAAC,IAAM,CAC/C,GAAI,CAACA,GAAS,OACX,OAAAZ,EACE,kDACA,CACE,MAAO,SACP,KAAM,oCACR,CACF,EAEO,QAAQ,KAAK,CAAC,EAGxB,QAAQ,OAAS,IAAIM,EACrB,QAAQ,OAAO,MAAM,wBAAwB,EAE7C,MAAMG,EAAmB,MAAMF,EAAyBK,GAAS,gBAAgB,EAC1EC,EAAcX,EAAgBU,GAAS,WAAW,EAEnDE,EAAa,MAAMb,EAAe,CACvC,OAAQW,GAAS,OACjB,iBAAAH,EACA,YAAAI,CACD,CAAC,EAED,GAAI,CAACC,EACF,OAAAd,EACE,wDAAyDY,GAAS,MAAM,iIACxE,CACE,MAAO,SACP,KAAM,oEACR,CACF,EAEO,QAAQ,KAAK,CAAC,EAGxB,MAAMG,EAAcD,GAAY,aAAe,aACzCE,EAAkB,IAAI,KAAK,EAAE,YAAY,EACzCC,EAAW,MAAMd,EAAkB,CAAE,YAAAY,CAAY,CAAC,EAExD,MAAMhB,EAAM,CACX,YAAAgB,EACA,cAAe,GACf,eAAgBD,GAAY,kBAC5B,qBAAsB,EACvB,CAAC,EAED,QAAQ,OAAO,MAAM,sBAAsB,EAE3C,MAAMT,EAAqB,CAC1B,gBAAAW,EACA,WAAAF,EACA,iBAAAL,EACA,YAAAI,EACA,SAAAI,CACD,CAAC,EAED,QAAQ,IAAI,aAAcH,CAAU,EAEpC,QAAQ,OAAO,MAAM,cAAc,EACnC,QAAQ,IAAIA,GAAY,4BAA8B;AAAA,6BAAgCD,CAAW,gBAAgBC,GAAY,GAAG;AAAA,EAAQ;AAAA,oCAAuCD,CAAW,gBAAgBC,GAAY,GAAG;AAAA,CAAW,CACrO,EAEA,IAAOI,EAAQR",
6
6
  "names": ["build", "cli_log", "get_deployment", "get_push_domain", "get_settings_file", "get_deployment_token", "upload_build_to_push", "Loader", "get_token_for_deployment", "input_deployment_token", "deployment_token", "push", "args", "options", "push_domain", "deployment", "environment", "build_timestamp", "settings", "push_v2_default"]
7
7
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@joystick.js/cli-canary",
3
3
  "type": "module",
4
- "version": "0.0.0-canary.1750",
5
- "canary_version": "0.0.0-canary.1749",
4
+ "version": "0.0.0-canary.1752",
5
+ "canary_version": "0.0.0-canary.1751",
6
6
  "description": "The CLI for Joystick.",
7
7
  "main": "dist/index.js",
8
8
  "bin": {
@@ -83,9 +83,9 @@ const push = async (args = {}, options = {}) => {
83
83
  settings,
84
84
  });
85
85
 
86
- console.log({ deployment });
86
+ console.log('DEPLOYMENT', deployment);
87
87
 
88
- process.loader.print('Deploying test...')
88
+ process.loader.print('Deploying...')
89
89
  console.log(deployment?.intial_deployment_completed ? `\nMonitor your deployment at ${push_domain}/deployments/${deployment?._id}.\n` : `\nFinish your deployment's setup at ${push_domain}/deployments/${deployment?._id}/setup.\n`);
90
90
  };
91
91
 
@@ -1,47 +0,0 @@
1
- # Use Node.js 20 Slim as the base image
2
- FROM node:20-slim
3
-
4
- # Avoid prompts from apt
5
- ENV DEBIAN_FRONTEND=noninteractive
6
-
7
- # Set the working directory in the container
8
- WORKDIR /app
9
-
10
- # Allow custom apt dependencies to be passed as build argument
11
- ARG CUSTOM_APT_DEPS=""
12
-
13
- # Install custom apt dependencies if provided
14
- RUN if [ ! -z "$CUSTOM_APT_DEPS" ]; then \
15
- apt-get update && apt-get install -y $CUSTOM_APT_DEPS \
16
- && apt-get clean \
17
- && rm -rf /var/lib/apt/lists/*; \
18
- fi
19
-
20
- # Allow custom global npm packages to be passed as build argument
21
- ARG GLOBAL_NPM_PACKAGES=""
22
-
23
- # Install custom global npm packages if provided
24
- RUN if [ ! -z "$GLOBAL_NPM_PACKAGES" ]; then \
25
- npm install -g $GLOBAL_NPM_PACKAGES; \
26
- fi
27
-
28
- # Copy package.json and package-lock.json (if available)
29
- COPY ./.build/package*.json ./
30
-
31
- # Install NPM dependencies
32
- RUN npm ci --only=production
33
-
34
- # Add build argument to invalidate cache
35
- ARG CACHEBUST=1
36
-
37
- # Copy the rest of the pre-built application
38
- COPY ./.build .
39
-
40
- # Expose the port the app runs on
41
- EXPOSE 2600
42
-
43
- # Note: Environment variables (JOYSTICK_SETTINGS, PUSH_INSTANCE_TOKEN)
44
- # will be passed at runtime via the container.env file
45
-
46
- # Command to run the application
47
- CMD ["node", "index.server.js"]
@@ -1,2 +0,0 @@
1
- import{exec as f,execSync as m}from"child_process";import s from"path";import{fileURLToPath as p}from"url";import c from"fs";const k=p(import.meta.url),g=s.dirname(k),_=()=>{try{return m("docker --version",{stdio:"ignore"}),!0}catch{return!1}},$=(e="",i="",{apt_deps:d=[],npm_deps:l=[]}={})=>new Promise((a,r)=>{if(!_()){process.loader.print("Push requires Docker to deploy your app. Please visit https://docs.docker.com/get-started/get-docker/ to download Docker for your OS."),r(new Error("Docker is not installed or not in the PATH"));return}process.loader.print("Building Docker image for deployment...");const t=s.join(g,"Dockerfile");if(!c.existsSync(t)){r(new Error(`Dockerfile not found at ${t}`));return}if(!i||!c.existsSync(s.join(i,".build"))){r(new Error("Invalid context path or .build directory not found"));return}const u=`docker build --quiet ${[`CUSTOM_APT_DEPS=${d.join(" ")}`,`GLOBAL_NPM_PACKAGES=${l.join(" ")}`,`CACHEBUST=${Date.now()}`].map(o=>`--build-arg ${o}`).join(" ")} -t ${e} -f "${t}" "${i}"`;f(u,{stdio:["ignore","pipe","pipe"]},(o,y,n)=>{if(o){console.error(`Error building Docker image: ${o.message}`),r(o);return}n.trim()&&!n.includes("Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them")&&console.error(`Docker build stderr: ${n}`),process.loader.print(`Successfully built Docker image: ${e}`),a()})});var w=$;export{w as default};
2
- //# sourceMappingURL=build_docker_image.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/commands/push_v2/build_docker_image.js"],
4
- "sourcesContent": ["import { exec, execSync } from 'child_process';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport fs from 'fs';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nconst check_docker_installation = () => {\n try {\n execSync('docker --version', { stdio: 'ignore' });\n return true;\n } catch (error) {\n return false;\n }\n};\n\nconst build_docker_image = (\n image_name = '',\n context_path = '',\n {\n apt_deps = [],\n npm_deps = []\n } = {}\n) => {\n return new Promise((resolve, reject) => {\n if (!check_docker_installation()) {\n process.loader.print(\"Push requires Docker to deploy your app. Please visit https://docs.docker.com/get-started/get-docker/ to download Docker for your OS.\");\n reject(new Error(\"Docker is not installed or not in the PATH\"));\n return;\n }\n\n process.loader.print('Building Docker image for deployment...');\n \n const dockerfile_path = path.join(__dirname, 'Dockerfile');\n \n if (!fs.existsSync(dockerfile_path)) {\n reject(new Error(`Dockerfile not found at ${dockerfile_path}`));\n return;\n }\n\n // Ensure context_path is set and contains the .build directory\n if (!context_path || !fs.existsSync(path.join(context_path, '.build'))) {\n reject(new Error('Invalid context path or .build directory not found'));\n return;\n }\n\n // Prepare build arguments for dependencies\n const build_args = [\n `CUSTOM_APT_DEPS=${apt_deps.join(' ')}`,\n `GLOBAL_NPM_PACKAGES=${npm_deps.join(' ')}`,\n `CACHEBUST=${Date.now()}` // Add timestamp to invalidate cache\n ].map(arg => `--build-arg ${arg}`).join(' ');\n\n // Add --quiet flag to suppress verbose output\n const command = `docker build --quiet ${build_args} -t ${image_name} -f \"${dockerfile_path}\" \"${context_path}\"`;\n\n exec(command, { stdio: ['ignore', 'pipe', 'pipe'] }, (error, stdout, stderr) => {\n if (error) {\n console.error(`Error building Docker image: ${error.message}`);\n reject(error);\n return;\n }\n \n // The --quiet flag will output only the image ID, which we can ignore\n \n // Check if stderr contains actual error messages\n if (stderr.trim() && !stderr.includes(\"Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them\")) {\n console.error(`Docker build stderr: ${stderr}`);\n }\n \n process.loader.print(`Successfully built Docker image: ${image_name}`);\n resolve();\n });\n });\n};\n\nexport default build_docker_image;"],
5
- "mappings": "AAAA,OAAS,QAAAA,EAAM,YAAAC,MAAgB,gBAC/B,OAAOC,MAAU,OACjB,OAAS,iBAAAC,MAAqB,MAC9B,OAAOC,MAAQ,KAEf,MAAMC,EAAaF,EAAc,YAAY,GAAG,EAC1CG,EAAYJ,EAAK,QAAQG,CAAU,EAEnCE,EAA4B,IAAM,CACtC,GAAI,CACF,OAAAN,EAAS,mBAAoB,CAAE,MAAO,QAAS,CAAC,EACzC,EACT,MAAgB,CACd,MAAO,EACT,CACF,EAEMO,EAAqB,CACzBC,EAAa,GACbC,EAAe,GACf,CACE,SAAAC,EAAW,CAAC,EACZ,SAAAC,EAAW,CAAC,CACd,EAAI,CAAC,IAEE,IAAI,QAAQ,CAACC,EAASC,IAAW,CACtC,GAAI,CAACP,EAA0B,EAAG,CAChC,QAAQ,OAAO,MAAM,uIAAuI,EAC5JO,EAAO,IAAI,MAAM,4CAA4C,CAAC,EAC9D,MACF,CAEA,QAAQ,OAAO,MAAM,yCAAyC,EAE9D,MAAMC,EAAkBb,EAAK,KAAKI,EAAW,YAAY,EAEzD,GAAI,CAACF,EAAG,WAAWW,CAAe,EAAG,CACnCD,EAAO,IAAI,MAAM,2BAA2BC,CAAe,EAAE,CAAC,EAC9D,MACF,CAGA,GAAI,CAACL,GAAgB,CAACN,EAAG,WAAWF,EAAK,KAAKQ,EAAc,QAAQ,CAAC,EAAG,CACtEI,EAAO,IAAI,MAAM,oDAAoD,CAAC,EACtE,MACF,CAUA,MAAME,EAAU,wBAPG,CACjB,mBAAmBL,EAAS,KAAK,GAAG,CAAC,GACrC,uBAAuBC,EAAS,KAAK,GAAG,CAAC,GACzC,aAAa,KAAK,IAAI,CAAC,EACzB,EAAE,IAAIK,GAAO,eAAeA,CAAG,EAAE,EAAE,KAAK,GAAG,CAGO,OAAOR,CAAU,QAAQM,CAAe,MAAML,CAAY,IAE5GV,EAAKgB,EAAS,CAAE,MAAO,CAAC,SAAU,OAAQ,MAAM,CAAE,EAAG,CAACE,EAAOC,EAAQC,IAAW,CAC9E,GAAIF,EAAO,CACT,QAAQ,MAAM,gCAAgCA,EAAM,OAAO,EAAE,EAC7DJ,EAAOI,CAAK,EACZ,MACF,CAKIE,EAAO,KAAK,GAAK,CAACA,EAAO,SAAS,sGAAsG,GAC1I,QAAQ,MAAM,wBAAwBA,CAAM,EAAE,EAGhD,QAAQ,OAAO,MAAM,oCAAoCX,CAAU,EAAE,EACrEI,EAAQ,CACV,CAAC,CACH,CAAC,EAGH,IAAOQ,EAAQb",
6
- "names": ["exec", "execSync", "path", "fileURLToPath", "fs", "__filename", "__dirname", "check_docker_installation", "build_docker_image", "image_name", "context_path", "apt_deps", "npm_deps", "resolve", "reject", "dockerfile_path", "command", "arg", "error", "stdout", "stderr", "build_docker_image_default"]
7
- }
@@ -1,2 +0,0 @@
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};
2
- //# sourceMappingURL=cdn_mirrors.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/commands/push_v2/cdn_mirrors.js"],
4
- "sourcesContent": ["const cdn_mirrors = [\n 'https://push-versions-1.cheatcode.co',\n 'https://push-versions-2.cheatcode.co',\n 'https://push-versions-3.cheatcode.co',\n];\n\nexport default cdn_mirrors;\n"],
5
- "mappings": "AAAA,MAAMA,EAAc,CAClB,uCACA,uCACA,sCACF,EAEA,IAAOC,EAAQD",
6
- "names": ["cdn_mirrors", "cdn_mirrors_default"]
7
- }
@@ -1,2 +0,0 @@
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};
2
- //# sourceMappingURL=create_version.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/commands/push_v2/create_version.js"],
4
- "sourcesContent": ["import fetch from 'node-fetch';\n\nconst create_version = (options = {}) => {\n\treturn fetch(`${options?.push_provision_domain}/api/versions/${options?.domain}`, {\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'x-push-session-token': options?.session_token,\n\t\t},\n\t\tbody: JSON.stringify(options?.body),\n\t})?.then(async (response) => {\n\t\t// NOTE: We only care about the response body here so parse it out and return it.\n\t\tconst data = await response.json();\n\t\treturn data?.data;\n\t}).catch((error) => {\n\t\tconsole.warn(error);\n\t});\n};\n\nexport default create_version;\n"],
5
- "mappings": "AAAA,OAAOA,MAAW,aAElB,MAAMC,EAAiB,CAACC,EAAU,CAAC,IAC3BF,EAAM,GAAGE,GAAS,qBAAqB,iBAAiBA,GAAS,MAAM,GAAI,CACjF,OAAQ,OACR,QAAS,CACR,eAAgB,mBAChB,uBAAwBA,GAAS,aAClC,EACA,KAAM,KAAK,UAAUA,GAAS,IAAI,CACnC,CAAC,GAAG,KAAK,MAAOC,IAEF,MAAMA,EAAS,KAAK,IACpB,IACb,EAAE,MAAOC,GAAU,CACnB,QAAQ,KAAKA,CAAK,CACnB,CAAC,EAGF,IAAOC,EAAQJ",
6
- "names": ["fetch", "create_version", "options", "response", "error", "create_version_default"]
7
- }
@@ -1,2 +0,0 @@
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};
2
- //# sourceMappingURL=handle_initial_deployment.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/commands/push_v2/handle_initial_deployment.js"],
4
- "sourcesContent": ["import fetch from \"node-fetch\";\n\nconst handle_initial_deployment = async (options = {}) => {\n return fetch(`${options?.push_provision_domain}/api/deployments/${options?.deployment?.domain}`, {\n method: \"POST\",\n headers: {\n \"x-push-session-token\": options?.session_token,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n environment: options?.environment,\n build_timestamp: options?.build_timestamp,\n domain: options?.deployment?.domain,\n deployment_id: options?.deployment?._id,\n }),\n }).then(async (response) => {\n const data = await response.json();\n return data?.data;\n }).catch((error) => {\n console.warn(error);\n });\n};\n\nexport default handle_initial_deployment;\n"],
5
- "mappings": "AAAA,OAAOA,MAAW,aAElB,MAAMC,EAA4B,MAAOC,EAAU,CAAC,IAC3CF,EAAM,GAAGE,GAAS,qBAAqB,oBAAoBA,GAAS,YAAY,MAAM,GAAI,CAChG,OAAQ,OACR,QAAS,CACP,uBAAwBA,GAAS,cACjC,eAAgB,kBAClB,EACA,KAAM,KAAK,UAAU,CACnB,YAAaA,GAAS,YACtB,gBAAiBA,GAAS,gBAC1B,OAAQA,GAAS,YAAY,OAC7B,cAAeA,GAAS,YAAY,GACtC,CAAC,CACF,CAAC,EAAE,KAAK,MAAOC,IACD,MAAMA,EAAS,KAAK,IACpB,IACb,EAAE,MAAOC,GAAU,CAClB,QAAQ,KAAKA,CAAK,CACpB,CAAC,EAGH,IAAOC,EAAQJ",
6
- "names": ["fetch", "handle_initial_deployment", "options", "response", "error", "handle_initial_deployment_default"]
7
- }
@@ -1,2 +0,0 @@
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};
2
- //# sourceMappingURL=handle_version_deployment.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/commands/push_v2/handle_version_deployment.js"],
4
- "sourcesContent": ["import fetch from \"node-fetch\";\n\nconst handle_version_deployment = async (options = {}) => {\n return fetch(`${options?.push_provision_domain}/api/deployments/${options?.deployment?.domain}`, {\n method: \"PUT\",\n headers: {\n \"x-push-session-token\": options?.session_token,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n build_timestamp: options?.build_timestamp,\n domain: options?.deployment?.domain,\n deployment_id: options?.deployment?._id,\n }),\n }).then(async (response) => {\n const data = await response.json();\n return data?.data;\n }).catch((error) => {\n console.warn(error);\n });\n};\n\nexport default handle_version_deployment;\n"],
5
- "mappings": "AAAA,OAAOA,MAAW,aAElB,MAAMC,EAA4B,MAAOC,EAAU,CAAC,IAC3CF,EAAM,GAAGE,GAAS,qBAAqB,oBAAoBA,GAAS,YAAY,MAAM,GAAI,CAChG,OAAQ,MACR,QAAS,CACP,uBAAwBA,GAAS,cACjC,eAAgB,kBAClB,EACA,KAAM,KAAK,UAAU,CACnB,gBAAiBA,GAAS,gBAC1B,OAAQA,GAAS,YAAY,OAC7B,cAAeA,GAAS,YAAY,GACtC,CAAC,CACF,CAAC,EAAE,KAAK,MAAOC,IACD,MAAMA,EAAS,KAAK,IACpB,IACb,EAAE,MAAOC,GAAU,CAClB,QAAQ,KAAKA,CAAK,CACpB,CAAC,EAGH,IAAOC,EAAQJ",
6
- "names": ["fetch", "handle_version_deployment", "options", "response", "error", "handle_version_deployment_default"]
7
- }
@@ -1,18 +0,0 @@
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};
18
- //# sourceMappingURL=confirm_deployment.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/commands/push_v2/prompts/confirm_deployment.js"],
4
- "sourcesContent": ["import AsciiTable from 'ascii-table';\nimport chalk from 'chalk';\n\nconst render_instance_row = (table, [continent_name = '', continent_instances = []]) => {\n\ttable.addRow(`${chalk.magenta(continent_name)}\\n`);\n\n\tfor (let i = 0; i < continent_instances?.length; i += 1) {\n\t\tconst instance = continent_instances[i];\n\t\ttable.addRow(\n\t\t\t`${chalk.yellow(instance?.provider)} (${chalk.green(instance?.region)})`,\n\t\t\t`${chalk.white(instance?.size)} $${chalk.green(instance?.pricePerMonth)}/mo. x${chalk.blue(instance?.quantity)} ${chalk.white('=')} $${chalk.green((instance?.quantity * instance?.pricePerMonth))}/mo.${i + 1 === continent_instances?.length ? '\\n' : ''}`,\n\t\t);\n\t}\n};\n\nconst get_total_monthly_cost_for_instances = (instances = []) => {\n\tconst instances_by_continent = Object.values(instances)?.flatMap((instances_for_continent) => instances_for_continent);\n\treturn instances_by_continent?.reduce((total = 0, instance = {}) => {\n\t\ttotal += instance?.pricePerMonth * instance?.quantity;\n\t\treturn total;\n\t}, 0);\n};\n\nconst confirm_deployment = (instances = {}) => {\n\tconst load_balancer_total_per_month = get_total_monthly_cost_for_instances(instances?.load_balancer);\n\tconst app_total_per_month = get_total_monthly_cost_for_instances(instances?.app);\n\tconst total_monthly_cost = load_balancer_total_per_month + app_total_per_month;\n\n\tconst table = new AsciiTable();\n\n\ttable.removeBorder();\n\ttable.addRow(`${chalk.blue('Load Balancer')}\\n`);\n\n\tconst load_balancer_continents = Object.entries(instances?.load_balancer);\n\tconst app_continents = Object.entries(instances?.app);\n\n\tfor (let i = 0; i < load_balancer_continents?.length; i += 1) {\n\t\trender_instance_row(table, load_balancer_continents[i]);\n\t}\n\n\ttable.addRow(`\\n ${chalk.blue('App')}\\n`);\n\n\tfor (let i = 0; i < app_continents?.length; i += 1) {\n\t\trender_instance_row(table, app_continents[i]);\n\t}\n\t\n\ttable.addRow(chalk.white('\\n ---\\n'));\n\t\n\ttable.addRow(\n\t\tchalk.green('Monthly Cost'),\n\t\tchalk.white(`$${chalk.green(total_monthly_cost)}/mo.`)\n\t);\n\n\ttable.addRow(\n\t\tchalk.green('Annual Cost'),\n\t\tchalk.white(`$${chalk.green(total_monthly_cost * 12)}/yr.`)\n\t);\n\n\tconst is_abnormal = total_monthly_cost > 100;\n\n\treturn [{\n\t name: 'confirm_deployment',\n\t type: 'confirm',\n\t prefix: '',\n\t message: `\\n ${chalk.greenBright('>')} Start deployment and provision these instances?`,\n\t suffix: `\n\t \\n${table.toString()}\n\t ${is_abnormal ? `\\n\\n ${chalk.yellowBright(`!!! >>> These costs are ${chalk.magenta('high')}. Be absolutely ${chalk.magenta('CERTAIN')} you want to run this deployment. <<< !!!`)}\n\t \\n ` : '\\n'}`,\n\t}];\n};\n\nexport default confirm_deployment;\n"],
5
- "mappings": "AAAA,OAAOA,MAAgB,cACvB,OAAOC,MAAW,QAElB,MAAMC,EAAsB,CAACC,EAAO,CAACC,EAAiB,GAAIC,EAAsB,CAAC,CAAC,IAAM,CACvFF,EAAM,OAAO,GAAGF,EAAM,QAAQG,CAAc,CAAC;AAAA,CAAI,EAEjD,QAASE,EAAI,EAAGA,EAAID,GAAqB,OAAQC,GAAK,EAAG,CACxD,MAAMC,EAAWF,EAAoBC,CAAC,EACtCH,EAAM,OACL,GAAGF,EAAM,OAAOM,GAAU,QAAQ,CAAC,KAAKN,EAAM,MAAMM,GAAU,MAAM,CAAC,IACrE,GAAGN,EAAM,MAAMM,GAAU,IAAI,CAAC,MAAMN,EAAM,MAAMM,GAAU,aAAa,CAAC,UAAUN,EAAM,KAAKM,GAAU,QAAQ,CAAC,KAAKN,EAAM,MAAM,GAAG,CAAC,MAAMA,EAAM,MAAOM,GAAU,SAAWA,GAAU,aAAc,CAAC,OAAOD,EAAI,IAAMD,GAAqB,OAAS;AAAA,EAAO,EAAE,EAC/P,CACD,CACD,EAEMG,EAAuC,CAACC,EAAY,CAAC,IAC3B,OAAO,OAAOA,CAAS,GAAG,QAASC,GAA4BA,CAAuB,GACtF,OAAO,CAACC,EAAQ,EAAGJ,EAAW,CAAC,KAC7DI,GAASJ,GAAU,cAAgBA,GAAU,SACtCI,GACL,CAAC,EAGCC,EAAqB,CAACH,EAAY,CAAC,IAAM,CAC9C,MAAMI,EAAgCL,EAAqCC,GAAW,aAAa,EAC7FK,EAAsBN,EAAqCC,GAAW,GAAG,EACzEM,EAAqBF,EAAgCC,EAErDX,EAAQ,IAAIH,EAElBG,EAAM,aAAa,EACnBA,EAAM,OAAO,GAAGF,EAAM,KAAK,eAAe,CAAC;AAAA,CAAI,EAE/C,MAAMe,EAA2B,OAAO,QAAQP,GAAW,aAAa,EAClEQ,EAAiB,OAAO,QAAQR,GAAW,GAAG,EAEpD,QAASH,EAAI,EAAGA,EAAIU,GAA0B,OAAQV,GAAK,EAC1DJ,EAAoBC,EAAOa,EAAyBV,CAAC,CAAC,EAGvDH,EAAM,OAAO;AAAA,IAAOF,EAAM,KAAK,KAAK,CAAC;AAAA,CAAI,EAEzC,QAASK,EAAI,EAAGA,EAAIW,GAAgB,OAAQX,GAAK,EAChDJ,EAAoBC,EAAOc,EAAeX,CAAC,CAAC,EAG7CH,EAAM,OAAOF,EAAM,MAAM;AAAA;AAAA,CAAW,CAAC,EAErCE,EAAM,OACLF,EAAM,MAAM,cAAc,EAC1BA,EAAM,MAAM,IAAIA,EAAM,MAAMc,CAAkB,CAAC,MAAM,CACtD,EAEAZ,EAAM,OACLF,EAAM,MAAM,aAAa,EACzBA,EAAM,MAAM,IAAIA,EAAM,MAAMc,EAAqB,EAAE,CAAC,MAAM,CAC3D,EAEA,MAAMG,EAAcH,EAAqB,IAEzC,MAAO,CAAC,CACN,KAAM,qBACN,KAAM,UACN,OAAQ,GACR,QAAS;AAAA,GAAMd,EAAM,YAAY,GAAG,CAAC,mDACrC,OAAQ;AAAA;AAAA,EACJE,EAAM,SAAS,CAAC;AAAA,KAClBe,EAAc;AAAA;AAAA,IAASjB,EAAM,aAAa,2BAA2BA,EAAM,QAAQ,MAAM,CAAC,mBAAmBA,EAAM,QAAQ,SAAS,CAAC,2CAA2C,CAAC;AAAA;AAAA,GAC5K;AAAA,CAAI,EACb,CAAC,CACF,EAEA,IAAOkB,EAAQP",
6
- "names": ["AsciiTable", "chalk", "render_instance_row", "table", "continent_name", "continent_instances", "i", "instance", "get_total_monthly_cost_for_instances", "instances", "instances_for_continent", "total", "confirm_deployment", "load_balancer_total_per_month", "app_total_per_month", "total_monthly_cost", "load_balancer_continents", "app_continents", "is_abnormal", "confirm_deployment_default"]
7
- }
@@ -1,6 +0,0 @@
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};
6
- //# sourceMappingURL=session_token.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/commands/push_v2/prompts/session_token.js"],
4
- "sourcesContent": ["import chalk from 'chalk';\n\nconst session_token = () => [{\n name: 'session_token',\n type: 'text',\n prefix: '',\n message: `\\n${chalk.yellowBright('>')} To login to Push, paste your session token below:\\n`,\n suffix: ` ${chalk.yellowBright('Find your session token here:')} https://push.cheatcode.co/account/profile\\n\\n`,\n}];\n\nexport default session_token;\n"],
5
- "mappings": "AAAA,OAAOA,MAAW,QAElB,MAAMC,EAAgB,IAAM,CAAC,CAC3B,KAAM,gBACN,KAAM,OACN,OAAQ,GACR,QAAS;AAAA,EAAKD,EAAM,aAAa,GAAG,CAAC;AAAA,EACrC,OAAQ,KAAKA,EAAM,aAAa,+BAA+B,CAAC;AAAA;AAAA,CAClE,CAAC,EAED,IAAOE,EAAQD",
6
- "names": ["chalk", "session_token", "session_token_default"]
7
- }
@@ -1,2 +0,0 @@
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};
2
- //# sourceMappingURL=validate_deployment.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/commands/push_v2/validate_deployment.js"],
4
- "sourcesContent": ["import fetch from 'node-fetch';\n\nconst validate_deployment = (options = {}) => {\n\treturn fetch(`${options?.push_provision_domain}/api/deployments/${options?.push_config?.domain}/validate`, {\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'x-push-session-token': options?.session_token,\n\t\t},\n\t\tbody: JSON.stringify(options?.push_config),\n\t})?.then(async (response) => {\n\t\tconst data = await response.json();\n\t\treturn data?.data;\n\t}).catch((error) => {\n\t\tconsole.warn(error);\n\t});\n};\n\nexport default validate_deployment;\n"],
5
- "mappings": "AAAA,OAAOA,MAAW,aAElB,MAAMC,EAAsB,CAACC,EAAU,CAAC,IAChCF,EAAM,GAAGE,GAAS,qBAAqB,oBAAoBA,GAAS,aAAa,MAAM,YAAa,CAC1G,OAAQ,OACR,QAAS,CACR,eAAgB,mBAChB,uBAAwBA,GAAS,aAClC,EACA,KAAM,KAAK,UAAUA,GAAS,WAAW,CAC1C,CAAC,GAAG,KAAK,MAAOC,IACF,MAAMA,EAAS,KAAK,IACpB,IACb,EAAE,MAAOC,GAAU,CACnB,QAAQ,KAAKA,CAAK,CACnB,CAAC,EAGF,IAAOC,EAAQJ",
6
- "names": ["fetch", "validate_deployment", "options", "response", "error", "validate_deployment_default"]
7
- }
@@ -1,2 +0,0 @@
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};
2
- //# sourceMappingURL=validate_push_config.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/commands/push_v2/validate_push_config.js"],
4
- "sourcesContent": ["import fetch from 'node-fetch';\n\nconst validate_push_config = (options = {}) => {\n\treturn fetch(`${options?.push_provision_domain}/api/validate/config`, {\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t},\n\t\tbody: JSON.stringify(options?.push_config),\n\t})?.then(async (response) => {\n\t\tconst data = await response.json();\n\t\treturn data?.data;\n\t}).catch((error) => {\n\t\tconsole.warn(error);\n\t});\n};\n\nexport default validate_push_config;\n"],
5
- "mappings": "AAAA,OAAOA,MAAW,aAElB,MAAMC,EAAuB,CAACC,EAAU,CAAC,IACjCF,EAAM,GAAGE,GAAS,qBAAqB,uBAAwB,CACrE,OAAQ,OACR,QAAS,CACR,eAAgB,kBACjB,EACA,KAAM,KAAK,UAAUA,GAAS,WAAW,CAC1C,CAAC,GAAG,KAAK,MAAOC,IACF,MAAMA,EAAS,KAAK,IACpB,IACb,EAAE,MAAOC,GAAU,CACnB,QAAQ,KAAKA,CAAK,CACnB,CAAC,EAGF,IAAOC,EAAQJ",
6
- "names": ["fetch", "validate_push_config", "options", "response", "error", "validate_push_config_default"]
7
- }
@@ -1,47 +0,0 @@
1
- # Use Node.js 20 Slim as the base image
2
- FROM node:20-slim
3
-
4
- # Avoid prompts from apt
5
- ENV DEBIAN_FRONTEND=noninteractive
6
-
7
- # Set the working directory in the container
8
- WORKDIR /app
9
-
10
- # Allow custom apt dependencies to be passed as build argument
11
- ARG CUSTOM_APT_DEPS=""
12
-
13
- # Install custom apt dependencies if provided
14
- RUN if [ ! -z "$CUSTOM_APT_DEPS" ]; then \
15
- apt-get update && apt-get install -y $CUSTOM_APT_DEPS \
16
- && apt-get clean \
17
- && rm -rf /var/lib/apt/lists/*; \
18
- fi
19
-
20
- # Allow custom global npm packages to be passed as build argument
21
- ARG GLOBAL_NPM_PACKAGES=""
22
-
23
- # Install custom global npm packages if provided
24
- RUN if [ ! -z "$GLOBAL_NPM_PACKAGES" ]; then \
25
- npm install -g $GLOBAL_NPM_PACKAGES; \
26
- fi
27
-
28
- # Copy package.json and package-lock.json (if available)
29
- COPY ./.build/package*.json ./
30
-
31
- # Install NPM dependencies
32
- RUN npm ci --only=production
33
-
34
- # Add build argument to invalidate cache
35
- ARG CACHEBUST=1
36
-
37
- # Copy the rest of the pre-built application
38
- COPY ./.build .
39
-
40
- # Expose the port the app runs on
41
- EXPOSE 2600
42
-
43
- # Note: Environment variables (JOYSTICK_SETTINGS, PUSH_INSTANCE_TOKEN)
44
- # will be passed at runtime via the container.env file
45
-
46
- # Command to run the application
47
- CMD ["node", "index.server.js"]
@@ -1,78 +0,0 @@
1
- import { exec, execSync } from 'child_process';
2
- import path from 'path';
3
- import { fileURLToPath } from 'url';
4
- import fs from 'fs';
5
-
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
-
9
- const check_docker_installation = () => {
10
- try {
11
- execSync('docker --version', { stdio: 'ignore' });
12
- return true;
13
- } catch (error) {
14
- return false;
15
- }
16
- };
17
-
18
- const build_docker_image = (
19
- image_name = '',
20
- context_path = '',
21
- {
22
- apt_deps = [],
23
- npm_deps = []
24
- } = {}
25
- ) => {
26
- return new Promise((resolve, reject) => {
27
- if (!check_docker_installation()) {
28
- process.loader.print("Push requires Docker to deploy your app. Please visit https://docs.docker.com/get-started/get-docker/ to download Docker for your OS.");
29
- reject(new Error("Docker is not installed or not in the PATH"));
30
- return;
31
- }
32
-
33
- process.loader.print('Building Docker image for deployment...');
34
-
35
- const dockerfile_path = path.join(__dirname, 'Dockerfile');
36
-
37
- if (!fs.existsSync(dockerfile_path)) {
38
- reject(new Error(`Dockerfile not found at ${dockerfile_path}`));
39
- return;
40
- }
41
-
42
- // Ensure context_path is set and contains the .build directory
43
- if (!context_path || !fs.existsSync(path.join(context_path, '.build'))) {
44
- reject(new Error('Invalid context path or .build directory not found'));
45
- return;
46
- }
47
-
48
- // Prepare build arguments for dependencies
49
- const build_args = [
50
- `CUSTOM_APT_DEPS=${apt_deps.join(' ')}`,
51
- `GLOBAL_NPM_PACKAGES=${npm_deps.join(' ')}`,
52
- `CACHEBUST=${Date.now()}` // Add timestamp to invalidate cache
53
- ].map(arg => `--build-arg ${arg}`).join(' ');
54
-
55
- // Add --quiet flag to suppress verbose output
56
- const command = `docker build --quiet ${build_args} -t ${image_name} -f "${dockerfile_path}" "${context_path}"`;
57
-
58
- exec(command, { stdio: ['ignore', 'pipe', 'pipe'] }, (error, stdout, stderr) => {
59
- if (error) {
60
- console.error(`Error building Docker image: ${error.message}`);
61
- reject(error);
62
- return;
63
- }
64
-
65
- // The --quiet flag will output only the image ID, which we can ignore
66
-
67
- // Check if stderr contains actual error messages
68
- if (stderr.trim() && !stderr.includes("Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them")) {
69
- console.error(`Docker build stderr: ${stderr}`);
70
- }
71
-
72
- process.loader.print(`Successfully built Docker image: ${image_name}`);
73
- resolve();
74
- });
75
- });
76
- };
77
-
78
- export default build_docker_image;
@@ -1,7 +0,0 @@
1
- const cdn_mirrors = [
2
- 'https://push-versions-1.cheatcode.co',
3
- 'https://push-versions-2.cheatcode.co',
4
- 'https://push-versions-3.cheatcode.co',
5
- ];
6
-
7
- export default cdn_mirrors;
@@ -1,20 +0,0 @@
1
- import fetch from 'node-fetch';
2
-
3
- const create_version = (options = {}) => {
4
- return fetch(`${options?.push_provision_domain}/api/versions/${options?.domain}`, {
5
- method: 'POST',
6
- headers: {
7
- 'Content-Type': 'application/json',
8
- 'x-push-session-token': options?.session_token,
9
- },
10
- body: JSON.stringify(options?.body),
11
- })?.then(async (response) => {
12
- // NOTE: We only care about the response body here so parse it out and return it.
13
- const data = await response.json();
14
- return data?.data;
15
- }).catch((error) => {
16
- console.warn(error);
17
- });
18
- };
19
-
20
- export default create_version;
@@ -1,24 +0,0 @@
1
- import fetch from "node-fetch";
2
-
3
- const handle_initial_deployment = async (options = {}) => {
4
- return fetch(`${options?.push_provision_domain}/api/deployments/${options?.deployment?.domain}`, {
5
- method: "POST",
6
- headers: {
7
- "x-push-session-token": options?.session_token,
8
- 'Content-Type': 'application/json',
9
- },
10
- body: JSON.stringify({
11
- environment: options?.environment,
12
- build_timestamp: options?.build_timestamp,
13
- domain: options?.deployment?.domain,
14
- deployment_id: options?.deployment?._id,
15
- }),
16
- }).then(async (response) => {
17
- const data = await response.json();
18
- return data?.data;
19
- }).catch((error) => {
20
- console.warn(error);
21
- });
22
- };
23
-
24
- export default handle_initial_deployment;
@@ -1,23 +0,0 @@
1
- import fetch from "node-fetch";
2
-
3
- const handle_version_deployment = async (options = {}) => {
4
- return fetch(`${options?.push_provision_domain}/api/deployments/${options?.deployment?.domain}`, {
5
- method: "PUT",
6
- headers: {
7
- "x-push-session-token": options?.session_token,
8
- 'Content-Type': 'application/json',
9
- },
10
- body: JSON.stringify({
11
- build_timestamp: options?.build_timestamp,
12
- domain: options?.deployment?.domain,
13
- deployment_id: options?.deployment?._id,
14
- }),
15
- }).then(async (response) => {
16
- const data = await response.json();
17
- return data?.data;
18
- }).catch((error) => {
19
- console.warn(error);
20
- });
21
- };
22
-
23
- export default handle_version_deployment;
@@ -1,73 +0,0 @@
1
- import AsciiTable from 'ascii-table';
2
- import chalk from 'chalk';
3
-
4
- const render_instance_row = (table, [continent_name = '', continent_instances = []]) => {
5
- table.addRow(`${chalk.magenta(continent_name)}\n`);
6
-
7
- for (let i = 0; i < continent_instances?.length; i += 1) {
8
- const instance = continent_instances[i];
9
- table.addRow(
10
- `${chalk.yellow(instance?.provider)} (${chalk.green(instance?.region)})`,
11
- `${chalk.white(instance?.size)} $${chalk.green(instance?.pricePerMonth)}/mo. x${chalk.blue(instance?.quantity)} ${chalk.white('=')} $${chalk.green((instance?.quantity * instance?.pricePerMonth))}/mo.${i + 1 === continent_instances?.length ? '\n' : ''}`,
12
- );
13
- }
14
- };
15
-
16
- const get_total_monthly_cost_for_instances = (instances = []) => {
17
- const instances_by_continent = Object.values(instances)?.flatMap((instances_for_continent) => instances_for_continent);
18
- return instances_by_continent?.reduce((total = 0, instance = {}) => {
19
- total += instance?.pricePerMonth * instance?.quantity;
20
- return total;
21
- }, 0);
22
- };
23
-
24
- const confirm_deployment = (instances = {}) => {
25
- const load_balancer_total_per_month = get_total_monthly_cost_for_instances(instances?.load_balancer);
26
- const app_total_per_month = get_total_monthly_cost_for_instances(instances?.app);
27
- const total_monthly_cost = load_balancer_total_per_month + app_total_per_month;
28
-
29
- const table = new AsciiTable();
30
-
31
- table.removeBorder();
32
- table.addRow(`${chalk.blue('Load Balancer')}\n`);
33
-
34
- const load_balancer_continents = Object.entries(instances?.load_balancer);
35
- const app_continents = Object.entries(instances?.app);
36
-
37
- for (let i = 0; i < load_balancer_continents?.length; i += 1) {
38
- render_instance_row(table, load_balancer_continents[i]);
39
- }
40
-
41
- table.addRow(`\n ${chalk.blue('App')}\n`);
42
-
43
- for (let i = 0; i < app_continents?.length; i += 1) {
44
- render_instance_row(table, app_continents[i]);
45
- }
46
-
47
- table.addRow(chalk.white('\n ---\n'));
48
-
49
- table.addRow(
50
- chalk.green('Monthly Cost'),
51
- chalk.white(`$${chalk.green(total_monthly_cost)}/mo.`)
52
- );
53
-
54
- table.addRow(
55
- chalk.green('Annual Cost'),
56
- chalk.white(`$${chalk.green(total_monthly_cost * 12)}/yr.`)
57
- );
58
-
59
- const is_abnormal = total_monthly_cost > 100;
60
-
61
- return [{
62
- name: 'confirm_deployment',
63
- type: 'confirm',
64
- prefix: '',
65
- message: `\n ${chalk.greenBright('>')} Start deployment and provision these instances?`,
66
- suffix: `
67
- \n${table.toString()}
68
- ${is_abnormal ? `\n\n ${chalk.yellowBright(`!!! >>> These costs are ${chalk.magenta('high')}. Be absolutely ${chalk.magenta('CERTAIN')} you want to run this deployment. <<< !!!`)}
69
- \n ` : '\n'}`,
70
- }];
71
- };
72
-
73
- export default confirm_deployment;
@@ -1,11 +0,0 @@
1
- import chalk from 'chalk';
2
-
3
- const session_token = () => [{
4
- name: 'session_token',
5
- type: 'text',
6
- prefix: '',
7
- message: `\n${chalk.yellowBright('>')} To login to Push, paste your session token below:\n`,
8
- suffix: ` ${chalk.yellowBright('Find your session token here:')} https://push.cheatcode.co/account/profile\n\n`,
9
- }];
10
-
11
- export default session_token;
@@ -1,19 +0,0 @@
1
- import fetch from 'node-fetch';
2
-
3
- const validate_deployment = (options = {}) => {
4
- return fetch(`${options?.push_provision_domain}/api/deployments/${options?.push_config?.domain}/validate`, {
5
- method: 'POST',
6
- headers: {
7
- 'Content-Type': 'application/json',
8
- 'x-push-session-token': options?.session_token,
9
- },
10
- body: JSON.stringify(options?.push_config),
11
- })?.then(async (response) => {
12
- const data = await response.json();
13
- return data?.data;
14
- }).catch((error) => {
15
- console.warn(error);
16
- });
17
- };
18
-
19
- export default validate_deployment;
@@ -1,18 +0,0 @@
1
- import fetch from 'node-fetch';
2
-
3
- const validate_push_config = (options = {}) => {
4
- return fetch(`${options?.push_provision_domain}/api/validate/config`, {
5
- method: 'POST',
6
- headers: {
7
- 'Content-Type': 'application/json',
8
- },
9
- body: JSON.stringify(options?.push_config),
10
- })?.then(async (response) => {
11
- const data = await response.json();
12
- return data?.data;
13
- }).catch((error) => {
14
- console.warn(error);
15
- });
16
- };
17
-
18
- export default validate_push_config;