Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added embla-carousel as a dependency for CodeSandbox template #685

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

zaaakher
Copy link
Contributor

@zaaakher zaaakher commented Jan 8, 2024

Fixes #684

I had to add embla-carousel as a dependency of embla-carousel-docs so that it can be used in createSandboxReactPackageJson.ts dynamically

@zaaakher
Copy link
Contributor Author

zaaakher commented Jan 8, 2024

I might be missing something,

What do you use to automate updating the embla-carousel** versions in all the package.json's of all the packages in this monorepo?

@davidjerleke
Copy link
Owner

I might be missing something,

What do you use to automate updating the embla-carousel** versions in all the package.json's of all the packages in this monorepo?

@zaaakher good question! These commands in the root package.json will do that:

"version:patch": "yarn workspaces foreach version patch && yarn version:push",
"version:minor": "yarn workspaces foreach version minor && yarn version:push",
"version:major": "yarn workspaces foreach version major && yarn version:push",

Best,
David

@davidjerleke davidjerleke added bug Something isn't working documentation Improvements or additions to documentation labels Jan 8, 2024
@zaaakher
Copy link
Contributor Author

zaaakher commented Jan 8, 2024

@davidjerleke so it seems that the unrecognized embla-carousel in CodeSandbox is not resolved yet.

The only way I was able to fix it is by making embla-carousel a dependency in createSandboxReactPackageJson.ts like this:

    dependencies: {
      react: dependencies.react,
      'react-dom': dependencies['react-dom'],
      'react-scripts': '4.0.0',
      'embla-carousel-react': dependencies['embla-carousel-react'],
      'embla-carousel': dependencies['embla-carousel'], <--- here (assuming embla-carousel moved back to dependencies)
      ...(plugins && plugins)
    },

Does that mean I should move embla-carousel back as a regular dependency in embla-carousel-docs like before?

@davidjerleke
Copy link
Owner

davidjerleke commented Jan 8, 2024

@davidjerleke so it seems that the unrecognized embla-carousel in CodeSandbox is not resolved yet.

The only way I was able to fix it is by making embla-carousel a dependency in createSandboxReactPackageJson.ts like this:

    dependencies: {
      react: dependencies.react,
      'react-dom': dependencies['react-dom'],
      'react-scripts': '4.0.0',
      'embla-carousel-react': dependencies['embla-carousel-react'],
      'embla-carousel': dependencies['embla-carousel'], <--- here (assuming embla-carousel moved back to dependencies)
      ...(plugins && plugins)
    },

Does that mean I should move embla-carousel back as a regular dependency in embla-carousel-docs like before?

If I spin up a new npm or yarn project locally and import the types from embla-carousel when using embla-carousel-react, it just works. And with pnpm installing it as a devDependency works. Maybe CodeSandbox handles dependencies differently than all package managers?

So yes: If adding it as a dependency works, we have to settle with this special solution for the CodeSandboxes only. Sorry for the back and forth. Didn't know CodeSandbox works that way. Thank you 👍!

@zaaakher
Copy link
Contributor Author

zaaakher commented Jan 8, 2024

Don't worry about it 👌

I just pushed a commit and everything works properly now 👍

@davidjerleke davidjerleke force-pushed the fix/types-in-sandboxes branch from 7cec8bf to d704049 Compare January 8, 2024 12:04
@davidjerleke davidjerleke removed their assignment Jan 8, 2024
@davidjerleke davidjerleke added the resolved This issue is resolved label Jan 8, 2024
@davidjerleke davidjerleke merged commit 9f40e6a into davidjerleke:master Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation resolved This issue is resolved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Types warning in (TS + React) CodeSandbox template
2 participants