hhenrichsen / motion-canvas-component-library-template

A template repo that brings in some of the standards of Motion Canvas to allow easily making component libraries for Motion Canvas.
16 stars 0 forks source link

Consider specifying peer dependencies #209

Closed aarthificial closed 11 months ago

aarthificial commented 11 months ago

I've noticed that the installation guide requires people to configure vite as follows:

export default defineConfig({
  plugins: [motionCanvas()],
  resolve: {
    alias: {
      '@motion-canvas/core': path.resolve('./node_modules/@motion-canvas/core'),
      '@motion-canvas/2d': path.resolve('./node_modules/@motion-canvas/2d'),
    },
  },
});

This is only necessary if the version of Motion Canvas people have installed is older than the one required by this package. In that case, npm will create a nested node_modules directory inside node_modules/my-motion-canvas-library containing the newer Motion Canvas packages.

Specifying peerDependencies as follows:

"peerDependencies": {
  "@motion-canvas/2d": "^3.11.0",
  "@motion-canvas/core": "^3.11.0"
},

...will prompt npm to update the Motion Canvas version people have installed (as long as it's compatible with their package.json requirements of course). This should solve this problem for like 99% of cases.

Not sure if you've already considered this so just wanted to put it out there. I'm also not sure if dependabot can update peerDependencies?

hhenrichsen commented 11 months ago

Dependabot can't update peerDependencies (which was my motivation for removing them in e38f09d), but most of the time a minor / major bump in Motion Canvas means that there are changes I should review, anyways.