Skip to content

Upgrade TS, Canvas to v3 #3115

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

Merged
merged 7 commits into from
Mar 31, 2025
Merged

Upgrade TS, Canvas to v3 #3115

merged 7 commits into from
Mar 31, 2025

Conversation

RichDom2185
Copy link
Member

@RichDom2185 RichDom2185 commented Mar 16, 2025

Description

Fixes build errors with NodeJS 22 on Windows

Checklist

  • I have tested this code
  • I have updated the documentation

@RichDom2185 RichDom2185 requested a review from tsammeow March 16, 2025 07:57
@RichDom2185 RichDom2185 self-assigned this Mar 16, 2025
@RichDom2185 RichDom2185 enabled auto-merge (squash) March 16, 2025 07:57
@sayomaki
Copy link
Contributor

FAIL src/commons/sagas/__tests__/PlaygroundSaga.ts
   Test suite failed to run

    Cannot find module 'canvas' from 'node_modules/konva/lib/index-node.js'

    Require stack:
      node_modules/konva/lib/index-node.js
      node_modules/react-konva/lib/ReactKonva.js
      src/features/cseMachine/CseMachineLayout.tsx
      src/features/cseMachine/CseMachine.tsx
      src/commons/utils/JsSlangHelper.ts
      src/commons/application/ApplicationTypes.ts
      src/commons/sagas/__tests__/PlaygroundSaga.ts

      4 | import { KonvaEventObject } from 'konva/lib/Node';
      5 | import React, { RefObject } from 'react';
    > 6 | import { Layer, Rect, Stage } from 'react-konva';
        | ^
      7 | import classes from 'src/styles/Draggable.module.scss';

From konva README page:

In order to run konva in nodejs environment you also need to install canvas package manually. Konva will use it for 2d canvas API.

@RichDom2185
Copy link
Member Author

FAIL src/commons/sagas/__tests__/PlaygroundSaga.ts
   Test suite failed to run

    Cannot find module 'canvas' from 'node_modules/konva/lib/index-node.js'

    Require stack:
      node_modules/konva/lib/index-node.js
      node_modules/react-konva/lib/ReactKonva.js
      src/features/cseMachine/CseMachineLayout.tsx
      src/features/cseMachine/CseMachine.tsx
      src/commons/utils/JsSlangHelper.ts
      src/commons/application/ApplicationTypes.ts
      src/commons/sagas/__tests__/PlaygroundSaga.ts

      4 | import { KonvaEventObject } from 'konva/lib/Node';
      5 | import React, { RefObject } from 'react';
    > 6 | import { Layer, Rect, Stage } from 'react-konva';
        | ^
      7 | import classes from 'src/styles/Draggable.module.scss';

From konva README page:

In order to run konva in nodejs environment you also need to install canvas package manually. Konva will use it for 2d canvas API.

Right, in that case I will upgrade canvas instead as v2 doesn't work with NodeJS 22 on Windows

@RichDom2185 RichDom2185 disabled auto-merge March 31, 2025 13:21
@RichDom2185 RichDom2185 enabled auto-merge (squash) March 31, 2025 13:23
@RichDom2185 RichDom2185 requested a review from sayomaki March 31, 2025 13:23
@coveralls
Copy link

coveralls commented Mar 31, 2025

Pull Request Test Coverage Report for Build 14175319556

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 31.098%

Totals Coverage Status
Change from base Build 14175171233: 0.0%
Covered Lines: 4888
Relevant Lines: 14827

💛 - Coveralls

@RichDom2185 RichDom2185 changed the title Upgrade TS, drop Canvas dependency Upgrade TS, Canvas to v3 Mar 31, 2025
Copy link
Contributor

@sayomaki sayomaki left a comment

Choose a reason for hiding this comment

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

LGTM, the current recommended version of node should still be 20, but having it compatible with the newer version is good as well.

@RichDom2185 RichDom2185 merged commit 651ace7 into master Mar 31, 2025
8 checks passed
@RichDom2185 RichDom2185 deleted the richard/ts-58 branch March 31, 2025 17:33
@RichDom2185
Copy link
Member Author

LGTM, the current recommended version of node should still be 20, but having it compatible with the newer version is good as well.

Agreed, we should aim to futureproof when possible

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.

3 participants