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-up

v3.0.0

Published

Up! - Angular Upgrade Toolkit

Downloads

3

Readme

Installation

npm install -g ng-up

What's inside

⚡️ Up! is a toolkit which helps you migrate your existing AngularJS projects to Angular framework.

🚀 It contains various modules responsible for solving different challenges of migration process.

🔥 Each functionality can be tested using dry run mode, so you file system stays untouched until you decide to do so.

Update templates

What problem does it solve?

Down the road of migration process you can easily find many time-consuming challenges, and one of them is updating the syntax of standard directives (ng-if, ng-repeat, etc...). Knowing the fact that migration is not about introducing any functional changes in your project, Up! tries to update different parts of your template to keep the same behavior of your components as in AngularJS environment.

Command

ng-up template

Options

-p, --pattern [glob]                 Pattern - glob (default: **/*.html)
-s, --stripTagPrefix [strip]         Strip tag prefix (default: data)
-a, --aliasForThis [alias]           Alias for this (default: $ctrl)
-f, --format [format]                Format (syntax) of template (default: html)
-b, --bindToCurlyBraces [bind]       Transform ng-bind to curly braces binding (default: false)
-c, --classListToRemove [classList]  Comma separated list of classes to remove (default: ng-hide)
-d, --dry                            Dry run - see command output
-h, --help                           output usage information

Example usage

ng-up template -p '**/*.pug' -f 'pug' -a 'vm'

How it works

Up! reads the content of files matching pattern you've passed to ng-up template command, and applies various transformations to be aligned to new Angular syntax (i.e. updating standard directives, removing scope references).

Before - simple.component.html:

<div>
    <p ng-if="vm.showDetails">Some details</p>
    <ul>
        <li ng-repeat="item in vm.items"></li>
    </ul>
</div>

After - simple.component-ngup.html:

<div>
    <p *ngIf="showDetails">Some details</p>
    <ul>
        <li *ngFor="let item of items"></li>
    </ul>
</div>

Read more about transformation details

Create providers

What problem does it solve?

Hybrid apps based on @angular/upgrade can inject already existing AngularJS services into new Angular codebase. To achieve this, you have to manually prepare factory providers for each injectable (i.e. AngularJS service). Up! gives you the possibility to create this kind of providers automatically.

Command

ng-up provider

Options

-n, --name <serviceName>  Name of AngularJS service
-d, --dry                 Dry run - see command output
-h, --help                output usage information

Example usage

ng-up provider -n AmazingService

How it works

Up! creates new file based on service name you pass to ng-up provider command. Content of this file looks as follows:

import { InjectionToken } from "@angular/core";

export const AMAZING_SERVICE_TOKEN = new InjectionToken<any>('AMAZING_SERVICE');

export function AmazingServiceFactory(injector: any) {
    return injector.get('AmazingService')
}

export const AmazingServiceProvider = {
    provide: AMAZING_SERVICE_TOKEN,
    deps: ['$injector'],
    useFactory: AmazingServiceFactory
}

Name of the file matches service for which you're creating this provider: amazing-service.provider.ts

Having this file created, now you can import it and include as a provider inside of Angular module - AmazingService is ready to use!

Components (to be released)

Create facade directives (using UpgradeComponents) for your existing AngularJS components.

soon...

Special thanks to

Front-End Team @ SmartRecruiters