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

@sage-bionetworks/sage-angular

v1.4.0

Published

[![GitHub Release](https://img.shields.io/github/release/Sage-Bionetworks/sage-angular.svg?include_prereleases&color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github)](https://github.com/Sage-Bionetworks/sage-angular/releases) [![

Downloads

2

Readme

Sage Bionetworks library for Angular

GitHub Release GitHub CI GitHub License Latest npm version

Library of reusable Angular artifacts used in Sage Bionetworks projects

Introduction

This repository provides a library of reusable code that defines components, services, and other Angular artifacts (pipes, directives, and so on) that are imported into projects developed by Sage Bionetworks.

This repository includes a multi-project workspace that supports the development of the library @sage-bionetworks/sage-angular. The two projects included are:

  • sage-angular: the library @sage-bionetworks/sage-angular.
  • sage-angular-demo: a demo app used to showcase the content of the library.

Previews

Version | Demo app | Storybook ------- | -------- | --------- 1.4.0 | Demo app | Storybook Edge | Demo app | Storybook

Installation

npm install @sage-bionetworks/sage-angular --save

Import the styles and themes of the library in your main styles.scss:

@import '@sage-bionetworks/sage-angular/src/styles';
@import '@sage-bionetworks/sage-angular/src/lib-theme';

// Include material core styles.
@include mat-core();

@include angular-material-theme($theme);
@include sage-angular-theme($theme);

Import the image assets of the library in your angular.json:

"assets": [
  {
    "glob": "**/*.@(svg)",
    "input": "sage-angular/dist/sage-angular/src/assets/images",
    "output": "images"
  }
],

Development server

Run npm ci to install the npm dependencies of this project.

Run npm run start for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

The library sage-angular is split into multiple features that include each a subentry to improve tree shaking and thus the performance of SPAs. As a convention, the content of a feature folder should stay as flat as possible and thus avoid sub-folders. An example of this approach is provided by the library Angular Material.

Adding a library feature

We use the Angular schematic ng-samurai to add new feature to the library. The command below will perform the following actions:

  • Create a new folder with the provided name
  • Create a (module, component, index.ts, public-api.ts, package.json)
  • Export the module and the component from the public-api.ts
ng g ng-samurai:generate-subentry --project sage-angular feature-a

Options can be passed to the command to disable the generation of certain types of artifacts like --gc false to disable the generation of the default component. Alternatively, remove the artifacts that are not needed after the generation of the feature.

The file projects/sage-angular/src/public-apis.ts lists the features that are available to consumer applications. Add the line export * from '@sage-bionetworks/sage-angular/src/lib/feature-a'; to export the feature.

Adding artifacts to a feature

The command ng generate <artifact> or ng g <artifact> generates a new Angular artifact where <artifact> takes a value in directive|pipe|service|class|guard|interface|enum|module. The option --project <project> specifies the project the artifact should be added to.

For example, run this command to add a service to the feature feature-a:

ng generate service --project sage-angular feature-a/feature-a

Run this command to add a component to the feature feature-a:

ng generate component --project sage-angular feature-a/feature-a

This library is configured to add the prefix sage- to the selector of components generated via ng generate component. For example, the selector of the component feature-a is sage-feature-a and this component will be imported in an HTML document with <sage-feature-a></sage-feature-a>.

The entry point file public-api.ts of the feature must include all the artifacts that are offered by the feature. The entry point file must be updated manually when adding or removing artifacts to a feature.

Adding artifacts to the demo app

Run this command to add a module:

ng g m --project sage-angular-demo module-x

Run this command to add a component to the module module-x:

ng g c --project sage-angular-demo module-x/component-x

Running lint checks

Run npm run lint to execute the lint checks via TSLint.

Build

Run npm run build to build the library. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build. Run npm run build:demo to build the demo app.

Running unit tests

Run npm run test to execute the unit tests via Karma.

Running end-to-end tests

Run npm run e2e to execute the end-to-end tests via Protractor.

License

Apache License 2.0