0.0.12 • Published 4 years ago

aem-sling-2-ts v0.0.12

Weekly downloads
40
License
-
Repository
-
Last release
4 years ago

AEM Sling to Typescript Converter

A CLI tool which scans a projects for Apache Sling models and generates equivalent Typescript definitions.

This is a useful tool for any AEM + React Typescript projects, promoting type-safety between the BE and FE.

Installation

Install package as dev depedency

npm install --save-dev aem-sling-2-ts

Add script to package.json

{
    "scripts": {
        "generate:sling-ts": "aem-sling-2-ts ../core ./src/types/sling-interfaces.d.ts"
    }
}

Usage

The generate the Typescript definition file containing the sling model interfaces, run:

npm run generate:sling-ts

Importing Definitions

After generating the .d.ts definition file, the interfaces can be referenced globally:

const MyComponent = (props: Sling.ExampleModelProps) => (
    <div>{props.example}</div>
)

Future scope

  1. Make code namespace aware!
  2. Scaffold react components from Sling models
  3. Improved type mappings
0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago