Workspaces, Monorepos and Shipping a Package — Concept Check
Questions on Workspaces, Monorepos and Shipping a Package. How a frontend, a backend and a shared library live in one repository — and what changes when you publish one of them.
Questions in this quiz
7 questions on Workspaces, Monorepos and Shipping a Package — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.You have a monorepo with a frontend, backend, and shared library. After changing a schema in the shared library, what is the immediate benefit?
- AThe backend app runs faster due to caching
- BBoth frontend and backend apps fail to typecheck immediately
- CThe frontend app automatically updates its dependencies
- DThe shared library is automatically published to npm
2.In a workspace setup, what happens if you run 'npm install'?
- AEach package is installed separately, increasing overall time
- BOnly the root package is installed, ignoring workspace packages
- CAll packages are installed once, linking local packages as if published
- DOnly the packages with changes are installed
3.You updated the shared library and want to test it locally with a consuming app. What is the simplest method?
- AUse 'npm link' to link the library with the app
- BDirectly modify the node_modules in the app
- CPublish the library to npm and then install it
- DUse 'npm pack' to create a tarball and install it
4.A developer claims that marking 'react' as a peerDependency will solve 'Invalid hook call' errors. Why might this be correct?
- AIt automatically updates React to the latest version
- BIt forces React to be bundled twice, preventing conflicts
- CIt ensures only one copy of React is used, avoiding hook errors
- DIt allows React to be ignored during the build process
5.When publishing a package, which field ensures consumers can only import specified paths?
- ApeerDependencies
- Bdependencies
- Cexports
- Dmain
6.What is a potential downside of using a monorepo with workspaces without proper CI caching?
- AIncreased package size due to duplication
- BSlower CI builds due to rebuilding unchanged packages
- CDifficulty in managing package versions
- DIncompatibility with npm scripts
7.Why is it important to ship .d.ts files with a published package?
- ATo reduce the package size
- BTo automatically generate documentation
- CTo provide TypeScript consumers with type information
- DTo ensure compatibility with older JavaScript versions