Sam4Sc is a migration assistant for Angular to SCAM (Single Angular Component Modules) and Standalone Components.
Migrating an Angular application to the SCAM model is a preparation for the final switch to Standalone Components.
Sam4Sc assists in both steps, whereas the migration from SCAM to Standalone Components is fully automatic.
The migration/generation of SCAMs is semi-automatic. The SCAMs a generated first. After that, the developer(s) must define the dependencies per SCAM manually.
To install Sam4Sc, execute
npm i -D @angular-architects/sam4sc
npx ng generate @angular-architects/sam4sc:scam --dry-run
# make sure, everything looks alright
npx ng generate @angular-architects/sam4sc:scam
or alternatively,
npx ng generate @angular-architects/sam4sc:scam --project [projectName]
Sam4sc prints out a list of existing SCAMs, and also if components are undeclared.
SCAM is nothing else than an NgModule which declares only one element. It is quite possible that you have already SCAMs in your application.
npx ng generate @angular-architects/sam4sc:report
SCAMs will have a JavaScript comment at the start of the file with a tag SAM4SC:SCAM. Remove those, if you have added the dependencies and that module will not show up in the progress report.
npx ng generate @angular-architects/sam4sc:scam2sc
Please feel free to try it out and give feedback.
- Detailed Explanation of SCAM, by Lars Gyrup Brink Nielsen
- RFC Standalone Components
- Standalone Components and their Impact on Modularity, by Rainer Hahnekamp
Angular Architects: Angular Content, Consultancy, Training
Thanks goes to these wonderful people (emoji key):
Rainer Hahnekamp 💻 |
Lars Gyrup Brink Nielsen 💻 |
hm2075 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!