Skip to content

Commit 780e04f

Browse files
committed
fix(build): use getLocalPackageAliases instead of hardcoded paths
Replace hardcoded Socket package paths with canonical getLocalPackageAliases helper for consistency across all socket-* repositories. This ensures local development workflows remain synchronized and paths are computed using the same logic everywhere. The distAliases from getLocalPackageAliases point to /dist folders, so we convert them to package roots by removing the /dist suffix, which is what the resolvePackageSubpath function expects.
1 parent 23b45e5 commit 780e04f

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

packages/cli/.config/esbuild.cli.build.mjs

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { builtinModules } from 'node:module'
1212
import path from 'node:path'
1313
import { fileURLToPath } from 'node:url'
1414

15+
import { getLocalPackageAliases } from '../scripts/utils/get-local-package-aliases.mjs'
16+
1517
const __dirname = path.dirname(fileURLToPath(import.meta.url))
1618
const rootPath = path.join(__dirname, '..')
1719

@@ -45,25 +47,15 @@ const versionHash = `${packageJson.version}:${gitHash}:${randUuidSegment}${
4547
publishedBuild ? '' : ':dev'
4648
}`
4749

48-
// Get local Socket package paths.
49-
const socketPackages = {
50-
'@socketsecurity/lib': path.join(rootPath, '..', '..', '..', 'socket-lib'),
51-
'@socketsecurity/registry': path.join(
52-
rootPath,
53-
'..',
54-
'..',
55-
'..',
56-
'socket-registry',
57-
'registry',
58-
),
59-
'@socketsecurity/sdk': path.join(rootPath, '..', '..', '..', 'socket-sdk-js'),
60-
'@socketregistry/packageurl-js': path.join(
61-
rootPath,
62-
'..',
63-
'..',
64-
'..',
65-
'socket-packageurl-js',
66-
),
50+
// Get local Socket package paths using canonical helper.
51+
// rootPath is packages/cli, so go up to socket-cli root for getLocalPackageAliases.
52+
const socketCliRoot = path.join(rootPath, '..', '..')
53+
const distAliases = getLocalPackageAliases(socketCliRoot)
54+
55+
// Convert dist paths to package roots (remove /dist suffix).
56+
const socketPackages = {}
57+
for (const [packageName, distPath] of Object.entries(distAliases)) {
58+
socketPackages[packageName] = path.dirname(distPath)
6759
}
6860

6961
// Resolve subpath from package.json exports.

0 commit comments

Comments
 (0)