Skip to content

Commit f11d90f

Browse files
authored
chore: adjust ui-components publishing (#8620)
* chore: adjust ui-components publishing * chore: normalize moduleResolution casing * chore: make compile:watch cross-platform * chore: missing pnpm-lock updates * meta: updated readme Added local development instructions for using the package via npm link. Signed-off-by: Claudio Wunder <cwunder@gnome.org> --------- Signed-off-by: Claudio Wunder <cwunder@gnome.org>
1 parent d2e5cd2 commit f11d90f

File tree

8 files changed

+128
-61
lines changed

8 files changed

+128
-61
lines changed

.github/workflows/publish-packages.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,11 @@ jobs:
116116
# Check if a custom publish script exists in package.json
117117
if jq -e '.scripts.release' package.json > /dev/null; then
118118
pnpm run release
119-
else
120-
pnpm publish --access public --no-git-checks
121119
fi
122120
121+
# Then publish the package to npm
122+
pnpm publish --access public --no-git-checks
123+
123124
- name: Notify on Manual Release
124125
if: ${{ github.event_name == 'workflow_dispatch' }}
125126
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # 2.3.3

apps/site/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"esModuleInterop": true,
1111
"module": "esnext",
1212
"moduleResolution": "Bundler",
13+
"customConditions": ["default"],
1314
"resolveJsonModule": true,
1415
"isolatedModules": true,
1516
"jsx": "react-jsx",

packages/i18n/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"forceConsistentCasingInFileNames": true,
99
"esModuleInterop": true,
1010
"module": "esnext",
11-
"moduleResolution": "Bundler",
11+
"moduleResolution": "bundler",
1212
"resolveJsonModule": true,
1313
"isolatedModules": true,
1414
"incremental": true,

packages/ui-components/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,23 @@ The components are based on [this design file](https://www.figma.com/design/a10c
88
Most components in this package are available on [Chromatic](https://www.chromatic.com/library?appId=64c7d71358830e9105808652).
99

1010
For additional details regarding specific components, refer to the [nodejs/nodejs.org](https://github.com/nodejs/nodejs.org) repository.
11+
12+
## Local development
13+
14+
To use this package via `npm link` in another repo (for example, doc-kit), build the
15+
compiled outputs and keep them updated while you work.
16+
17+
```bash
18+
# From nodejs.org/packages/ui-components
19+
pnpm install
20+
node --run compile:watch
21+
22+
# In another terminal, still in nodejs.org/packages/ui-components
23+
npm link
24+
25+
# From the consumer repo (for example doc-kit)
26+
npm link @node-core/ui-components
27+
```
28+
29+
The `compile:watch` script keeps `dist/` up to date so consumers resolve compiled
30+
CSS and JavaScript instead of the raw Tailwind source.

packages/ui-components/package.json

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
"version": "1.5.10",
44
"type": "module",
55
"exports": {
6-
"./*": [
7-
"./src/*",
8-
"./src/*.tsx",
9-
"./src/*/index.tsx",
10-
"./src/*.ts",
11-
"./src/*/index.ts"
12-
]
6+
"./*": {
7+
"rolldown": [
8+
"./dist/*",
9+
"./dist/*.js",
10+
"./dist/*/index.js"
11+
],
12+
"default": [
13+
"./src/*",
14+
"./src/*.tsx",
15+
"./src/*/index.tsx",
16+
"./src/*.ts",
17+
"./src/*/index.ts"
18+
]
19+
}
1320
},
1421
"repository": {
1522
"type": "git",
@@ -20,7 +27,8 @@
2027
"compile:ts": "tsc",
2128
"compile:css": "postcss --dir dist --base src \"src/**/*.module.css\" src/styles/index.css",
2229
"compile": "node --run compile:ts && node --run compile:css",
23-
"release": "node --run compile && node scripts/publish.mjs",
30+
"compile:watch": "concurrently -k \"node --run compile:ts -- --watch\" \"node --run compile:css -- --watch\"",
31+
"release": "node --run compile",
2432
"lint": "node --run lint:js && node --run lint:css",
2533
"lint:css": "stylelint \"**/*.css\" --allow-empty-input --cache --cache-strategy=content --cache-location=.stylelintcache",
2634
"lint:css:fix": "node --run lint:css -- --fix",
@@ -61,6 +69,7 @@
6169
"@types/node": "catalog:",
6270
"@types/react": "catalog:",
6371
"cross-env": "catalog:",
72+
"concurrently": "^8.2.2",
6473
"css-loader": "~7.1.2",
6574
"eslint-plugin-react": "~7.37.5",
6675
"eslint-plugin-react-hooks": "^7.0.1",
@@ -80,14 +89,25 @@
8089
"typescript": "catalog:"
8190
},
8291
"imports": {
83-
"#ui/*": [
84-
"./src/*",
85-
"./src/*.tsx",
86-
"./src/*/index.tsx",
87-
"./src/*.ts",
88-
"./src/*/index.ts"
89-
]
92+
"#ui/*": {
93+
"rolldown": [
94+
"./dist/*",
95+
"./dist/*.js",
96+
"./dist/*/index.js"
97+
],
98+
"default": [
99+
"./src/*",
100+
"./src/*.tsx",
101+
"./src/*/index.tsx",
102+
"./src/*.ts",
103+
"./src/*/index.ts"
104+
]
105+
}
90106
},
107+
"files": [
108+
"dist/**",
109+
"README.md"
110+
],
91111
"engines": {
92112
"node": ">=20"
93113
}

packages/ui-components/scripts/publish.mjs

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

packages/ui-components/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
"forceConsistentCasingInFileNames": true,
99
"esModuleInterop": true,
1010
"module": "esnext",
11-
"moduleResolution": "Bundler",
11+
"moduleResolution": "bundler",
12+
"customConditions": ["default"],
1213
"resolveJsonModule": true,
1314
"isolatedModules": true,
1415
"jsx": "react-jsx",
16+
"declaration": true,
1517
"incremental": true,
1618
"baseUrl": "./src",
1719
"rootDir": "./src",

0 commit comments

Comments
 (0)