Skip to Content
Dec 02, 2022 at 01:06 PM

Building Angular libraries with Piper

102 Views Last edit Dec 02, 2022 at 01:08 PM 3 rev

I'm trying to build and publish an Angular component with piper, but it seems that there's no support for the standard Angular workspace configuration when the goal is to publish individual components (monorepo).

The workspace looks something like this:

-- package.json
-- projects
   -- my-component
      -- package.json

When building, I see messages like the following:

npmExecuteScripts - Discovered package.json file projects/my-component/package.json
npmExecuteScripts - Discovered package.json file package.json
npmExecuteScripts - triggering publish for projects/my-component/package.json
npmExecuteScripts - running command: npm publish --userconfig projects/my-component/.piperNpmrc ---registry https://...
npmExecuteScripts - triggering publish for package.json
npmExecuteScripts - running command: npm publish --userconfig .piperNpmrc --registry https://...

But the final result is that it essentially builds and publishes the root workspace "my-project" twice.

What a "normal" npm build for the project components should look like is:

npm build my-component
cd dist/my-component
npm publish

Is there any way to achieve this with Piper?