-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean update of front according to the sonar plugin exemple method
- Loading branch information
Showing
15 changed files
with
3,724 additions
and
5,050 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2009-2020 SonarSource SA | ||
* mailto:info AT sonarsource DOT com | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be | ||
// injected into the application via DefinePlugin in Webpack configuration. | ||
|
||
const REACT_APP = /^REACT_APP_/i; | ||
|
||
function getClientEnvironment() { | ||
return Object.keys(process.env).filter(key => REACT_APP.test(key)).reduce((env, key) => { | ||
env['process.env.' + key] = JSON.stringify(process.env[key]); | ||
return env; | ||
}, { | ||
// Useful for determining whether we’re running in production mode. | ||
// Most importantly, it switches React into the correct mode. | ||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development') | ||
}); | ||
} | ||
|
||
module.exports = getClientEnvironment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright (C) 2009-2020 SonarSource SA | ||
* mailto:info AT sonarsource DOT com | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
const path = require("path"); | ||
const autoprefixer = require("autoprefixer"); | ||
|
||
module.exports = { | ||
// Define the entry points here. They MUST have the same name as the page_id | ||
// defined in src/main/java/org/sonarsource/plugins/example/web/MyPluginPageDefinition.java | ||
entry: { | ||
// Using Vanilla JS: | ||
report: ["./src/main/js/global_page/index.js"], | ||
}, | ||
output: { | ||
// The entry point files MUST be shipped inside the final JAR's static/ | ||
// directory. | ||
path: path.join(__dirname, "../../target/classes/static"), | ||
filename: "[name].js" | ||
}, | ||
resolve: { | ||
modules: [ path.join(__dirname, "src/main/js"), 'node_modules' ] | ||
}, | ||
externals: { | ||
// React 16.8 ships with SonarQube, and should be re-used to avoid | ||
// collisions at runtime. | ||
react: "React", | ||
"react-dom": "ReactDOM", | ||
// Register the Sonar* globals as packages, to simplify importing. | ||
// See src/main/js/common/api.js for more information on what is exposed | ||
// in SonarRequest. | ||
"sonar-request": "SonarRequest", | ||
}, | ||
module: { | ||
// Our example uses Babel to transpile our code. | ||
loaders: [ | ||
{ | ||
test: /\.js$/, | ||
loader: "babel", | ||
exclude: /(node_modules)/ | ||
}, | ||
{ | ||
test: /\.css/, | ||
loader: "style-loader!css-loader!postcss-loader" | ||
}, | ||
{ test: /\.json$/, loader: "json" } | ||
] | ||
}, | ||
postcss() { | ||
return [ | ||
autoprefixer({ | ||
browsers: [ | ||
"last 3 Chrome versions", | ||
"last 3 Firefox versions", | ||
"last 3 Safari versions", | ||
"last 3 Edge versions", | ||
"IE 11" | ||
] | ||
}) | ||
]; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright (C) 2009-2020 SonarSource SA | ||
* mailto:info AT sonarsource DOT com | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
const webpack = require('webpack'); | ||
const config = require('./webpack.config'); | ||
const getClientEnvironment = require('../env'); | ||
|
||
// Get environment variables to inject into our app. | ||
const env = getClientEnvironment(); | ||
|
||
// Assert this just to be safe. | ||
// Development builds of React are slow and not intended for production. | ||
if (env['process.env.NODE_ENV'] !== '"production"') { | ||
throw new Error('Production builds must have NODE_ENV=production.'); | ||
} | ||
|
||
const noUglify = process.argv.some(arg => arg.indexOf('--no-uglify') > -1); | ||
|
||
// Don't attempt to continue if there are any errors. | ||
config.bail = true; | ||
|
||
config.plugins = [ | ||
// Makes some environment variables available to the JS code, for example: | ||
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`. | ||
// It is absolutely essential that NODE_ENV was set to production here. | ||
// Otherwise React will be compiled in the very slow development mode. | ||
new webpack.DefinePlugin(env), | ||
|
||
// This helps ensure the builds are consistent if source hasn't changed: | ||
new webpack.optimize.OccurrenceOrderPlugin(), | ||
|
||
// Try to dedupe duplicated modules, if any: | ||
new webpack.optimize.DedupePlugin() | ||
]; | ||
|
||
if (!noUglify) { | ||
config.plugins.push( | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
screw_ie8: true, // React doesn't support IE8 | ||
warnings: false | ||
}, | ||
mangle: { | ||
screw_ie8: true | ||
}, | ||
output: { | ||
comments: false, | ||
screw_ie8: true | ||
} | ||
}) | ||
); | ||
} | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,56 @@ | ||
{ | ||
"name": "sonar-cnes-report-plugin", | ||
"license": "GPL-3.0", | ||
"version": "4.2.0", | ||
"devDependencies": { | ||
"@babel/core": "^7.8.7", | ||
"@babel/plugin-proposal-class-properties": "^7.8.3", | ||
"@babel/preset-env": "^7.8.7", | ||
"@babel/preset-react": "^7.8.3", | ||
"@emotion/core": "^10.0.17", | ||
"@emotion/styled": "^10.0.17", | ||
"autoprefixer": "9.7.4", | ||
"babel-core": "6.14.0", | ||
"babel-jest": "^25.1.0", | ||
"babel-loader": "^8.0.6", | ||
"babel-preset-react-app": "0.2.1", | ||
"css-loader": "^3.4.2", | ||
"emotion-theming": "^10.0.19", | ||
"lodash": "4.17.21", | ||
"postcss-calc": "7.0.2", | ||
"postcss-custom-properties": "9.1.1", | ||
"postcss-loader": "3.0.0", | ||
"react": "16.13.0", | ||
"react-dev-utils": "^11.0.4", | ||
"react-dom": "16.13.0", | ||
"react-router": "3.2.6", | ||
"sonar-ui-common": "1.0.33", | ||
"style-loader": "1.1.3", | ||
"uglifyjs-webpack-plugin": "^2.2.0", | ||
"webpack": "^4.42.0" | ||
}, | ||
"scripts": { | ||
"build": "node src/main/js/scripts/build.js" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"@babel/env", | ||
"@babel/react" | ||
], | ||
"plugins": [ | ||
"@babel/plugin-proposal-class-properties" | ||
] | ||
}, | ||
"dependencies": {} | ||
} | ||
{ | ||
"name": "sonar-cnes-report", | ||
"license": "LGPL-3.0", | ||
"version": "5.0.0", | ||
"devDependencies": { | ||
"autoprefixer": "6.2.2", | ||
"babel-core": "6.14.0", | ||
"babel-loader": "6.2.5", | ||
"babel-preset-react-app": "0.2.1", | ||
"cross-env": "2.0.0", | ||
"cross-spawn": "4.0.0", | ||
"css-loader": "0.23.1", | ||
"detect-port": "1.0.0", | ||
"dotenv": "2.0.0", | ||
"enzyme": "2.6.0", | ||
"enzyme-to-json": "1.4.5", | ||
"expose-loader": "0.7.1", | ||
"express": "4.13.4", | ||
"express-http-proxy": "0.6.0", | ||
"filesize": "3.3.0", | ||
"find-cache-dir": "0.1.1", | ||
"gzip-size": "3.0.0", | ||
"imports-loader": "0.6.5", | ||
"json-loader": "0.5.4", | ||
"path-exists": "2.1.0", | ||
"postcss-loader": "0.8.0", | ||
"prettier": "0.22.0", | ||
"react": "15.6.2", | ||
"react-addons-shallow-compare": "15.6.2", | ||
"react-addons-test-utils": "15.6.2", | ||
"react-dev-utils": "0.2.1", | ||
"react-dom": "15.6.2", | ||
"react-router": "3.0.2", | ||
"react-transform-hmr": "1.0.4", | ||
"recursive-readdir": "2.1.0", | ||
"rimraf": "2.5.4", | ||
"script-loader": "0.6.1", | ||
"strip-ansi": "3.0.1", | ||
"style-loader": "0.13.0", | ||
"webpack": "1.13.2", | ||
"webpack-dev-server": "1.16.1" | ||
}, | ||
"scripts": { | ||
"build": "node scripts/build.js" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"react-app" | ||
] | ||
}, | ||
"dependencies": { | ||
"backbone": "^1.4.0", | ||
"jquery": "^1.11.0", | ||
"underscore": "^1.9.1" | ||
} | ||
} |
Oops, something went wrong.