Skip to content

Commit 417dd15

Browse files
committed
fix: do not bundle with tsup
1 parent f58f8fa commit 417dd15

File tree

4 files changed

+8
-201
lines changed

4 files changed

+8
-201
lines changed

libvirt/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
"prepare": "pnpm run build",
1414
"build": "node scripts/conditional-build.js",
1515
"build/native": "node scripts/build-native.js",
16-
"build/stub": "tsup lib/stub.ts --dts",
17-
"build/ts": "tsup lib/index.ts --dts --format cjs --clean",
16+
"build/ts": "tsc",
1817
"test": "mocha -r ts-node/register lib/**/*.spec.ts",
1918
"examples/list": "node examples/list.js",
2019
"examples/start": "node examples/start.js",
@@ -73,7 +72,6 @@
7372
"gts": "^3.1.0",
7473
"mocha": "^10.2.0",
7574
"ts-node": "^10.0.0",
76-
"tsup": "^8.3.6",
7775
"typescript": "^4.3.2"
7876
},
7977
"os": ["linux", "darwin"],

libvirt/scripts/conditional-build.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const { spawnSync } = require("child_process");
22
const { platform } = require("os");
33
const fs = require("fs");
4+
const { exec } = require("child_process");
45

56
function runCommand(command, args, options = {}) {
67
const result = spawnSync(command, args, {
@@ -43,28 +44,10 @@ function checkLibvirt() {
4344

4445
async function build() {
4546
try {
46-
if (checkLibvirt()) {
47-
console.log("Building native bindings...");
48-
runCommand("pnpm", ["run", "build/native"]);
49-
50-
console.log("Building TypeScript...");
51-
runCommand("pnpm", ["run", "build/ts"]);
52-
} else {
53-
console.log(
54-
"Failed to install/find libvirt, building stub implementation..."
55-
);
56-
runCommand("pnpm", ["run", "build/stub"]);
57-
58-
if (fs.existsSync("dist/stub.d.ts")) {
59-
fs.copyFileSync("dist/stub.d.ts", "dist/index.d.ts");
60-
fs.copyFileSync("dist/stub.js", "dist/index.js");
61-
} else {
62-
console.error("Stub build failed to generate files");
63-
process.exit(1);
64-
}
65-
}
47+
await exec('pnpm run build/native');
48+
await exec('pnpm run build/ts');
6649
} catch (error) {
67-
console.error("Build failed:", error);
50+
console.error('Failed to build:', error);
6851
process.exit(1);
6952
}
7053
}

libvirt/tsconfig.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// "sourceMap": true, /* Generates corresponding '.map' file. */
1414
// "outFile": "./", /* Concatenate and emit output to single file. */
1515
"outDir": "./dist", /* Redirect output structure to the directory. */
16-
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
16+
"rootDir": "./lib",
1717
// "composite": true, /* Enable project compilation */
1818
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
1919
// "removeComments": true, /* Do not emit comments to output. */
@@ -64,9 +64,6 @@
6464
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
6565
"skipLibCheck": true
6666
},
67-
"include": [
68-
"lib/**/*",
69-
"scripts/**/*"
70-
],
71-
"exclude": ["node_modules", "**/*.spec.ts"]
67+
"include": ["lib/**/*"],
68+
"exclude": ["node_modules", "dist", "test", "examples"]
7269
}

pnpm-lock.yaml

Lines changed: 0 additions & 171 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)