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

@teamhive/angular-package-core

v0.1.0

Published

A common package for all Angular packages published by team hive

Downloads

3

Readme

@teamhive/angular-package-core

A common package for all Angular packages published by team hive

DEMO: https://teamhive.github.io/angular-package-core

Contribution Guidelines

Changelog

Installation

npm i @teamhive/angular-package-core --save

In angular.json add the following entries to their locations

  ...
  "styles": [
    "node_modules/prismjs/themes/prism.css",
    "node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css"
  ],
  "scripts": [
    "node_modules/marked/lib/marked.js",
    "node_modules/prismjs/prism.js",
    "node_modules/prismjs/components/prism-bash.min.js",
    "node_modules/prismjs/components/prism-typescript.min.js",
    "node_modules/prismjs/components/prism-scss.min.js",
    "node_modules/prismjs/plugins/line-numbers/prism-line-numbers.js"
  ]

Usage

app.module.ts

import { TeamHivePackageCoreModule } from '@teamhive/angular-package-core';

@NgModule({
  imports: [
    ...,
    TeamHivePackageCoreModule.forRoot(),
  ]
})
When providing values to the ExampleSources and SupportingSource objects, use the require() function with '!!raw-loader' to read the files so they can be passed. requiring them in, in this way makes sure that, during bundling the locations of the files are taken into account

app-example-page-shell is the main component to use from this package

import { Component } from '@angular/core';
import { ExampleSources, SupportingSource } from '@teamhive/angular-package-core';

@Component({
  selector: 'app-my-page',
  templateUrl: 'my-page.component.html',
  styleUrls: ['my-page.component.scss']
})
export class MyPageComponent {

  // The component example's files. Allows the component to be run and the files viewed at the same time. 
  // Dynamic paths do not work. The entire relative path must be available at compile time.
  readonly source: ExampleSources = {
    html: require(`!!raw-loader?lang=html!../../exampless/my-example/my-example.component.html`),
    ts: require(`!!raw-loader?lang=typescript!../../examples/my-example/my-example.component.ts`)
  }

  // Other supporting files (data, interfaces, utils, pipes, etc.)
  otherFiles: SupportingSource[] = [
    {
      name: 'sample-data.ts',
      language: 'javascript',
      content: require('!!raw-loader?lang=typescript!../../data/sample-data.ts')
    }
  ];
}
<!-- the example title will display above the example -->
<app-example-page-shell exampleTitle="My Example" [exampleSources]="source" [otherSources]="otherFiles">
    <app-my-example></app-my-example>
</app-example-page-shell>
import { Component } from '@angular/core';

@Component({
  selector: 'app-my-example',
  templateUrl: 'my-example.component.html',
  styleUrls: ['my-example.component.scss']
})
export class MyExampleComponent {
  ...
}

Inputs and Configuration

Directives and Inputs

| Inputs | Description | |---|---| | exampleTitle | The title to display above the example | | exampleSources | The files that are used as a part of the component rendered as an example. See example-sources.interface.ts | | otherSources | The supporting files for the example or any other files to include for display. See supporting-sources.interface.ts

More Examples

See the Demo for more configuration, and styling options.