skeletonlabs / skeleton

A complete design system and component solution, built on Tailwind.
https://skeleton.dev
MIT License
5.16k stars 322 forks source link

Investigate possible monorepo's #462

Closed niktek closed 1 year ago

niktek commented 2 years ago

https://monorepo.tools/#understanding-monorepos

Aim: Minimal touch to get started and see a benefit. JS/TS as first class citizen. Doesn't impact our current deployment strategy. Nice to have automatic test runner as part of deploy.

Contenders: Turborepo ✅ https://turbo.build - Vercel Lage ✅ https://microsoft.github.io/lage/ just a task runner - Microsoft Rush ✅ https://rushjs.io - Microsoft Lerna ✅ https://lerna.js.org (Lerna and NX are like turbo repo and turbo pack) - Nrwl Nx ✅ https://nx.dev - Nrwl Pants ❌ no apparent first class support for JS/TS Bazel ❌ no apparent first class support for JS/TS Gradle ❌ no apparent first class support for JS/TS

niktek commented 2 years ago

Issues that arise.

VSCode workspaces are completely separate from package manager workspaces. But here is a way of suggesting required extensions for things like Prettier and Linting. https://code.visualstudio.com/docs/editor/extension-marketplace#_workspace-recommended-extensions @leranjun has provided his .vscode/settings.json file as a reference for linting on save

{
    "[html]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[json]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[jsonc]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[svelte]": {
        "editor.defaultFormatter": "svelte.svelte-vscode"
    },
    "editor.codeActionsOnSave": [
        "source.fixAll.eslint"
    ],
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true,
    "eslint.probe": [
        "javascript",
        "typescript",
        "svelte",
        "json"
    ],
    "eslint.validate": [
        "javascript",
        "typescript",
        "svelte",
        "json"
    ],
    "svelte.enable-ts-plugin": true
}
endigo9740 commented 2 years ago

@niktek you might post your final results here and close this out if this is complete for now. Please and thanks!

niktek commented 2 years ago
niktek commented 2 years ago

The aliases change the context of how skeleton-ui runs. So if you are running in docsite and import a component using: import { Dialog } from '@brainandbones/skeleton and Dialog in turn has a import { dialogStore } from '$lib/utilities/Dialog/stores'; then $lib will be pointing to docsite/src/lib and error out. There are a few ways to work around this, everything in skeleton-ui uses a new alias called $sklib and that alias is applied to both docsite and skeleton-ui OR we make sure that they use relative file pathing (which for dialogStore in Dialog was actually much shorter). Something doesn't quite feel right about this.

niktek commented 2 years ago

Also a note to myself more than anything: tsconfig aliases and vite aliases can have undesirable conflicts when they are the same e.g. @brainandbones/skeleton for tsconfig will intercept an import before Vite's @brainandbones/skeleton/components - this has implications for the Sveld and the theme.css?inline imports.

niktek commented 1 year ago

Two separate instances of Vite running and messing up aliases - https://github.com/sveltejs/kit/issues/2879 Package.json needs to have values in dev mode that are changed on publish - https://github.com/sveltejs/kit/issues/6824 (such as exported css files and types etc.

There are workarounds for these and hopefully better native solutions will come later from upstream

HuakunShen commented 1 year ago

I can't get it working with turbo repo. Does the current latest version of skeleton still work with turbo repo? @niktek

endigo9740 commented 1 year ago

@HuakunShen we use PNPM workspaces. You can find instruction here: