Skip to content

Commit bf2f769

Browse files
layershifterclaude
andcommitted
refactor(core,react,shadow-dom,style-types): replace rollup with tsc for builds
Replace @nx/rollup:rollup executor with dual tsc builds (ESM + CJS) for the four browser packages. Uses composite project references to handle cross-package dependencies. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 832ca3b commit bf2f769

16 files changed

Lines changed: 143 additions & 117 deletions

packages/core/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"url": "https://github.com/microsoft/griffel"
99
},
1010
"sideEffects": false,
11+
"main": "./cjs/index.js",
12+
"module": "./index.js",
13+
"types": "./index.d.ts",
1114
"dependencies": {
1215
"@emotion/hash": "^0.9.0",
1316
"@griffel/style-types": "^1.3.0",

packages/core/project.json

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,19 @@
66
"tags": [],
77
"targets": {
88
"build": {
9-
"executor": "@nx/rollup:rollup",
10-
"outputs": ["{options.outputPath}"],
9+
"dependsOn": ["^build"],
10+
"executor": "nx:run-commands",
11+
"outputs": ["{workspaceRoot}/dist/packages/core"],
1112
"options": {
12-
"outputPath": "dist/packages/core",
13-
"tsConfig": "packages/core/tsconfig.lib.json",
14-
"skipTypeField": true,
15-
"skipTypeCheck": true,
16-
"project": "packages/core/package.json",
17-
"entryFile": "packages/core/src/index.ts",
18-
"useLegacyTypescriptPlugin": true,
19-
"rollupConfig": "tools/getRollupOptions.js",
20-
"compiler": "babel",
21-
"sourceMap": true,
22-
"external": ["tslib"],
23-
"format": ["esm", "cjs"],
24-
"assets": [
25-
{
26-
"glob": "packages/core/README.md",
27-
"input": ".",
28-
"output": "."
29-
},
30-
{
31-
"glob": "LICENSE.md",
32-
"input": ".",
33-
"output": "."
34-
}
35-
]
13+
"cwd": "packages/core",
14+
"commands": [
15+
"tsc -b tsconfig.lib.json --pretty",
16+
"tsc -b tsconfig.lib.cjs.json --pretty",
17+
"cp package.json ../../dist/packages/core/package.json",
18+
"cp README.md ../../dist/packages/core/README.md",
19+
"cp ../../LICENSE.md ../../dist/packages/core/LICENSE.md"
20+
],
21+
"parallel": false
3622
}
3723
},
3824
"lint": {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "./tsconfig.lib.json",
3+
"compilerOptions": {
4+
"module": "node16",
5+
"moduleResolution": "node16",
6+
"outDir": "../../dist/packages/core/cjs",
7+
"tsBuildInfoFile": "../../dist/packages/core/cjs/tsconfig.lib.cjs.tsbuildinfo",
8+
"sourceMap": false
9+
},
10+
"references": [{ "path": "../style-types/tsconfig.lib.cjs.json" }]
11+
}

packages/core/tsconfig.lib.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
{
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "../../dist/out-tsc",
4+
"composite": true,
5+
"outDir": "../../dist/packages/core",
6+
"tsBuildInfoFile": "../../dist/packages/core/tsconfig.lib.tsbuildinfo",
7+
"rootDir": "./src",
8+
"declaration": true,
9+
"declarationMap": true,
510
"types": ["node", "environment"]
611
},
712
"exclude": [
13+
"dist",
814
"**/*.spec.ts",
915
"**/*.test.ts",
1016
"**/*.spec.tsx",
@@ -15,5 +21,6 @@
1521
"**/*.test.jsx",
1622
"jest.config.ts"
1723
],
18-
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
24+
"include": ["src/**/*.ts", "src/**/*.tsx"],
25+
"references": [{ "path": "../style-types/tsconfig.lib.json" }]
1926
}

packages/react/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"url": "https://github.com/microsoft/griffel"
99
},
1010
"sideEffects": false,
11+
"main": "./cjs/index.js",
12+
"module": "./index.js",
13+
"types": "./index.d.ts",
1114
"wyw-in-js": {
1215
"tags": {
1316
"makeStyles": "@griffel/tag-processor/make-styles",

packages/react/project.json

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,19 @@
66
"tags": [],
77
"targets": {
88
"build": {
9-
"executor": "@nx/rollup:rollup",
10-
"outputs": ["{options.outputPath}"],
9+
"dependsOn": ["^build"],
10+
"executor": "nx:run-commands",
11+
"outputs": ["{workspaceRoot}/dist/packages/react"],
1112
"options": {
12-
"outputPath": "dist/packages/react",
13-
"tsConfig": "packages/react/tsconfig.lib.json",
14-
"skipTypeField": true,
15-
"skipTypeCheck": true,
16-
"project": "packages/react/package.json",
17-
"entryFile": "packages/react/src/index.ts",
18-
"compiler": "babel",
19-
"sourceMap": true,
20-
"useLegacyTypescriptPlugin": true,
21-
"rollupConfig": ["@nx/react/plugins/bundle-rollup", "tools/getRollupOptions.js"],
22-
"external": ["tslib"],
23-
"format": ["esm", "cjs"],
24-
"assets": [
25-
{
26-
"glob": "packages/react/README.md",
27-
"input": ".",
28-
"output": "."
29-
},
30-
{
31-
"glob": "LICENSE.md",
32-
"input": ".",
33-
"output": "."
34-
}
35-
]
13+
"cwd": "packages/react",
14+
"commands": [
15+
"tsc -b tsconfig.lib.json --pretty",
16+
"tsc -b tsconfig.lib.cjs.json --pretty",
17+
"cp package.json ../../dist/packages/react/package.json",
18+
"cp README.md ../../dist/packages/react/README.md",
19+
"cp ../../LICENSE.md ../../dist/packages/react/LICENSE.md"
20+
],
21+
"parallel": false
3622
}
3723
},
3824
"lint": {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "./tsconfig.lib.json",
3+
"compilerOptions": {
4+
"module": "node16",
5+
"moduleResolution": "node16",
6+
"outDir": "../../dist/packages/react/cjs",
7+
"tsBuildInfoFile": "../../dist/packages/react/cjs/tsconfig.lib.cjs.tsbuildinfo",
8+
"sourceMap": false
9+
},
10+
"references": [{ "path": "../core/tsconfig.lib.cjs.json" }]
11+
}

packages/react/tsconfig.lib.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
{
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "../../dist/out-tsc",
4+
"composite": true,
5+
"outDir": "../../dist/packages/react",
6+
"tsBuildInfoFile": "../../dist/packages/react/tsconfig.lib.tsbuildinfo",
7+
"rootDir": "./src",
8+
"declaration": true,
9+
"declarationMap": true,
510
"types": ["node", "environment"]
611
},
712
"exclude": [
13+
"dist",
814
"**/*.spec.ts",
915
"**/*.test.ts",
1016
"**/*.spec.tsx",
@@ -19,5 +25,6 @@
1925
"**/*.stories.tsx",
2026
"jest.config.ts"
2127
],
22-
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
28+
"include": ["src/**/*.ts", "src/**/*.tsx"],
29+
"references": [{ "path": "../core/tsconfig.lib.json" }]
2330
}

packages/shadow-dom/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"url": "https://github.com/microsoft/griffel"
99
},
1010
"sideEffects": false,
11+
"main": "./cjs/index.js",
12+
"module": "./index.js",
13+
"types": "./index.d.ts",
1114
"dependencies": {
1215
"@griffel/core": "^1.19.2",
1316
"tslib": "^2.1.0"

packages/shadow-dom/project.json

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,19 @@
66
"tags": [],
77
"targets": {
88
"build": {
9-
"executor": "@nx/rollup:rollup",
10-
"outputs": ["{options.outputPath}"],
9+
"dependsOn": ["^build"],
10+
"executor": "nx:run-commands",
11+
"outputs": ["{workspaceRoot}/dist/packages/shadow-dom"],
1112
"options": {
12-
"outputPath": "dist/packages/shadow-dom",
13-
"tsConfig": "packages/shadow-dom/tsconfig.lib.json",
14-
"skipTypeField": true,
15-
"skipTypeCheck": true,
16-
"project": "packages/shadow-dom/package.json",
17-
"entryFile": "packages/shadow-dom/src/index.ts",
18-
"compiler": "babel",
19-
"sourceMap": true,
20-
"useLegacyTypescriptPlugin": true,
21-
"rollupConfig": ["@nx/react/plugins/bundle-rollup", "tools/getRollupOptions.js"],
22-
"external": ["tslib"],
23-
"format": ["esm", "cjs"],
24-
"assets": [
25-
{
26-
"glob": "packages/shadow-dom/README.md",
27-
"input": ".",
28-
"output": "."
29-
},
30-
{
31-
"glob": "LICENSE.md",
32-
"input": ".",
33-
"output": "."
34-
}
35-
]
13+
"cwd": "packages/shadow-dom",
14+
"commands": [
15+
"tsc -b tsconfig.lib.json --pretty",
16+
"tsc -b tsconfig.lib.cjs.json --pretty",
17+
"cp package.json ../../dist/packages/shadow-dom/package.json",
18+
"cp README.md ../../dist/packages/shadow-dom/README.md",
19+
"cp ../../LICENSE.md ../../dist/packages/shadow-dom/LICENSE.md"
20+
],
21+
"parallel": false
3622
}
3723
},
3824
"lint": {

0 commit comments

Comments
 (0)