Skip to content

Commit 81183fe

Browse files
committed
Refactor build scripts to use local utilities
- Update scripts to import from local helpers instead of socket-registry - Import esbuild from local node_modules - Re-export CLI helpers from helpers.mjs for consistency
1 parent c0639c1 commit 81183fe

5 files changed

Lines changed: 20 additions & 10 deletions

File tree

scripts/build-externals.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ import { fileURLToPath } from 'node:url'
1010

1111
const require = createRequire(import.meta.url)
1212

13-
// Use esbuild from root node_modules since registry package is zero-dependency.
14-
import esbuild from '../../node_modules/esbuild/lib/main.js'
13+
// Use esbuild from node_modules.
14+
import esbuild from 'esbuild'
15+
import { createCherryPickEntry } from './cherry-pick-entries.mjs'
16+
import { createNonBarrelEntry } from './non-barrel-imports.mjs'
1517
import {
1618
printError,
1719
printFooter,
1820
printHeader,
1921
printSuccess,
20-
} from '../../scripts/utils/cli-helpers.mjs'
21-
import { createCherryPickEntry } from './cherry-pick-entries.mjs'
22-
import { createNonBarrelEntry } from './non-barrel-imports.mjs'
22+
} from './utils/helpers.mjs'
2323

2424
const __dirname = path.dirname(fileURLToPath(import.meta.url))
2525
const rootDir = path.resolve(__dirname, '..')

scripts/build-js.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
*/
55
// eslint-disable-next-line n/no-extraneous-import
66
import { build, context } from 'esbuild'
7-
8-
import { printError, printSuccess } from '../../scripts/utils/cli-helpers.mjs'
97
import {
108
analyzeMetafile,
119
buildConfig,
1210
watchConfig,
1311
} from '../.config/esbuild.config.mjs'
12+
import { printError, printSuccess } from './utils/helpers.mjs'
1413

1514
const isQuiet = process.argv.includes('--quiet')
1615
const isVerbose = process.argv.includes('--verbose')

scripts/fix-commonjs-exports.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
printFooter,
1313
printHeader,
1414
printSuccess,
15-
} from '../../scripts/utils/cli-helpers.mjs'
15+
} from './utils/helpers.mjs'
1616

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

scripts/fix-default-imports.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
printFooter,
1212
printHeader,
1313
printSuccess,
14-
} from '../../scripts/utils/cli-helpers.mjs'
14+
} from './utils/cli-helpers.mjs'
1515

1616
const __dirname = path.dirname(fileURLToPath(import.meta.url))
1717
const distDir = path.resolve(__dirname, '..', 'dist')

scripts/utils/helpers.mjs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
/**
2-
* @fileoverview Simplified helpers for socket-registry scripts.
2+
* @fileoverview Simplified helpers for socket-lib scripts.
33
* These are local utilities that don't depend on dist/lib.
44
*/
55

66
import { promises as fs } from 'node:fs'
77

8+
// Re-export unified print functions from cli-helpers.
9+
export {
10+
printDivider,
11+
printError,
12+
printFooter,
13+
printHeader,
14+
printInfo,
15+
printSuccess,
16+
printWarning,
17+
} from './cli-helpers.mjs'
18+
819
// Simple logger without any dependencies on dist.
920
export const logger = {
1021
info: msg => console.log(msg),

0 commit comments

Comments
 (0)