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

@sumoc/jsii-faker

v0.0.8

Published

Synthisize a minimal JSII file for Projen typescript projects.

Downloads

1

Readme

JSII Faker

This is a proof of concept Projen Component that builds a minimal .jsii file in the root of a Typescript based Projen project. The resulting file only includes the metadata that is required specifically to support new Projen project creation using syntax similar to:

npx projen new --from @sumoc/jsii-faker fake

Run the above code to try it out.

[!CAUTION] Despite it's usefulness, this entire package is possibly a terrible idea. It breaks a lot of rules and standards for jsii, and should be considered a dangerous pre-alpha abomination ...and I hope you like it!

How to Use

Minimally you can use this library to register Projen project types so that they are written into a local .jsii file in your project. To do this, simply add this code to your .projenrc.ts file:

const jsii = new JsiiFaker(project);
jsii.addClassType({ name: "FakeProject" });

Why Create this?

JSII has some fairly significant restrictions on Typescript language features. These restrictions are primarily in place so that JSII can generate Go, Python, and other library wrappers for the project. However, many use cases don't need language support for anything but Typescript. This means you end up giving up a lot of Typescript capabilities with (in my opinion) very little upside.

The only reason Projen even requires is so that when you run npx projen new --from @scope/package, Projen can reach out to the NPM registry and use the root level .jsii file it finds there to build an inventory of project types that Projen's tooling can then create using the given package.

Why not use Projen's existing JsiiProject type?

To ensure that jsii modules can be exported to a variety of other languages such as Java and C#, the jsii standard imposes some fairly significant limitations on your Typescript. These limitations have good and legitimate reasons for existing! This means that any projects created using the JsiiProject project type also have to follow these rules.

I had a project that did not follow these rules. I wanted to use npx projen new --from @scope/package on it without significantl;y changing my code. Therefore, this proof of concept package was born.

What you are missing by not using Projen's built in JsiiProject type?

The biggest things you miss out on are:

  • No automatic API.md file generated by JSII's DocGen tooling.
  • No compatible versions in other language like GO, Java, Python.

The loss of automatic API documentation is annoying but completely worth it (in my use case) in exchange for unlocking the full capabilities of TypeScript in a Projen project.

Limitations

This is an initial proof of concept.

  • Only Projen projects that extend TypeScriptProject and accept TypeScriptProjectOptions are currently supported.
  • This package does not currently allow custom ProjectOptions options to be added to the .jsii file (though your project can still support them).

Random Notes / Note to Self

You can see this code for more on how AWS's jsii library would otherwise assemble and validate the file: