Skip to content

Commit

Permalink
fix: command flags are kebab case, not camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
HipsterBrown committed Dec 22, 2024
1 parent df44e16 commit bce9e3f
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 50 deletions.
12 changes: 6 additions & 6 deletions src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface BuildOptions {
device?: Device
port?: string
example?: string
listExamples?: boolean
listDevices?: boolean
'list-examples'?: boolean
'list-devices'?: boolean
mode?: Mode
output?: string
deploy?: boolean
Expand All @@ -35,8 +35,8 @@ const command = buildCommand({
device = currentPlatform,
deploy = false,
example,
listExamples = false,
listDevices = false,
'list-examples': listExamples = false,
'list-devices': listDevices = false,
mode = (process.env.NODE_ENV as Mode) ?? 'development',
output,
port,
Expand Down Expand Up @@ -99,12 +99,12 @@ const command = buildCommand({
'Name of example project to run, use --list-examples to select from an interactive list',
optional: true,
},
listExamples: {
'list-examples': {
kind: 'boolean',
brief: 'Select an example project from an interactive list',
optional: true,
},
listDevices: {
'list-devices': {
kind: 'boolean',
brief: 'Select a target device or platform from an interactive list',
optional: true,
Expand Down
12 changes: 6 additions & 6 deletions src/commands/clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ type Mode = 'development' | 'production'
interface CleanOptions {
device?: Device
example?: string
listExamples?: boolean
listDevices?: boolean
'list-examples'?: boolean
'list-devices'?: boolean
mode?: Mode
output?: string
config?: string[]
Expand All @@ -32,8 +32,8 @@ const command = buildCommand({
const {
device = currentPlatform,
example,
listExamples = false,
listDevices = false,
'list-examples': listExamples = false,
'list-devices': listDevices = false,
mode = (process.env.NODE_ENV as Mode) ?? 'development',
output,
config = [],
Expand Down Expand Up @@ -89,12 +89,12 @@ const command = buildCommand({
'Name of example project to run, use --list-examples to select from an interactive list',
optional: true,
},
listExamples: {
'list-examples': {
kind: 'boolean',
brief: 'Select an example project from an interactive list',
optional: true,
},
listDevices: {
'list-devices': {
kind: 'boolean',
brief: 'Select a target device or platform from an interactive list',
optional: true,
Expand Down
12 changes: 6 additions & 6 deletions src/commands/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface DebugOptions {
device?: Device
port?: string
example?: string
listExamples?: boolean
listDevices?: boolean
'list-examples'?: boolean
'list-devices'?: boolean
log?: boolean
mode?: Mode
output?: string
Expand All @@ -33,8 +33,8 @@ const command = buildCommand({
device = currentPlatform,
port,
example,
listExamples = false,
listDevices = false,
'list-examples': listExamples = false,
'list-devices': listDevices = false,
log = false,
mode = (process.env.NODE_ENV as Mode) ?? 'development',
output,
Expand Down Expand Up @@ -84,12 +84,12 @@ const command = buildCommand({
'Name of example project to run, use --list-examples to select from an interactive list',
optional: true,
},
listExamples: {
'list-examples': {
kind: 'boolean',
brief: 'Select an example project from an interactive list',
optional: true,
},
listDevices: {
'list-devices': {
kind: 'boolean',
brief: 'Select a target device or platform from an interactive list',
optional: true,
Expand Down
28 changes: 14 additions & 14 deletions src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface InitOptions {
typescript?: boolean
io?: boolean
example?: string
listExamples?: boolean
'list-examples'?: boolean
overwrite?: boolean
asyncMain?: boolean
}
Expand All @@ -27,7 +27,7 @@ const command = buildCommand({
typescript = false,
io = false,
example,
listExamples = false,
'list-examples': listExamples = false,
overwrite = false,
asyncMain = false,
} = flags
Expand Down Expand Up @@ -59,14 +59,14 @@ const command = buildCommand({
const filteredChoices = choices.filter((choice) =>
choice.includes(String(example)),
)
;({ example: selectedExample } = await prompt.ask([
{
type: 'autocomplete',
name: 'example',
message: 'Here are the available examples templates:',
choices: filteredChoices.length > 0 ? filteredChoices : choices,
},
]))
; ({ example: selectedExample } = await prompt.ask([
{
type: 'autocomplete',
name: 'example',
message: 'Here are the available examples templates:',
choices: filteredChoices.length > 0 ? filteredChoices : choices,
},
]))
}

// copy files into new project directory
Expand All @@ -89,9 +89,9 @@ const command = buildCommand({
const includes = [
io
? [
'"$(MODDABLE)/modules/io/manifest.json"',
'"$(MODDABLE)/examples/manifest_net.json"',
]
'"$(MODDABLE)/modules/io/manifest.json"',
'"$(MODDABLE)/examples/manifest_net.json"',
]
: '"$(MODDABLE)/examples/manifest_base.json"',
typescript && '"$(MODDABLE)/examples/manifest_typings.json"',
]
Expand Down Expand Up @@ -157,7 +157,7 @@ const command = buildCommand({
parse: String,
optional: true,
},
listExamples: {
'list-examples': {
kind: 'boolean',
brief: 'Select an example project from the Moddable SDK',
optional: true,
Expand Down
12 changes: 6 additions & 6 deletions src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface RunOptions {
device?: Device
port?: string
example?: string
listExamples?: boolean
listDevices?: boolean
'list-examples'?: boolean
'list-devices'?: boolean
log?: boolean
mode?: Mode
output?: string
Expand All @@ -30,8 +30,8 @@ const command = buildCommand({
const {
device = currentPlatform,
example,
listExamples = false,
listDevices = false,
'list-examples': listExamples = false,
'list-devices': listDevices = false,
log = false,
mode = (process.env.NODE_ENV as Mode) ?? 'development',
output,
Expand Down Expand Up @@ -91,12 +91,12 @@ const command = buildCommand({
'Name of example project to run, use --list-examples to select from an interactive list',
optional: true,
},
listExamples: {
'list-examples': {
kind: 'boolean',
brief: 'Select an example project from an interactive list',
optional: true,
},
listDevices: {
'list-devices': {
kind: 'boolean',
brief: 'Select a target device or platform from an interactive list',
optional: true,
Expand Down
18 changes: 9 additions & 9 deletions src/commands/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import type { SetupArgs } from '../toolbox/setup/types'

interface SetupOptions {
device?: Device
listDevices?: boolean
'list-devices'?: boolean
tool?: 'ejectfix'
targetBranch?: SetupArgs['targetBranch']
sourceRepo?: string
'target-branch'?: SetupArgs['targetBranch']
'source-repo'?: string
}
const command = buildCommand({
docs: {
Expand All @@ -23,10 +23,10 @@ const command = buildCommand({
const currentPlatform: Device = platformType().toLowerCase() as Device
const {
device,
listDevices = false,
'list-devices': listDevices = false,
tool,
targetBranch = 'latest-release',
sourceRepo = MODDABLE_REPO,
'target-branch': targetBranch = 'latest-release',
'source-repo': sourceRepo = MODDABLE_REPO,
} = flags
let target: Device = device ?? DEVICE_ALIAS[currentPlatform]

Expand Down Expand Up @@ -88,7 +88,7 @@ const command = buildCommand({
'Target device or platform SDK to set up; defaults to Moddable SDK for current OS; use --list-devices for interactive selection',
optional: true,
},
listDevices: {
'list-devices': {
kind: 'boolean',
brief:
'Select target device or platform SDK to set up from a list; defaults to false',
Expand All @@ -100,14 +100,14 @@ const command = buildCommand({
brief: 'Install additional tooling to support common development tasks',
optional: true,
},
targetBranch: {
'target-branch': {
kind: 'parsed',
parse: String,
brief:
'The remote branch or release to use as source for Moddable SDK set up; defaults to `latest-release`',
optional: true,
},
sourceRepo: {
'source-repo': {
kind: 'parsed',
parse: String,
brief:
Expand Down
6 changes: 3 additions & 3 deletions src/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DEVICE_ALIAS } from '../toolbox/prompt/devices'

interface UpdateOptions {
device?: Device
targetBranch?: 'public' | 'latest-release'
'target-branch'?: 'public' | 'latest-release'
}

const command = buildCommand({
Expand All @@ -17,7 +17,7 @@ const command = buildCommand({
const currentPlatform: Device = platformType().toLowerCase() as Device
const {
device = DEVICE_ALIAS[currentPlatform],
targetBranch = 'latest-release',
'target-branch': targetBranch = 'latest-release',
} = flags
const { default: update } = await import(`../toolbox/update/${device}`)
await update({ targetBranch })
Expand All @@ -31,7 +31,7 @@ const command = buildCommand({
'Target device or platform SDK to set up; defaults to Moddable SDK for current OS',
optional: true,
},
targetBranch: {
'target-branch': {
kind: 'enum',
values: ['public', 'latest-release'],
brief:
Expand Down

0 comments on commit bce9e3f

Please sign in to comment.