fix(turbo): keep package exports fresh in dev
This commit is contained in:
parent
a77826eab9
commit
2d779165cd
5 changed files with 68 additions and 3 deletions
|
|
@ -118,6 +118,12 @@ describe("workspace boundaries", () => {
|
|||
const webTsconfig = JSON.parse(
|
||||
readFileSync(join(root, "apps/web/tsconfig.json"), "utf8"),
|
||||
) as { compilerOptions?: { paths?: Record<string, string[]> } };
|
||||
const modelPackage = JSON.parse(
|
||||
readFileSync(join(root, "packages/dashboard-model/package.json"), "utf8"),
|
||||
) as { exports?: Record<string, WorkspacePackageExport> };
|
||||
const uiPackage = JSON.parse(
|
||||
readFileSync(join(root, "packages/ui/package.json"), "utf8"),
|
||||
) as { exports?: Record<string, WorkspacePackageExport> };
|
||||
const viteConfig = readFileSync(join(root, "apps/web/vite.config.ts"), "utf8");
|
||||
const turboConfig = JSON.parse(
|
||||
readFileSync(join(root, "turbo.json"), "utf8"),
|
||||
|
|
@ -139,6 +145,29 @@ describe("workspace boundaries", () => {
|
|||
expect(viteConfig).not.toContain("../../packages/dashboard-model/src");
|
||||
expect(viteConfig).not.toContain("../../packages/ui/src");
|
||||
expect(turboConfig.tasks?.dev?.dependsOn).toEqual(["^build"]);
|
||||
expectPackageExport(modelPackage.exports?.["."], {
|
||||
types: "./dist/index.d.ts",
|
||||
development: "./src/index.ts",
|
||||
default: "./dist/index.js",
|
||||
});
|
||||
expectPackageExport(modelPackage.exports?.["./fixtures"], {
|
||||
types: "./dist/fixtures/index.d.ts",
|
||||
development: "./src/fixtures/index.ts",
|
||||
default: "./dist/fixtures/index.js",
|
||||
});
|
||||
expectPackageExport(uiPackage.exports?.["."], {
|
||||
types: "./dist/index.d.ts",
|
||||
development: "./src/index.ts",
|
||||
default: "./dist/index.js",
|
||||
});
|
||||
expectPackageExport(uiPackage.exports?.["./styles.css"], {
|
||||
development: "./src/styles.css",
|
||||
default: "./dist/styles.css",
|
||||
});
|
||||
expectPackageExport(uiPackage.exports?.["./tokens.css"], {
|
||||
development: "./src/tokens.css",
|
||||
default: "./dist/tokens.css",
|
||||
});
|
||||
});
|
||||
|
||||
test("builds the internal container from a turbo-pruned web workspace", () => {
|
||||
|
|
@ -210,3 +239,18 @@ describe("workspace boundaries", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
type WorkspacePackageExport =
|
||||
| string
|
||||
| {
|
||||
types?: string;
|
||||
development?: string;
|
||||
default?: string;
|
||||
};
|
||||
|
||||
function expectPackageExport(
|
||||
actual: WorkspacePackageExport | undefined,
|
||||
expected: Exclude<WorkspacePackageExport, string>,
|
||||
): void {
|
||||
expect(actual).toMatchObject(expected);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue