Put up fences around your TypeScript modules

ilesar

Ivan Lesar

Posted on January 4, 2021

Put up fences around your TypeScript modules

The author says it best...

"Good Fences is a tool that allows you to segment a TypeScript project into conceptual areas and manage dependencies between those areas."

https://github.com/smikula/good-fences

Define what you import or export between Typescript files, directories and subdirectories with tagged fence.json files.

{
    "tags": [ "tagA", "tagB" ],
    "exports": [
        "index",
        {
            "modules": "sample_directory/*",
            "accessibleTo": "tagX"
        }
    ],
    "imports": [
        "tagC",
        "tagD"
    ]
}
Enter fullscreen mode Exit fullscreen mode

And the most important feature... a human readable log with errors.

Good-fences violation in src/foo.ts:
    Import not allowed: src/bar.ts
    Fence: src/fence.json
Enter fullscreen mode Exit fullscreen mode

What are your goto tools? Have you stumbled upon anything new and added it to your arsenal? 🧠

💖 💪 🙅 🚩
ilesar
Ivan Lesar

Posted on January 4, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Put up fences around your TypeScript modules
engineeringmonday Put up fences around your TypeScript modules

January 4, 2021