Skip to content

Commit c7c6a1f

Browse files
committed
Reference more constants from object instead of cherry-picking up-front
1 parent 0035c7e commit c7c6a1f

File tree

66 files changed

+102
-235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+102
-235
lines changed

src/commands/analytics/cmd-analytics.mts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import { hasDefaultApiToken } from '../../utils/sdk.mts'
1414

1515
import type { CliCommandConfig } from '../../utils/meow-with-subcommands.mts'
1616

17-
const { DRY_RUN_BAILING_NOW } = constants
18-
1917
export const CMD_NAME = 'analytics'
2018

2119
const description = 'Look up analytics data'
@@ -168,7 +166,7 @@ async function run(
168166
}
169167

170168
if (dryRun) {
171-
logger.log(DRY_RUN_BAILING_NOW)
169+
logger.log(constants.DRY_RUN_BAILING_NOW)
172170
return
173171
}
174172

src/commands/audit-log/cmd-audit-log.mts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import { hasDefaultApiToken } from '../../utils/sdk.mts'
1515

1616
import type { CliCommandConfig } from '../../utils/meow-with-subcommands.mts'
1717

18-
const { DRY_RUN_BAILING_NOW, SOCKET_WEBSITE_URL } = constants
19-
2018
export const CMD_NAME = 'audit-log'
2119

2220
const description = 'Look up the audit log for an organization'
@@ -70,7 +68,7 @@ async function run(
7068
${getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME}`)}
7169
7270
This feature requires an Enterprise Plan. To learn more about getting access
73-
to this feature and many more, please visit ${SOCKET_WEBSITE_URL}/pricing
71+
to this feature and many more, please visit ${constants.SOCKET_WEBSITE_URL}/pricing
7472
7573
The type FILTER arg is an enum. Defaults to any. It should be one of these:
7674
associateLabel, cancelInvitation, changeMemberRole, changePlanSubscriptionSeats,
@@ -161,7 +159,7 @@ async function run(
161159
}
162160

163161
if (dryRun) {
164-
logger.log(DRY_RUN_BAILING_NOW)
162+
logger.log(constants.DRY_RUN_BAILING_NOW)
165163
return
166164
}
167165

src/commands/audit-log/output-audit-log.mts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import type { Widgets } from 'blessed'
1515

1616
const require = createRequire(import.meta.url)
1717

18-
const { REDACTED } = constants
19-
2018
export async function outputAuditLog(
2119
result: CResult<SocketSdkSuccessResult<'getAuditLogEvents'>['data']>,
2220
{
@@ -110,7 +108,9 @@ export async function outputAsJson(
110108
ok: true,
111109
data: {
112110
desc: 'Audit logs for given query',
113-
generated: constants.ENV.VITEST ? REDACTED : new Date().toISOString(),
111+
generated: constants.ENV.VITEST
112+
? constants.REDACTED
113+
: new Date().toISOString(),
114114
logType,
115115
nextPage: auditLogs.data.nextPage,
116116
org: orgSlug,
@@ -172,7 +172,7 @@ These are the Socket.dev audit logs as per requested query.
172172
- page: ${page}
173173
- next page: ${auditLogs.nextPage}
174174
- per page: ${perPage}
175-
- generated: ${constants.ENV.VITEST ? REDACTED : new Date().toISOString()}
175+
- generated: ${constants.ENV.VITEST ? constants.REDACTED : new Date().toISOString()}
176176
177177
${table}
178178
`

src/commands/ci/cmd-ci.mts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { getFlagListOutput } from '../../utils/output-formatting.mts'
88

99
import type { CliCommandConfig } from '../../utils/meow-with-subcommands.mts'
1010

11-
const { DRY_RUN_BAILING_NOW } = constants
12-
1311
const config: CliCommandConfig = {
1412
commandName: 'ci',
1513
description: 'Shorthand for `socket scan create --report --no-interactive`',
@@ -68,7 +66,7 @@ async function run(
6866
const dryRun = !!cli.flags['dryRun']
6967

7068
if (dryRun) {
71-
logger.log(DRY_RUN_BAILING_NOW)
69+
logger.log(constants.DRY_RUN_BAILING_NOW)
7270
return
7371
}
7472

src/commands/config/cmd-config-auto.mts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import { getFlagListOutput } from '../../utils/output-formatting.mts'
1515
import type { LocalConfig } from '../../utils/config.mts'
1616
import type { CliCommandConfig } from '../../utils/meow-with-subcommands.mts'
1717

18-
const { DRY_RUN_BAILING_NOW } = constants
19-
2018
export const CMD_NAME = 'auto'
2119

2220
const description =
@@ -97,7 +95,7 @@ ${getSupportedConfigEntries()
9795
}
9896

9997
if (dryRun) {
100-
logger.log(DRY_RUN_BAILING_NOW)
98+
logger.log(constants.DRY_RUN_BAILING_NOW)
10199
return
102100
}
103101

src/commands/config/cmd-config-get.mts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import { getFlagListOutput } from '../../utils/output-formatting.mts'
1515
import type { LocalConfig } from '../../utils/config.mts'
1616
import type { CliCommandConfig } from '../../utils/meow-with-subcommands.mts'
1717

18-
const { DRY_RUN_BAILING_NOW } = constants
19-
2018
const config: CliCommandConfig = {
2119
commandName: 'get',
2220
description: 'Get the value of a local CLI config item',
@@ -92,7 +90,7 @@ async function run(
9290
}
9391

9492
if (dryRun) {
95-
logger.log(DRY_RUN_BAILING_NOW)
93+
logger.log(constants.DRY_RUN_BAILING_NOW)
9694
return
9795
}
9896

src/commands/config/cmd-config-list.mts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import { getFlagListOutput } from '../../utils/output-formatting.mts'
1010

1111
import type { CliCommandConfig } from '../../utils/meow-with-subcommands.mts'
1212

13-
const { DRY_RUN_BAILING_NOW } = constants
14-
1513
const config: CliCommandConfig = {
1614
commandName: 'list',
1715
description: 'Show all local CLI config items and their values',
@@ -73,7 +71,7 @@ async function run(
7371
}
7472

7573
if (dryRun) {
76-
logger.log(DRY_RUN_BAILING_NOW)
74+
logger.log(constants.DRY_RUN_BAILING_NOW)
7775
return
7876
}
7977

src/commands/config/cmd-config-set.mts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import { getFlagListOutput } from '../../utils/output-formatting.mts'
1515
import type { LocalConfig } from '../../utils/config.mts'
1616
import type { CliCommandConfig } from '../../utils/meow-with-subcommands.mts'
1717

18-
const { DRY_RUN_BAILING_NOW } = constants
19-
2018
export const CMD_NAME = 'set'
2119

2220
const description = 'Update the value of a local CLI config item'
@@ -112,7 +110,7 @@ ${getSupportedConfigEntries()
112110
}
113111

114112
if (dryRun) {
115-
logger.log(DRY_RUN_BAILING_NOW)
113+
logger.log(constants.DRY_RUN_BAILING_NOW)
116114
return
117115
}
118116

src/commands/config/cmd-config-unset.mts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import { getFlagListOutput } from '../../utils/output-formatting.mts'
1515
import type { LocalConfig } from '../../utils/config.mts'
1616
import type { CliCommandConfig } from '../../utils/meow-with-subcommands.mts'
1717

18-
const { DRY_RUN_BAILING_NOW } = constants
19-
2018
export const CMD_NAME = 'unset'
2119

2220
const description = 'Clear the value of a local CLI config item'
@@ -98,7 +96,7 @@ ${getSupportedConfigEntries()
9896
}
9997

10098
if (dryRun) {
101-
logger.log(DRY_RUN_BAILING_NOW)
99+
logger.log(constants.DRY_RUN_BAILING_NOW)
102100
return
103101
}
104102

src/commands/fix/cmd-fix.mts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import { getDefaultOrgSlug } from '../ci/fetch-default-org-slug.mts'
2323
import type { CliCommandConfig } from '../../utils/meow-with-subcommands.mts'
2424
import type { RangeStyle } from '../../utils/semver.mts'
2525

26-
const { DRY_RUN_NOT_SAVING } = constants
27-
2826
export const CMD_NAME = 'fix'
2927

3028
const DEFAULT_LIMIT = 10
@@ -206,7 +204,7 @@ Available styles:
206204
}
207205

208206
if (dryRun) {
209-
logger.log(DRY_RUN_NOT_SAVING)
207+
logger.log(constants.DRY_RUN_NOT_SAVING)
210208
return
211209
}
212210

0 commit comments

Comments
 (0)