Commit Graph

53 Commits

Author SHA1 Message Date
Ashley Harrison
0c0d63b830
Build: enable caching in eslint plugin (#64325)
enable caching in eslint plugin
2023-03-07 14:53:50 +00:00
Jack Westbrook
3a7623753b
Build: Replace babel-loader with esbuild-loader (#57837)
* build(webpack): replace babel-loader with esbuild-loader

* build(webpack): add esbuild minifier to production builds

* Wip

* Removed ngInject and replaced with manual inject params

* chore: bump esbuild to 0.15.13

* Fixed angular issues

* build(frontend): update esbuild to 0.16.16

* chore(webpack): support browserslist for esbuild

* build(esbuild): unify versions of esbuild to 0.16.17 and esbuild-loader to 2.21.0

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2023-01-23 12:15:05 +01:00
Jack Westbrook
78bef7a26a
Build: Enable long term caching for frontend assets (#47625)
* build(webpack): move CopyUniconsPlugin into own file

* chore(webpack): delete unused blobUrl and compile loaders

* build(webpack): prefer contenthash over fullhash for longer caching

* build(webpack): set optimization.moduleIds named only in dev

* build(webpack): introduce HTMLWebpackCSSChunks so templates can access theme css by name

* feat: inject css files with contenthash in html templates

* revert(error-template): remove ContentDeliveryURL from CSS href

* refactor(index-template): update grafanaBootData.themePaths

* chore(webpack): add typescript annotations for CopyUniconsPlugin
2022-05-26 11:49:18 +02:00
Josh Hunt
3c6e0e8ef8
Chore: ESlint import order (#44959)
* Add and configure eslint-plugin-import

* Fix the lint:ts npm command

* Autofix + prettier all the files

* Manually fix remaining files

* Move jquery code in jest-setup to external file to safely reorder imports

* Resolve issue caused by circular dependencies within Prometheus

* Update .betterer.results

* Fix missing // @ts-ignore

* ignore iconBundle.ts

* Fix missing // @ts-ignore
2022-04-22 14:33:13 +01:00
Josh Hunt
3b497f3e8d
Chore: Move babel config to a root babel.config.json (#41615)
* Chore: Move babel config to a root babel.config.json

* Re-add babel cache settings to webpack

* Re-add production browserlist in babel config

* re-add babel hot refresh config

* fix storybook
2021-11-18 16:38:58 +00:00
Jack Westbrook
5fad5511e9
Build: Enable persistent cache for faster Webpack builds (#41430)
* build(webpack): enable caching for development and production builds

* build(webpack): introduce unminified production build script

* build(typescript): introduce incremental flag to cache typechecking

* chore(git): ignore typescript cache file

* chore(webpack): bump dependencies to latest
2021-11-11 14:32:34 +01:00
Jack Westbrook
8d3b31ff23
Build: Upgrade Webpack 5 (#36444)
* build(webpack): bump to v5 and successful yarn start compilation

* build(webpack): update postcss dependencies

* build(webpack): silence warnings about hash renamed to fullhash

* build(webpack): enable persistent cache to store generated webpack modules / chunks

* build(webpack): prefer eslintWebpackPlugin over tschecker so eslint doesn't block typechecking

* chore(yarn): run yarn-deduplicate to clean up dependencies

* chore(yarn): refresh lock file after clean install

* build(webpack): prefer output.clean over CleanWebpackPlugin

* build(webpack): prefer esbuild over babel-loader for dev config

* build(babel): turn off cache compression to improve build performance

* build(webpack): get production builds working

* build(webpack): remove phantomJS (removed from grafana in v7) specific loader

* build(webpack): put back babel for dev builds no performance gain in using esbuild in webpack

* build(webpack): prefer terser and optimise css plugins for prod. slower but smaller bundles

* build(webpack): clean up redundant code. inform postcss about node_modules

* build(webpack): remove deprecation warnings flag

* build(webpack): bump packages, dev performance optimisations, attempt to get hot working

* chore(storybook): use webpack 5 for dev and production builds

* build(storybook): speed up dev build

* chore(yarn): refresh lock file

* chore(webpack): bump webpack and related deps to latest

* refactor(webpack): put back inline-source-map, move start scripts out of grafana toolkit

* feat(webpack): prefer react-refresh over react-hot-loader

* build(webpack): update webpack.hot to use react-refresh

* chore: remove react-hot-loader from codebase

* refactor(queryeditorrow): fix circular dependency causing react-fast-refresh errors

* revert(webpack): remove stats.errorDetails from common config

* build(webpack): bump to v5 and successful yarn start compilation

* build(webpack): update postcss dependencies

* build(webpack): silence warnings about hash renamed to fullhash

* build(webpack): enable persistent cache to store generated webpack modules / chunks

* build(webpack): prefer eslintWebpackPlugin over tschecker so eslint doesn't block typechecking

* chore(yarn): run yarn-deduplicate to clean up dependencies

* chore(yarn): refresh lock file after clean install

* build(webpack): prefer output.clean over CleanWebpackPlugin

* build(webpack): prefer esbuild over babel-loader for dev config

* build(babel): turn off cache compression to improve build performance

* build(webpack): get production builds working

* build(webpack): remove phantomJS (removed from grafana in v7) specific loader

* build(webpack): put back babel for dev builds no performance gain in using esbuild in webpack

* build(webpack): prefer terser and optimise css plugins for prod. slower but smaller bundles

* build(webpack): clean up redundant code. inform postcss about node_modules

* build(webpack): remove deprecation warnings flag

* build(webpack): bump packages, dev performance optimisations, attempt to get hot working

* chore(storybook): use webpack 5 for dev and production builds

* build(storybook): speed up dev build

* chore(yarn): refresh lock file

* chore(webpack): bump webpack and related deps to latest

* refactor(webpack): put back inline-source-map, move start scripts out of grafana toolkit

* feat(webpack): prefer react-refresh over react-hot-loader

* build(webpack): update webpack.hot to use react-refresh

* chore: remove react-hot-loader from codebase

* refactor(queryeditorrow): fix circular dependency causing react-fast-refresh errors

* revert(webpack): remove stats.errorDetails from common config

* revert(webpack): remove include from babel-loader so symlinks (enterprise) work as before

* refactor(webpack): fix deprecation warnings in prod builds

* fix(storybook): fix failing builds due to replacing css-optimise webpack plugin

* fix(storybook): use raw-loader for svg icons

* build(webpack): fix dev script colors error

* chore(webpack): bump css-loader and react-refresh-webpack-plugin to latest versions

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2021-08-31 12:55:05 +02:00
Torkel Ödegaard
693985a6ba
Plugins: Support es5 plugins extending es6 core classes (#32664)
* Plugins: Support es5 plugins extending es6 core classes

* Make all base classes backward compatible
2021-04-06 14:51:35 +02:00
Torkel Ödegaard
7f6229494d
Babel: Target more modern browsers, updates browserlistrc (#32573)
* Babel: Target more modern browsers, updates browserlistrc

* Updates

* Fixed circular dependencies, grafana booted
2021-04-01 10:32:00 +02:00
Torkel Ödegaard
b0ffcfd558
Babel: Refactoring config so that it's shared and removes legacy plugin (#32559)
* Updated plugins

* Fixing stuff

* Update

* Fixing more stuff
2021-03-31 19:09:19 +02:00
Hugo Häggmark
602d8f601c
Chore: Changes source map devtool to inline-source-map (#30004) 2020-12-30 06:03:53 +01:00
Domas
bd9add72de
toolkit: expose maxWorkers option for plugin build & test tasks (#27724) 2020-10-01 10:50:56 +02:00
denominator
1d2b839a1d
Docs: Fix note format for documentation (#27940) 2020-09-30 12:45:07 -07:00
Zoltán Bedi
ae30482465
Chore: MEGA - Make Eslint Great Again 💅 (#26094)
* Fix lint error in types.ts

* Bump eslint and its deps to latest

* Add eslintignore and remove not needed eslintrcs

* Change webpack configs eslint config

* Update package.jsons and removed unused eslintrc files

* Chore yarn lint --fix 💅

* Add devenv to eslintignore

* Remove eslint disable comments for rules that are not used

* Remaining eslint fixes 💅

* Bump grafana/eslint-config 💥

* Modify package.json

No need for duplicate checks.

* Modify eslintignore to ignore data and dist folders

* Revert removing .eslintrc to make sure not to use certain packages

* Modify package.json to remove not needed command

* Use gitignore for ignoring paths
2020-08-11 17:52:44 +02:00
Zoltán Bedi
c16890c22d
Chore: use fork-ts-checker plugin for eslint check (#25631)
* Use fork-ts-checker for eslint check

* Fix lint issue

* Add packages to lint

* Add comments to webpack configs
2020-06-22 16:15:29 +02:00
Torkel Ödegaard
92a16d2e10
Transforms: Adds beta notice and updates transform descriptions (#24158)
* Transforms: Adds beta notice and updates transform descriptions

* Rename organize fields

* Webpack - enable images import

* Introduce FeatureState type

* Alow Container component grow/shrink config

* Enable svg import in main app

* Jest + webpack for svgs

* InfoBox refactor (+ added feature info box), Badge component introduced

* Update packages/grafana-ui/src/components/TransformersUI/FilterByNameTransformerEditor.tsx

Co-authored-by: Carl Bergquist <carl@grafana.com>

* Minor fixes

* Update packages/grafana-ui/src/components/TransformersUI/OrganizeFieldsTransformerEditor.tsx

Co-authored-by: Carl Bergquist <carl@grafana.com>

* Update packages/grafana-ui/src/components/TransformersUI/SeriesToFieldsTransformerEditor.tsx

Co-authored-by: Carl Bergquist <carl@grafana.com>

* fix typo

* Build storybook fixed

* Fix padding

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
Co-authored-by: Carl Bergquist <carl@grafana.com>
2020-05-04 15:05:31 +02:00
Peter Holmberg
e16213724c
DevEnv: Revert to clean stale assets (#23742) 2020-04-22 07:49:04 +02:00
Torkel Ödegaard
f2337c9855
Webpack: Do not clean webpack output on every rebuild (#23157) 2020-03-28 06:40:29 +01:00
Lukas Siatka
6065b1b91d
DevEnv: updates import of CleanWebpackPlugin to named import (#22800) 2020-03-16 10:52:30 +01:00
Ryan McKinley
2c9b321c48
FieldOverides: apply field overrides based on configuration (#22047)
* test apply

* test apply

* Move standard field config editor registry to grafana-data

* merge master

* Apply field config defaults

* Make field and dataFrameIndex optional on on FieldOverrideContext

* Apply custom field config overrides

* Gauge - make sure thresholds are set

* Move series and field scoped vars calculation

* Enable template variables interpolation in title fields

* Expose standars field configs from grafana ui via function

* Add missing option to the config for the min value to be derived from field values

* Fix ts issue

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
2020-02-13 21:37:24 +01:00
Steven Vachon
f48169633c
TSLint → ESLint (#21006)
* Alphabetized tslint and tsconfig files

* Optimized tsconfig files

* Optimized editorconfig & prettier config files

… to reduce redundancy

* Switched to @grafana/tsconfig

… and:
* de-duped options
* removed options with default values

* Fixed nasty issue with types for nested slate-react

* Replaced TSLint with ESLint

* TSLint disables → ESLint disables

… also JSHint removals, which haven’t had an affect since it was replaced with TSLint.

* Compliances for ESLint, Prettier and TypeScript

* Updated lockfile
2020-02-08 02:40:04 +01:00
Steven Vachon
9005b484f0
Replace ts-loader with Babel (#21587)
* Applied prettier to relevant webpack configs

* Replaced ng-annotate with babel-plugin-angularjs-annotate

… and replaced ts-loader with @preset/typescript

* Removed redundant import

… that is problematic with Babel's module resolver

* Updated lockfile

* Traspile debug package to es5 for PhantomJS support

* Update babel to latest version

* Remove @babel/poolyfill and url search params polyfill

* Add ts-loader to grafana-ui dependencies

* Update prod webpack build to use cor-js 3

* Applied prettier to relevant webpack configs

* Replaced ng-annotate with babel-plugin-angularjs-annotate

… and replaced ts-loader with @preset/typescript

* Updated lockfile

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
2020-01-30 10:54:11 +01:00
Dominik Prokop
8bc4ef3e9c Revert "Babel: use babel-loader instead of ts-loader, ng-annotate with babel-plugin-angularjs-annotate (#21554)" (#21570)
This reverts #21554 which caused problems with e2e.
This reverts commit e7e0d18bc8.
2020-01-17 15:52:56 +01:00
Steven Vachon
e7e0d18bc8 Babel: use babel-loader instead of ts-loader, ng-annotate with babel-plugin-angularjs-annotate (#21554)
* Applied prettier to some webpack configs

* Removed ng-annotate

… and used same annotation approach as webpack.hot.js

* Removed redundant import

… that is problematic with Babel's module resolver

* Updated lockfile

* Replace ts-loader with babel-loader in webpack.dev

* Change tslint-loade order in dev webpack config

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
2020-01-17 12:36:46 +01:00
Dominik Prokop
178bb1d3ab Echo: mechanism for collecting custom events lazily (#20365)
* Introduce Echo for collecting frontend metrics

* Update public/app/core/services/echo/Echo.ts

Co-Authored-By: Peter Holmberg <peterholmberg@users.noreply.github.com>

* Custom meta when adding event

* Rename consumer to backend

* Remove buffer from Echo

* Minor tweaks

* Update package.json

* Update public/app/app.ts

* Update public/app/app.ts

* Collect paint metrics when collecting tti. Remove echoBackendFactory

* Update yarn.lock

* Move Echo interfaces to runtime

* progress on meta and echo

* Collect meta analytics events

* Move MetaanalyticsBackend to enterprise repo

* Fixed unit tests

* Removed unused type from test

* Fixed issues with chunk loading (reverted index-template changes)

* Restored changes

* Fixed webpack prod
2019-12-05 08:30:39 +01:00
kay delaney
6ea2d484b1
Webpack: Fix accidental double typechecking (#18881) 2019-09-04 10:17:49 +01:00
kay delaney
7985aa1e57
Performance/Webpack: Introduces more aggressive code-splitting and other perf improvements (#18544)
* Performance/Webpack: Introduces more aggressive code-splitting and other perf improvements
- Introduces dynamic imports for built-in plugins
- Uses dynamic imports for various packages (rst2html, brace)
- Introduces route-based dynamic imports
- Splits angular and moment into separate bundles
2019-09-03 09:29:02 +01:00
David
89abc77b22
Build: Optional skipping of typescript checking in dev bundler (#18772)
* Build: Removed typescript checking from dev bundler

- when switching branches and trying out features, TS checking and bundling are eating up a lot
of CPU
- most of us are using an editor with typechecking support
- this commit removes type checking from the dev bundler
- we still have type checking enabled as a precommit hook and as part of
the prod bundler

* Adds new npm script: start:noTsCheck
2019-08-30 14:02:31 +02:00
Oleg Gaidarenko
eac1459832
Build: watch and dev mode webpack improvements (#18153)
* Ignore `node_modules` in watch mode

* Simplify development setup
2019-07-20 07:46:41 +03:00
Johannes Schill
bdce61d02a chore: Bump clean-webpack-plugin, html-webpack-harddisk-plugin, postcss-reporter 2019-03-14 08:25:56 +01:00
Johannes Schill
79f6b4f8e6 chore: Bump css-loader and remove minimize option since its removed in css-loader 2019-03-14 08:25:54 +01:00
Johannes Schill
e3ddfccb61 fix: Move chunk splitting from prod to common so we get the same files in dev as prod 2019-03-05 13:29:54 +01:00
Torkel Ödegaard
34c70ca7ce fix for issue with error view in production builds 2018-11-20 13:47:45 +01:00
Torkel Ödegaard
b415d82611 fixed to template PR issues, #13938 2018-11-02 10:49:46 +01:00
Tarek Becker
70bb81c6eb Load hash based styles in error.html, too 2018-11-01 23:31:17 +01:00
Tarek Becker
4d4eb354b7 Add [hash] to filename of grafana.{light,dark}.css 2018-11-01 21:43:07 +01:00
Pierre GIRAUD
a92d51731d Webpack tapable plugin deprecation (#12960)
* Remove unrequired extract-text-webpack-plugin

* Update ngAnnotate to avoid deprecation warning

* Avoid deprecation warning (Tapable.plugin -> hooks)
2018-08-20 11:55:29 +02:00
Torkel Ödegaard
713a87fb5b
Webpack 4 (WIP) (#12098)
* Webpack 4

* webpack: force angular version 1.6 as 1.7 has removed a legacy feature toggle Grafana needs, switched from awesome-typescript-loader to ts-loader & forked ts checker

* Webpack 4

* webpack: force angular version 1.6 as 1.7 has removed a legacy feature toggle Grafana needs, switched from awesome-typescript-loader to ts-loader & forked ts checker

* upgrade ts loader

* simplified splitChunks

* upgrade circle node image to v8

* webpack: minor changes, using the new mode option, removed unused awesome-typescript loader, investigating karma issue but no solution yet

* fix: change angular mocks version restriction to be more strict

* add babel-loader for HMR support, fix karma debug runner

* babel-loader to yarn.lock

* webpack: changed from ExtractTextPlugin  to MiniCssExtractPlugin, and updated the minification step to use new webpack4 optimization config section

* webpack: remove css minifcation from general css processing as it's done in the webpack optimization step

* limit vendors chunk to .ts and .js files

* fix: removed typescript compile error, wanted to see if we still got test failure for that

* tech: upgrade uglify-js, should be faster now
2018-06-26 01:28:37 -07:00
PedroD
3bf12e4ff5 Fixing wrong /public path, relative to the webpack.dev script, that would avoid webpack from cleaning previous builds. (#12351) 2018-06-25 04:45:47 -07:00
David Kaltschmidt
ebe8e62bd5 Split webpack dev config into dev and hot
Motivation:

* too many conditionals for config, better to be explicit
* different priorities: faster build for hot mode
* working SCSS sources for styles in hot mode

The biggest differences:

* removed linter from TS loader in hot (should be editor or precommit
 or responsibility)
* simplified styles loading
* hot needs more extensions to resolve
* removed commons chunking for hot
* removed devServer from dev

Reduced HMR time from 8s to 4s on my machine.
2018-05-28 13:49:15 +02:00
David Kaltschmidt
dd66cbc847 Use babel and hot loader only in yarn start
* moved babel rules for hot reloading into TS loader
* toggling use of babel via HOT variable (true with `yarn start`)
* overriding webpack output when HOT to fix asset paths in dashboard
 urls like http://localhost:3333/d/...
2018-05-14 11:58:15 +02:00
David
ed067e8d35 Fix CSS asset loading for yarn start (HMR) (#11855)
* enable url() processing in CSS to ensure assets load in HMR mode
* only needed when running `yarn start` which needs this for the hot
reloader
2018-05-07 17:02:55 +02:00
Torkel Ödegaard
249c1e8d3d fix: loading of css url (images/fonts) 2018-05-07 14:02:38 +02:00
David Kaltschmidt
f1220fd2a4 Explore WIP 2018-04-26 20:27:19 +02:00
David Kaltschmidt
cc5d7002b0 Add weback-dev-server with hot/hmr support
* adds `npm start` / `yarn start` script
* starts a webpack-dev-server using the dev config, served on :3333
* hot reloading (HMR) for react/styles, not working for angular code
* new entry `dev.ts` for dynamic imports of CSS theme (ExtractText does
not work with HMR)
* TS loader pipeline moved out of common to add HMR for react
* applied `hot()` to some react containers (that's their new default
 export, named exports remains for testing)
* added sections to README
* updated yarn.lock
2018-04-19 11:42:53 +02:00
Torkel Ödegaard
97cc454ded ux: minor changes 2017-11-01 14:23:46 +01:00
Daniel Lee
5e8f253ff8 webpack: changed devtools setting to stop exceptions 2017-10-11 16:09:05 +02:00
Torkel Ödegaard
b228c23dbe testing: fixing tests 2017-10-07 22:05:31 +02:00
Torkel Ödegaard
1af00f5209 build: remove clean plugin from dev build 2017-10-03 20:25:47 +02:00
Torkel Ödegaard
3dac77468b fix: ensure panel.datasource is null as default 2017-10-03 12:18:22 +02:00