npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@danils/angular-builder

v0.0.67

Published

Angular builder

Downloads

49

Readme

Angular-builder Documentation

Angular-builder allows you as a developer to scan their projects and represent into a json. Also, you can execute from one to many angular schematics.

How to use this schematics' package

ng add @danils/angular-builder or npm install -g @danils/angular-builder

When you have already installed, follow these steps:

  1. Execute ng g @danils/angular-builder:scan
  2. Modify the json created.
  3. Execute ng g @danils/angular-builder:build

Features

  • Scan and represent your project into a json file.
  • Execute any schematic created with @angular-devkit.
  • Could install the collection if they are not installed.
  • Could uninstall the collections installed.

Coming Features

  • If the schematic doesn't find a workspace, it can create it.
  • Choose which collections uninstall.
  • Allow managing interdependencies between the execution of the schematics.
  • Support Nx.

Scan your project

ng g @danils/angular-builder:scan or ng g @danils/angular-builder:s

Problem to solve?

Angular Builder uses a json file to execute schematics at the same time. For this reason scan schematic allows you to scan your project and represent the result into a json file.

Builder

ng g @danils/angular-builder:build or ng g @danils/angular-builder:b

Example here: Custom JSON File.

Problem to solve?

Working with the Angular framework, you can use schematic's custom or by default like ng g component; with this limitation, this schematic allows you to execute any schematic in any folder or at the root level.

That is an amazing feature because you can solve two main scenarios:

  1. You can start projects faster.
  2. You can implement features on existed projects. Scan your project and call whichever schematic that you want.

Analyze the json structure

When you see the json structure for the first time, you can see the file has different levels.

Level 1

At the root level, you can see these properties:

| Property name | Description | Optional | | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | | $schema | The reference to a file that allow you to know what properties can you add to the file. | | | settings | settings contains collection and collections contain schematics settings | true | | projects | angular workspaces allows you to have many projects. This section has all the existed projects but also if you add some that doesn't exist it will create it. | false | | schematic | you can execute schematics at the root level, usually these schematics are for configuration purposes. | |

Level 2

Settings

The purpose of this property is to allow you to specify settings for all schematics.

For grouping purpose, settings have collections. For example, @schematics/angular are the collection for default schematics like components, services, pipes.

Every collection has schematics, in this section you can set all the properties that the schematic allows. I will list some of the most common schematics with links to see the angular default schematic settings.

Notes: If you want that the schematic build installs collections, add these collections to global settings. No matter if you don't define any schematic inside.

| Schematics for @schematics/angular | | --------------------------------------------------------------------------------------------------------------- | | component | | service | | directive |

Schematic's settings allow you to have an alias The alias allows you to not specify the collection and also has a friendly name.

What is the structure of the settings?

"settings":{
  "[COLLECTION-NAME]": {
    "[SCHEMATIC-NAME]": {
      "alias": "[ALIAS]",
      "[PROPERTY-NAME]": [VALUE]
    }
  }
}

For example:

{
  "settings": {
    "@schematics/angular": {
      "component": {
        "alias": "components",
        "standalone": true
      }
    }
  }
}
Projects

Projects have all the projects created, but if you define someone that is not created, the schematic will create it. All the settings of every project are read from the angular.json Project structure

{
  "[PROJECT-NAME]":{
    "type": "library | application",
    "settings": "something like global settings",
    ...project structures like folders or schematics.
  }
}
{
  "projects": {
    "project-demo": {
      "type": "application",
      "settings": {
        "@schematics/angular": {
          "component": {
            "style": "scss"
          }
        }
      },
      "src": {
        "type": "folder",
        "app": {
          "type": "folder"
        },
        "assets": {
          "type": "folder"
        }
      }
    }
  }
}

Level 3

Folder or Schematic?

Inside every project, you will have two types of objects:

  1. Schematic
  2. Folder

To differentiate between folders and schematics, you need to define the type. For example,

{
  "components": {
    "type": "schematic"
  },
  "assets": {
    "type": "folder"
  }
}

Schematics The properties that schematic object has are: The object is a key/value pair. You have two options for the key:

  1. Use an alias declare on global settings or project settings.
  2. Define the schematic with this pattern: [COLLECTION-NAME]:[SCHEMATIC-NAME].

| Property name | Description | optional | | ------------- | ------------------------------------------------------- | -------- | | type | | false | | settings | All the setting of this schematic | true | | instances | Execute many times with the same schematic base on name | true |

{
  "components": {
    "type": "schematic",
    "settings": {
      "prefix": "core"
    },
    "instances": {
      "home": {},
      "footer": {},
      "header": {}
    }
  },
  "@danils/schematicskit:prettier": {
    "type": "schematic"
  }
}

Folders Inside folder objects yoy can have another folder or schematics object.

{
  "assets": {
    "type": "folder",
    "scss": {
      "type": "folder"
    }
  }
}

Priority of settings in different levels.

The priority of settings is: instances > schematic > project > global You can set some properties of the settings and mix them together. But if you put some property on global will be re-write in project settings.