Skip to content

feat: add package manager detection #7

feat: add package manager detection

feat: add package manager detection #7

Workflow file for this run

name: CI Check
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_call:
outputs:
check_passed:
description: "Whether all checks passed"
value: ${{ jobs.check.outputs.passed }}
jobs:
check:
name: Check and Build
runs-on: ubuntu-latest
outputs:
passed: ${{ steps.set_output.outputs.passed }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run check
- name: Build
run: npm run build
- name: PowerShell - Verify build output
shell: pwsh
run: |
Write-Host "=== Verifying build output ===" -ForegroundColor Cyan
$requiredFiles = @("dist/cli.js", "dist/cli.d.ts", "dist/scanner.js", "dist/detector.js", "dist/generator.js", "dist/env.js", "dist/scripts.js", "dist/utils.js")
$errors = 0
foreach ($file in $requiredFiles) {
if (Test-Path $file) {
Write-Host "✓ $file exists" -ForegroundColor Green
} else {
Write-Host "✗ $file missing" -ForegroundColor Red
$errors++
}
}
if ($errors -gt 0) {
throw "Build verification failed - $errors files missing"
}
Write-Host "=== All build files verified ===" -ForegroundColor Green
- name: PowerShell - Verify package.json
shell: pwsh
run: |
$pkg = Get-Content package.json | ConvertFrom-Json
Write-Host "Package: $($pkg.name)@$($pkg.version)" -ForegroundColor Cyan
if (-not $pkg.name -or -not $pkg.version) {
throw "Missing name or version in package.json"
}
Write-Host "✓ package.json valid" -ForegroundColor Green
- name: Dry-run package
run: npm pack --dry-run
- name: Set output
id: set_output
if: success()
run: echo "passed=true" >> $GITHUB_OUTPUT