Add PHP Analyzer Plugin and Composer Lock Data Handling
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
- Implemented the PhpAnalyzerPlugin to analyze PHP projects. - Created ComposerLockData class to represent data from composer.lock files. - Developed ComposerLockReader to load and parse composer.lock files asynchronously. - Introduced ComposerPackage class to encapsulate package details. - Added PhpPackage class to represent PHP packages with metadata and evidence. - Implemented PhpPackageCollector to gather packages from ComposerLockData. - Created PhpLanguageAnalyzer to perform analysis and emit results. - Added capability signals for known PHP frameworks and CMS. - Developed unit tests for the PHP language analyzer and its components. - Included sample composer.lock and expected output for testing. - Updated project files for the new PHP analyzer library and tests.
This commit is contained in:
32
src/DevPortal/StellaOps.DevPortal.Site/scripts/sync-spec.mjs
Normal file
32
src/DevPortal/StellaOps.DevPortal.Site/scripts/sync-spec.mjs
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env node
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import crypto from 'node:crypto';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const moduleRoot = path.resolve(__dirname, '..');
|
||||
const repoRoot = path.resolve(moduleRoot, '..', '..', '..');
|
||||
const sourceSpec = path.join(repoRoot, 'src/Api/StellaOps.Api.OpenApi/stella.yaml');
|
||||
const targetDir = path.join(moduleRoot, 'public', 'api');
|
||||
const targetSpec = path.join(targetDir, 'stella.yaml');
|
||||
|
||||
function hashFile(filePath) {
|
||||
const hash = crypto.createHash('sha256');
|
||||
hash.update(fs.readFileSync(filePath));
|
||||
return hash.digest('hex');
|
||||
}
|
||||
|
||||
if (!fs.existsSync(sourceSpec)) {
|
||||
console.error(`[devportal:sync-spec] missing source spec at ${sourceSpec}`);
|
||||
process.exitCode = 1;
|
||||
process.exit();
|
||||
}
|
||||
|
||||
fs.mkdirSync(targetDir, { recursive: true });
|
||||
fs.copyFileSync(sourceSpec, targetSpec);
|
||||
|
||||
const sizeKb = (fs.statSync(targetSpec).size / 1024).toFixed(1);
|
||||
const digest = hashFile(targetSpec).slice(0, 12);
|
||||
console.log(`[devportal:sync-spec] copied aggregate spec -> public/api/stella.yaml (${sizeKb} KiB, sha256:${digest}...)`);
|
||||
Reference in New Issue
Block a user