Skip to content

Export a helper function that lists all the internal packages #104

@BenJackGill

Description

@BenJackGill

It would be great if you could provide a function that returned all the internal package names as a string array.

This would make integrating isolate-package and tsup much simpler.

At the moment we have to manually list all of the internal packages in the tsup noExternal config property. But sometimes I forget to do that and I see strange errors that are hard to track down until I remember to add any new internal packages to the noExternal list.

I assume isolate-package has a way of identifying the internal packages, so if you could export that as a helper function for us we could easily use it within tsup to solve this issue.

This is how my current tsup.config.ts file looks. I have to manually list all the internal packages. This is error prone because I often forget to list them here.

import { defineConfig } from "tsup";

export default defineConfig({
  clean: true,
  entry: ["src/**/*.ts"],
  format: ["esm"],
  // List all internal packages here
  noExternal: [
    "@repo/firebase-functions-helpers",
    "@repo/firestore-converter",
    "@repo/types",
    "@repo/tsconfig",
    "@repo/utils",
  ],
  sourcemap: true,
  treeshake: true,
  tsconfig: "tsconfig.json",
});

This is how is could it work if you exported a helper function for us. The internal packages are automatically listed using an isolate-package helper function named internalPackages (just a name suggestion).

import { defineConfig } from "tsup";
import { internalPackages } from "isolate-package"; // <--- Possible helper function exported from isolate-package

export default defineConfig({
  clean: true,
  entry: ["src/**/*.ts"],
  format: ["esm"],
  // List all internal packages here
  noExternal: internalPackages(), // <-- Using it here to auto update the noExternal list
  sourcemap: true,
  treeshake: true,
  tsconfig: "tsconfig.json",
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions