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

autodts

v0.0.6

Published

Autodts generates d.ts files for publishing TypeScript projects on npm.

Downloads

1,453

Readme

autodts

npm version dependency status

autodts generates .d.ts files for publishing TypeScript projects on npm.

Usage

It's best to run autodts from the package.json file of a Node.js module. Here's an example:

{
  "name": "example",
  "version": "0.0.1",
  "description": "Example of a TypeScript-based package",
  "scripts": {
    "preinstall": "npm install autodts",
    "postinstall": "autodts link",
    "prepublish": "tsc && autodts generate"
  },
  "typescript": {
    "definition": "index.d.ts"
  },
  "dependencies": {
    "autodts": "~0.0.6",
    "@lib/dependency-example": "0.0.3"
  },
  "devDependencies": {
    "@lib/autodts-generator": "~0.0.1",
    "typescript": "~1.5.3"
  }
}

The preinstall command is needed to work around npm issue #5001.

autodts link checks all packages listed in dependencies. If their package.json file contains a typescript section with a definition setting, a reference is added to the output file typings/auto.d.ts, for example:

// Automatically generated file. Edits will be lost.
/// <reference path="../node_modules/@lib/dependency-example/index.d.ts" />

This allows pulling the type information of all required modules into a TypeScript source file with a single /// <reference path = "typings/auto.d.ts" /> statement.

An entire tree of npm packages written in TypeScript can be installed with correct references to typings if packages referencing types from others add the above preinstall and postinstall sections in their package.json.

It's possible to change the output file path using the --out parameter, for example: autodts link --out typings/tsd.d.ts.

autodts generate calls autodts-generator to produce a single .d.ts file with all type information in the package. It will be automatically written to the path defined in the definition setting in the typescript section of your package.json file. Using it requires a particular package structure, otherwise it's better to use dts-generator directly.

To use the generate command, you should add @lib/autodts-generator to your devDependencies. autodts doesn't automatically require it, because it pulls the entire TypeScript compiler and is not needed for the link command.

autodts link is meant for the common case of installing TypeScript-based npm packages, autodts generate for the rarer event of publishing them.

License

The MIT License Copyright (c) 2015 BusFaster Ltd