Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/bright-paths-resolve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@party-stack/build-config": patch
"@party-stack/tanstack-start-build-config": patch
---

Enable TypeScript path resolution by default in the shared app and library Vite configs. Preserve the default when merging caller resolve options, allow explicit opt-outs, and have the TanStack Start preset inherit the shared setting.
10 changes: 9 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
"ignore": [
"@bobbyfidz/apollo",
"@bobbyfidz/foundry-graphql",
"@bobbyfidz/foundry-graphql-schema",
"@bobbyfidz/foundry-graphql-server",
"@bobbyfidz/osdk-react",
"@bobbyfidz/osdk-react-todo-app",
"@bobbyfidz/osdk-utils"
]
}
1 change: 1 addition & 0 deletions old/apollo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@bobbyfidz/apollo",
"version": "0.3.1",
"private": true,
"files": [
"lib"
],
Expand Down
1 change: 1 addition & 0 deletions old/foundry-graphql-schema/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@bobbyfidz/foundry-graphql-schema",
"version": "0.2.6",
"private": true,
"files": [
"lib"
],
Expand Down
1 change: 1 addition & 0 deletions old/foundry-graphql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@bobbyfidz/foundry-graphql",
"version": "0.1.6",
"private": true,
"bin": {
"foundry-graphql": "./bin/run.js"
},
Expand Down
1 change: 1 addition & 0 deletions old/osdk-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@bobbyfidz/osdk-react",
"version": "0.13.1",
"private": true,
"files": [
"lib"
],
Expand Down
1 change: 1 addition & 0 deletions old/osdk-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@bobbyfidz/osdk-utils",
"version": "0.2.2",
"private": true,
"files": [
"lib"
],
Expand Down
3 changes: 2 additions & 1 deletion packages/build-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The preset provides:
- `check`, `build`, and `test` tasks, ordered after their prerequisites.
- Unbundled ESM, declarations, and source maps in `lib` through `vp pack`.
- Vitest discovery under `src`, with package-specific test options.
- TypeScript path resolution through `resolve.tsconfigPaths` for libraries and apps.
- Strict TypeScript settings targeting ES2022, with Node and DOM types.

Apps use `defineAppConfig` from the same package. It provides check/build/test/dev
Expand All @@ -31,7 +32,7 @@ plugins and app-specific settings in the caller. Apps can extend
TanStack Start apps use `@party-stack/tanstack-start-build-config` for framework
plugins, React Compiler, Tailwind, and the app TSConfig together.

Package options override the defaults. Individual task options are merged;
Package options override the defaults. Resolve and individual task options are merged;
arrays and task cache options replace their defaults. Lint and formatting remain
in the workspace root.

Expand Down
19 changes: 19 additions & 0 deletions packages/build-config/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
import { describe, expect, it } from "vite-plus/test";
import { defineAppConfig, defineLibraryConfig } from "./index.js";

describe.each([
["library", defineLibraryConfig],
["app", defineAppConfig],
] as const)("%s resolution defaults", (_name, defineConfig) => {
it("enables tsconfig paths by default", () => {
expect(defineConfig().resolve?.tsconfigPaths).toBe(true);
});

it("preserves tsconfig paths with caller aliases", () => {
const alias = { "@app": "/src" };
expect(defineConfig({ resolve: { alias } }).resolve).toEqual({ tsconfigPaths: true, alias });
});

it("allows callers to disable tsconfig paths", () => {
expect(defineConfig({ resolve: { tsconfigPaths: false } }).resolve?.tsconfigPaths).toBe(false);
expect(defineConfig().resolve?.tsconfigPaths).toBe(true);
});
});

describe("library config composition", () => {
it("keeps prerequisites and packaging when a package overrides its commands", () => {
const config = defineLibraryConfig({
Expand Down
3 changes: 3 additions & 0 deletions packages/build-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type LibraryConfig = Omit<ViteUserConfig, "run"> & {
*/
export function defineLibraryConfig(config: LibraryConfig = {}): ViteUserConfig {
const base = defineConfig({
resolve: { tsconfigPaths: true },
run: {
tasks: {
check: {
Expand Down Expand Up @@ -64,6 +65,7 @@ export type AppConfig = LibraryConfig;
export function defineAppConfig(config: AppConfig = {}): ViteUserConfig {
return composeConfig(
defineConfig({
resolve: { tsconfigPaths: true },
run: {
tasks: {
check: {
Expand Down Expand Up @@ -110,6 +112,7 @@ function composeConfig(base: ViteUserConfig, config: LibraryConfig): ViteUserCon
return {
...base,
...config,
resolve: { ...base.resolve, ...config.resolve },
...(base.pack || config.pack
? {
pack: Array.isArray(config.pack)
Expand Down
1 change: 1 addition & 0 deletions packages/tanstack-start-build-config/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe("TanStack Start config", () => {
expect(config.plugins?.[1]).toEqual({ name: "worktreeDev" });
expect(devtools).toHaveBeenCalledWith({ consolePiping: { enabled: false } });
expect(config.server).toEqual({ port: 3000 });
expect(config.resolve?.tsconfigPaths).toBe(true);
expect(config.build).toMatchObject({ sourcemap: true });
expect(config.run?.tasks?.dev).toMatchObject({
command: "vp dev --host",
Expand Down
1 change: 0 additions & 1 deletion packages/tanstack-start-build-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export function defineAppConfig(config: TanStackStartConfig = {}): ViteUserConfi
const { start, plugins, worktreeDev: worktreeDevOptions, ...appConfig } = config;
return defineBaseAppConfig({
...appConfig,
resolve: { tsconfigPaths: true, ...appConfig.resolve },
plugins: lazyPlugins(() => [
plugins,
worktreeDevOptions !== false && worktreeDev(worktreeDevOptions),
Expand Down
Loading