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

ern-api-gen

v0.51.2

Published

Electrode Native API Generator

Downloads

5,355

Readme

ern-api-gen

This package is part of Electrode Native.

The Electrode Native API Generator creates new API projects based on a Swagger schema.

The generated code uses react-native-electrode-bridge to facilitate bi-directional message exchange between native code (Android/iOS) and JavaScript (React Native).

Usage

See the documentation and CLI help for more information:

ern create-api --help

Details

ern-api-gen is based on code from the Swagger project, mainly version 2.X of Swagger Codegen.

Stock (Swagger) Code Generators

The three primary code generators adapted from Swagger are:

In line with the main Swagger project, all three classes extend the base class DefaultCodegen.

Custom (ERN) Code Generators

For the purposes of ern-api-gen there are three custom implementations of API code generators for native code (Java/Swift) and JavaScript:

Codegen | Base Class | Template Folder --- | --- | --- ErnAndroidApiCodegen | AndroidClientCodegen | resources/android/libraries/ern/ ErnES6ApiCodegen | ES6Codegen | resources/es6/libraries/ern/ ErnSwiftCodegen | SwiftCodegen | resources/swift/libraries/ern/

Note that ErnES6ApiCodegen extends ES6Codegen, not JavascriptClientCodegen (see next section for details).

ES6 Generator

The base class of ErnES6ApiCodegen is the ES6Codegen class which extends JavascriptClientCodegen. ES6Codegen uses a different template directory but otherwise does not change functionality much compared to its base class. It's important to understand that Swagger does not have a ES6Codegen and instead uses conditionals in JavascriptClientCodegen to generate ES6. The ES6 template folder of Swagger differs significantly from the one in ern-api-gen. This is likely due to the fact that ES6 generation was not yet available in Swagger at the time the initial code was converted for ern-api-gen.

History

Below is a brief summary of the significant events in this module. The information was mainly obtained from Git logs and by comparing select snapshots to historic state of swagger-codegen.

Initial version

The very first version of the content in this folder can be traced back to the addition of the ern-message-gen folder in 36637761 on Apr 4, 2017.

When the code was first added to the repository it had not only gone through a Java to JavaScript conversion, but also contained other changes and additions. Some changes in the resource files (e.g. triple curly braces) may have been a necessity due to subtle differences of the Mustache template engine in Java, and the mustache JavaScript package used by ern-api-gen. For these two reasons is it very difficult (or impossible) to determine the exact state of the Swagger project that was used as the actual "source".

The most accurate approximations point to somewhere between v2.2.1 and v2.2.2, with most code being closer to v2.2.1, while a few files more closely resemble v2.2.2. There are more than 900 commits between the two tags.

Rename

ern-message-gen was renamed to ern-api-gen on Aug 9, 2017 (0f9e0e34). This fully replaced the previous hull-based generator from the initial commit.

TypeScript conversion

A major update (mainly formatting) was done in 8fea575a when the rest of the Electrode Native code base was converted to TypeScript on Apr 28, 2018.

In May 2019, the JavaScript sources in ern-api-gen were converted to TypeScript: 92b69b9b (as well as 6d8f166a, 2e7d2327).