meow-js / meow-js

A module to communicate with the scratch api.
https://meow.js.org
MIT License
9 stars 1 forks source link

Rollup & ESM support #15

Open FunctionalMetatable opened 2 years ago

FunctionalMetatable commented 2 years ago

Will keep CJS as well, using rollup. In progress :D

Also this is kinda broken bc node-fetch esm

webdev03 commented 2 years ago

you could use cross-fetch

FunctionalMetatable commented 2 years ago

Nvm, node-fetch was pinned at 3.6.

Still writing TS

webdev03 commented 2 years ago

I used tsup for ESM and TS in my package,

{
  "main": "./dist/index.cjs",
  "module": "./dist/index.js",
  "types": "./dist/index.d.ts",
  "scripts": {
    "build": "tsup src/index.ts --format cjs,esm --minify --dts",
    "build:watch": "tsup src/index.ts --format cjs,esm --minify --dts --watch"
  },
  "devDependencies": {
    "@types/node": "^17.0.10",
    "tsup": "^5.11.11",
    "typescript": "^4.5.5"
  },
  "exports": {
    ".": {
      "require": "./dist/index.cjs",
      "import": "./dist/index.js",
      "types": "./dist/index.d.ts"
    }
  },
  "type": "module"
}

(unimportant parts removed) then you should be able to replace file extensions, switch require for import and then it will work with both ESM and CJS at the same time (even if you only specify index.ts it does go through each file since index.ts uses ScratchSession which uses the other files)

FunctionalMetatable commented 2 years ago

If you're making your own one, we should merge them together

webdev03 commented 2 years ago

I guess ok! I thought the readme said discontinued or something

FunctionalMetatable commented 2 years ago

said discontinued because I wasn't working on the main repo, but I was working on the ts repo

webdev03 commented 2 years ago

ohh there's a ts repo?!

webdev03 commented 2 years ago

I can merge it if you want

FunctionalMetatable commented 2 years ago

I can merge it if you want

don't. I'll merge to yours soon. Tbh there should be a whole scratch community org ngl

webdev03 commented 2 years ago

There is a scratch community org. It's called LLK. You mean like an org for everyone to put true it things in? That would place a lot of trust on the owner but it is a good idea. Also I think merging into yours is better since you have already got the forum topic and most of the things, also a bit of docs and cloud support too

FunctionalMetatable commented 2 years ago

scratch community org. It's called LLK

Thats the official ST one