Skip to content

Fix broken canvas dependency #3

Open
J053Fabi0 wants to merge 14 commits into
Ciaxur:mainfrom
J053Fabi0:main
Open

Fix broken canvas dependency #3
J053Fabi0 wants to merge 14 commits into
Ciaxur:mainfrom
J053Fabi0:main

Conversation

@J053Fabi0
Copy link
Copy Markdown

@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
Copy Markdown
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).

Comment thread deps.ts Outdated
@@ -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
Copy Markdown
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