Skip to content

Commit d57ee6f

Browse files
committed
Update registry package use
1 parent 0645b64 commit d57ee6f

20 files changed

+146
-89
lines changed

.dep-stats.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22
"dependencies": {
33
"@apideck/better-ajv-errors": "^0.3.6",
44
"@cyclonedx/cdxgen": "^11.0.5",
5-
"@inquirer/confirm": "^5.0.2",
6-
"@inquirer/password": "^4.0.3",
7-
"@inquirer/select": "^4.0.3",
85
"@npmcli/promise-spawn": "^8.0.2",
96
"@socketregistry/hyrious__bun.lockb": "1.0.5",
107
"@socketregistry/yocto-spinner": "^1.0.1",
118
"@socketsecurity/config": "^2.1.3",
12-
"@socketsecurity/registry": "^1.0.36",
9+
"@socketsecurity/registry": "^1.0.48",
1310
"@socketsecurity/sdk": "^1.3.0",
1411
"blessed": "^0.1.81",
1512
"blessed-contrib": "^4.11.0",
@@ -49,9 +46,6 @@
4946
},
5047
"external": {
5148
"@apideck/better-ajv-errors": "^0.3.6",
52-
"@inquirer/confirm": "^5.0.2",
53-
"@inquirer/password": "^4.0.3",
54-
"@inquirer/select": "^4.0.3",
5549
"@npmcli/promise-spawn": "^8.0.2",
5650
"blessed": "^0.1.81",
5751
"blessed-contrib": "^4.11.0",

package-lock.json

Lines changed: 5 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,11 @@
7575
"dependencies": {
7676
"@apideck/better-ajv-errors": "^0.3.6",
7777
"@cyclonedx/cdxgen": "^11.0.5",
78-
"@inquirer/confirm": "^5.0.2",
79-
"@inquirer/password": "^4.0.3",
80-
"@inquirer/select": "^4.0.3",
8178
"@npmcli/promise-spawn": "^8.0.2",
8279
"@socketregistry/hyrious__bun.lockb": "1.0.5",
8380
"@socketregistry/yocto-spinner": "^1.0.1",
8481
"@socketsecurity/config": "^2.1.3",
85-
"@socketsecurity/registry": "^1.0.36",
82+
"@socketsecurity/registry": "^1.0.48",
8683
"@socketsecurity/sdk": "^1.3.0",
8784
"blessed": "^0.1.81",
8885
"blessed-contrib": "^4.11.0",

scripts/constants.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
const path = require('node:path')
44

5-
const semver = require('semver')
6-
75
const registryConstants = require('@socketsecurity/registry/lib/constants')
86
const {
97
kInternalsSymbol,
@@ -14,8 +12,6 @@ const {
1412
const ROLLUP_ENTRY_SUFFIX = '?commonjs-entry'
1513
const ROLLUP_EXTERNAL_SUFFIX = '?commonjs-external'
1614
const SLASH_NODE_MODULES_SLASH = '/node_modules/'
17-
const SUPPORTS_SYNC_ESM = semver.satisfies(process.versions.node, '>=22.12')
18-
const DIST_TYPE = SUPPORTS_SYNC_ESM ? 'module-sync' : 'require'
1915

2016
const rootPath = path.resolve(__dirname, '..')
2117
const rootConfigPath = path.join(rootPath, '.config')
@@ -25,19 +21,22 @@ const rootSrcPath = path.join(rootPath, 'src')
2521

2622
const babelConfigPath = path.join(rootConfigPath, 'babel.config.js')
2723
const depStatsPath = path.join(rootPath, '.dep-stats.json')
28-
const distPath = path.join(rootDistPath, DIST_TYPE)
2924
const tsconfigPath = path.join(rootConfigPath, 'tsconfig.rollup.json')
3025

26+
const LAZY_DIST_TYPE = () =>
27+
registryConstants.SUPPORTS_NODE_REQUIRE_MODULE ? 'module-sync' : 'require'
28+
29+
const lazyDistPath = () => path.join(rootDistPath, constants.DIST_TYPE)
30+
3131
const constants = createConstantsObject(
3232
{
33-
DIST_TYPE,
33+
DIST_TYPE: undefined,
3434
ROLLUP_ENTRY_SUFFIX,
3535
ROLLUP_EXTERNAL_SUFFIX,
3636
SLASH_NODE_MODULES_SLASH,
37-
SUPPORTS_SYNC_ESM,
3837
babelConfigPath,
3938
depStatsPath,
40-
distPath,
39+
distPath: undefined,
4140
rootConfigPath,
4241
rootDistPath,
4342
rootPackageJsonPath,
@@ -46,6 +45,10 @@ const constants = createConstantsObject(
4645
tsconfigPath
4746
},
4847
{
48+
getters: {
49+
DIST_TYPE: LAZY_DIST_TYPE,
50+
distPath: lazyDistPath
51+
},
4952
mixin: registryConstants
5053
}
5154
)

src/cli.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ import { messageWithCauses, stackWithCauses } from 'pony-cause'
77
import updateNotifier from 'tiny-updater'
88

99
import * as cliCommands from './commands'
10-
import { rootPkgJsonPath } from './constants'
10+
import constants from './constants'
1111
import { logSymbols } from './utils/color-or-markdown'
1212
import { AuthError, InputError } from './utils/errors'
1313
import { meowWithSubcommands } from './utils/meow-with-subcommands'
1414

15+
const { rootPkgJsonPath } = constants
16+
1517
const formattedCliCommands = Object.fromEntries(
1618
Object.entries(cliCommands).map(entry => {
1719
const key = entry[0]

src/commands/audit-log.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import select, { Separator } from '@inquirer/select'
1+
import { Separator, select } from '@socketsecurity/registry/lib/prompts'
22
import colors from 'yoctocolors-cjs'
33
import meow from 'meow'
44
import yoctoSpinner from '@socketregistry/yocto-spinner'

src/commands/cdxgen.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import colors from 'yoctocolors-cjs'
66
import yargsParse from 'yargs-parser'
77
import { pluralize } from '@socketsecurity/registry/lib/words'
88

9-
import { cdxgenBinPath, synpBinPath } from '../constants'
9+
import constants from '../constants'
1010

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

13+
const { cdxgenBinPath, synpBinPath } = constants
1314
const { execPath } = process
1415

1516
const {

src/commands/info.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import colors from 'yoctocolors-cjs'
22
import meow from 'meow'
33
import yoctoSpinner from '@socketregistry/yocto-spinner'
44

5-
import { SOCKET_PUBLIC_API_KEY } from '../constants'
5+
import constants from '../constants'
66
import { commonFlags, outputFlags, validationFlags } from '../flags'
77
import {
88
handleApiCall,
@@ -20,6 +20,8 @@ import type { CliSubcommand } from '../utils/meow-with-subcommands'
2020
import type { SocketSdkReturnType } from '@socketsecurity/sdk'
2121
import type { Spinner } from '@socketregistry/yocto-spinner'
2222

23+
const { SOCKET_PUBLIC_API_KEY } = constants
24+
2325
export const info: CliSubcommand = {
2426
description: 'Look up info regarding a package',
2527
async run(argv, importMeta, { parentName }) {

src/commands/login.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
import confirm from '@inquirer/confirm'
2-
import password from '@inquirer/password'
3-
import select from '@inquirer/select'
1+
import { confirm, password, select } from '@socketsecurity/registry/lib/prompts'
42

53
import isInteractive from 'is-interactive'
64
import meow from 'meow'
75
import yoctoSpinner from '@socketregistry/yocto-spinner'
86
import terminalLink from 'terminal-link'
97

10-
import { SOCKET_PUBLIC_API_KEY } from '../constants'
8+
import constants from '../constants'
119
import { AuthError, InputError } from '../utils/errors'
1210
import { printFlagList } from '../utils/formatting'
1311
import { setupSdk } from '../utils/sdk'
1412
import { getSetting, updateSetting } from '../utils/settings'
1513

1614
import type { CliSubcommand } from '../utils/meow-with-subcommands'
17-
import type { Separator } from '@inquirer/select'
15+
import type { Separator } from '@socketsecurity/registry/lib/prompts'
1816
import type { SocketSdkReturnType } from '@socketsecurity/sdk'
1917

2018
type Choice<Value> = {
@@ -29,6 +27,8 @@ type OrgChoice = Choice<string>
2927

3028
type OrgChoices = (Separator | OrgChoice)[]
3129

30+
const { SOCKET_PUBLIC_API_KEY } = constants
31+
3232
const description = 'Socket API login'
3333

3434
const flags: { [key: string]: any } = {

src/commands/npm.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import path from 'node:path'
22

33
import spawn from '@npmcli/promise-spawn'
44

5-
import { distPath } from '../constants'
5+
import constant from '../constants'
66

77
import type { CliSubcommand } from '../utils/meow-with-subcommands'
88

9+
const { distPath } = constant
10+
911
const description = 'npm wrapper functionality'
1012

1113
export const npm: CliSubcommand = {

0 commit comments

Comments
 (0)