Skip to content

Commit abc9e56

Browse files
committed
Migrate from @socketsecurity/registry/lib to @socketsecurity/lib
Migrate all imports from @socketsecurity/registry/lib/* to @socketsecurity/lib/* to use the new standalone lib package: Scripts: - Update build, check, lint, test, and other scripts - Update coverage script to use lib utilities - Update utility modules (run-command, changed-test-mapper, etc.) Source: - Update objects.ts to import from @socketsecurity/lib - Update type definitions Tests: - Update purl-spec tests to use @socketsecurity/lib This consolidates shared library code into @socketsecurity/lib package, simplifying dependencies across socket projects.
1 parent fde4a3a commit abc9e56

21 files changed

+76
-76
lines changed

scripts/build.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import { fileURLToPath } from 'node:url'
99
import { build, context } from 'esbuild'
1010
import colors from 'yoctocolors-cjs'
1111

12-
import { isQuiet } from '@socketsecurity/registry/lib/argv/flags'
13-
import { parseArgs } from '@socketsecurity/registry/lib/argv/parse'
14-
import { logger } from '@socketsecurity/registry/lib/logger'
15-
import { printFooter, printHeader } from '@socketsecurity/registry/lib/stdio/header'
12+
import { isQuiet } from '@socketsecurity/lib/argv/flags'
13+
import { parseArgs } from '@socketsecurity/lib/argv/parse'
14+
import { logger } from '@socketsecurity/lib/logger'
15+
import { printFooter, printHeader } from '@socketsecurity/lib/stdio/header'
1616

1717
import { runSequence } from './utils/run-command.mjs'
1818
import { analyzeMetafile, buildConfig, watchConfig } from '../.config/esbuild.config.mjs'

scripts/bump.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { fileURLToPath } from 'node:url'
1313
import semver from 'semver'
1414
import colors from 'yoctocolors-cjs'
1515

16-
import { parseArgs } from '@socketsecurity/registry/lib/argv/parse'
17-
import { logger } from '@socketsecurity/registry/lib/logger'
18-
import { printFooter, printHeader } from '@socketsecurity/registry/lib/stdio/header'
16+
import { parseArgs } from '@socketsecurity/lib/argv/parse'
17+
import { logger } from '@socketsecurity/lib/logger'
18+
import { printFooter, printHeader } from '@socketsecurity/lib/stdio/header'
1919

2020
const rootPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
2121
const WIN32 = process.platform === 'win32'
@@ -639,7 +639,7 @@ async function main() {
639639
console.log('\nInteractive mode: Available ✓ (default)')
640640
} else {
641641
console.log('\nInteractive mode: Not available')
642-
console.log(' (install @socketsecurity/registry or build local registry)')
642+
console.log(' (install @socketsecurity/lib or build local registry)')
643643
}
644644
process.exitCode = 0
645645
return
@@ -730,7 +730,7 @@ async function main() {
730730
if (values.interactive && !hasInteractivePrompts) {
731731
if (explicitlyRequestedInteractive) {
732732
logger.warn('Interactive mode requested but prompts not available')
733-
logger.info('To enable: install @socketsecurity/registry or build local registry')
733+
logger.info('To enable: install @socketsecurity/lib or build local registry')
734734
}
735735
values.interactive = false
736736
}

scripts/check.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* Runs code quality checks: ESLint and TypeScript type checking.
44
*/
55

6-
import { parseArgs } from '@socketsecurity/registry/lib/argv/parse'
7-
import { logger } from '@socketsecurity/registry/lib/logger'
8-
import { printFooter, printHeader } from '@socketsecurity/registry/lib/stdio/header'
6+
import { parseArgs } from '@socketsecurity/lib/argv/parse'
7+
import { logger } from '@socketsecurity/lib/logger'
8+
import { printFooter, printHeader } from '@socketsecurity/lib/stdio/header'
99

1010
import { runCommandQuiet } from './utils/run-command.mjs'
1111

scripts/clean.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import { fileURLToPath } from 'node:url'
99
import { deleteAsync } from 'del'
1010
import fastGlob from 'fast-glob'
1111

12-
import { isQuiet } from '@socketsecurity/registry/lib/argv/flags'
13-
import { parseArgs } from '@socketsecurity/registry/lib/argv/parse'
14-
import { logger } from '@socketsecurity/registry/lib/logger'
15-
import { createSectionHeader } from '@socketsecurity/registry/lib/stdio/header'
12+
import { isQuiet } from '@socketsecurity/lib/argv/flags'
13+
import { parseArgs } from '@socketsecurity/lib/argv/parse'
14+
import { logger } from '@socketsecurity/lib/logger'
15+
import { createSectionHeader } from '@socketsecurity/lib/stdio/header'
1616

1717
const rootPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
1818

scripts/cover.mjs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
*/
99

1010
import path from 'node:path'
11-
import { parseArgs } from 'node:util'
1211
import { fileURLToPath } from 'node:url'
1312

14-
import { printError, printHeader, printSuccess } from './utils/cli-helpers.mjs'
13+
import { parseArgs } from '@socketsecurity/lib/argv/parse'
14+
import { logger } from '@socketsecurity/lib/logger'
15+
import { printHeader } from '@socketsecurity/lib/stdio/header'
16+
1517
import { runCommandQuiet } from './utils/run-command.mjs'
1618

1719
const __dirname = path.dirname(fileURLToPath(import.meta.url))
@@ -24,6 +26,7 @@ const { values } = parseArgs({
2426
'type-only': { type: 'boolean', default: false },
2527
},
2628
strict: false,
29+
allowPositionals: true,
2730
})
2831

2932
printHeader('Running Coverage')
@@ -205,13 +208,13 @@ try {
205208
}
206209

207210
if (exitCode === 0) {
208-
printSuccess('Coverage completed successfully')
211+
logger.success('Coverage completed successfully')
209212
} else {
210-
printError('Coverage failed')
213+
logger.error('Coverage failed')
211214
}
212215

213216
process.exitCode = exitCode
214217
} catch (error) {
215-
printError(`Coverage script failed: ${error.message}`)
218+
logger.error(`Coverage script failed: ${error.message}`)
216219
process.exitCode = 1
217220
}

scripts/coverage-percent.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import path from 'node:path'
33

44
import colors from 'yoctocolors-cjs'
55

6-
import { getSpinner } from '@socketsecurity/registry/constants/process'
7-
import { getCodeCoverage } from '@socketsecurity/registry/lib/cover/code'
8-
import { getTypeCoverage } from '@socketsecurity/registry/lib/cover/type'
9-
import { logger } from '@socketsecurity/registry/lib/logger'
10-
import { parseArgs } from '@socketsecurity/registry/lib/parse-args'
11-
import { indentString } from '@socketsecurity/registry/lib/strings'
6+
import { getSpinner } from '@socketsecurity/lib/constants/process'
7+
import { getCodeCoverage } from '@socketsecurity/lib/cover/code'
8+
import { getTypeCoverage } from '@socketsecurity/lib/cover/type'
9+
import { logger } from '@socketsecurity/lib/logger'
10+
import { parseArgs } from '@socketsecurity/lib/parse-args'
11+
import { indentString } from '@socketsecurity/lib/strings'
1212

1313
/**
1414
* Logs coverage percentage data including code and type coverage metrics.

scripts/lint.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import { existsSync } from 'node:fs'
77
import path from 'node:path'
88

9-
import { isQuiet } from '@socketsecurity/registry/lib/argv/flags'
10-
import { parseArgs } from '@socketsecurity/registry/lib/argv/parse'
11-
import { getChangedFiles, getStagedFiles } from '@socketsecurity/registry/lib/git'
12-
import { logger } from '@socketsecurity/registry/lib/logger'
13-
import { printHeader } from '@socketsecurity/registry/lib/stdio/header'
9+
import { isQuiet } from '@socketsecurity/lib/argv/flags'
10+
import { parseArgs } from '@socketsecurity/lib/argv/parse'
11+
import { getChangedFiles, getStagedFiles } from '@socketsecurity/lib/git'
12+
import { logger } from '@socketsecurity/lib/logger'
13+
import { printHeader } from '@socketsecurity/lib/stdio/header'
1414

1515
import { runCommandQuiet } from './utils/run-command.mjs'
1616

scripts/loader.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @fileoverview Node.js loader to alias @socketsecurity/registry to local build when available.
2+
* @fileoverview Node.js loader to alias @socketsecurity/lib to local build when available.
33
* This allows scripts to use the latest local version during development.
44
*/
55

@@ -15,9 +15,9 @@ const registryPath = path.join(rootPath, '..', 'socket-registry', 'registry', 'd
1515
const useLocalRegistry = existsSync(registryPath)
1616

1717
export function resolve(specifier, context, nextResolve) {
18-
// Rewrite @socketsecurity/registry imports to local dist if available
19-
if (useLocalRegistry && specifier.startsWith('@socketsecurity/registry')) {
20-
const subpath = specifier.slice('@socketsecurity/registry'.length) || '/index.js'
18+
// Rewrite @socketsecurity/lib imports to local dist if available
19+
if (useLocalRegistry && specifier.startsWith('@socketsecurity/lib')) {
20+
const subpath = specifier.slice('@socketsecurity/lib'.length) || '/index.js'
2121
const localPath = path.join(registryPath, subpath.startsWith('/') ? subpath.slice(1) : subpath)
2222

2323
// Add .js extension if not present

scripts/publish.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import { existsSync, promises as fs } from 'node:fs'
88
import path from 'node:path'
99
import { fileURLToPath } from 'node:url'
1010

11-
import { parseArgs } from '@socketsecurity/registry/lib/argv/parse'
12-
import { logger } from '@socketsecurity/registry/lib/logger'
13-
import { printFooter, printHeader } from '@socketsecurity/registry/lib/stdio/header'
11+
import { parseArgs } from '@socketsecurity/lib/argv/parse'
12+
import { logger } from '@socketsecurity/lib/logger'
13+
import { printFooter, printHeader } from '@socketsecurity/lib/stdio/header'
1414

1515
const rootPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
1616
const WIN32 = process.platform === 'win32'

scripts/register-loader.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @fileoverview Register module loader for aliasing @socketsecurity/registry to local build.
2+
* @fileoverview Register module loader for aliasing @socketsecurity/lib to local build.
33
* This should be imported at the very top of any script that needs local registry access.
44
*/
55

0 commit comments

Comments
 (0)