Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9d5fdc4
feat: mise à jour des traductions et ajout de liens dans le pied de p…
hrenaud Oct 5, 2025
50a5454
refactor: rename and restructure KeyValue component props for improve…
hrenaud Oct 11, 2025
f0589e3
feat: préparation à l'ajout de la Configuration avancée au mode simpl…
hrenaud Oct 11, 2025
7e14289
feat: ajout de la gestion du fichier de scénario Puppeteer dans la co…
hrenaud Oct 11, 2025
4b29530
feat: ajouter la gestion d'un script puppeteer inclue dans `lighthous…
hrenaud Oct 11, 2025
5de3799
Merge branch 'feat/16-nouvelle-initialisation-de-lapplication-utilisa…
hrenaud Oct 11, 2025
c084e28
fix: error in merge
hrenaud Oct 12, 2025
eacc917
refactor: rename simpleMesures prop to mesure for consistency in Simp…
hrenaud Oct 12, 2025
6be9718
fix: remove duplicate "Reset" translation entries in English and Fren…
hrenaud Oct 12, 2025
ae0bba2
fix: restore "Application version" translation entry in English and F…
hrenaud Oct 12, 2025
33343ca
feat: ajouter la gestion de variables d'environnement passées au proc…
hrenaud Oct 12, 2025
c6b5d56
fix: correct return statement in _runDirectCollect function to ensure…
hrenaud Oct 12, 2025
38fcf28
feat: enhance button functionality in AdvConfiguration and KeyValue c…
hrenaud Oct 12, 2025
610faac
chore: release v0.5.0
hrenaud Oct 12, 2025
736a81b
chore: add environment variable for Puppeteer download skipping in re…
hrenaud Oct 12, 2025
88d6074
feat: integrate environment variable management in JsonPanMesure comp…
hrenaud Oct 18, 2025
083491e
feat: add advanced measurement configuration management and update tr…
hrenaud Oct 18, 2025
98d8f20
chore: update lighthouse-plugin-ecoindex dependencies to version 6.0.…
hrenaud Oct 18, 2025
6cc694a
feat: enhance handleSimpleMesures to accept advanced configuration an…
hrenaud Oct 18, 2025
476a963
chore: release v0.6.0
hrenaud Oct 18, 2025
82bfed0
chore: update lighthouse-plugin-ecoindex dependencies to version 6.0.…
hrenaud Oct 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
restore-keys: |
${{ runner.os }}-modules-
- run: npm ci
env:
PUPPETEER_SKIP_DOWNLOAD: ${{vars.PUPPETEER_SKIP_DOWNLOAD}}
- name: Debug token
run: echo ${GITHUB_TOKEN:0:3}
env:
Expand Down
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@


# [0.6.0](https://github.com/cnumr/EcoindexApp/compare/0.5.0...0.6.0) (2025-10-18)


### Features

* add advanced measurement configuration management and update translations for simple measurement ([083491e](https://github.com/cnumr/EcoindexApp/commit/083491e393dc836b199944c0d4341936feecea48))
* enhance handleSimpleMesures to accept advanced configuration and environment variables for improved measurement handling ([6cc694a](https://github.com/cnumr/EcoindexApp/commit/6cc694a27a8e429601b165fb3acf03dbc37e9957))
* integrate environment variable management in JsonPanMesure component ([88d6074](https://github.com/cnumr/EcoindexApp/commit/88d6074119a46e7b58b5e70740c6d3c9a37adb39))

# [0.5.0](https://github.com/cnumr/EcoindexApp/compare/0.4.1...0.5.0) (2025-10-12)


### Bug Fixes

* correct return statement in _runDirectCollect function to ensure proper promise resolution ([c6b5d56](https://github.com/cnumr/EcoindexApp/commit/c6b5d564ef7dff03505a088a68e44ed14674f89d))
* error in merge ([c084e28](https://github.com/cnumr/EcoindexApp/commit/c084e283dab94a83ce948d6bb289d6eae227519e))
* remove duplicate "Reset" translation entries in English and French locale files ([6be9718](https://github.com/cnumr/EcoindexApp/commit/6be9718da9fec995b8e3a5a06c5b87db3fcf8632))
* restore "Application version" translation entry in English and French locale files ([ae0bba2](https://github.com/cnumr/EcoindexApp/commit/ae0bba2d7334dd00fd47fb2cb2800cea11cbd5ec))


### Features

* ajout de la gestion du fichier de scénario Puppeteer dans la configuration avancée, incluant des traductions et des mises à jour de l'interface ([7e14289](https://github.com/cnumr/EcoindexApp/commit/7e14289883e5a23c56f0132ae49570feb96844e0))
* ajouter la gestion d'un script puppeteer inclue dans `lighthouse-plugin-ecoindex` ^6.01 [#20](https://github.com/cnumr/EcoindexApp/issues/20) ([4b29530](https://github.com/cnumr/EcoindexApp/commit/4b2953053141fcdeba3f1d2562e124d66fe2439d))
* ajouter la gestion de variables d'environnement passées au process de mesure [#22](https://github.com/cnumr/EcoindexApp/issues/22) ([33343ca](https://github.com/cnumr/EcoindexApp/commit/33343caa62d498fed988faafacdd719e6b05041f))
* enhance button functionality in AdvConfiguration and KeyValue components with delete icon and translation support ([38fcf28](https://github.com/cnumr/EcoindexApp/commit/38fcf280d51c02132f1ad52174018d1fb721fd09))
* mise à jour des traductions et ajout de liens dans le pied de page pour la version de l'application et du plugin Ecoindex ([9d5fdc4](https://github.com/cnumr/EcoindexApp/commit/9d5fdc4f86032037d77f16fdedf63ea81aa40745))
* préparation à l'ajout de la Configuration avancée au mode simple en externalisant les élements de fromulaire sur `output`, `extra-header` et `audit-category` ([f0589e3](https://github.com/cnumr/EcoindexApp/commit/f0589e3f1c5da3df5878b6255f871d4911ef2d13))

## [0.4.1](https://github.com/cnumr/EcoindexApp/compare/0.4.0...0.4.1) (2025-10-04)


Expand Down
1,695 changes: 1,382 additions & 313 deletions lib/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"license": "ISC",
"dependencies": {
"lighthouse": "12.5.1",
"lighthouse-plugin-ecoindex-core": "6.0.3",
"lighthouse-plugin-ecoindex-courses": "6.0.3"
"lighthouse-plugin-ecoindex-core": "6.0.6",
"lighthouse-plugin-ecoindex-courses": "6.0.6"
},
"peerDependencies": {
"lighthouse": "12.5.1"
Expand Down
2,026 changes: 1,621 additions & 405 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "EcoindexApp",
"productName": "EcoindexApp",
"private": true,
"version": "0.4.1",
"version": "0.6.0",
"description": "An application to measures the ecological impact of a website with LightHouse and Ecoindex.",
"homepage": "https://github.com/cnumr/EcoindexApp#readme",
"bugs": "https://github.com/cnumr/EcoindexApp/issues",
Expand Down Expand Up @@ -149,7 +149,7 @@
"i18next-node-fs-backend": "^2.1.3",
"i18next-resources-to-backend": "^1.2.1",
"lighthouse": "12.5.1",
"lighthouse-plugin-ecoindex-courses": "^6.0.3",
"lighthouse-plugin-ecoindex-courses": "^6.0.6",
"lucide-react": "^0.412.0",
"native-is-elevated": "^0.7.0",
"node-polyfill-webpack-plugin": "^4.0.0",
Expand Down
17 changes: 14 additions & 3 deletions src/interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface IElectronAPI {
getInitialTranslations: () => Promise<object>
handleSetFolderOuput: () => Promise<string>
handleSelectFolder: () => Promise<string>
handleSelectPuppeteerFilePath: () => Promise<string>
getWorkDir: (newDir: string) => Promise<string>
getHomeDir: () => Promise<string>
isNodeInstalled: () => Promise<boolean>
Expand All @@ -45,10 +46,15 @@ export interface IElectronAPI {
// handleLighthouseEcoindexPluginUpdate: () => Promise<boolean>
// isLighthousePluginEcoindexMustBeInstallOrUpdated: () => Promise<ResultMessage>
handleIsPuppeteerBrowserInstalled: () => Promise<boolean | string>
handleSimpleMesures: (urlsList: ISimpleUrlInput[]) => Promise<string>
handleSimpleMesures: (
urlsList: ISimpleUrlInput[],
localAdvConfig: IAdvancedMesureData,
envVars: IKeyValue
) => Promise<string>
handleJsonSaveAndCollect: (
json: IJsonMesureData,
andCollect: boolean
andCollect: boolean,
envVars: IKeyValue
) => Promise<string>
handleJsonReadAndReload: () => Promise<IJsonMesureData>
handleIsJsonConfigFileExist: (workDir: string) => Promise<boolean>
Expand All @@ -64,16 +70,21 @@ export interface IInitalization {
}

declare global {
export interface IJsonMesureData {
export interface IAdvancedMesureData {
'extra-header': object | null
output: string[]
'puppeteer-script'?: string
'audit-category': string[]
'output-path'?: string
'user-agent'?: string
'output-name'?: string
}
export interface IJsonMesureData extends IAdvancedMesureData {
courses: ICourse[]
}
export interface ISimpleMesureData extends IAdvancedMesureData {
value: string
}
export interface ICourse {
name: string
target: string
Expand Down
37 changes: 35 additions & 2 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,39 @@
}
}
},
"Application version": "Application version:",
"Plugin version": "Écoindex plugins v:"
"Plugin version:": "Version of the Ecoindex measurement engine (lighthouse-plugin-ecoindex):",
"footer": {
"visite-website": {
"app": "Go consult the application website",
"plugin": "Go consult the Lighthouse-Plugin-Ecoindex plugin site"
}
},
"advConfiguration": {
"title": "Advanced configuration",
"title-title": "Click to open or close Advanced Setup",
"puppeteer": {
"title": "Use a custom Puppeteer scenario file",
"input": {
"aria": "Puppetter scenario file"
},
"description": "Please fill in if you need to use a specific scenario, such as strong authentication. \nUse *.js, *.ts, *.mjs or *.cjs files (*.mjs is recommended).",
"help-link": "You will find more information on this subject in the help https://lighthouse-ecoindex.greenit.eco/guides/9-adv-conf/#utilisation-dun-fichier-de-script-puppeteer-custom"
},
"envvar": {
"description": "Environment variables to pass to the measurements script (for an identifier/password to use with the Puppeteer custom script, for example). \nThey will not be saved!",
"title": "Environment variables"
}
},
"key-value": {
"add": {
"to": "Add an item to"
}
},
"Reset": "Reset",
"Application version:": "Application version:",
"simple-mesure": {
"urls": {
"title": "URLs"
}
}
}
41 changes: 36 additions & 5 deletions src/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"Add an URL": "Ajouter une URL",
"Application Update": "Mise à jour de l'application",
"Application succefully loaded.\nWelcome 👋": "L'application a été chargée avec succès.\nBienvenue 👋",
"Application version:": "Version de l'application",
"Are you shure to want create report(s) in your default folder?": "Êtes-vous sûr de vouloir créer le(s) rapport(s) dans votre dossier par défaut ?",
"Are you shure to want create report(s) in your default folder?\n\rDestination: {{homeDir}}": "Êtes-vous sûr de vouloir créer le(s) rapport(s) dans votre dossier par défaut ?\n\rDestination: {{homeDir}}",
"Browse": "Parcourir",
Expand Down Expand Up @@ -68,7 +67,7 @@
"Full Screen": "Plein écran",
"Generates Html reports in seleted dir.": "Génération des rapports HTML dans le dossier sélectionné.",
"Generates reports files in seleted dir.": "Génération des rapports dans le dossier sélectionné.",
"Header to add cookies, Authentication...": "Header pour ajouter des Cookies, Authenification...",
"Header to add cookies, Authentication...": "Header pour ajouter des Cookies, Authentification...",
"Help": "Aide",
"Hide App": "Masquer l'application",
"Hide Others": "Masquer les autres applications",
Expand Down Expand Up @@ -173,7 +172,6 @@
"windows": {
"unpacking": "Extraction des fichiers (cela peut prendre quelques secondes et faire freezé l'application)..."
},
"homeDir-workDir": "Recherche du dossier de travail",
"dir": {
"home": "Recherche du dossier utilisateur...",
"work": "Recherche du dossier de travail..."
Expand Down Expand Up @@ -219,6 +217,39 @@
}
}
},
"Plugin version": "Écoindex plugins v:",
"Application version": "Version de l'application:"
"Plugin version:": "Version du moteur de mesure Écoindex (lighthouse-plugin-ecoindex):",
"footer": {
"visite-website": {
"app": "Aller consulter le site de l'application",
"plugin": "Aller consulter le site du plugin lighthouse-plugin-ecoindex"
}
},
"advConfiguration": {
"title": "Configuration avancée",
"title-title": "Cliquez pour ouvrir ou fermer la Configuration avancée",
"puppeteer": {
"title": "Utilisez un fichier de scénario Puppeteer custom",
"input": {
"aria": "Fichier de scénario Puppetter"
},
"description": "À renseigner si vous devez utiliser un scénarion spécififique, comme une authentification forte. Utiliser des fichies de types *.js, *.ts, *.mjs ou *.cjs (*.mjs est recommandé).",
"help-link": "Vous trouverez plus d'information à ce sujet sur l'aide https://lighthouse-ecoindex.greenit.eco/guides/9-adv-conf/#utilisation-dun-fichier-de-script-puppeteer-custom"
},
"envvar": {
"description": "Variables d'environnement à passer au script de mesures (pour un identifiant/password à utiliser avec le script Puppeteer custom, par exemple). Elles ne seront pas sauvegardées !",
"title": "Variables d'environnement"
}
},
"key-value": {
"add": {
"to": "Ajouter un élément à"
}
},
"Reset": "Effacer",
"Application version": "Version de l'application:",
"simple-mesure": {
"urls": {
"title": "URLs"
}
}
}
80 changes: 61 additions & 19 deletions src/main/handlers/HandleCollectAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { _sendMessageToFrontConsole } from '../utils/SendMessageToFrontConsole'
import { _sendMessageToFrontLog } from '../utils/SendMessageToFrontLog'
import { convertJSONDatasFromISimpleUrlInput } from '../utils/ConvertJSONDatas'
import { error } from 'console'
import { exit } from 'node:process'
import { fileURLToPath } from 'node:url'
import fs from 'fs'
import { getMainLog } from '../main'
Expand Down Expand Up @@ -276,7 +277,8 @@ async function _runCollect(
async function _runDirectCollect(
command: SimpleCollectDatas_V2 | ComplexeCollectDatas_V2,
event: IpcMainEvent,
isSimple = false
isSimple = false,
envVars: IKeyValue = null
) {
const mainLog = getMainLog().scope('main/runDirectCollect')
try {
Expand Down Expand Up @@ -306,6 +308,16 @@ async function _runDirectCollect(

// Définir les variables d'environnement pour le processus Node.js
process.env.WORK_DIR = workDir
// Définir les variables d'environnement demandés par l'utilisateur
if (envVars) {
try {
Object.entries(envVars).map((ev) => {
process.env[ev[0].toUpperCase()] = ev[1]
})
} catch (error) {
throw new Error(`EnvVars in error`)
}
}

// Créer une Promise qui se résoudra quand le processus enfant sera terminé
await new Promise<void>((resolve, reject) => {
Expand All @@ -325,12 +337,6 @@ async function _runDirectCollect(
process.platform === 'win32' ? 'lib' : 'lib.asar',
'courses_index.mjs'
)
// pathToScript = path.join(__dirname, '..', 'scripts', 'courses_index.mjs')
// pathToScript = process.env['WEBPACK_SERVE'] === 'true'
// ? path.join(__dirname, '..', 'scripts', 'courses_index.mjs')
// : path.join(
// 'app.asar', 'scripts', 'courses_index.mjs'
// )
const child = utilityProcess.fork(pathToScript, ['test'], {
stdio: ['ignore', 'pipe', 'pipe'],
})
Expand Down Expand Up @@ -470,7 +476,9 @@ async function _runDirectCollect(
*/
export const handleSimpleCollect = async (
event: IpcMainEvent,
urlsList: ISimpleUrlInput[]
urlsList: ISimpleUrlInput[],
localAdvConfig: IAdvancedMesureData,
envVars: IKeyValue
) => {
const mainLog = getMainLog().scope('main/handleSimpleCollect')
if (!urlsList || urlsList.length === 0) {
Expand All @@ -482,9 +490,13 @@ export const handleSimpleCollect = async (
})

// prepare common collect
const collectDatas = _prepareDatas(`simple`, [`html`], urlsList)
const { command, nodeDir, workDir: _workDir } = await _prepareCollect()
const collectDatas = _prepareDatas(
`simple`,
localAdvConfig.output as ('statement' | 'json' | 'html')[],
urlsList
)

const { command, nodeDir, workDir: _workDir } = await _prepareCollect()
_debugLogs('Simple measure start, process intialization...')
_debugLogs(`Urls list: ${JSON.stringify(urlsList)}`)
try {
Expand All @@ -494,24 +506,52 @@ export const handleSimpleCollect = async (
command.push(url.value)
}
})
command.push('-o')
command.push('html')
collectDatas.command['output'] = localAdvConfig.output as (
| 'statement'
| 'json'
| 'html'
)[]
collectDatas.command['audit-category'] = localAdvConfig[
'audit-category'
] as (
| 'accessibility'
| 'best-practices'
| 'performance'
| 'seo'
| 'lighthouse-plugin-ecoindex-core'
)[]
collectDatas.command['extra-header'] = JSON.stringify(
localAdvConfig['extra-header']
) as unknown as {
[key: string]: string
}
collectDatas.command['user-agent'] = localAdvConfig['user-agent']
if (localAdvConfig['puppeteer-script']) {
collectDatas.command['puppeteer-script'] =
localAdvConfig['puppeteer-script']
}
command.push('--output-path')
command.push(`${_workDir}`)

// Fake mesure and path. TODO: use specified path and urls
showNotification({
subtitle: i18n.t(' 🚀Simple collect'),
body: i18n.t('Collect started...'),
})
try {
if (isDev()) {
// mainLog.debug(`before (simple) runCollect`, nodeDir, command)
const [script, ...args] = command
mainLog.debug(`before (simple) runCollect`, script, args)
// mainLog.debug(`before (simple) runCollect`, collectDatas)
mainLog.debug(
`before (simple) runCollect(script, args)`,
script,
args
)
mainLog.debug(
`before (simple) runCollect(collectDatas)`,
collectDatas
)
}
// await _runCollect(command, nodeDir, event, true)
await _runDirectCollect(collectDatas, event, true)
await _runDirectCollect(collectDatas, event, true, envVars)
} catch (error) {
showNotification({
subtitle: i18n.t('🚫 Simple collect'),
Expand Down Expand Up @@ -546,9 +586,11 @@ export const handleSimpleCollect = async (
export const handleJsonSaveAndCollect = async (
event: IpcMainEvent,
jsonDatas: IJsonMesureData,
andCollect: boolean
andCollect: boolean,
envVars: IKeyValue
) => {
const mainLog = getMainLog().scope('main/handleJsonSaveAndCollect')

if (!jsonDatas) {
throw new Error('Json data is empty')
}
Expand Down Expand Up @@ -627,7 +669,7 @@ export const handleJsonSaveAndCollect = async (
// command.push(_workDir)
try {
// await _runCollect(command, nodeDir, event)
await _runDirectCollect(collectDatas, event, false)
await _runDirectCollect(collectDatas, event, false, envVars)
} catch (error) {
mainLog.error('Simple collect error', error)
throw new Error('Simple collect error')
Expand Down
Loading