Skip to content

Commit

Permalink
feat: outdir for compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
infodusha committed Jul 22, 2024
1 parent adfe095 commit 045d782
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"watch": "bun build ./src/index.ts --outdir ./dist --watch",
"build": "bun build ./src/index.ts --outdir ./dist",
"build:bin": "bun build ./src/bin.ts --target node --outdir ./dist",
"compile": "cd example && bun --bun ../src/bin.ts --outdir ./dist",
"compile": "cd example && bun --bun ../src/bin.ts",
"lint": "bunx biome lint",
"test": "playwright test",
"test:local": "playwright test --ui"
Expand Down
16 changes: 13 additions & 3 deletions src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@ import * as cheerio from "cheerio";

import { copyFile, mkdir, readFile, writeFile } from "node:fs/promises";
import { dirname, relative, resolve } from "node:path";
import { parseArgs } from "node:util";

import { commentMarker, componentSelector } from "./helpers";
import { commentMarker, componentSelector, returnIfDefined } from "./helpers";

// TODO get from args
const DIST_DIR = "./dist";
const options = {
outdir: {
type: "string",
short: "o",
default: "./dist",
},
} as const;

const { values } = parseArgs({ args: process.argv.slice(2), options });

const DIST_DIR = returnIfDefined(values.outdir);

const files = await fg("**/*.html", {
ignore: ["**/node_modules/**", `${DIST_DIR}/**`],
Expand Down

0 comments on commit 045d782

Please sign in to comment.