Improve JSR package metadata

This commit is contained in:
2026-07-10 04:19:00 +09:00
parent 8eac5c5cb4
commit fc1f3e0b25
10 changed files with 213 additions and 19 deletions
@@ -1,4 +1,4 @@
import { writeFileSync } from 'node:fs';
import { readFileSync, writeFileSync } from 'node:fs';
import { resolve } from 'node:path';
const packageDir = resolve(import.meta.dirname, '../../../packages/decodal-wasm');
@@ -8,6 +8,11 @@ writeFileSync(
'# wasm-pack output is committed for the browser runtime package.\n',
);
const packageJsonPath = resolve(packageDir, 'package.json');
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
packageJson.version = '0.1.3';
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
writeFileSync(
resolve(packageDir, 'README.md'),
`# decodal-wasm
@@ -38,11 +43,8 @@ import init, { evaluateProject } from 'decodal-wasm';
await init();
const result = evaluateProject(JSON.stringify({
entry: 'main.dcdl',
files: {
'main.dcdl': 'Server = { port = Int default 8080; };',
},
const result = evaluateProject('main.dcdl', JSON.stringify({
'main.dcdl': 'Server = { port = Int default 8080; };',
}));
console.log(JSON.parse(result));
@@ -51,3 +53,27 @@ console.log(JSON.parse(result));
The exported functions return JSON strings so callers can handle diagnostics and successful results without depending on Rust data structures.
`,
);
writeFileSync(
resolve(packageDir, 'jsr.json'),
JSON.stringify(
{
name: '@hare/decodal-wasm',
version: '0.1.3',
license: 'MIT',
exports: './mod.ts',
publish: {
include: [
'README.md',
'mod.ts',
'decodal_wasm.js',
'decodal_wasm.d.ts',
'decodal_wasm_bg.wasm',
'package.json',
],
},
},
null,
2,
) + '\n',
);