Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken canvas dependency #3

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

J053Fabi0
Copy link

@J053Fabi0 J053Fabi0 commented May 17, 2024

The current code throws this error:

error: Uncaught SyntaxError: The requested module 'https://deno.land/std/encoding/base64.ts' does not provide an export named 'encode'
export { encode, decode } from "https://deno.land/std/encoding/base64.ts";
         ^
    at <anonymous> (https://deno.land/x/canvas@v1.2.2/deps.ts:2:10)

Updating the canvas dependency to the latest version solves the problem.

I have tested using import Graph from "https://raw.githubusercontent.com/J053Fabi0/DenoChart/main/mod.ts"; and it works.

Copy link
Owner

@Ciaxur Ciaxur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good to me, aside from opting to use your jsr@deno-canvas instead of just bumping the version of the official one (https://deno.land/x/canvas@v1.4.1).

@@ -1,4 +1,4 @@
import Canvas from 'https://deno.land/x/canvas@v1.2.2/mod.ts';
import Canvas from "@josefabio/deno-canvas";
Copy link
Owner

@Ciaxur Ciaxur Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just update this and deps.ts#L4 to https://deno.land/x/canvas@v1.4.1/mod.ts'?

That works for me:

➜ DenoChart git:(main) ✗ gd deps.ts
diff --git a/deps.ts b/deps.ts
index f8e3dcf..c3d47c2 100644
--- a/deps.ts
+++ b/deps.ts
@@ -1,4 +1,4 @@
-import Canvas from 'https://deno.land/x/canvas@v1.2.2/mod.ts';
+import Canvas from 'https://deno.land/x/canvas@v1.4.1/mod.ts';
 export default Canvas;
 
-export * from 'https://deno.land/x/canvas@v1.2.2/mod.ts';
\ No newline at end of file
+export * from 'https://deno.land/x/canvas@v1.4.1/mod.ts';

➜ DenoChart git:(main) ✗ deno --version
deno 1.33.2 (release, x86_64-unknown-linux-gnu)
v8 11.4.183.1
typescript 5.0.3

➜ DenoChart git:(main) ✗ deno run ../main.ts 
Initialized Canvas Instance W[720] H[480]
Create Graph with Options: {
  height: 480,
  width: 720,
  backgroundColor: { r: 0, g: 0, b: 0, a: 0.75 },
  titleText: "Uptime",
  xAxisText: "Hours",
  yAxisText: "Day",
  yMax: 50,
  yPadding: 0,
  xPadding: 0,
  bar_width: 25,
  bar_spacing: 5,
  graphSegments_X: 18,
  graphSegments_Y: 10,
  titleColor: "rgb(255,255,255)",
  xTextColor: "rgba(255,255,255,1)",
  yTextColor: "rgba(255,255,255,1)",
  xSegmentColor: "rgba(255,255,255,0.5)",
  ySegmentColor: "rgba(255,255,255,0.5)",
  graphValuePrecision: 2,
  verbose: true
}
yMax Evaluated to:  50
✅ Granted write access to "image.png".
Graph save to 'image.png'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants