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

@uitgeverij-deviant/ng-publish-to-git

v3.0.1

Published

A helper package for publishing one or more Angular libraries to a Git repo instead of the NPM registry

Downloads

8

Readme

ng-publish-to-git

Publishes your Angular library to a git repository instead of npm. It also labels the source and the package in their respective repositories. Version numbers are automatically bumped and there is a detection of changes. Unchanged projects are not published.

If needed version number can always be changed manually but be careful with lowering version numbers as collisions may occur with existing tags.

Install

npm install -g ng-publish-to-git

Usage

First you need to add the configuration secion of ng-publish-to-git in your root level package.json file.

For example:

"ng-publish-to-git": {
  "commitPrefix": "GLOBAL-PREFIX",
  "packages": [
    {
      "name": "lib1",
      "commitPrefix": "LIB1-SPECIFIC-PREFIX",
      "publish": true,
      "repositoryUrl": "https://some-repo-for-lib1-packages.git"
    },
    {
      "name": "lib2",
      "publish": true,
      "repositoryUrl": "ssh://[email protected]"
    },
  ]
}

After that you can run ng-publish-to-git from the project root directory with one or more of the following command line options:

  • --commit-prefix your-prefix
  • --package package-name
  • --debug
  • --configuration configuration-name

--commit-prefix your-prefix
This prefixes all commits to both the source and the package repository with the given prefix. This prefix will be the same for all libraries in your source project. Individual prefixes can also be set in the ng-publish-to-git configuration.

--package package-name
If you have more than one library in your project this option will let you publish only the given library package, the others will remain unpublished.

--debug
This option produces a little more output for solving problems, also the temporary directory where the package is created will not be deleted afterwards and its path will be shown.

The package repository will contain no branches, only tags. You need one package repository for each library but you can have the source for multiple libraries in one repository.

After a successful publish you can install the library as a dependency in your Angular application like a normal dependency with the only difference being that you need to specify during install that it comes from a git repository.

--configuration configuration-name
This option passes the configuration to build to the build process. If omitted the default configuration 'production' will be used.

Example:
--configuration production

Examples:
npm install git+ssh://[email protected]:npm/some-lib.git#v1.0.27
npm install git+ssh://[email protected]:npm/some-lib#semver:^5.0
npm install git+https://[email protected]/npm/some-lib.git
npm install git://github.com/npm/some-lib.git#v1.0.27

For more info see the documentation of npm install

Configuration options

The ng-publish-to-git configuration in the package.json file consists of an object with the following keys at root level:

commitPrefix (optional)
This is the global commit prefix, it will be used for all packages that do not have a prefix defined at the package level.

packages (required)
This is an array of package configurations for each individual package.

At the package level you have the following keys available:

name (required)
The name of the library package.

commitPrefix (optional)
A per package override of the global commit prefix.

publish (optional)
A boolean controlling whether or not the package should be published if no package name is specified on the command line. By default packages will be published (if changed) but it might be beneficial to be able to suppress publishing by setting this to false.

repositoryUrl (required)
The url to be used to access the package repository. For example:

"repositoryUrl": "https://some-repo-for-lib1-packages.git"

or

"repositoryUrl": "ssh://[email protected]"

Pre publish hook

If needed there is the possibility to add the key: prePublishToGit to the scripts section of a library level package.json file. This script will be run before publishing the package and can be used to copy files to the dist folder that the ng build command will not copy, like assets (pre Angular 9).

As of Angular 9 a better option may be the use of a ng-packagr setting like is demonstrated here.