Skip to content

Commit 804d04c

Browse files
committed
moving test config up
1 parent 4d0800a commit 804d04c

File tree

5 files changed

+42
-48
lines changed

5 files changed

+42
-48
lines changed

dist/index.js

Lines changed: 18 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addOpenSCADPlugin } from "../../dist/index.js";
1+
import { addOpenSCADPlugin } from "./dist/index.js";
22

33
/**
44
* Testing & Development Config
@@ -7,13 +7,12 @@ import { addOpenSCADPlugin } from "../../dist/index.js";
77
*/
88
export default function (eleventyConfig) {
99
eleventyConfig.setQuietMode(false);
10-
eleventyConfig.setInputDirectory("input");
11-
eleventyConfig.setOutputDirectory("output");
12-
eleventyConfig.addWatchTarget("../../dist/**/*");
10+
eleventyConfig.setInputDirectory("test/_11ty/input");
11+
eleventyConfig.setOutputDirectory("test/_11ty/output");
12+
eleventyConfig.addWatchTarget("dist/**/*");
1313

1414
addOpenSCADPlugin(eleventyConfig, {
1515
launchPath: "nightly",
1616
verbose: true,
17-
collectionPage: true,
1817
});
1918
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"dev": "pnpm build --watch ./src",
3636
"bump": "bumpp",
3737
"release": "bumpp && npm publish",
38-
"start": "cd ./test/_11ty && DEBUG=eleventy:scad* pnpx @11ty/eleventy --serve",
38+
"start": "DEBUG=eleventy:scad* eleventy --serve",
3939
"test": "vitest",
4040
"typecheck": "tsc --noEmit"
4141
},

src/core/scad-bin.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import debug from "../lib/debug";
1+
import Debug from "../lib/debug";
22
import type { PlatformMap } from "../types";
33

4+
const debug = Debug.extend("bin");
5+
46
/**
57
* Default OpenSCAD install locations
68
*
@@ -47,12 +49,11 @@ export function autoBinPath(
4749
platform: NodeJS.Platform,
4850
binType: null | "auto" | "nightly" = "auto",
4951
) {
50-
const log = debug.extend("bin");
5152
const binMap = binType === "nightly" ? SCAD_BIN_NIGHTLY : SCAD_BIN;
5253
const bin = binMap[platform as keyof PlatformMap];
5354
const retVal = typeof bin === "string" ? bin : null;
54-
log("platform: %s", platform);
55-
log("binType: %s", binType);
56-
log("output: %s", retVal);
55+
debug("platform: %s", platform);
56+
debug("binType: %s", binType);
57+
debug("output: %s", retVal);
5758
return retVal;
5859
}

src/core/scad2stl.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import { spawn } from "node:child_process";
2-
import { debug } from "../lib";
2+
import Debug from "../lib/debug";
33

4-
type ScadExportResult = {
5-
output: string[];
6-
ok: boolean;
7-
};
8-
9-
let workerId = 0;
4+
const debug = Debug.extend("scad2stl");
105

116
/**
127
* Generate an `.stl` from a given `.scad` file
@@ -15,11 +10,8 @@ export async function scad2stl(
1510
launchPath: string,
1611
files: { in: string; out: string },
1712
): Promise<ScadExportResult> {
18-
const debugWorker = debug.extend(`worker${workerId++}`);
19-
20-
// debugWorker("spawned %s", launchPath);
21-
debugWorker("input: %s", files.in);
22-
debugWorker("output: %s", files.out);
13+
debug("input: %s", files.in);
14+
debug("output: %s", files.out);
2315

2416
const { promise, resolve, reject } =
2517
Promise.withResolvers<ScadExportResult>();
@@ -28,12 +20,12 @@ export async function scad2stl(
2820
const output: string[] = [];
2921

3022
scad.stdout.on("data", (data) => {
31-
debugWorker("[stdout] %s", data.toString());
23+
debug("[stdout] %s", data.toString());
3224
});
3325

3426
scad.stderr.on("data", (data) => {
35-
const lines = String(data).split("\n");
36-
// lines.forEach((line) => void debugWorker("[stderr] %s", line));
27+
// const lines = String(data).split("\n");
28+
// lines.forEach((line) => void debug("[stderr] %s", line));
3729
output.push(data.toString());
3830
});
3931

@@ -42,9 +34,14 @@ export async function scad2stl(
4234
});
4335

4436
scad.on("close", (exitCode) => {
45-
debugWorker("process closed");
37+
// debug("done");
4638
resolve({ output, ok: exitCode === 0 });
4739
});
4840

4941
return promise;
5042
}
43+
44+
type ScadExportResult = {
45+
output: string[];
46+
ok: boolean;
47+
};

0 commit comments

Comments
 (0)