A basic template for creating a library monorepo using Nx
- Run
npm i
- Run
npm run add:lit some-component-name
- Run
npm start
- Start developing
/packages
- Contains the packages to be published. Won't exist until you create your first package
/docs
- Contains the docs application that serves package documentation and demos. It can(and, if published, should) be customized, but should just work(tm) as is to get started.
/utilities
- Contains shared configurations and nx plugins.
-
npm start
- Starts the repo up for development using thestart
command in all apps and packages. NX will first look forstart
in package.json then in project.json. -
npm run add:<type> <package-name>
- Runsnx g <type> <package-name>
-- Currently the only available type islit
. -
npm run rm <package-name>
- Runsnx g rm <package-name>
-- Note: if you remove the last package then the packages folder will get removed as well. There's probably a way to prevent it, but you can't check an empty folder into git anyway, so... yeah... -
npx nx g add-to-docs <package-name>
- Adds an existing package to the docs app and generates an import helper. Called automatically by component generators. -
npx nx g lit <package-name>
- Creates a lit component package and runsadd-to-docs
. -
npx nx g regenerate-lockfile
- Removespackage-lock.json
andnode_modules/.package-lock.json
and re-runsnpm install
to regenerate lockfiles. Because lockfiles get crappy sometimes. -
npx nx g remove-from-docs <package-name>
- Removes a package from the docs app and deletes its import helper. Called automaticallt by therm
generator. -
npx nx g rm <package-name>
- Removes a packages files and runsremove-from-docs
. -
npx nx g update-shared-json
- Copies shared properties from root package.json to docs and packages and copies rootdependencies
to docs and to all packages aspeerDependencies
. -- Note: packages removed from root dependencies will not automatically be removed from workspace package.json files.