hperrin / svelte-material-ui

Svelte Material UI Components
https://sveltematerialui.com/
Apache License 2.0
3.27k stars 287 forks source link

Yarn support with Smui-Theme #639

Open DavidArchibald opened 7 months ago

DavidArchibald commented 7 months ago

Describe the bug If you use Yarn and try to use smui-theme it'll error like so:

Compiling SMUI Styles...
/home/name/repoPath/.pnp.cjs:11831
      Error.captureStackTrace(firstError);
            ^

Error: smui-theme tried to access @material/dom, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: @material/dom (via "@material/dom/package.json")
Required by: smui-theme@npm:7.0.0-beta.15 (via /home/name/.yarn/berry/cache/smui-theme-npm-7.0.0-beta.15-72073d0652-10c0.zip/node_modules/smui-theme/bin/)

Require stack:
- /home/name/.yarn/berry/cache/smui-theme-npm-7.0.0-beta.15-72073d0652-10c0.zip/node_modules/smui-theme/bin/index.js
- /home/name/.yarn/berry/cache/smui-theme-npm-7.0.0-beta.15-72073d0652-10c0.zip/node_modules/smui-theme/smui-theme
    at require$$0.Module._resolveFilename (/home/name/repoPath/.pnp.cjs:11831:13)
    at Function.resolve (node:internal/modules/helpers:118:19)
    at Object.handler (/home/name/.yarn/berry/cache/smui-theme-npm-7.0.0-beta.15-72073d0652-10c0.zip/node_modules/smui-theme/bin/index.js:62:34)
    at /home/name/.yarn/berry/cache/yargs-npm-17.7.2-80b62638e1-10c0.zip/node_modules/yargs/build/index.cjs:1:8993
    at j (/home/name/.yarn/berry/cache/yargs-npm-17.7.2-80b62638e1-10c0.zip/node_modules/yargs/build/index.cjs:1:4956)
    at _.handleValidationAndGetResult (/home/name/.yarn/berry/cache/yargs-npm-17.7.2-80b62638e1-10c0.zip/node_modules/yargs/build/index.cjs:1:8962)
    at _.applyMiddlewareAndGetResult (/home/name/.yarn/berry/cache/yargs-npm-17.7.2-80b62638e1-10c0.zip/node_modules/yargs/build/index.cjs:1:9604)
    at _.runCommand (/home/name/.yarn/berry/cache/yargs-npm-17.7.2-80b62638e1-10c0.zip/node_modules/yargs/build/index.cjs:1:7231)
    at [runYargsParserAndExecuteCommands] (/home/name/.yarn/berry/cache/yargs-npm-17.7.2-80b62638e1-10c0.zip/node_modules/yargs/build/index.cjs:1:58539)
    at te.parse (/home/name/.yarn/berry/cache/yargs-npm-17.7.2-80b62638e1-10c0.zip/node_modules/yargs/build/index.cjs:1:40478)

Node.js v19.4.0

This leads back to this line: https://github.com/hperrin/svelte-material-ui/blob/b16385ce9bcbe84049ebb55e66e4d24b9576e7e0/packages/smui-theme/bin/index.js#L62

Because @material/dom isn't declared as a dependency. I'd be completely willing to put in a PR to fix this but I'm filing an issue in case there's something I'm missing about how the package is supposed to work. It seems like even once this dependency issue is fixed there's another one right after.

To Reproduce Steps to reproduce the behavior:

  1. Create a new folder and open a terminal in it.
  2. Run yarn init (you can leave the defaults).
  3. Run yarn add -D smui-theme
  4. Run mkdir static
  5. Run yarn run smui-theme compile static/smui.css -i src/theme

This issue of course persists in a more completely set up project with an actual theme in src/theme etc.

Expected behavior

For the command not to error.