Skip to content

Commit a0e89f0

Browse files
authored
chore(bindings/node): Add README.md (#10402)
1 parent 12c2807 commit a0e89f0

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"scripts": {
4949
"postinstall": "node postinstall.js",
5050
"artifacts": "napi artifacts --npm-dir scripts/npm",
51-
"prepack": "tsc -d && napi prepublish -p scripts/npm --tag-style npm",
51+
"prepack": "tsc -d && napi prepublish -p scripts/npm --tag-style npm && node scripts/copy-readme.js",
5252
"pack": "wasm-pack",
5353
"build:ts": "tsc -d",
5454
"build:wasm": "npm-run-all \"pack -- build ../../bindings/binding_core_wasm --scope swc {1} -t {2} --features plugin\" --",

packages/core/scripts/copy-readme.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* This script copies the README.md from the repository root to the packages/core directory
3+
* to ensure it's properly included in the npm package.
4+
*/
5+
const fs = require('fs');
6+
const path = require('path');
7+
8+
// Path to the project root README.md and the packages/core README.md
9+
const rootReadmePath = path.resolve(__dirname, '../../../README.md');
10+
const packageReadmePath = path.resolve(__dirname, '../README.md');
11+
12+
try {
13+
// Check if root README exists
14+
if (!fs.existsSync(rootReadmePath)) {
15+
console.error('Root README.md does not exist:', rootReadmePath);
16+
process.exit(1);
17+
}
18+
19+
// Copy the README.md file
20+
fs.copyFileSync(rootReadmePath, packageReadmePath);
21+
console.log('Successfully copied README.md to packages/core for npm publishing.');
22+
} catch (error) {
23+
console.error('Error copying README.md:', error);
24+
process.exit(1);
25+
}

0 commit comments

Comments
 (0)