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

burstmake

v1.0.9

Published

Tool to create tsconfig for complex application

Downloads

7

Readme

Burstmake

Burstmake is a tool to manage your TypeScript project when there are more indipendent parts. In this case, the solution is either creating one tsconfig.json file for each subpart or using another tool to have a pretty manage. Burstmake wants to simplify everything using one file: burstmake.json.

Sections

Installing and use

For the latest stable version:

npm install -g burstmake

and run:

burstmake

in the root of project to create the tsconfig.json files from burstmake.json file.

Summary

Imagine a project as below:

root
|-- front 
|   |-- src
|   |-- test
|    
|-- back
    |-- src
    |-- test

now, to compile all the four parts you need a tsconfig.json file for front/src, front/test, back/src and back/test, which have the options to translate from TypeScript to JavaScript.

This is a mistake! In the worst case you have the same options for four files.

As said above, Burstmake wants to bring a new, better, solution.

Before explaining what to do, we must introduce the concept of topic and hotpoint.

Topic

The topic is the set of TypeScript rules to apply to the hotpoint. One topic has the same content of a TypeScript configuration but with some differences.

The most important property of a topic is the possibility to extend it for creating a hierarchy of topics, in this way the problem of making multiple tsconfig files with the same options is resolved.

Another property of topics is that the paths are relative to the root of the project. This is very useful and it doesn't meet the tedious problem to resolve pesky relative path.

The example below shows how to write a topic:

{
    "common": {
        "compilerOptions": {
            "target": "es5",
            "noImplicitAny": true,
            "removeComments": true,
            "preserveConstEnums": true,
            "sourceMap": true
        }
    },

    "front_t": {
        "base": "common",
    
        "compilerOptions": {
            "module": "amd",
            "outFile": "built/app.js"
        }
    },
    
    "back_t": {
        "base": "common",
        
        "compilerOptions": {
            "module": "commonjs"
        }
    }
}

When Burstmake runs, front_t and back_t will inherite all compiler options from common topic. If a declaration is both in a parent topic and in a children topics, the children topic's declaration will be used. In the case above, front_t and back_t become:

{
    "front_t": {
        "compilerOptions": {
            "target": "es5",
            "noImplicitAny": true,
            "removeComments": true,
            "preserveConstEnums": true,
            "sourceMap": true,
            "module": "amd",
            "outFile": "built/app.js"
        }
    }
}
{
    "back_t": {
        "compilerOptions": {
            "target": "es5",
            "noImplicitAny": true,
            "removeComments": true,
            "preserveConstEnums": true,
            "sourceMap": true,
            "module": "commonjs"
        }
    }
}

Hotpoint

Alright, now we have learned how to write a topic and use inheritance to avoid multiple similar tsconfig.json files, how do we specify the subsets of the project in which we want to use it?

Well, is simple. In the burstmake.json file there must be an 'hotpoint' attribute in which is stated the association topic-folder.

This is an example:

{
    "hotpoint": {
        "front_t": "./front/",
        "back_t": "./back/"
    },

    "common": {
    
    },
    
    "front_t": {
    
    },
    
    "back_t": {
    
    }
}

If you run burstmake in the front/ and back/ directory you should find a tsconfig.json file with the correct configuration. As you can see the common topic is not inserted in the hotpoint section, it is only a topic from which taking information about the common configurations.

Note: the / is important, make sure you won't forget it.

Schema

The structure of burstmake.json file is:

{
    "hotpoint": {
        "topic_declared": "path_with_final_slash"
    },
    
    "topic": {
        "base": "some_topic",
        
        "compilerOptions": {
        },
        
        "include": [
            "file outside of topic, useful for .d.ts definitions"
        ],
        
        "exclude": [
            "use minimatch expression to ignore files or 
	    directories in the topic folder"
        ],
    }
}

The compilerOptions attribute is the compilerOptions of a tsconfig.json file but for now it supports only:

  • module
  • target
  • moduleResolution
  • noImplicitAny
  • removeComments
  • preserveConstEnums
  • outDir
  • outFile
  • sourceMap
  • declaration
  • noEmitOnError

IMPORTANT: The paths in hotpoint and compilerOptions must use the format: ./path/, instead the paths in include must be in the path/source format.