Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57ac5296cb |
No files matched your search
@@ -1,5 +1,13 @@
|
||||
# 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
|
||||
|
||||
feature: sk-react-toolkit holds the server helpers, web components and Vite font plugin shared by manage-ui and sql-query-webui.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// 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 { copyFileSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
||||
import { copyFileSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
|
||||
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.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.
|
||||
copyFileSync(join(ROOT, 'web', 'virtual-font.d.ts'), join(DIST, 'web', 'virtual-font.d.ts'));
|
||||
const renderApp = join(DIST, 'web', 'renderApp.d.ts');
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@koszewscy/sk-react-toolkit",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@koszewscy/sk-react-toolkit",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"devDependencies": {
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@emotion/styled": "^11.14.1",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"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.",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
Reference in new issue
Block a user