clock icon indicating copy to clipboard operation
clock copied to clipboard

Improve workflow and fix ESM modules

Open ScreamZ opened this issue 1 year ago • 0 comments

@endel Had issue with your ESM code

you can try it with a simple with bun (ou deno or node as u which), the important part is "type": "module" or use a .mjs file.

import Timer from "@colyseus/timer"

const timer = new Timer();
{
  "name": "sandbox",
  "module": "index.ts",
  "type": "module",
  "devDependencies": {
    "@types/bun": "latest"
  },
  "peerDependencies": {
    "typescript": "^5.0.0"
  },
  "dependencies": {
    "@colyseus/timer": "^1.0.0"
  }
}

, so i rewrote full clock and timer (as they depends on each others.)

They both works in commonJS and ESM.

  • Added CI checks with github workflows

Based on work from https://www.totaltypescript.com/how-to-create-an-npm-package for best practice and ensure export are stable.

ScreamZ avatar Nov 04 '24 10:11 ScreamZ