Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 11 additions & 31 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,25 @@
{
"targetDefaults": {
"clean": {
"dependsOn": [
"^clean"
]
"dependsOn": ["^clean"]
},
"build": {
"dependsOn": [
"^build"
],
"inputs": [
"production",
"^production"
]
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
},
"refresh-manifests": {
"dependsOn": [
"build",
"refresh-readme"
]
"dependsOn": ["build", "refresh-readme"]
},
"refresh-readme": {
"dependsOn": [
"build"
]
"dependsOn": ["build"]
},
"lint": {},
"lint:fix": {},
"type-check": {
"dependsOn": [
"^build"
]
"dependsOn": ["^build"]
},
"bundle": {
"dependsOn": [
"build"
]
"dependsOn": ["build"]
}
},
"extends": "@nx/workspace/presets/npm.json",
Expand Down Expand Up @@ -65,16 +49,12 @@
"defaultBase": "main",
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"default": [
"{projectRoot}/**/*",
"sharedGlobals"
],
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"sharedGlobals": [],
"production": [
"default"
]
"production": ["default"]
},
"tui": {
"autoExit": true
}
},
"analytics": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const getBackgroundExecutionReasonMessage = (reason: BackgroundExecutionReason):
return 'No cached response available'
case BackgroundExecutionReason.CacheAboutToExpire:
return 'Cache is about to expire'
default:
case BackgroundExecutionReason.Unknown:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shoul'd we still have a default case here just in case? same in the others, why not a default?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not having a default forces you to implement a caseif you add a new option to the Enum. The default would silently catch it.

return 'Unknown reason'
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,10 @@ async function renderBulkOperationResult(operation: BulkOperation, outputFile?:
renderSuccess({headline, customSections})
}
break
default:
case 'CANCELED':
case 'CANCELING':
case 'EXPIRED':
case 'FAILED':
renderError({headline, customSections})
break
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ export function formatBulkOperationCancellationResult(
renderType: 'warning',
}
}
default:
case 'CREATED':
case 'EXPIRED':
case 'RUNNING':
return {
headline,
renderType: 'info',
Expand Down
4 changes: 3 additions & 1 deletion packages/app/src/cli/services/generate/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ function getTemplateLanguage(flavor: ExtensionFlavorValue | undefined): Template
case 'rust':
case 'wasm':
return flavor
default:
case undefined:
case 'liquid':
case 'config-only':
return undefined
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,12 @@ function graphQLToAdminAccess(
switch (access) {
case 'MERCHANT_READ_WRITE':
return 'merchant_read_write'
default:
case 'MERCHANT_READ':
case 'PRIVATE':
case 'PUBLIC_READ':
case 'PUBLIC_READ_WRITE':
case null:
case undefined:
return undefined
}
}
Expand All @@ -721,7 +726,9 @@ function graphQLToStorefrontAccess(
switch (access) {
case 'PUBLIC_READ':
return 'public_read'
default:
case 'NONE':
case null:
case undefined:
return undefined
}
}
Expand All @@ -734,7 +741,9 @@ function graphQLToCustomerAccountAccess(
return 'read'
case 'READ_WRITE':
return 'read_write'
default:
case 'NONE':
case null:
case undefined:
return undefined
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export function buildExtensionConfig(extension: ExtensionRegistration, allExtens
allExtensions,
cardPresentDeployConfigToCLIConfig,
)
case undefined:
default:
throw new Error(`Unsupported extension: ${context}`)
}
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/cli/utilities/mkcert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ async function getMkcertPath(
async function downloadMkcert(targetPath: string, platform: NodeJS.Platform, arch: NodeJS.Architecture): Promise<void> {
let assetName: string

// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- default throws for unsupported platforms
switch (platform) {
case 'darwin':
assetName = arch === 'arm64' ? `mkcert-${MKCERT_VERSION}-darwin-arm64` : `mkcert-${MKCERT_VERSION}-darwin-amd64`
Expand Down
3 changes: 2 additions & 1 deletion packages/cli-kit/src/private/node/session/scopes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export function tokenExchangeScopes(api: API): string[] {
return [scopeTransform('app-management')]
case 'business-platform':
return [scopeTransform('destinations')]
default:
case 'admin':
case 'storefront-renderer':
throw new BugError(`API not supported for token exchange: ${api}`)
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/cli-kit/src/public/node/context/fqdn.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/switch-exhaustiveness-check -- all switches branch on Environment.Local vs default (production) */
import {AbortError} from '../error.js'
import {serviceEnvironment} from '../../../private/node/context/service.js'
import {DevServer, DevServerCore} from '../vendor/dev_server/index.js'
Expand Down
4 changes: 2 additions & 2 deletions packages/cli-kit/src/public/node/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ function logLevelValue(level: LogLevel): number {
return 50
case 'fatal':
return 60
default:
return 30
case 'silent':
return 70
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/cli-kit/src/public/node/tree-kill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function adaptedTreeKill(
const pidsToProcess = new Set<string>()
pidsToProcess.add(rootPid)

// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- default handles all Unix-like platforms
switch (process.platform) {
case 'win32':
// @ts-ignore
Expand All @@ -87,7 +88,6 @@ function adaptedTreeKill(
},
)
break
// Linux
default:
buildProcessTree(
rootPid,
Expand Down
Loading