@fabernovel/heart-greenit
Advanced tools
Comparing version 4.0.0-alpha.6 to 4.0.0-alpha.7
import type { GreenITConfig, GreenITReport } from "@fabernovel/heart-common"; | ||
/** | ||
* @see {@link https://github.com/GoogleChrome/lighthouse/blob/main/docs/puppeteer.md#option-2-launch-chrome-with-lighthousechrome-launcher-and-handoff-to-puppeteer} | ||
*/ | ||
export declare function requestResult(config: GreenITConfig): Promise<GreenITReport["result"]>; |
@@ -10,11 +10,6 @@ import { createJsonReports } from "greenit-cli/cli-core/analysis.js"; | ||
}; | ||
/** | ||
* @see {@link https://github.com/GoogleChrome/lighthouse/blob/main/docs/puppeteer.md#option-2-launch-chrome-with-lighthousechrome-launcher-and-handoff-to-puppeteer} | ||
*/ | ||
export async function requestResult(config) { | ||
const browser = await puppeteer.launch({ | ||
// https://www.howtogeek.com/devops/how-to-run-puppeteer-and-headless-chrome-in-a-docker-container/#using-puppeteer-in-docker | ||
args: ["--disable-gpu", "--disable-dev-shm-usage", "--disable-setuid-sandbox", "--no-sandbox"], | ||
defaultViewport: null, | ||
// https://developer.chrome.com/articles/new-headless/ | ||
headless: "new", | ||
@@ -30,10 +25,6 @@ }); | ||
const reports = new Array(); | ||
// As the createJsonReports use console.* functions to display progress info and errors and do not send back these information, | ||
// we need to disable the console.* functions during this operation to properly handle the output | ||
const consoleLog = console.log; | ||
const consoleError = console.error; | ||
try { | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
console.log = () => { }; | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
console.error = () => { }; | ||
@@ -40,0 +31,0 @@ const r = await createJsonReports(browser, [{ url: config.url }], options); |
@@ -1,6 +0,7 @@ | ||
import type { GreenITConfig } from "@fabernovel/heart-common"; | ||
import { Module, type ModuleAnalysisInterface, GreenITReport } from "@fabernovel/heart-common"; | ||
import type { GreenITConfig, ModuleMetadata } from "@fabernovel/heart-common"; | ||
import { GreenITReport, Module, type ModuleAnalysisInterface } from "@fabernovel/heart-common"; | ||
export declare class GreenITModule extends Module implements ModuleAnalysisInterface<GreenITConfig, GreenITReport> { | ||
#private; | ||
constructor(moduleMetadata: ModuleMetadata, verbose: boolean); | ||
startAnalysis(config: GreenITConfig, threshold?: number): Promise<GreenITReport>; | ||
} |
@@ -1,5 +0,11 @@ | ||
import { Module, GreenITReport } from "@fabernovel/heart-common"; | ||
import { GreenITReport, Module, logger } from "@fabernovel/heart-common"; | ||
import { requestResult } from "./api/Client.js"; | ||
export class GreenITModule extends Module { | ||
#threshold; | ||
constructor(moduleMetadata, verbose) { | ||
super(moduleMetadata, verbose); | ||
if (verbose) { | ||
logger.info(`${moduleMetadata.name} initialized.`); | ||
} | ||
} | ||
async startAnalysis(config, threshold) { | ||
@@ -6,0 +12,0 @@ this.#threshold = threshold; |
@@ -1,3 +0,2 @@ | ||
import { GreenITModule } from "./GreenITModule.js"; | ||
declare const _default: GreenITModule; | ||
export default _default; | ||
import type { ModuleIndex } from "@fabernovel/heart-common"; | ||
export declare const initialize: ModuleIndex["initialize"]; |
import { GreenITModule } from "./GreenITModule.js"; | ||
export default new GreenITModule({ | ||
name: "Heart GreenIT", | ||
service: { | ||
name: "GreenIT Analysis", | ||
logo: "https://raw.githubusercontent.com/faberNovel/heart/main/assets/images/logos/GreenIT.png?v=20221214", | ||
}, | ||
}); | ||
export const initialize = (moduleMetadata, verbose) => { | ||
return new GreenITModule(moduleMetadata, verbose); | ||
}; |
{ | ||
"name": "@fabernovel/heart-greenit", | ||
"version": "4.0.0-alpha.6", | ||
"version": "4.0.0-alpha.7", | ||
"description": "Analysis module of Heart, which analyses URLs with GreenIT", | ||
@@ -35,5 +35,5 @@ "keywords": [ | ||
"dependencies": { | ||
"@fabernovel/heart-common": "^4.0.0-alpha.6", | ||
"@fabernovel/heart-common": "^4.0.0-alpha.7", | ||
"greenit-cli": "github:cnumr/GreenIT-Analysis-cli#a4363a9bcf7630e4a5a4cd264a7da9ec6f34b571", | ||
"puppeteer": "^20.4.0", | ||
"puppeteer": "^20.9.0", | ||
"rimraf": "^5.0.1" | ||
@@ -45,5 +45,5 @@ }, | ||
"@types/node": "^18.16.19", | ||
"@typescript-eslint/eslint-plugin": "^5.57.0", | ||
"@typescript-eslint/parser": "^5.57.0", | ||
"eslint": "^8.36.0", | ||
"@typescript-eslint/eslint-plugin": "^6.1.0", | ||
"@typescript-eslint/parser": "^6.1.0", | ||
"eslint": "^8.45.0", | ||
"jest": "^29.6.1", | ||
@@ -54,3 +54,3 @@ "ts-jest": "^29.1.1", | ||
"peerDependencies": { | ||
"@fabernovel/heart-cli": "^4.0.0-alpha.6" | ||
"@fabernovel/heart-cli": "^4.0.0-alpha.7" | ||
}, | ||
@@ -60,2 +60,11 @@ "engines": { | ||
}, | ||
"heart": { | ||
"id": "greenit", | ||
"name": "Heart GreenIT", | ||
"type": "analysis", | ||
"service": { | ||
"name": "GreenIT Analysis", | ||
"logoUrl": "https://raw.githubusercontent.com/faberNovel/heart/main/assets/images/logos/GreenIT.png?v=20221214" | ||
} | ||
}, | ||
"scripts": { | ||
@@ -62,0 +71,0 @@ "build": "rimraf lib && tsc --project tsconfig.build.json", |
41769
96
+ Addedsocks@2.8.3(transitive)
- Removedsocks@2.8.4(transitive)
Updatedpuppeteer@^20.9.0