Skip to content

Commit 6cb9b92

Browse files
jonphippsclaude
andcommitted
refactor: improve TypeScript configuration and build system
- Update Nx Cloud ID for workspace integration - Add CSS module type definitions for theme package - Fix theme package test imports and TypeScript config - Add composite project setup with proper references - Remove outdated scaffold template configuration - Add typecheck targets to all standard sites - Standardize tsconfig.json across all projects - Configure separate TypeScript declaration generation - Fix workspace-level declaration file output structure 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent e8b0bfb commit 6cb9b92

File tree

23 files changed

+307
-158
lines changed

23 files changed

+307
-158
lines changed

nx.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
}
149149
}
150150
],
151-
"nxCloudId": "686155f6ee99673f43464d29",
151+
"nxCloudId": "6857fccbb755d4191ce6fbe4",
152152
"defaultBase": "dev",
153153
"affected": {
154154
"defaultBase": "dev"

packages/theme/project.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,20 @@
88
"build": {
99
"executor": "nx:run-commands",
1010
"options": {
11-
"command": "pnpm exec tsup",
12-
"cwd": "packages/theme"
11+
"commands": [
12+
"pnpm exec tsup",
13+
"tsc --project tsconfig.build.json"
14+
],
15+
"cwd": "packages/theme",
16+
"parallel": false
1317
},
1418
"outputs": ["{projectRoot}/dist"],
1519
"cache": true,
1620
"inputs": [
1721
"production",
1822
"{projectRoot}/src/**/*",
1923
"{projectRoot}/tsup.config.ts",
24+
"{projectRoot}/tsconfig.build.json",
2025
"{projectRoot}/package.json"
2126
]
2227
},

packages/theme/src/global.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.css' {
2+
const content: Record<string, string>;
3+
export default content;
4+
}

packages/theme/src/tests/fixtures/siteConfigs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Standard site configuration fixtures for testing
2-
import type { SiteConfig } from '@ifla/theme/config/siteConfig';
2+
import type { SiteConfig } from '../../config/siteConfig';
33

44
export const mockSiteConfig: Partial<SiteConfig> = {
55
title: 'Test Site',

packages/theme/tsconfig.build.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"declaration": true,
5+
"declarationMap": true,
6+
"emitDeclarationOnly": true,
7+
"outDir": "../../dist",
8+
"rootDir": "../../",
9+
"composite": true,
10+
"noEmit": false
11+
},
12+
"include": [
13+
"src/**/*"
14+
],
15+
"exclude": [
16+
"**/*.test.ts",
17+
"**/*.test.tsx",
18+
"**/*.spec.ts",
19+
"**/*.spec.tsx",
20+
"src/tests/**/*"
21+
]
22+
}

packages/theme/tsconfig.build.tsbuildinfo

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

packages/theme/tsconfig.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"rootDir": "../../",
5-
"baseUrl": "../../",
4+
"baseUrl": ".",
5+
"composite": true,
6+
"noEmit": false // Ensure this is not set to true
67
},
78
"include": [
8-
"src/**/*",
9+
"src/**/*"
910
],
1011
"exclude": [
1112
"node_modules",

packages/theme/tsup.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { defineConfig } from 'tsup';
22
import { sassPlugin, postcssModules } from 'esbuild-sass-plugin';
3+
import type { Plugin } from 'esbuild';
34

45
export default defineConfig({
56
entry: {
@@ -12,7 +13,8 @@ export default defineConfig({
1213
'config/siteConfig': 'src/config/siteConfig.ts',
1314
},
1415
format: ['esm', 'cjs'],
15-
dts: true,
16+
// Disable built-in DTS generation due to TypeScript project conflicts
17+
dts: false,
1618
splitting: false, // Disable code splitting to avoid bundling issues
1719
sourcemap: true,
1820
clean: true, // Clean output directory before build
@@ -32,7 +34,7 @@ export default defineConfig({
3234
'prism-react-renderer',
3335
],
3436
esbuildPlugins: [
35-
// Type assertion to work around version mismatch between tsup and esbuild
36-
sassPlugin({ transform: postcssModules({}) }) as any,
37+
// Properly type the sass plugin
38+
sassPlugin({ transform: postcssModules({}) }) as Plugin,
3739
],
3840
});

portal/tsconfig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
44
"baseUrl": ".",
5+
"composite": true,
6+
"tsBuildInfoFile": "./build/.tsbuildinfo",
57
"paths": {
68
"@ifla/theme": ["../packages/theme/src/index.ts"],
79
"@ifla/theme/*": ["../packages/theme/src/*"],
@@ -19,5 +21,8 @@
1921
"docusaurus.config.ts",
2022
"sidebars.ts",
2123
"navbar.ts"
24+
],
25+
"references": [
26+
{ "path": "../packages/theme" }
2227
]
2328
}

scripts/scaffold-template/docusaurus.config.ts

Lines changed: 0 additions & 148 deletions
This file was deleted.

0 commit comments

Comments
 (0)