将 Semantic UI 与 Lerna 和 yarn 工作区一起使用
Use Semantic UI with Lerna and yarn workspaces
Semantic UI(和 Semantic UI)安装程序(著名的?)不支持 yarn,因为它具有交互式安装后脚本。即使在 semantic.json
中使用 "autoInstall": true
,yarn 仍然会在第一次安装时中断。
这使得在使用工作区时很难将主题语义 UI 安装在 Lerna monorepo 中的自己的包中。即使将--ignore-scripts
添加到Lerna的package.json
脚本中,它仍然会运行一个标准yarn install
自己不时进行更改,并被Semantic[=阻塞22=].
有办法解决这个问题吗?
一种方法是编辑 packages/semantic-ui/package.json
,从 dependencies
中删除 "semantic-ui"
并添加脚本 "install": "node ./install.js"
。然后创建一个生成 npm install semantic-ui --no-save
的脚本,仅当在环境中检测到 yarn 时(以防止无限安装循环;检查 process.env.npm_config_user_agent
)。
这是一种令人费解的 error-prone 方法,但是如果 semantic.json
和 "autoInstall": true
存在,它将自动安装 Semantic UI 和 运行 gulp 工作,使自定义主题可用于 @monorepo/semantic-ui/dist/semantic.min.css
的其他包。
您实际上可以使用 fomantic-ui 让 autoInstall
与 yarn 一起工作,我只是 运行 这些命令并且它有效
$ yarn add fomantic-ui --ignore-scripts
$ yarn --cwd node_modules/fomantic-ui run install
semantic.json
- "autoInstall": false,
+ "autoInstall": true,
现在每次 yarn install
是 运行 它都会 "skip" 安装脚本。
Make sure you are using the latest version of FUI
FUI repo 上也有关于这个问题的完整问题https://github.com/fomantic/Fomantic-UI/issues/386
Semantic UI(和 Semantic UI)安装程序(著名的?)不支持 yarn,因为它具有交互式安装后脚本。即使在 semantic.json
中使用 "autoInstall": true
,yarn 仍然会在第一次安装时中断。
这使得在使用工作区时很难将主题语义 UI 安装在 Lerna monorepo 中的自己的包中。即使将--ignore-scripts
添加到Lerna的package.json
脚本中,它仍然会运行一个标准yarn install
自己不时进行更改,并被Semantic[=阻塞22=].
有办法解决这个问题吗?
一种方法是编辑 packages/semantic-ui/package.json
,从 dependencies
中删除 "semantic-ui"
并添加脚本 "install": "node ./install.js"
。然后创建一个生成 npm install semantic-ui --no-save
的脚本,仅当在环境中检测到 yarn 时(以防止无限安装循环;检查 process.env.npm_config_user_agent
)。
这是一种令人费解的 error-prone 方法,但是如果 semantic.json
和 "autoInstall": true
存在,它将自动安装 Semantic UI 和 运行 gulp 工作,使自定义主题可用于 @monorepo/semantic-ui/dist/semantic.min.css
的其他包。
您实际上可以使用 fomantic-ui 让 autoInstall
与 yarn 一起工作,我只是 运行 这些命令并且它有效
$ yarn add fomantic-ui --ignore-scripts
$ yarn --cwd node_modules/fomantic-ui run install
semantic.json
- "autoInstall": false,
+ "autoInstall": true,
现在每次 yarn install
是 运行 它都会 "skip" 安装脚本。
Make sure you are using the latest version of FUI
FUI repo 上也有关于这个问题的完整问题https://github.com/fomantic/Fomantic-UI/issues/386