I have an Angular Schematic that works differently when I install it versus when I link to it on my hard drive.
Steps to reproduce:
- Create a new Angular app with Angular CLI:
ng new --routing --style css
- Add my schematic and run it:
npm install @oktadev/schematic
ng g @oktadev/schematic:add-auth
This only updates a few files, when it should create and update more.
UPDATE package.json (1380 bytes)
UPDATE src/app/home/home.component.css (0 bytes)
UPDATE src/app/home/home.component.html (180 bytes)
However, if I run npm link @oktadev/schematics
in my project, followed by ng g @oktadev/schematics:add-auth
, it works.
UPDATE package.json (1380 bytes)
UPDATE src/app/app-routing.module.ts (547 bytes)
UPDATE src/app/app.component.spec.ts (1347 bytes)
UPDATE src/app/app.component.ts (600 bytes)
UPDATE src/app/app.module.ts (917 bytes)
UPDATE src/app/home/home.component.css (0 bytes)
UPDATE src/app/home/home.component.html (180 bytes)
UPDATE src/app/home/home.component.spec.ts (964 bytes)
UPDATE src/app/home/home.component.ts (631 bytes)
UPDATE src/app/shared/okta/auth.interceptor.ts (1066 bytes)
You can find the project at https://github.com/oktadeveloper/schematics if you'd like to try and reproduce the issue. The released code on npmjs.com is the same as what's currently on the master branch.
Why is the behavior different when I install it versus link to it?