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

@lottiefiles/tsconfig

v2.0.0

Published

Shared Typescript config for LottieFiles projects

Downloads

208

Readme

Typescript Config

Base tsconfig.json for using Typescript in the various projects at LottieFiles.

Table of contents

Installation

1. Install config and Typescript.

Install Typescript and the shared config by running:

# Normal repository? Install in the project root.
pnpm add -D typescript @lottiefiles/tsconfig

# Monorepo? Install Prettier in the project root workspace.
pnpm add -DW typescript @lottiefiles/tsconfig

2. Create configuration file

Create a tsconfig.json file in your project root with the contents below:

{
  "extends": "@lottiefiles/tsconfig",

  "compilerOptions": {
    // Compiled output JS and source maps output directory
    "outDir": "./dist",

    // Source root directory
    "rootDir": "./src",
  }
}

Usage

Monorepo Recommendation

tsconfig.build.json

Create a tsconfig.build.json in the project root that extends from @lottiefiles/tsconfig. This file will be used for build processes.

{
  // Extend from the org config
  "extends": "@lottiefiles/tsconfig",

  "compilerOptions": {
    // Use composite mode to enable building using projects and project references
    "composite": true,

    // Allow emit (required for composite mode)
    "noEmit": false
  },

  "exclude": [
    // Exclude tests and snapshots
    "**/test",
    "**/*.test.ts",
    "**/__mocks__",
    "**/__tests__",
    "**/__snapshots__",
    "**/coverage",

    // Exclude builds
    "**/dist",
    "**/dist-dev",
    "**/artifacts"
  ]
}
tsconfig.dev.json

Create a tsconfig.dev.json in the project root that extends from @lottiefiles/tsconfig. This file will be used for linting processes.

{
  // Extend from the org config
  "extends": "@lottiefiles/tsconfig",

  "compilerOptions": {
    // Allow non-module Typescript files (e.g. scripts)
    "isolatedModules": false
  },

  "exclude": [
    // Exclude non-code test resources
    "**/__snapshots__",
    "**/coverage",

    // Exclude builds
    "**/dist",
    "**/dist-dev",
    "**/artifacts"
  ],

  // Include all Javascript, Typescript, JSX, CommonJS and Module files
  "include": ["**/*.js", "**/*.jsx", "**/*.json", "**/*.ts", "**/*.tsx", "**/*.mjs", "**/*.cjs", "**/.*.cjs"]
}
tsconfig.json

Create a tsconfig.json in the root that extends from the tsconfig.build.json file and add any development/IDE relevant customization necessary for Typescript typechecking.

{
  // Must be set to empty [] array
  "files": [],

  "compilerOptions": {
    "disableSourceOfProjectReferenceRedirect": true
  },

  "references": [{ "path": "../path-to-package1" }, { "path": "../path-to-package2" }]
}
  1. For every package in the workspace, create a tsconfig.json file that extends from the root tsconfig.build.json file (and depending on use case, a tsconfig.dev.json that extends from the root tsconfig.dev.json file).
{
  // Extend from the build config
  "extends": "../../tsconfig.build.json",

  // Compiler options
  "compilerOptions": {
    // Compiled output JS and source maps output directory
    "outDir": "./dist",

    // Source root directory
    "rootDir": "./src"
  },

  "include": ["./src", "./types"],

  // Setup project references
  "references": [{ "path": "../path-to-package2" }]
}

Use references path list to allow Typescript to pickup other packages in the workspace and typing information to be extracted.

Changelog

See CHANGELOG.md for the latest changes.