diff --git a/CHANGELOG.md b/CHANGELOG.md index 6597be631..d727cedde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## [1.1.30](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.30) - 2025-11-18 + +### Changed +- Enhanced `SOCKET_CLI_COANA_LOCAL_PATH` to support compiled Coana CLI binaries alongside Node.js script files + +### Fixed +- Resolved PR creation workflow to properly recreate pull requests after closing or merging +- Corrected API token selection to honor `SOCKET_CLI_API_TOKEN` environment variable in package alert requests + ## [1.1.29](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.29) - 2025-11-16 ### Added diff --git a/package.json b/package.json index 817a1747b..a96d3ed11 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "socket", - "version": "1.1.29", + "version": "1.1.30", "description": "CLI for Socket.dev", "homepage": "https://github.com/SocketDev/socket-cli", "license": "MIT AND OFL-1.1", diff --git a/src/utils/dlx.test.mts b/src/utils/dlx.test.mts index 150dd7fa9..c8fcf0562 100644 --- a/src/utils/dlx.test.mts +++ b/src/utils/dlx.test.mts @@ -66,7 +66,7 @@ describe('utils/dlx', () => { it('should place --silent before dlx for pnpm', async () => { const packageSpec: DlxPackageSpec = { name: '@coana-tech/cli', - version: '~1.0.0', + version: '1.0.0', } await spawnDlx(packageSpec, ['run', '/some/path'], { @@ -125,7 +125,7 @@ describe('utils/dlx', () => { it('should place --silent after --yes for npm', async () => { const packageSpec: DlxPackageSpec = { name: '@coana-tech/cli', - version: '~1.0.0', + version: '1.0.0', } await spawnDlx(packageSpec, ['run', '/some/path'], { diff --git a/src/utils/path-resolve.test.mts b/src/utils/path-resolve.test.mts index 4156aeaa6..d0fdbb397 100644 --- a/src/utils/path-resolve.test.mts +++ b/src/utils/path-resolve.test.mts @@ -1,3 +1,4 @@ +import { existsSync, lstatSync, readdirSync, rmSync } from 'node:fs' import path from 'node:path' import { fileURLToPath } from 'node:url' @@ -23,6 +24,36 @@ const __dirname = path.dirname(__filename) const rootNmPath = path.join(__dirname, '../..', NODE_MODULES) const mockFixturePath = normalizePath(path.join(__dirname, 'mock')) const mockNmPath = normalizePath(rootNmPath) + +// Remove broken symlinks in node_modules before loading to prevent mock-fs errors. +function cleanupBrokenSymlinks(dirPath: string): void { + try { + if (!existsSync(dirPath)) { + return + } + const entries = readdirSync(dirPath, { withFileTypes: true }) + for (const entry of entries) { + const fullPath = path.join(dirPath, entry.name) + try { + if (entry.isSymbolicLink() && !existsSync(fullPath)) { + // Symlink exists but target does not, remove it. + rmSync(fullPath, { force: true }) + } else if (entry.isDirectory()) { + // Recursively check subdirectories. + cleanupBrokenSymlinks(fullPath) + } + } catch { + // Ignore errors for individual entries. + } + } + } catch { + // If we cannot read the directory, skip cleanup. + } +} + +// Clean up broken symlinks before loading node_modules. +cleanupBrokenSymlinks(rootNmPath) + const mockedNmCallback = mockFs.load(rootNmPath) function mockTestFs(config: FileSystem.DirectoryItems) {