Ok, I was able to solve this after writing it all out, I realized the solution was quite simple.
I only need to run npm pack in the 'dist/core' directory - this wraps up the @mylib/core/testing files along with the @mylib/core. So for anyone looking to do similar, this is how I wrap my @mylib/core/testing package along with the @mylib/core package. ng build --prod @mylib/core ng build --prod @mylib/core/testing cd dist/mylib/core && npm pack Which produces a single mylib-core-0.1.0.tgz file which contains both packages. Perfect! On Fri, Aug 17, 2018 at 8:58 AM Codewise Software <[email protected]> wrote: > I am writing a reusable library to use in my applications. I would like to > follow the angular naming pattern for my modules. > > Thus far I have: > > @mylib/core > @mylib/core/testing > > I generated these with the angular cli: > > ng g library @mylib/core > > When generating @mylib/core/testing I ran into the error that "this is not > valid package name". I checked the angular src, and indeed there is a > package.json file located at ./packages/core/testing and the name is in > fact @angular/core/testing - so I thought this was just a shortcoming on > behalf of the cli. > > So i created my package manually - and everything went well, npm > ng build --prod @mylib/core/testing ran successfully. Now the issue comes > when I try to npm pack - this does not work. I get the same message about > the package name not being valid. > > Browsing npm i see that @angular/core/testing is in fact not on npm. So it > would appear there is some magic happening somewhere. > > What I would like is to be able to have > > import { MyTestingStub } from '@mylib/core/testing' just like angular. > -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
