我有一个用 create React app 制作的有趣项目。我想将同一应用程序转换为浏览器扩展。这个想法迫使我将该项目设为单一存储库。因为在这两个应用程序中,我将使用相同的组件、钩子、提供程序等。
我不想使用 Lerna 或 Yarn 工作区。而且,这将是我的第一个单一仓库。我想开始使用 Turborepo。但是,我无法想象如何让它以良好的方式工作。
我的目标文件夹结构如下
我会将包文件夹中的 monorepo 依赖项导入到 apps 文件夹中存在的 apps 中。
例如;
import { useExampleHook } from '@projectname/hooks'
import { ExampleComponent } from '@projectname/components'
Run Code Online (Sandbox Code Playgroud)
如果您除了 Turborepo 之外还有其他解决方案,请随时告诉我。NPM 工作区也是一个可以接受的解决方案。但是,turborepo 由于性能更好而具有优先权。
预先感谢您的时间和答复
我正在开发一个 CMS 项目,刚刚遇到一个问题。_userEvent.default.clear is not a function。
import user from \'@testing-library/user-event\'\n\ntest(\'can edit label\', async () => {\n createArticleMock()\n await renderRootAndInitStore(rightNowTeasers, globalInitialState)\n\n const index = 1\n const input = screen.getByDisplayValue(labels[index])\n const newLabel = \'V\xc3\x84RLDEN\'\n user.clear(input)\n user.type(input, newLabel)\n\n expect(await screen.findByDisplayValue(newLabel))\n user.click(screen.getByTestId(\'settings-form-save\'))\n await screen.findByText(newLabel)\n})\nRun Code Online (Sandbox Code Playgroud)\n\n当我访问时@testing-library/user-event,我看到那些线条
// Definitions by: Wu Haotian <https://github.com/whtsky>\nexport interface IUserOptions {\n allAtOnce?: boolean;\n delay?: number;\n}\n\nexport interface ITabUserOptions {\n shift?: boolean;\n focusTrap?: Document | Element;\n}\n\nexport type TargetElement = Element | Window;\n\ndeclare const userEvent: {\n …Run Code Online (Sandbox Code Playgroud)