1

The Semantic UI (and Fomantic UI) installer (famously?) doesn't support yarn because of its interactive postinstall script. Even with "autoInstall": true in semantic.json, yarn will still break on the first install.

This makes it hard to keep a themed Semantic UI installation in its own package in a Lerna monorepo, when using workspaces. Even if --ignore-scripts is added to Lerna's package.json scripts, it will still run a standard yarn install by itself every now and then when making changes, and become blocked by Semantic UI.

Is there a way around this?

4

2 回答 2

1

事实上,你可以autoInstall使用 fomantic-ui 来使用 yarn,我只是运行了这些命令,它就成功了

$ yarn add fomantic-ui --ignore-scripts
$ yarn --cwd node_modules/fomantic-ui run install

语义.json

-  "autoInstall": false,
+  "autoInstall": true,

现在每次yarn install运行它都会“跳过”安装脚本。

确保您使用的是最新版本的 FUI

FUI repo https://github.com/fomantic/Fomantic-UI/issues/386上还有一个关于这个问题的完整问题

于 2019-05-13T11:59:46.160 回答
0

One way is to edit packages/semantic-ui/package.json, removing "semantic-ui" from dependencies and adding the script "install": "node ./install.js". Then create a script that spawns npm install semantic-ui --no-save, only if yarn is detected in the environment (to prevent an infinite install loop; check process.env.npm_config_user_agent).

This is a convoluted and error-prone way, however if a semantic.json with "autoInstall": true is present it will automatically install Semantic UI and run the gulp job, making the custom theme available to other packages at @monorepo/semantic-ui/dist/semantic.min.css.

于 2019-05-12T18:22:48.770 回答