refactor(turbo): consume workspace package exports
This commit is contained in:
parent
9240ae4925
commit
a77826eab9
4 changed files with 28 additions and 18 deletions
|
|
@ -114,6 +114,33 @@ describe("workspace boundaries", () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("consumes workspace packages through package exports instead of source aliases", () => {
|
||||||
|
const webTsconfig = JSON.parse(
|
||||||
|
readFileSync(join(root, "apps/web/tsconfig.json"), "utf8"),
|
||||||
|
) as { compilerOptions?: { paths?: Record<string, string[]> } };
|
||||||
|
const viteConfig = readFileSync(join(root, "apps/web/vite.config.ts"), "utf8");
|
||||||
|
const turboConfig = JSON.parse(
|
||||||
|
readFileSync(join(root, "turbo.json"), "utf8"),
|
||||||
|
) as { tasks?: Record<string, { dependsOn?: string[] }> };
|
||||||
|
|
||||||
|
expect(webTsconfig.compilerOptions?.paths).not.toHaveProperty(
|
||||||
|
"@dimensionlab/dashboard-model",
|
||||||
|
);
|
||||||
|
expect(webTsconfig.compilerOptions?.paths).not.toHaveProperty(
|
||||||
|
"@dimensionlab/dashboard-model/fixtures",
|
||||||
|
);
|
||||||
|
expect(webTsconfig.compilerOptions?.paths).not.toHaveProperty("@dimensionlab/ui");
|
||||||
|
expect(webTsconfig.compilerOptions?.paths).not.toHaveProperty(
|
||||||
|
"@dimensionlab/ui/styles.css",
|
||||||
|
);
|
||||||
|
expect(webTsconfig.compilerOptions?.paths).toEqual({
|
||||||
|
"$lib/*": ["src/lib/*"],
|
||||||
|
});
|
||||||
|
expect(viteConfig).not.toContain("../../packages/dashboard-model/src");
|
||||||
|
expect(viteConfig).not.toContain("../../packages/ui/src");
|
||||||
|
expect(turboConfig.tasks?.dev?.dependsOn).toEqual(["^build"]);
|
||||||
|
});
|
||||||
|
|
||||||
test("builds the internal container from a turbo-pruned web workspace", () => {
|
test("builds the internal container from a turbo-pruned web workspace", () => {
|
||||||
const containerfile = readFileSync(
|
const containerfile = readFileSync(
|
||||||
join(root, "apps/web/Containerfile"),
|
join(root, "apps/web/Containerfile"),
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,6 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@dimensionlab/dashboard-model": ["../../packages/dashboard-model/src/index.ts"],
|
|
||||||
"@dimensionlab/dashboard-model/fixtures": [
|
|
||||||
"../../packages/dashboard-model/src/fixtures/index.ts"
|
|
||||||
],
|
|
||||||
"@dimensionlab/ui": ["../../packages/ui/src/index.ts"],
|
|
||||||
"@dimensionlab/ui/styles.css": ["../../packages/ui/src/styles.css"],
|
|
||||||
"$lib/*": ["src/lib/*"]
|
"$lib/*": ["src/lib/*"]
|
||||||
},
|
},
|
||||||
"types": ["node", "bun-types", "react", "react-dom", "vite/client"]
|
"types": ["node", "bun-types", "react", "react-dom", "vite/client"]
|
||||||
|
|
|
||||||
|
|
@ -24,18 +24,6 @@ export default defineConfig({
|
||||||
plugins: [react(), tailwindcss()],
|
plugins: [react(), tailwindcss()],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
"@dimensionlab/ui/styles.css": fileURLToPath(
|
|
||||||
new URL("../../packages/ui/src/styles.css", import.meta.url),
|
|
||||||
),
|
|
||||||
"@dimensionlab/ui": fileURLToPath(
|
|
||||||
new URL("../../packages/ui/src/index.ts", import.meta.url),
|
|
||||||
),
|
|
||||||
"@dimensionlab/dashboard-model/fixtures": fileURLToPath(
|
|
||||||
new URL("../../packages/dashboard-model/src/fixtures/index.ts", import.meta.url),
|
|
||||||
),
|
|
||||||
"@dimensionlab/dashboard-model": fileURLToPath(
|
|
||||||
new URL("../../packages/dashboard-model/src/index.ts", import.meta.url),
|
|
||||||
),
|
|
||||||
$lib: fileURLToPath(new URL("./src/lib", import.meta.url)),
|
$lib: fileURLToPath(new URL("./src/lib", import.meta.url)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@
|
||||||
"env": ["DATABASE_URL"]
|
"env": ["DATABASE_URL"]
|
||||||
},
|
},
|
||||||
"dev": {
|
"dev": {
|
||||||
|
"dependsOn": ["^build"],
|
||||||
"cache": false,
|
"cache": false,
|
||||||
"persistent": true,
|
"persistent": true,
|
||||||
"env": [
|
"env": [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue