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

@enmove/conf-ts

v1.0.0-alpha.2

Published

A set of base configuration files for TypeScript.

Downloads

52

Readme

@enmove/conf-ts

A set of base configuration files for TypeScript.

conf-ts provides several types of base configuration files to inherit from your tsconfig.json.

This modules requires TypeScript 3.2 or newer.

Usage

As of TypeScript 3.2, we are able to inherit base tsconfig files from packages located in node_modules in an intuitive way. To leverage this, add this package as a dev dependency first:

$ yarn add -D @enmove/conf-ts

Then, add your tsconfig.json to your project directory and extends the one of the base config files. For example:

{
    "extends": "@enmove/conf-ts",
    "include": ["src/**/*"]
}

Presets

conf-ts provides following configurations out of the box:

  • @enmove/cont-ts
  • @enmove/conf-ts/decl
  • @enmove/conf-ts/dom
  • @enmove/conf-ts/dom/decl

conf-ts

The most basic configuration of this module and all of other more-specific configurations in this module inherit from this, which declares common compiler settings to utilize TypeScript features.

WHEN TO USE: Use this as the default tsconfig unless your code involves any react or DOM-related code.

// Example of `tsconfig.json`
{
    "extends": "@enmove/cont-ts",
    "compilerOptions": {
        "baseUrl": ".",
        "paths": { "@src/*": ["src/*"] }
    },
    "include": [
        "src/**/*",
        "test/**/*",
        "__*__/**/*",
        "../../typings/**/*"
    ],
    "exclude": [
        "test/types/**/*"
    ]
}

This example json file also assumes you have following directory structure:

  • All source .ts and .tsx sources are in src
  • test for test codes
  • For special directory like __fixtures__ and __mocks__ also contains ts codes
  • You have typings directory in which some missing type declarations you added for third-party js libraries are stored on the monorepo's root directory
  • And ignores all .ts files in test/types so they can have own tsconfig

conf-ts/decl

This configuration justs adds declaration: true to the basic configuration so it emits .d.ts along with transpiled .js files and their source maps. It also preserve comments in the code. Thus, when you publish your package as a library, the user can still see JSDocs in their code editors.

WHEN TO USE: Use this for building a library in place of the basic config.

// Example of `tsconfig.build.json`
{
    "extends": "@enmove/conf-ts/decl",
    "compilerOptions": {
        "outDir": "./dist"
    },
    "include": [
        "src/**/*",
        "../../typings/**/*"
    ],
    "exclude": [
        "**/__*__"
    ]
}

And you should want to add script to your package.json in order to use the tsconfig for building:

{
    ...
    "scirpts": {
        "compile": "tsc --project tsconfig.build.json",
    },
    ...
}

conf-ts/dom

This configuration adds dom library so you can reference to the browser APIs, and it tells that the application uses react.

WHEN TO USE: Your application needs react and access to the DOM.

conf-ts/dom/decl

The dom version of conf-ts/decl.

WHEN TO USE: You want to expose a library that needs react and use of DOM API.

Tip: Preview your config file

You can print out the effective config with --showConfig option (as of TS 3.2):

$ tsc --showConfig

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es6",
        ...
        "strict": true
    },
    "files": [
        "./src/index.ts",
    ],
    "include": [
        "src/**/*"
    ]
}

Additional info

This package is included in: