diff --git a/package.json b/package.json index 4b0e46c1..c16dafd5 100644 --- a/package.json +++ b/package.json @@ -1,136 +1,137 @@ { "name": "swh-web", "version": "0.0.223", "description": "Static assets management for swh-web", "scripts": { "build-dev": "NODE_ENV=development webpack --config ./swh/web/assets/config/webpack.config.development.js --colors", "build-test": "NODE_ENV=test webpack --config ./swh/web/assets/config/webpack.config.development.js --colors", "start-dev": "NODE_ENV=development nodemon --watch swh/web/api --watch swh/web/browse --watch swh/web/templates --watch swh/web/common --watch swh/web/settings --watch swh/web/assets/config --ext py,html,js --exec \"webpack-dev-server --info=false --config ./swh/web/assets/config/webpack.config.development.js --colors\"", "build": "NODE_ENV=production webpack --config ./swh/web/assets/config/webpack.config.production.js --colors", "mochawesome": "mochawesome-merge --reportDir cypress/mochawesome/results > cypress/mochawesome/mochawesome.json && marge -o cypress/mochawesome/report cypress/mochawesome/mochawesome.json", "eslint": "eslint -c swh/web/assets/config/.eslintrc --fix swh/web/assets/**", "preinstall": "npm -v || (SWH_WEB=$PWD && cd /tmp && yarn add npm && cd node_modules/npm && yarn link && cd $SWH_WEB && yarn link npm)" }, "repository": { "type": "git", "url": "https://forge.softwareheritage.org/source/swh-web" }, "author": "The Software Heritage developers", "license": "AGPL-3.0-or-later", "dependencies": { "@babel/runtime-corejs3": "^7.7.6", + "@sentry/browser": "^5.10.2", "admin-lte": "^3.0.1", "ansi_up": "^4.0.4", "bootstrap": "^4.4.1", "chosen-js": "^1.8.7", "clipboard": "^2.0.4", "core-js": "^3.5.0", "d3": "^5.14.2", "datatables.net-responsive-bs4": "^2.2.3", "dompurify": "^2.0.7", "elementsfrompoint-polyfill": "^1.0.0", "font-awesome": "^4.7.0", "highlight.js": "^9.17.1", "highlightjs-line-numbers.js": "^2.7.0", "html-encoder-decoder": "^1.3.8", "iframe-resizer": "^4.2.8", "jquery": "^3.4.1", "js-cookie": "^2.2.1", "js-year-calendar": "^1.0.0-alpha.7", "notebookjs": "^0.4.2", "object-fit-images": "^3.2.4", "octicons": "^8.5.0", "org": "^0.2.0", "pdfjs-dist": "^2.2.228", "popper.js": "^1.16.0", "showdown": "^1.9.1", "typeface-alegreya": "0.0.69", "typeface-alegreya-sans": "^0.0.72", "validate.js": "^0.13.1", "waypoints": "^4.0.1", "whatwg-fetch": "^3.0.0" }, "devDependencies": { "@babel/core": "^7.7.5", "@babel/plugin-syntax-dynamic-import": "^7.7.4", "@babel/plugin-transform-runtime": "^7.7.6", "@babel/preset-env": "^7.7.6", "@cypress/code-coverage": "^1.10.4", "autoprefixer": "^9.7.3", "axios": "^0.19.0", "babel-eslint": "^10.0.3", "babel-loader": "^8.0.6", "babel-plugin-istanbul": "^5.2.0", "bootstrap-loader": "^3.0.4", "cache-loader": "^4.1.0", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^5.1.1", "css-loader": "^3.3.2", "cypress": "^3.8.0", "cypress-multi-reporters": "^1.2.3", "ejs": "^3.0.1", "eslint": "^6.7.2", "eslint-loader": "^3.0.3", "eslint-plugin-chai-friendly": "^0.5.0", "eslint-plugin-cypress": "^2.7.0", "eslint-plugin-import": "^2.19.1", "eslint-plugin-node": "^10.0.0", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-standard": "^4.0.1", "exports-loader": "^0.7.0", "expose-loader": "^0.7.5", "file-loader": "^5.0.2", "imports-loader": "^0.8.0", "istanbul-lib-coverage": "^2.0.5", "less": "^3.10.3", "less-loader": "^5.0.0", "mini-css-extract-plugin": "^0.8.0", "mocha": "^6.2.2", "mochawesome": "^4.1.0", "mochawesome-merge": "^2.1.0", "mochawesome-report-generator": "^4.0.1", "node-sass": "^4.13.0", "nodemon": "^2.0.2", "nyc": "^14.1.1", "optimize-css-assets-webpack-plugin": "^5.0.3", "postcss-loader": "^3.0.0", "postcss-normalize": "^8.0.1", "postcss-reporter": "^6.0.1", "progress-bar-webpack-plugin": "^1.12.1", "resolve-url-loader": "^3.1.1", "robotstxt-webpack-plugin": "^7.0.0", "sass-loader": "^8.0.0", "schema-utils": "^2.6.1", "script-loader": "^0.7.2", "spdx-expression-parse": "^3.0.0", "style-loader": "^1.0.1", "stylelint": "^12.0.0", "stylelint-config-standard": "^19.0.0", "terser-webpack-plugin": "^2.3.0", "url-loader": "^3.0.0", "webpack": "^4.41.2", "webpack-bundle-tracker": "^0.4.3", "webpack-cli": "^3.3.10", "webpack-dev-server": "^3.9.0" }, "browserslist": [ "cover 99.5%", "not dead" ], "postcss": { "plugins": { "autoprefixer": {}, "postcss-normalize": {} } }, "nyc": { "report-dir": "cypress/coverage", "exclude": [ "swh/web/assets/src/bundles/vendors/index.js", "swh/web/assets/src/thirdparty/**/*.js" ] }, "engines": { "node": ">=8.9.0" } } diff --git a/swh/web/assets/src/bundles/vendors/index.js b/swh/web/assets/src/bundles/vendors/index.js index ee87592e..9d0ab992 100644 --- a/swh/web/assets/src/bundles/vendors/index.js +++ b/swh/web/assets/src/bundles/vendors/index.js @@ -1,45 +1,48 @@ /** * Copyright (C) 2018-2019 The Software Heritage developers * See the AUTHORS file at the top-level directory of this distribution * License: GNU Affero General Public License version 3, or any later version * See top-level LICENSE file for more information */ // vendors bundles centralizing assets used in all swh-web applications // polyfills in order to use advanced js features (like Promise or fetch) // in browsers that do not support them import 'core-js/stable'; import 'regenerator-runtime/runtime'; import 'whatwg-fetch/dist/fetch.umd'; import 'elementsfrompoint-polyfill'; // jquery and bootstrap import 'jquery'; import 'bootstrap-loader/lib/bootstrap.loader?configFilePath=../../../swh/web/assets/config/.bootstraprc!bootstrap-loader/no-op.js'; // admin-lte scripts import 'admin-lte'; // js-cookie import 'js-cookie'; // jquery datatables import 'datatables.net'; import 'datatables.net-responsive-bs4'; import 'datatables.net-bs4/css/dataTables.bootstrap4.css'; import 'datatables.net-responsive-bs4/css/responsive.bootstrap4.css'; import './datatables.css'; // chosen-js import 'chosen-js'; import 'chosen-js/chosen.min.css'; // iframe-resizer import 'iframe-resizer'; // web fonts import 'typeface-alegreya'; import 'typeface-alegreya-sans'; import 'font-awesome/css/font-awesome.css'; import './octicons.css'; + +// Monitoring +import '@sentry/browser'; diff --git a/swh/web/assets/src/bundles/webapp/index.js b/swh/web/assets/src/bundles/webapp/index.js index 896211fd..34b7bfca 100644 --- a/swh/web/assets/src/bundles/webapp/index.js +++ b/swh/web/assets/src/bundles/webapp/index.js @@ -1,27 +1,28 @@ /** * Copyright (C) 2018-2019 The Software Heritage developers * See the AUTHORS file at the top-level directory of this distribution * License: GNU Affero General Public License version 3, or any later version * See top-level LICENSE file for more information */ // webapp entrypoint bundle centralizing global custom stylesheets // and utility js modules used in all swh-web applications // explicitly import the vendors bundle import '../vendors'; // global swh-web custom stylesheets import './webapp.css'; import './breadcrumbs.css'; export * from './webapp-utils'; // utility js modules export * from './code-highlighting'; export * from './readme-rendering'; export * from './pdf-rendering'; export * from './notebook-rendering'; export * from './xss-filtering'; export * from './history-counters'; export * from './badges'; +export * from './sentry'; diff --git a/swh/web/assets/src/bundles/webapp/sentry.js b/swh/web/assets/src/bundles/webapp/sentry.js new file mode 100644 index 00000000..bf8ac7dc --- /dev/null +++ b/swh/web/assets/src/bundles/webapp/sentry.js @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2019 The Software Heritage developers + * See the AUTHORS file at the top-level directory of this distribution + * License: GNU Affero General Public License version 3, or any later version + * See top-level LICENSE file for more information + */ + +import * as Sentry from '@sentry/browser'; + +// Called by a + + {% block header %}{% endblock %}