@joystick.js/cli-canary 0.0.0-canary.1664 → 0.0.0-canary.1665

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.
@@ -43,6 +43,9 @@ RUN if [ ! -z "$GLOBAL_NPM_PACKAGES" ]; then \
43
43
  # Set the working directory in the container
44
44
  WORKDIR /app
45
45
 
46
+ # Add build argument to invalidate cache
47
+ ARG CACHEBUST=1
48
+
46
49
  # Copy the pre-built application
47
50
  COPY ./.build /app
48
51
 
@@ -1 +1 @@
1
- import{exec as m,execSync as p}from"child_process";import t from"path";import{fileURLToPath as k}from"url";import c from"fs";const g=k(import.meta.url),_=t.dirname(g),$=()=>{try{return p("docker --version",{stdio:"ignore"}),!0}catch{return!1}},b=(e="",i="",{apt_deps:d=[],npm_deps:l=[]}={})=>new Promise((a,o)=>{if(!$()){process.loader.print("Push requires Docker to deploy your app. Visit https://docs.docker.com/get-started/get-docker/ to download docker for your OS."),o(new Error("Docker is not installed or not in the PATH"));return}process.loader.print("Building Docker image for deployment...");const n=t.join(_,"Dockerfile");if(!c.existsSync(n)){o(new Error(`Dockerfile not found at ${n}`));return}if(!i||!c.existsSync(t.join(i,".build"))){o(new Error("Invalid context path or .build directory not found"));return}const u=`docker build ${[`CUSTOM_APT_DEPS=${d.join(" ")}`,`GLOBAL_NPM_PACKAGES=${l.join(" ")}`].map(r=>`--build-arg ${r}`).join(" ")} -t ${e} -f "${n}" "${i}"`;m(u,(r,f,s)=>{if(r){console.error(`Error building Docker image: ${r.message}`),o(r);return}s&&console.error(`Docker build stderr: ${s}`),process.loader.print(f),process.loader.print(`Successfully built Docker image: ${e}`),a()})});var E=b;export{E as default};
1
+ import{exec as f,execSync as m}from"child_process";import s from"path";import{fileURLToPath as k}from"url";import d from"fs";const g=k(import.meta.url),_=s.dirname(g),$=()=>{try{return m("docker --version",{stdio:"ignore"}),!0}catch{return!1}},b=(e="",i="",{apt_deps:l=[],npm_deps:a=[]}={})=>new Promise((u,o)=>{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."),o(new Error("Docker is not installed or not in the PATH"));return}process.loader.print("Building Docker image for deployment...");const n=s.join(_,"Dockerfile");if(!d.existsSync(n)){o(new Error(`Dockerfile not found at ${n}`));return}if(!i||!d.existsSync(s.join(i,".build"))){o(new Error("Invalid context path or .build directory not found"));return}const p=`docker build ${[`CUSTOM_APT_DEPS=${l.join(" ")}`,`GLOBAL_NPM_PACKAGES=${a.join(" ")}`,`CACHEBUST=${Date.now()}`].map(r=>`--build-arg ${r}`).join(" ")} -t ${e} -f "${n}" "${i}"`;f(p,{stdio:["pipe","pipe","pipe"]},(r,c,t)=>{if(r){console.error(`Error building Docker image: ${r.message}`),o(r);return}c.trim()&&process.loader.print(c),t.trim()&&!t.includes("Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them")&&console.error(`Docker build stderr: ${t}`),process.loader.print(`Successfully built Docker image: ${e}`),u()})});var w=b;export{w as default};
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.1664",
5
- "canary_version": "0.0.0-canary.1663",
4
+ "version": "0.0.0-canary.1665",
5
+ "canary_version": "0.0.0-canary.1664",
6
6
  "description": "The CLI for Joystick.",
7
7
  "main": "dist/index.js",
8
8
  "bin": {
@@ -43,6 +43,9 @@ RUN if [ ! -z "$GLOBAL_NPM_PACKAGES" ]; then \
43
43
  # Set the working directory in the container
44
44
  WORKDIR /app
45
45
 
46
+ # Add build argument to invalidate cache
47
+ ARG CACHEBUST=1
48
+
46
49
  # Copy the pre-built application
47
50
  COPY ./.build /app
48
51
 
@@ -25,7 +25,7 @@ const build_docker_image = (
25
25
  ) => {
26
26
  return new Promise((resolve, reject) => {
27
27
  if (!check_docker_installation()) {
28
- process.loader.print("Push requires Docker to deploy your app. Visit https://docs.docker.com/get-started/get-docker/ to download docker for your OS.");
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
29
  reject(new Error("Docker is not installed or not in the PATH"));
30
30
  return;
31
31
  }
@@ -48,21 +48,29 @@ const build_docker_image = (
48
48
  // Prepare build arguments for dependencies
49
49
  const build_args = [
50
50
  `CUSTOM_APT_DEPS=${apt_deps.join(' ')}`,
51
- `GLOBAL_NPM_PACKAGES=${npm_deps.join(' ')}`
51
+ `GLOBAL_NPM_PACKAGES=${npm_deps.join(' ')}`,
52
+ `CACHEBUST=${Date.now()}` // Add timestamp to invalidate cache
52
53
  ].map(arg => `--build-arg ${arg}`).join(' ');
53
54
 
54
55
  const command = `docker build ${build_args} -t ${image_name} -f "${dockerfile_path}" "${context_path}"`;
55
56
 
56
- exec(command, (error, stdout, stderr) => {
57
+ exec(command, { stdio: ['pipe', 'pipe', 'pipe'] }, (error, stdout, stderr) => {
57
58
  if (error) {
58
59
  console.error(`Error building Docker image: ${error.message}`);
59
60
  reject(error);
60
61
  return;
61
62
  }
62
- if (stderr) {
63
+
64
+ // Only log stdout if it's not empty
65
+ if (stdout.trim()) {
66
+ process.loader.print(stdout);
67
+ }
68
+
69
+ // Check if stderr contains actual error messages
70
+ if (stderr.trim() && !stderr.includes("Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them")) {
63
71
  console.error(`Docker build stderr: ${stderr}`);
64
72
  }
65
- process.loader.print(stdout);
73
+
66
74
  process.loader.print(`Successfully built Docker image: ${image_name}`);
67
75
  resolve();
68
76
  });