Skip to content

Commit e1bdfd7

Browse files
committed
Fix CJS build, add README to dist folder
1 parent ebfaae2 commit e1bdfd7

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

scripts/prepare-publish.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ const main = async () => {
7676

7777
const licensePath = path.join(rootDir, "LICENSE");
7878
await copyFile(licensePath, path.join(distDir, "LICENSE"));
79+
80+
const readmePath = path.join(rootDir, "README.md");
81+
try {
82+
await copyFile(readmePath, path.join(distDir, "README.md"));
83+
} catch (error) {
84+
if (error && error.code === "ENOENT") {
85+
console.warn("README.md not found; skipping copy to dist.");
86+
} else {
87+
throw error;
88+
}
89+
}
7990
};
8091

8192
main().catch((error) => {

tsconfig.cjs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"extends": "./tsconfig.json",
44
"compilerOptions": {
55
"outDir": "dist/cjs",
6-
"module": "NodeNext"
6+
"module": "CommonJS",
7+
"moduleResolution": "Node10"
78
},
89
"include": ["src/*.ts", "src/**/*.ts"]
910
}

0 commit comments

Comments
 (0)