Skip to content

Commit

Permalink
fixed command options
Browse files Browse the repository at this point in the history
Commander expects -- before option names for long command names.

It also does not support multiple long option names, like
"--local" and "--noGenTestData"

tj/commander.js#479
  • Loading branch information
jwartofsky-yext committed Jul 13, 2023
1 parent f0a87e6 commit cb4aa6b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/pages/src/build/build.ts
Expand Up @@ -6,7 +6,7 @@ export const buildCommand = (program: Command) => {
.command("build")
.description("Build site using Vite")
.option(
"scope <string>",
"--scope <string>",
"The subfolder to scope the served templates from"
)
.action(async (options) => {
Expand Down
22 changes: 16 additions & 6 deletions packages/pages/src/dev/dev.ts
Expand Up @@ -12,23 +12,33 @@ export const devCommand = (program: Command) => {
"Creates features.json, generates test data, " +
"and runs a custom local development server that is backed by Vite."
)
.option("local, noGenTestData", "Disables dynamically generated test data")
.option(
"scope <string>",
"--scope <string>",
"The subfolder to scope the served templates from"
)
.option("--local", "Disables dynamically generated test data")
.option(
"prod-url",
"--prod-url",
"Use production URLs, instead of /[template-name]/[external-id]",
true
)
.option(
"open-browser",
"--no-prod-url",
"Use local URLs, such as /[template-name]/[external-id]",
false
)
.option(
"--open-browser",
"Automatically opens the browser on server start-up",
true
)
.option("noInit", "Disables automatic yext init with .yextrc file")
.option("noGenFeatures", "Disable feature.json generation step")
.option(
"--no-open-browser",
"Do not open the browser on server start-up",
false
)
.option("--noInit", "Disables automatic yext init with .yextrc file")
.option("--noGenFeatures", "Disable feature.json generation step")
.action(async (options) => {
if (!options.noInit) {
await autoYextInit();
Expand Down
2 changes: 1 addition & 1 deletion packages/pages/src/generate/ci/ci.ts
Expand Up @@ -12,7 +12,7 @@ export const ciCommand = (program: Command) => {
.command("ci")
.description("Generates ci.json file")
.option(
"scope <string>",
"--scope <string>",
"The subfolder to scope the served templates from"
)
.action((options, command) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/pages/src/generate/features/features.ts
Expand Up @@ -11,7 +11,7 @@ export const featureCommand = (program: Command) => {
.command("features")
.description("Generates features.json file")
.option(
"scope <string>",
"--scope <string>",
"The subfolder to scope the served templates from"
)
.action(async (options, command) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/pages/src/prod/prod.ts
Expand Up @@ -5,8 +5,8 @@ export const prodCommand = (program: Command) => {
program
.command("prod")
.description("Runs a custom local production server")
.option("noBuild", "Disable build step")
.option("noRender", "Disable render step")
.option("--noBuild", "Disable build step")
.option("--noRender", "Disable render step")
.action(async (options) => {
const commandName = "yext pages";
if (!options.noBuild) await runSubprocess(commandName, ["build"]);
Expand Down

0 comments on commit cb4aa6b

Please sign in to comment.