jsonresume / jsonresume.org

The mono repo that builds the homepage, utils, ui components, registry and anything else
https://jsonresume.org
88 stars 23 forks source link

CommonJS builds of themes in ./packages #152

Open XuluWarrior opened 1 month ago

XuluWarrior commented 1 month ago

From what I can see, the themes in ./packages (e.g. jsonresume-theme-professional) all use ESM modules. Including when they are packaged and published to NPM. And from what I can tell, these themes can't be consumed by resume-cli or resumed for this reason.

Would it be possible to build and publish CommonJS packages?

Or at least, could you say which resume tools can consume the "module" style themes

levino commented 1 month ago

Hm. Interesting. I think at the very least the package should have a "type": "module" in its package.json, should it not? https://github.com/jsonresume/jsonresume.org/blob/ff68aceb05f8452dddc56226851f752bc2991b53/packages/jsonresume-theme-professional/package.json#L1-L22

levino commented 1 month ago

To be honest, I have no idea from where the npm version has been published. Looks quite different from the code here.

XuluWarrior commented 3 weeks ago

Hm. Interesting. I think at the very least the package should have a "type": "module" in its package.json, should it not?

I think "type": "module" would help. Except that when I tried it with node 22 (to be able to load ESM modules from CommonJS), I found that the npm package for jsonresume-theme-professional has untransformed JSX e.g. https://github.com/jsonresume/jsonresume.org/blob/ff68aceb05f8452dddc56226851f752bc2991b53/packages/jsonresume-theme-professional/src/index.js#L7

It would seem a build still needs updating to make a usable theme.

XuluWarrior commented 3 weeks ago

To be honest, I have no idea from where the npm version has been published. Looks quite different from the code here.

Actually I just tried following your link and I realised that there are two versions of jsonresume-theme-professional. jsonresume-theme-professional and @jsonresume/jsonresume-theme-professional

I was using the former. The latter is actually has "type": "module; already set. But I couldn't get it to work with resumed and node 22 because I get TypeError: styled.div is not a function

I haven't followed through any more to work out what is going on there.

thomasdavis commented 1 week ago

So I've been trying to move towards having everything under the namespace going fourth @jsonresume

I'm a bit out of the loop with how to even publish packages anymore in the npm ecosystem. Ideally we support ESM/ MJS, and we also need a way to transpile and support typescript when it is used.

I'm going to do a bit of research right now...

https://chatgpt.com/share/67333906-6bf4-8008-adbf-32c10cb3db21

So painful, but probably needs to be done and documented for any packages coming out of this monorepo.