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

ng-lib-utils

v1.0.7

Published

ng-lib-utils is helpful when developing angular library, it provides common routines: 1. uglifying the library code 2. copy readme.md file from the root folder to the transpiled code folder 3. bumping the version 4. publish the package

Downloads

20

Readme

ng-lib-utils is helpful when developing angular library, it provides common routines:

  1. uglifying the library code
  2. copy readme.md file from the root folder to the transpiled code folder
  3. bumping the version
  4. publish the package

uglifying the library code

when you build your library, usually to the 'dist' folder, that code is not uglified. uglifying the code means shortening variable/method names.

ng-lib-utils uses another package, ngx-uglifier, to uglify the code. in order to get a meaningful uglification, your library code needs to be written to support it, please follow the instructions on ngx-uglifier for that.

copy readme.md file from the root folder to the transpiled code folder

Usually packages are uploaded to repository site (e.g. npmjs.com) and to a source control site (e.g. github.com). The readme.md file needs to be the same in both sites. When you enable this option then the readme.md file from the root folder will be copied to the folder of the transpiled code, overriding the existing one.

bumping the version

The package version should be bumped every time you publish your package. This package enables you to bump the version, it does so only for the minor version. If you enable the option then the following will happen:

  • the version is extracted from the package.json in the root folder
  • the minor version is advanced in one
  • the package.json file is updated
  • the package.json file in the transpiled folder is updated with the bumped version

note that if you bump the version then make sure to publish your library as well, otherwise the version in the package.json will be unnecessarily bumped.

publish the package

if you enable this option then your library will be published.

Installation

npm install -D ng-lib-utils

Use

create a script in your root folder.

const NgLibUtils = require('ng-lib-utils');

const config = { projectName: 'my-lib' };
const ngLibUtils = new NgLibUtils.NgLibUtils(config);
ngLibUtils.init().then();

Run the script from the command line with arguments to enable the different options. For example, if the script name is lib-utils.js then the line below enables all 4 options:

node ./lib-utils --uglify --copy-readme --bump-version --publish

After running this line:

  • your code will be uglified
  • the readme.md file will be copied
  • the version number in package.json will be bumped
  • your library will be published

config object interface

The config object has the interface of NgxUglifierConfig and is described at ngx-uglifier.