Sam4Sc - a migration assistant for Angular to SCAM (Single Angular Component Modules) and Standalone Components

Related tags

Angular sam4sc
Overview

1. Introduction

All Contributors

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.

2. Setup and Usage

To install Sam4Sc, execute

npm i -D @angular-architects/sam4sc

2.1. Generate SCAMs

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]

2.2. Show the progress report for the SCAM report

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.

2.3. Migrate to Standalone Components (Beta)

npx ng generate @angular-architects/sam4s:scam2sc

Please feel free to try it out and give feedback.

3. More information

Angular Architects: Angular Content, Consultancy, Training

Contributors

Thanks goes to these wonderful people (emoji key):


Rainer Hahnekamp

💻

Lars Gyrup Brink Nielsen

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Comments
  • Skipping  SCAM components  and undeclared components

    Skipping SCAM components and undeclared components

    The tool report 17 SCAM components

    Skipping 17 SCAM component(s):

    but I havent set any components as SCAM components yet

    also I get skipping 19 undeclared components but these components are in modules

    opened by hm2075 3
  • Maximum call stack size exceeded

    Maximum call stack size exceeded

    after fixing the imports, removing index.ts files and cleaning up my application I now get

    RangeError: Maximum call stack size exceeded at Observable._trySubscribe (/workspace/xxx/node_modules/rxjs/internal/Observable.js:55:25)

    CLI was 13.2.5 and now upgrade to 14.0 next 6 and still same issue

    also updated rxjs6 to 7

    opened by hm2075 3
  • Lazy loaded routes/modules

    Lazy loaded routes/modules

    {
                    path: 'user',
                    loadChildren: () =>
                        import(/* webpackChunkName: "user" */ '../core/modules/user/user.module').then((m) => m.UserModule),
                    data: { preload: false, delay: false },
                },
    

    how do we deal with lazy loaded routes?

    RFC says the following is possible, do we need to add this in?

    RouterModule.forRoot([
      {
          path: '/some/route/to/standalone', 
          loadComponent: () => import('./standalone.cmp').then(m => m.StandaloneRouteCmp)
      },
      {
          path: '/some/route/to/standalone/with/default/export', 
          loadComponent: () => import('./default-standalone.cmp')
      }
    ]);
    
    opened by hm2075 1
  • Enhancements and auto imports

    Enhancements and auto imports

    I now have 350 files that I need to go in set imports for

    can't find anything on vscode for importing from inline html, did try IntelliJ IDE but I prefer vscode, its going to be a repetive and boring task however we could auto import based on inline html

    e.g if tag <mat-card found then import MatCardModule if [[formGroup] found then import ReactiveFormsModule

    and so on

    users could define their own matching criteria

    it wouldnt sort every component but would help the repetive task

    enhancement 
    opened by hm2075 1
  • import from index.ts (barrel)

    import from index.ts (barrel)

    if you have index.ts files that has an export then tool fails

    import {        
        XXXComponent,
    } from './index';
    ``
    
    the tool fails to find the component
    opened by hm2075 1
  • UntilDestroy()

    UntilDestroy()

    if you use https://github.com/ngneat/until-destroy

    and setup components as

    `` @UntilDestroy()

    @Component({ ``

    then you get a couldn't find component, I guess the checking is assuming nothing is sitting above @Component

    opened by hm2075 0
  • Relative and absolute paths

    Relative and absolute paths

    if an app uses absolute paths i.e by configuring tsconfig to use a base url then we get errors as

    cannot find component AppComponent in module /src/app/app.module.ts

    on

    import { AppComponent } from 'app/app.component';

    we could go in and change all these but the tool should really accomodate this as apps may contain a mixture of relatives and absolute. changing my imports to continue testing the tool

    opened by hm2075 0
  • Cannot find component

    Cannot find component

    if components are declared as follows

    const components = [
        xxTablesPageComponent,
        xxFormComponent,
        
    ];
    @NgModule({
        imports: [CommonModule, SharedModule, InpatientSharedModule],
        exports: [components],
        declarations: [components],
    })
    

    then we get Cannot find components declared in NgModule, I have swapped them out to continue testing the tool but we should accomodate for such scenarios

    opened by hm2075 0
Owner
Rainer Hahnekamp
Passionate Software Developer. Interested in Angular, .NET and Spring. Trainer and Consultant at AngularArchitects.io
Rainer Hahnekamp
A set of UI components for use with Angular 2 and Bootstrap 4.

#Fuel-UI A set of UI components for use with Angular 2 and Bootstrap 4. See Fuel-UI homepage for live demo and documentation. ##Dependencies Node Gulp

Fuel Interactive 302 Jul 4, 2022
An enterprise-class UI components based on At UI Design and Angular. 🚀 🚀 🚀

An enterprise-class UI components based on At UI Design and Angular. ?? ?? ??

塟愛鎵镞de栤仯 113 Dec 16, 2022
NGX-YOUI is a Highly customizable library of Angular UI components for content and styles

NGX-YOUI NGX-YOUI is an Angular UI Library that can be highly customized with content and styles. You can easily integrate with other CSS frameworks a

NGX-YOUI 5 Nov 29, 2022
🚀 Style and Component Library for Angular

ngx-ui Component & Style Library for Angular by Swimlane. Installing npm i @swimlane/ngx-ui --S Install the project's peer depencencies (moment, codem

Swimlane 654 Dec 24, 2022
Angular multiselect component for web application. Easy to integrate and use.

Angular multiselect component for web application. Easy to integrate and use.

Dinh The Loc 2 Apr 20, 2022
The code for a set of Angular 6+ components for the PatternFly project.

The code for a set of Angular 6+ components for the PatternFly project. Note that the release/3.x branch supports Angular 4 and 5.

PatternFly 87 Nov 15, 2022
Angular UI Component Library based on Ant Design

NG-ZORRO An enterprise-class Angular UI component library based on Ant Design. English | 简体中文 ✨ Features An enterprise-class UI design system for Angu

NG-ZORRO 8.3k Jan 6, 2023
Native Angular components & directives for Lightning Design System

ng-lightning This library contains native Angular components and directives written from scratch in TypeScript using the Lightning Design System CSS f

null 910 Dec 8, 2022
The best way to quickly integrate Bootstrap 5 Bootstrap 4 or Bootstrap 3 Components with Angular

ngx-bootstrap The best way to quickly integrate Bootstrap 5 Bootstrap 4 or Bootstrap 3 Components with Angular Links Documentation Release Notes Slack

Valor Software 5.4k Jan 8, 2023
Heavily inspired by Angular Forms, this package provides utilities for complex Model-driven form management in Lit-based Web Components.

Heavily inspired by Angular Forms, this package provides utilities for complex Model-driven form management in Lit-based Web Components.

Michele Stieven 8 Dec 9, 2022
A component built in angular 13 which can generate an signature image in different fonts based on the selection.

AngularSignatureGenerator This project was generated with Angular CLI version 13.2.6. Development server Run ng serve for a dev server. Navigate to ht

Rohith P 4 Apr 26, 2022
Demo showing how to lazy load a component in Angular without routing!

WidgetDashboard This project was generated with Angular CLI version 13.2.6. Development server Run ng serve for a dev server. Navigate to http://local

Andy Bond 3 Mar 25, 2022
Angular component for filtering , contact list in alphabetical listing. Awesome Contact List

NgxContactList | Angular 13+ Angular component for filtering contents in alphabetical listing, using default or custom templates. Ideal to build conta

null 3 Sep 15, 2022
Angular Library workspace to creating and testing angular libraries

Library Workspace Run Locally Clone the project https://github.com/sametcelikbicak/library-workspace.git Go to the library project directory cd li

Samet ÇELİKBIÇAK 4 Nov 1, 2022
Clarity Angular is a scalable, accessible, customizable, open-source design system built for Angular.

Getting Started Clarity Angular is published as two npm packages: Contains the static styles for building HTML components. Contains the Angular compon

VMware Clarity 145 Dec 29, 2022
An example application that uses file-based routing with Angular, Analog, Vite with the Angular Router

Angular, Vite, and File-based routes This is an example application that uses Angular, Analog, and Vite for file-based routing. Routes are places in t

Brandon 9 Sep 25, 2022
Single page aplication , rest api

SinglePageAppSpa This project was generated with Angular CLI version 14.0.0. Development server Run ng serve for a dev server. Navigate to http://loca

Johan Jiménez 1 Jul 15, 2022
📦 SVGs, fast and developer friendly in Angular

View settings all icons fixed size e.g. 30px button to align all icons distributes button to align all icons onscreen button to align all icons offscr

Push Based 18 Nov 28, 2022
Directives, utils, and events for working with angular zoneless

az-zoneless A set of directive and utilities to manage an angular zoneless app. Using this library you can go completly zoneless and still support 3rd

Yariv Katz 8 Dec 15, 2022