Skip to content

Write Code

The index.ts content

Create a new index.ts file with your initial code:

export interface GreeterProps {
  readonly greetee: string;
}

export class Greeter {
  private readonly greetee: string;

  public constructor(props: GreeterProps) {
    this.greetee = props.greetee;
  }

  public greet(): string {
    return `Hello, ${this.greetee}!`
  }
}

Iterate

Either run the build or build:watch script from the Set Up step in order to compile the project. The necessary tsconfig.json is automatically created so the TypeScript compiler produces the correct output.

Generate Targets

Once you are satisfied with the library, bindings in all supported languages can be generated by running jsii-pacmak, typically by using the package script from the Set Up step. Publishable artifacts will be generated and placed in per-language sub-directories of the dist folder:

$ tree dist
dist
├── dotnet
│   ├── Acme.ProjectName.1.0.0.nupkg
│   └── Acme.ProjectName.1.0.0.snupkg
├── java
│   └── com
│       └── acme
│           └── sample
│               └── project-name
│                   ├── 1.0.0
│                   │   ├── project-name-1.0.0-javadoc.jar
│                   │   ├── project-name-1.0.0-javadoc.jar.md5
│                   │   ├── project-name-1.0.0-javadoc.jar.sha1
│                   │   ├── project-name-1.0.0-sources.jar
│                   │   ├── project-name-1.0.0-sources.jar.md5
│                   │   ├── project-name-1.0.0-sources.jar.sha1
│                   │   ├── project-name-1.0.0.jar
│                   │   ├── project-name-1.0.0.jar.md5
│                   │   ├── project-name-1.0.0.jar.sha1
│                   │   ├── project-name-1.0.0.pom
│                   │   ├── project-name-1.0.0.pom.md5
│                   │   └── project-name-1.0.0.pom.sha1
│                   ├── maven-metadata.xml
│                   ├── maven-metadata.xml.md5
│                   └── maven-metadata.xml.sha1
├── js
│   └── project-name@1.0.0.jsii.tgz
└── python
    ├── project-name-1.0.0.tar.gz
    └── project_name-1.0.0-py3-none-any.whl

9 directories, 20 files