2017-10-01 13:02:25 -05:00
|
|
|
const path = require('path');
|
|
|
|
|
2020-01-23 01:33:39 -06:00
|
|
|
// https://github.com/visionmedia/debug/issues/701#issuecomment-505487361
|
|
|
|
function shouldExclude(filename) {
|
2020-04-02 06:34:16 -05:00
|
|
|
// There is external js code inside this which needs to be processed by babel.
|
|
|
|
if (filename.indexOf(`jaeger-ui-components`) > 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
@grafana/ui: Create Icon component and replace part of the icons (#23402)
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Resolve type errors resulted from merge
* Part2: Unicons implementation (#23266)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Icons update
* Add optional chaining to for isFontAwesome variable
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Part3: Unicons implementation (#23356)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Update icons in Explore
* Update icons in alerting
* Update + and x buttons
* Update icons in configurations and settings
* Update close icons
* Update icons in rich history
* Update alert messages
* Add optional chaining to for isFontAwesome variable
* Remove icon mock, set up jest.config
* Fix navbar plus icon
* Fir enable-bacground to enableBackgournd
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Merge remote branch origin master to icons-unicons
* Revert "Merge remote branch origin master to icons-unicons"
This reverts commit 3f25d50a39a940883fefe73ce51219139c1ed37f.
* Size-up dashnav icons
* Fix alerting icons, panel headers, update tests
* Fix typecheck error
* Adjustments - add panel icon, spacing
* Set TerserPlugin sourceMap to false to prevent running out of memory when publishing storybook
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-04-08 07:33:31 -05:00
|
|
|
const packagesToProcessbyBabel = [
|
|
|
|
'debug',
|
|
|
|
'lru-cache',
|
|
|
|
'yallist',
|
|
|
|
'apache-arrow',
|
|
|
|
'react-hook-form',
|
|
|
|
'rc-trigger',
|
|
|
|
'@iconscout/react-unicons',
|
|
|
|
];
|
2020-01-23 01:33:39 -06:00
|
|
|
for (const package of packagesToProcessbyBabel) {
|
|
|
|
if (filename.indexOf(`node_modules/${package}`) > 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-01-30 03:54:11 -06:00
|
|
|
console.log(path.resolve());
|
2017-10-01 13:02:25 -05:00
|
|
|
module.exports = {
|
|
|
|
target: 'web',
|
|
|
|
entry: {
|
|
|
|
app: './public/app/index.ts',
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, '../../public/build'),
|
2018-04-18 08:01:36 -05:00
|
|
|
filename: '[name].[hash].js',
|
2018-05-07 10:02:55 -05:00
|
|
|
// Keep publicPath relative for host.com/grafana/ deployments
|
2019-03-05 06:29:54 -06:00
|
|
|
publicPath: 'public/build/',
|
2017-10-01 13:02:25 -05:00
|
|
|
},
|
|
|
|
resolve: {
|
2018-10-09 12:46:31 -05:00
|
|
|
extensions: ['.ts', '.tsx', '.es6', '.js', '.json', '.svg'],
|
2020-01-30 03:54:11 -06:00
|
|
|
alias: {
|
|
|
|
// rc-trigger uses babel-runtime which has internal dependency to core-js@2
|
|
|
|
// this alias maps that dependency to core-js@t3
|
|
|
|
'core-js/library/fn': 'core-js/stable',
|
|
|
|
},
|
2020-03-18 05:18:48 -05:00
|
|
|
modules: [
|
|
|
|
'node_modules',
|
|
|
|
path.resolve('public'),
|
|
|
|
// we need full path to root node_modules for grafana-enterprise symlink to work
|
|
|
|
path.resolve('node_modules'),
|
|
|
|
],
|
2017-10-01 13:02:25 -05:00
|
|
|
},
|
2018-09-14 00:47:33 -05:00
|
|
|
stats: {
|
2019-01-05 08:19:54 -06:00
|
|
|
children: false,
|
2019-09-03 03:29:02 -05:00
|
|
|
warningsFilter: /export .* was not found in/,
|
2020-01-23 01:33:39 -06:00
|
|
|
source: false,
|
2018-09-14 00:47:33 -05:00
|
|
|
},
|
2017-10-01 13:02:25 -05:00
|
|
|
node: {
|
|
|
|
fs: 'empty',
|
|
|
|
},
|
|
|
|
module: {
|
2020-01-23 01:33:39 -06:00
|
|
|
rules: [
|
|
|
|
/**
|
|
|
|
* Some npm packages are bundled with es2015 syntax, ie. debug
|
|
|
|
* To make them work with PhantomJS we need to transpile them
|
|
|
|
* to get rid of unsupported syntax.
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: shouldExclude,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
presets: [['@babel/preset-env']],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2017-10-01 13:02:25 -05:00
|
|
|
test: require.resolve('jquery'),
|
2020-01-23 01:33:39 -06:00
|
|
|
use: [
|
|
|
|
{
|
2017-10-01 13:02:25 -05:00
|
|
|
loader: 'expose-loader',
|
2019-09-03 03:29:02 -05:00
|
|
|
query: 'jQuery',
|
2017-10-01 13:02:25 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'expose-loader',
|
2019-09-03 03:29:02 -05:00
|
|
|
query: '$',
|
|
|
|
},
|
|
|
|
],
|
2017-10-01 13:02:25 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.html$/,
|
2018-11-02 04:49:46 -05:00
|
|
|
exclude: /(index|error)\-template\.html/,
|
2020-01-23 01:33:39 -06:00
|
|
|
use: [
|
|
|
|
{
|
2019-09-03 03:29:02 -05:00
|
|
|
loader: 'ngtemplate-loader?relativeTo=' + path.resolve(__dirname, '../../public') + '&prefix=public',
|
|
|
|
},
|
2017-10-01 13:02:25 -05:00
|
|
|
{
|
|
|
|
loader: 'html-loader',
|
|
|
|
options: {
|
|
|
|
attrs: [],
|
|
|
|
minimize: true,
|
|
|
|
removeComments: false,
|
2019-09-03 03:29:02 -05:00
|
|
|
collapseWhitespace: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-05-04 08:05:31 -05:00
|
|
|
{
|
|
|
|
test: /\.(svg|ico|jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|cur|ani|pdf)(\?.*)?$/,
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: { name: 'static/img/[name].[hash:8].[ext]' },
|
|
|
|
},
|
2019-09-03 03:29:02 -05:00
|
|
|
],
|
2017-10-01 13:02:25 -05:00
|
|
|
},
|
2019-03-05 06:29:54 -06:00
|
|
|
// https://webpack.js.org/plugins/split-chunks-plugin/#split-chunks-example-3
|
|
|
|
optimization: {
|
2019-09-03 03:29:02 -05:00
|
|
|
moduleIds: 'hashed',
|
|
|
|
runtimeChunk: 'single',
|
2019-03-05 06:29:54 -06:00
|
|
|
splitChunks: {
|
2019-09-03 03:29:02 -05:00
|
|
|
chunks: 'all',
|
|
|
|
minChunks: 1,
|
2019-03-05 06:29:54 -06:00
|
|
|
cacheGroups: {
|
2019-09-03 03:29:02 -05:00
|
|
|
moment: {
|
|
|
|
test: /[\\/]node_modules[\\/]moment[\\/].*[jt]sx?$/,
|
|
|
|
chunks: 'initial',
|
|
|
|
priority: 20,
|
2020-01-23 01:33:39 -06:00
|
|
|
enforce: true,
|
2019-09-03 03:29:02 -05:00
|
|
|
},
|
|
|
|
angular: {
|
|
|
|
test: /[\\/]node_modules[\\/]angular[\\/].*[jt]sx?$/,
|
|
|
|
chunks: 'initial',
|
|
|
|
priority: 50,
|
2020-01-23 01:33:39 -06:00
|
|
|
enforce: true,
|
2019-09-03 03:29:02 -05:00
|
|
|
},
|
|
|
|
vendors: {
|
2019-03-05 06:29:54 -06:00
|
|
|
test: /[\\/]node_modules[\\/].*[jt]sx?$/,
|
2019-09-03 03:29:02 -05:00
|
|
|
chunks: 'initial',
|
|
|
|
priority: -10,
|
|
|
|
reuseExistingChunk: true,
|
2020-01-23 01:33:39 -06:00
|
|
|
enforce: true,
|
2019-09-03 03:29:02 -05:00
|
|
|
},
|
|
|
|
default: {
|
|
|
|
priority: -20,
|
|
|
|
chunks: 'all',
|
|
|
|
test: /.*[jt]sx?$/,
|
2020-01-23 01:33:39 -06:00
|
|
|
reuseExistingChunk: true,
|
2019-09-03 03:29:02 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2017-10-01 13:02:25 -05:00
|
|
|
};
|