Skip to content

Commit

Permalink
--root option (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock authored Jan 3, 2024
1 parent 2a65840 commit 0c355cd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions bin/observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import {readConfig} from "../src/config.js";
const command = process.argv.splice(2, 1)[0];

const CONFIG_OPTION = {
root: {
type: "string"
},
config: {
type: "string",
short: "c"
Expand All @@ -20,25 +23,25 @@ switch (command) {
}
case "build": {
const {
values: {config}
values: {config, root}
} = helpArgs(command, {
options: {...CONFIG_OPTION}
});
await import("../src/build.js").then(async (build) => build.build({config: await readConfig(config)}));
await import("../src/build.js").then(async (build) => build.build({config: await readConfig(config, root)}));
break;
}
case "deploy": {
const {
values: {config}
values: {config, root}
} = helpArgs(command, {
options: {...CONFIG_OPTION}
});
await import("../src/deploy.js").then(async (deploy) => deploy.deploy({config: await readConfig(config)}));
await import("../src/deploy.js").then(async (deploy) => deploy.deploy({config: await readConfig(config, root)}));
break;
}
case "preview": {
const {
values: {config, hostname, port}
values: {config, root, hostname, port}
} = helpArgs(command, {
options: {
...CONFIG_OPTION,
Expand All @@ -56,7 +59,7 @@ switch (command) {
});
await import("../src/preview.js").then(async (preview) =>
preview.preview({
config: await readConfig(config),
config: await readConfig(config, root),
hostname: hostname!,
port: port === undefined ? undefined : +port
})
Expand Down

0 comments on commit 0c355cd

Please sign in to comment.