From 2bbc8113c0e8cb711e5f620de2b4c540ed6a4d95 Mon Sep 17 00:00:00 2001 From: webdevcody Date: Fri, 2 Jan 2026 00:29:04 -0500 Subject: [PATCH] chore: update lockfile linting process - Replaced the inline linting command for package-lock.json with a dedicated script (lint-lockfile.mjs) to check for git+ssh:// URLs, ensuring compatibility with CI/CD environments. - The new script provides clear error messages and instructions if such URLs are found, enhancing the development workflow. --- package.json | 2 +- scripts/lint-lockfile.mjs | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 scripts/lint-lockfile.mjs diff --git a/package.json b/package.json index 9aff9d1a..bb9c7efa 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "test:server:coverage": "npm run test:cov --workspace=apps/server", "test:packages": "npm run test -w @automaker/types -w @automaker/utils -w @automaker/prompts -w @automaker/platform -w @automaker/model-resolver -w @automaker/dependency-resolver -w @automaker/git-utils --if-present", "test:all": "npm run test:packages && npm run test:server", - "lint:lockfile": "! grep -q 'git+ssh://' package-lock.json || (echo 'Error: package-lock.json contains git+ssh:// URLs. Run: git config --global url.\"https://github.com/\".insteadOf \"git@github.com:\"' && exit 1)", + "lint:lockfile": "node scripts/lint-lockfile.mjs", "format": "prettier --write .", "format:check": "prettier --check .", "prepare": "husky && npm run build:packages" diff --git a/scripts/lint-lockfile.mjs b/scripts/lint-lockfile.mjs new file mode 100644 index 00000000..b33c9780 --- /dev/null +++ b/scripts/lint-lockfile.mjs @@ -0,0 +1,33 @@ +#!/usr/bin/env node + +/** + * Script to check for git+ssh:// URLs in package-lock.json + * This ensures compatibility with CI/CD environments that don't support SSH. + */ + +import { readFileSync } from 'fs'; +import { join } from 'path'; + +const lockfilePath = join(process.cwd(), 'package-lock.json'); + +try { + const content = readFileSync(lockfilePath, 'utf8'); + + // Check for git+ssh:// URLs + if (content.includes('git+ssh://')) { + console.error('Error: package-lock.json contains git+ssh:// URLs.'); + console.error('Run: git config --global url."https://github.com/".insteadOf "git@github.com:"'); + console.error('Or run: npm run fix:lockfile'); + process.exit(1); + } + + console.log('✓ No git+ssh:// URLs found in package-lock.json'); + process.exit(0); +} catch (error) { + if (error.code === 'ENOENT') { + console.error('Error: package-lock.json not found'); + process.exit(1); + } + console.error('Error checking package-lock.json:', error.message); + process.exit(1); +}