# Using WorkspacesĪlways install packages in the app folder. The package.json file in app is unchanged, so you never have to worry that an update to Nodewood will clobber one of your packages, or conversely, an update to one of your packages will cause a Nodewood dependency to stop working. This means that when an updated Nodewood installation ( wood folder) includes new or changed packages, only the package.json file in wood is changed. Nodewood primarily uses it to allow the wood folder and the app folder to maintain their own list of JavaScript packages. Workspaces are a feature that make it much easier to use a monorepo (opens new window) project layout. Git config -global user.Nodewood makes heavy use of Yarn's Workspaces feature (opens new window). Jobs: publish-ui-components: name: Publish UI components to NPM runs-on: ubuntu-latest env: GITHUB_TOKEN: $" This is because Lerna will never publish if a repository is private. First, because we don’t want to publish the content of the `packages/app/*` directory, we need to add the line of code below to every package.json file. There are two other things we need to do before we’re done with setting up Lerna. In our case, it’s the `main` branch.Ĭheck out Lerna’s GitHub page to see more documentation about the `lerna.json` file. `` is an option that ensures that publishing only happens on a specified git branch. At Parca, we already follow the Conventional Commits style as seen in our contributing guide. The `conventionalCommits` option when enabled helps to populate a CHANGELOG.md with changes every time there’s a new release. This should have been exactly similar to the Yarn Workspaces setup, however, we omitted `packages/app/*` because we don't intend on publishing our apps, only the shared libraries. `packages` is an array of globs to use as package locations. The `useWorkspaces` flag is what will allow us to reuse the yarn workspace settings for lerna. `npmClient` is used to specify what type of package client to run commands with. Setting it to independent will mean maintaining the version of each package separately. The `version` has been explicitly set to a version number and this means that all the packages in our monorepo will share this version number. To initialize Lerna, we first need to add lerna to the project, using the command below. It contains the code for parsing data, profile viewing libraries, utility functions e.t.c The `packages/shared/*` directory is what we’re interested in publishing.
0 Comments
Leave a Reply. |