Мониторинг: @tnsu/monitoring-web 0.3.1 — патч webpack и «один на страницу» из библиотеки
Tests / frontend-test (pull_request) Successful in 4m36s
Tests / frontend-test (pull_request) Successful in 4m36s
config/webpack-patch.json ссылается на патч из пакета (spfx/webpack-patch.cjs), свой config/webpack-patch/monitoring.js удалён. Флаг monitoringStarted не нужен: повторный initMonitoring библиотека игнорирует сама. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/webpack-patch.schema.json",
|
||||
"patchFiles": ["./config/webpack-patch/monitoring.js"]
|
||||
"patchFiles": ["./node_modules/@tnsu/monitoring-web/spfx/webpack-patch.cjs"]
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
// Хэш коммита сборки — в логи (git.commit) и записи экрана мониторинга: @tnsu/monitoring-web читает
|
||||
// __TNSU_GIT_COMMIT__, а webpack подставляет его при сборке. Хэш — GIT_COMMIT или GITHUB_SHA пайплайна, иначе git.
|
||||
const { execSync } = require('node:child_process');
|
||||
const webpack = require('webpack');
|
||||
|
||||
function gitCommit() {
|
||||
const fromEnv = process.env.GIT_COMMIT || process.env.GITHUB_SHA;
|
||||
if (fromEnv) return fromEnv;
|
||||
try {
|
||||
return execSync('git rev-parse HEAD', { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim();
|
||||
} catch {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function monitoringPatch(config) {
|
||||
config.plugins = config.plugins || [];
|
||||
config.plugins.push(new webpack.DefinePlugin({ __TNSU_GIT_COMMIT__: JSON.stringify(gitCommit()) }));
|
||||
return config;
|
||||
};
|
||||
Reference in New Issue
Block a user