ElMassimo / iles

๐Ÿ The joyful site generator
https://iles.pages.dev
MIT License
1.08k stars 31 forks source link

Vite 5 and updated all packages with eslint flat config #274

Open TechAkayy opened 1 month ago

TechAkayy commented 1 month ago

Description ๐Ÿ“–

This pull request updates Iles & it's packages to Vite 5 along with all it's dependencies (had partial success, but with help we can fix it).

Commit-1 - Updated dependencies along with any API changes in their major versions (not many). Also, updated to eslint 9 with a flag config eslint.config.mjs. Installed @vue-macros/reactivity-transform to keep $-style APIs.

Commit-2 - Minor types references updated in two packages' package.json.

Commit-3/4 - Removed @vue-macros/reactivity-transform and updated to standard vue APIs. This can be ignored if you want to keep the $-style APIs.

There are still some minor hiccups for which I need help. Details with screenshots below.

Screenshots ๐Ÿ“ท

pnpm install installs without any peer dependency errors except for @mussi-eslint-config related. I guess this is your package @ElMassimo, and wondering what's the purpose of it? Is it still required in the new eslint 9 flat config way?

pnpm build:all builds fine.

pnpm dev throws some types warnings, looks harmless. image

The reason I removed reactivity-transform macro is because there seems to be some issue with it. Notice the missing semicolon after .../BackTick.tsx'. It was turned into a blocker for me. image

Key Issue:

Client Script Block seem to not work. When used,

<script client:load lang="ts">
console.log('Powered by รฎles ๐Ÿ', 'https://iles-docs.netlify.app')
</script>

I could trace it to an error logged by vue, something around missing end tag. image

I have added three // @ts-ignore in https://github.com/TechAkayy/iles/blob/417c641586484ede92f1bf12579d517479294703/packages/iles/src/node/plugin/wrap.ts#L50 which is related to the possibility of template.ast to be undefined. Type wasn't reconciling as ast showed up as RootNode, while some functions that it was pass through was expecting ElementNode.

TechAkayy commented 1 month ago

One important thing - because of the peer deps issue with @mussi/eslint-config, I couldn't lint properly.

ElMassimo commented 1 month ago

Hi Ahmed!

Appreciate you sharing this pull request.

Regarding the ESLint config, I'd be ok using something like @antfu/eslint-config and tweak a few rules which align more with standardjs.

For now feel free to ignore any lint issues, or disable that workflow.

I'll follow up on this when I have some time, thanks!

TechAkayy commented 1 month ago

Completed my PR for the update, here is a quick summary:

Only thing I couldn't solve is - in the blog, the one-piece image doesn't seem to be optimised, probably related to the underlying vite plugin, or in its usage (was there any breaking changes @ElMassimo?) - https://github.com/ElMassimo/vite-plugin-image-presets.

For the users updating iles, in their apps, with this update, they will have to:

Might be worth spinning out a prerelease verison for our users to test after your review & if it works nicely at your end. I did test on a few samples at my end, worked nicely :smile: Thanks ๐Ÿ‘

TechAkayy commented 1 month ago

With Vite 5 deprecating cjs node api, I have refactored tryInstallModule to tryImportOrInstallModule and use dynamic import() which works with both cjs & esm modules even when a package doesn't have main or exports defined in it's package.json. This takes care of packages like the svelte vite plugin that is esm only.

Also, antfu's install-pkg uses ezspawn which is not well maintained, and is currently broken with one of it's downstream package. So, I have taken inspiration from that and have used a childprocess exec to achieve the same in a simple way, we still use that package for detecting package manager. Auto install of iles modules works smooth with this, and I can see the installation succeeding, but testing on a local project (outside the playground folder) by pnpm linking the iles repo has been hard (probably a pnpm + monorepo challenge like in this issue).

ElMassimo commented 2 days ago

Hi @TechAkayy!

Would you enable me to push updates to this branch in your fork?

TechAkayy commented 2 days ago

Hi @TechAkayy!

Would you enable me to push updates to this branch in your fork?

Just invited you @ElMassimo. Thanks!

Good idea creating a fork without linting. Please let me know if you require anymore follow-ups from me. Cheers!