fix: the declarations of the published package import the other declarations by their .js names.
Release / release (push) Successful in 28s

This commit is contained in:
slawek committed 2026-10-28 19:25:09 +01:00
1 parent 4505b37abc
commit 57ac5296cb
4 files changed
+20 -4

No files matched your search

+8
View File
@@ -1,5 +1,13 @@
# Changelog # Changelog
## 0.1.1
fix: the declarations of the published package import the other declarations by their .js names.
- The `.d.ts` files of the package name the files they import as `.js`, as the compiled
JavaScript does, instead of the `.ts` and `.tsx` files of the source, which the package does not
hold.
## 0.1.0 ## 0.1.0
feature: sk-react-toolkit holds the server helpers, web components and Vite font plugin shared by manage-ui and sql-query-webui. feature: sk-react-toolkit holds the server helpers, web components and Vite font plugin shared by manage-ui and sql-query-webui.
+9 -1
View File
@@ -4,7 +4,7 @@
// the font plugin's virtual module, README.md, CHANGELOG.md and a package.json whose exports name the compiled files. // the font plugin's virtual module, README.md, CHANGELOG.md and a package.json whose exports name the compiled files.
import { spawnSync } from 'node:child_process'; import { spawnSync } from 'node:child_process';
import { copyFileSync, readFileSync, rmSync, writeFileSync } from 'node:fs'; import { copyFileSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { join } from 'node:path'; import { join } from 'node:path';
const ROOT = import.meta.dirname; const ROOT = import.meta.dirname;
@@ -21,6 +21,14 @@ const tsc = spawnSync(join(ROOT, 'node_modules', '.bin', 'tsc'), ['-p', join(ROO
if (tsc.error) fail(`tsc: ${tsc.error.message}; run npm ci first`); if (tsc.error) fail(`tsc: ${tsc.error.message}; run npm ci first`);
if (tsc.status !== 0) process.exit(tsc.status ?? 1); if (tsc.status !== 0) process.exit(tsc.status ?? 1);
// The declarations import the other declarations by their .js names, as the compiled JavaScript does.
for (const entry of ENTRIES) {
for (const file of readdirSync(join(DIST, entry)).filter((name) => name.endsWith('.d.ts'))) {
const path = join(DIST, entry, file);
writeFileSync(path, readFileSync(path, 'utf8').replace(/(from\s+|import\s+)(['"])(\.{1,2}\/[^'"]+)\.tsx?\2/g, '$1$2$3.js$2'));
}
}
// The compiled renderApp keeps its import of virtual:font, so its declarations reference the module's declaration. // The compiled renderApp keeps its import of virtual:font, so its declarations reference the module's declaration.
copyFileSync(join(ROOT, 'web', 'virtual-font.d.ts'), join(DIST, 'web', 'virtual-font.d.ts')); copyFileSync(join(ROOT, 'web', 'virtual-font.d.ts'), join(DIST, 'web', 'virtual-font.d.ts'));
const renderApp = join(DIST, 'web', 'renderApp.d.ts'); const renderApp = join(DIST, 'web', 'renderApp.d.ts');
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "@koszewscy/sk-react-toolkit", "name": "@koszewscy/sk-react-toolkit",
"version": "0.1.0", "version": "0.1.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@koszewscy/sk-react-toolkit", "name": "@koszewscy/sk-react-toolkit",
"version": "0.1.0", "version": "0.1.1",
"devDependencies": { "devDependencies": {
"@emotion/react": "^11.14.0", "@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1", "@emotion/styled": "^11.14.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@koszewscy/sk-react-toolkit", "name": "@koszewscy/sk-react-toolkit",
"version": "0.1.0", "version": "0.1.1",
"description": "Shared code of the React and Fastify web applications: web components, server helpers and the Vite font plugin.", "description": "Shared code of the React and Fastify web applications: web components, server helpers and the Vite font plugin.",
"private": true, "private": true,
"type": "module", "type": "module",