GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: search and install Schematics · Issue #10000 · angular/angular-cli

feat: search and install Schematics #10000

New issue
Copy link
New issue
Copy link
Open
Enhancement
Open
feat: search and install Schematics#10000
Enhancement
Copy link
Labels
area: @angular/clifeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under consideration
Milestone
Backlog

Description

@manekinekko
manekinekko
opened on Mar 18, 2018
Issue body actions

RFC: Search and install Angular CLI Schematics

tl;dr

The goal of this proposal is to add a new ng command allowing to search and install Angular CLI Schematics right from the command line, using the NPM registry. Read below for more technical details.

Longer version

The Angular CLI has introduced support for Schematics allowing developers to easily extend or even completely change the default behavior of the Angular CLI commands. With Schematics, we can (for instance)...

  • use the official ng update command to update the Angular dependencies of a project (and more).
  • use the Nrwl Nx Workspace to scaffold enterprise-grade Angular applications with proven project structure and patterns.
  • use your own Schematics to transform any Feature module to a Lazy Loading Feature module.

More generally, you can use Schematics to "[...] transforms to your project, such as create a new component or updating your code to fix breaking changes in a dependency. Or maybe you want to add a new configuration option or framework to an existing project". Read more on the angular.io.

The Angular community has already started creating custom Schematics, here are some of them:

  • @nrwl/schematics
  • @ngrx/schematics
  • @ionic-angular/schematics
  • @nativescript/schematics
  • @angular-extensions/schematics
  • @ssilvert/keycloak-schematic
  • @decerto/schematics
  • @michael.warneke/ng-schematics
  • material-schematics
  • ngx-schematics-collection
  • angular-crud
  • custom-schematics
  • ng-schematics-utils
  • enterprise-angular-generator

We expect the number of the Angular CLI Schematics to grow; hence, the goal of this thread is to discuss the ability to add a new ng command allowing to (right from the command line):

Note: the commands used below ng search ** are just for illustration purposes!

  1. Searching for available Schematics
> ng search foo_
● foo_abc     (description)      (popularity index)
○ foo_def     (description)      (popularity index)   
○ foo_ghi     (description)      (popularity index)
○ foo_ijk     (description)      (popularity index)
  1. Interactively search for Schematics
> ng search
? Find and install Angular CLI Schematics: foo_
● foo_abc     (description)      (popularity index)
○ foo_def     (description)      (popularity index)   
○ foo_ghi     (description)      (popularity index)
○ foo_ijk     (description)      (popularity index)
  1. Interactively installing Schematics
> ng search 
? Find and install Angular CLI Schematics: bar_ [ENTER]
● bar_def     (description)      (popularity index)   
○ bar_ijk     (description)      (popularity index)

Installing packages for tooling via npm...
  1. Install Schematics
    NOTE: This was implemented via the ng add command.
> ng schematics install foo_abc foo_ghi
Installing...

In order for this search to be done, we will leverage the NPM infrastructure and use the public registry as the database and we need to be able to identify what NPM packages are actually Angular CLI Schematics. Here are different proposals:

  1. Use the current schematics property in the package.json, eg. see example:
{
  ...
  "schematics": "./src/collection.json"
}
  1. Use an NPM named scope, eg. @ngxschematics (ngx being the community reserved prefix we agreed on (cc @IgorMinar) — @schematics is already reserved for the official Schematics made by the Angular team). The community NPM scope (@ngxschematics) would obviously be owned (and maintained) by the Angular core team. So (community) Schematics authors will have to send PRs to that repository to make their Schematics available (listed) in the Angular CLI search command (discussed here). This approach is similar to the DefinitelyTyped project (@types/**).

  2. Have some sort of a "Market Place for Schematics" (out of the scope of this proposal). This could be merged with the previous solution.

  3. Community Schematics authors would have to tag their schematics with an explicit set of tags, eg. (angular, schematics). Community Schematics that aren't tagged using these keywords won't be listed by the Angular CLI search command (discussed here).

Other topics to cover (later) are:

  1. list, update or remove local Schematics.
  2. Replace an active Schematic, eg. defaults, with a new one.

The search process would be done by using 3rd party search APIs that interface with the NPM registry (offering probably better performances?), here are some of them:

  1. npms.io
  2. npmsearch.com
  3. github.com/algolia/npm-search
  4. npm search

Similar projects (inspiration):

  • https://github.com/maticzav/emma-cli
  • https://microsoft.github.io/TypeSearch/
  • Vue CLI search command

Please use Github's emoji to express your interest in this draft.

cc @hansl @Brocco @filipesilva

[UPDATE] working prototype (https://github.com/manekinekko/angular-cli/blob/search-install-schematics/packages/%40angular/cli/tasks/schematic-search.ts)

[UPDATE] upgrade ptotype to v6.0.0-rc.6 (manekinekko@3706337)

angular-schematics

Reacted by Alfonso Andrés López Molina, Mike Ryan, Anas AMEZIANE, Mark Goho, Zama Khan Mohammed, Bonnie Brennan, Gaurav Mukherjee , Marcos Carvalho, Scott Anderson, Exequiel Ceasar Navarrete and 22 more
Reacted by Emilio Martinez, Nathan Walker and Paul Dao Nhan Nguyen

Activity

  1. manfredsteyer commented on Mar 18, 2018

    @manfredsteyer
    manfredsteyer
    on Mar 18, 2018
    Contributor
    More actions

    I like those ideas. Two things came in mind when reading this:

    • As Schematic Collections are distributed via npm packages, we could leverage the existing npm infrastructure
    • There is not always a strict separation b/w Schematics and libraries as a library can come with its own Schematics baked in
    Reacted by Michael Prentice and Vitalii Bobrov
  2. vitaliy-bobrov commented on Mar 18, 2018

    @vitaliy-bobrov
    vitaliy-bobrov
    on Mar 18, 2018
    More actions

    Great initiative, regarding search IMHO tags, looks better, as the simplier way to be listed in the search results. More steps to follow with publication === more contributions.

    Reacted by Wassim Chegham
  3. manekinekko commented on Mar 18, 2018

    @manekinekko
    manekinekko
    on Mar 18, 2018
    ContributorAuthor
    More actions

    @manfredsteyer

    As Schematic Collections are distributed via npm packages, we could leverage the existing npm infrastructure

    Agreed. Although, this will depend on what DX we wanna have (simple query search, autocomplete...etc).

    There is not always a strict separation b/w Schematics and libraries as a library can come with its own Schematics baked in

    This proposal is only for Schematics that are published on NPM. It's not meant for Schematics

  4. manekinekko commented on Mar 18, 2018

    @manekinekko
    manekinekko
    on Mar 18, 2018
    ContributorAuthor
    More actions

    @vitaliy-bobrov I'm okay with that too as long as the search process can be done in a deterministic and consistent way ^^

  5. choucry13 commented on Mar 19, 2018

    @choucry13
    choucry13
    on Mar 19, 2018
    More actions

    @manekinekko , it's very a good idea and if we use a specific schematics in enterprise, we can store it on a private nexus (a hoster for all packager type like npm, nuget, maven...). Do you think it's possible or not ?

  6. Haroenv commented on Mar 19, 2018

    @Haroenv
    Haroenv
    on Mar 19, 2018
    More actions

    Hey! Just chiming in here from Algolia, you can see a similar search made with our index in Emma-cli. It's made for the Yarn website originally, but definitely also meant to be used by other parts of the community.

    We'd prefer it if the search said powered by Algolia or something near the results (can be underneath or to the right edge maybe?), because we provide it as a free service and want as many people/projects as possible to know about it.

    Emma cli demo

    Ping me if you have any questions or want to try it out

    Reacted by philippe beroucry, Sylvain Utard, Michael Hladky, Emilio Martinez, Nathan Walker and Sumit Parakh
    Reacted by Wassim Chegham, Vitalii Bobrov, Sylvain Utard, Michael Hladky and Lazar Ljubenović
  7. clydin
    added
    featureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issues
    on Mar 19, 2018
  8. Toxicable commented on Mar 29, 2018

    @Toxicable
    Toxicable
    on Mar 29, 2018
    More actions

    I made another little demo here https://schematics-search.firebaseapp.com/
    It's search is pretty crude but it somewhat works and there's lots of optimizations that could be done to speed it up.
    The main point here is showing the kinds of speed it would take at max to find packages that are usable as Schematics

    The interface is irrlevent, I just wanted peoplr to be able to use it, we can easily put it into a CLI interface.

  9. StephenFluin commented on Apr 26, 2018

    @StephenFluin
    StephenFluin
    on Apr 26, 2018
    Contributor
    More actions

    Love this. I've been recommending people to add specific tags including:

    ng-add ng-update ng-generate ng-new to indicate their capabilities.

    Reacted by Michael Prentice
    Reacted by Wassim Chegham and Brad Green
  10. alan-agius4
    added
    triage #1
    needs: discussionOn the agenda for team meeting to determine next stepsOn the agenda for team meeting to determine next steps
    area: @angular/cli
    and removed
    needs: discussionOn the agenda for team meeting to determine next stepsOn the agenda for team meeting to determine next steps
    on May 27, 2020
  11. ngbot
    added this to the Backlog milestone on May 27, 2020
  12. alan-agius4
    removed
    triage #1
    on Jun 24, 2022
  13. angular-robot
    added
    feature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under consideration
    on Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular/clifeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under consideration

    Type

    Enhancement

    Projects

    No projects

      Milestone

      • BacklogNo due date

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.