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

@ng2react/cli

v1.5.0

Published

## Related projects to Investigate * [react-in-angularjs](https://github.com/xjpro/react-in-angularjs)

Downloads

6

Readme

@ng2react/cli

A command line interface for wrapper for @ng2react/core that converts AngularJS components to React using OpenAI.

Installation

npm install -g @ng2react/cli

Usage

ng2r [comand] --help

Commands:
  ng2react search <file>                   Finds angular components in a file
  ng2react convert <file> <componentName>  Converts angular components to react
  ng2react generateReactTest <file>        Converts angular components to react

Convert your AngularJS component or directive to React

ng2react convert <file> <componentName>

Converts angular components to react

Positionals:
  file           The file containing the component           [string] [required]
  componentName  The file to convert                         [string] [required]

Options:
  --version         Show version number                                [boolean]
  --cwd             The current working directory
          [string] [default: "/Users/maxbilbow/repos/dissertation/ng2react/cli"]
  --quiet           Suppresses all logging                             [boolean]
  --verbose         Outputs more information                           [boolean]
  --help            Show help                                          [boolean]
  --apiKey          The openai api key                                  [string]
  --model           The openai model to use          [string] [default: "gpt-4"]
  --organization    The openai model to use                             [string]
  --sourceRoot      The source root where all AngularJS JS and HTML are located
                                                                        [string]
  --temperature     The temperature to use when generating text, between 0 and 2
                                                         [number] [default: 0.2]
  --customPrompt    Custom rules (Markdown) that will be used instead of the
                    default rules regarding pattern conversion.         [string]
  --targetLanguage  Target language for code generation. If none provided, the
                    source language will be used.
                                  [string] [choices: "javascript", "typescript"]

Generate a Test

ng2react generateReactTest <file>

Converts angular components to react

Positionals:
  file  The file containing the component                    [string] [required]

Options:
  --version         Show version number                                [boolean]
  --cwd             The current working directory
          [string] [default: "/Users/maxbilbow/repos/dissertation/ng2react/cli"]
  --quiet           Suppresses all logging                             [boolean]
  --verbose         Outputs more information                           [boolean]
  --help            Show help                                          [boolean]
  --apiKey          The openai api key                                  [string]
  --model           The openai model to use          [string] [default: "gpt-4"]
  --organization    The openai model to use                             [string]
  --temperature     The temperature to use when generating text, between 0 and 2
                                                         [number] [default: 0.2]
  --targetLanguage  Target language for code generation. If none provided, the
                    source language will be used.
                                  [string] [choices: "javascript", "typescript"]

JSON API

If you wish to integrate this into your own application, you can use the JSON API by adding the --json flag.

For response types, see the JSON schemas:

Search Response:

type SearchResult = {
    result: {
        name: string
        file: string
        location: {
            start: number
            end: number
        }
    }[]
}

Convert / Test Gen Response:

type ConvertResult = {
    result: readonly {
        jsx: string
        markdown: string
    }[]
}