Skip to content

Commit

Permalink
RG-2122 remove "svg-inline-loader" from embeddable part of Ring UI
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-skl committed Feb 4, 2021
1 parent 1e90a29 commit 0d4edc5
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
9 changes: 7 additions & 2 deletions .storybook/custom-header/header-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ exports.managerWebpack = function managerWebpack(config) {
});

ringConfig.loaders.cssLoader.include.push(/\.storybook/);
ringConfig.loaders.svgInlineLoader.include.push(/@primer\/octicons/);
ringConfig.loaders.svgInlineLoader.include.push(/@jetbrains\/logos/);

ringConfig.config.module.rules.push({
test: /\.svg$/,
loader: require.resolve('svg-inline-loader'),
options: {removeSVGTagAttrs: false},
include: [/@primer\/octicons/, /@jetbrains\/logos/]
});

const serverUri = pkgConfig.hub;
const clientId = pkgConfig.clientId;
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
new webpack.NormalModuleReplacementPlugin(/@jetbrains\\/ring-ui\\/components\\/code\\/highlight.js$/, './highlight-lazy.js')
```
- `date-picker` has migrated from `moment` to `date-fns`. All the props deprecated in 3.1.0 are now removed. `onDateChange` is renamed back to `onChange` and will be removed in 5.0.
- `svg-inline-loader` is not used by Ring UI anymore. Concider installing and using own instance if needed.

## [3.1.0]
Some of the props of `date-picker` are changed or deprecared to allow removing the dependency on `moment` package in v4:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
"sinon-chai": "^3.5.0",
"storage-mock": "^1.0.3",
"stylelint": "^13.9.0",
"svg-inline-loader": "^0.8.2",
"teamcity-service-messages": "^0.1.11",
"vue": "^2.6.11",
"wallaby-webpack": "^3.9.16",
Expand Down Expand Up @@ -194,7 +195,6 @@
"simply-uuid": "^1.0.1",
"sniffr": "^1.2.0",
"style-loader": "~2.0.0",
"svg-inline-loader": "^0.8.2",
"url-loader": "^4.1.1",
"util-deprecate": "^1.0.2"
},
Expand Down
1 change: 1 addition & 0 deletions packages/generator/app/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"sinon": "^9.2.4",
"sinon-chai": "^3.5.0",
"stylelint": "^13.9.0",
"svg-inline-loader": "^0.8.2",
"xvfb-maybe": "^0.2.1",
"yo": "^3.1.1"
},
Expand Down
11 changes: 6 additions & 5 deletions packages/generator/app/templates/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ const pkgConfig = require('./package.json').config;

const componentsPath = join(__dirname, pkgConfig.components);

// Patch @jetbrains/ring-ui svg-sprite-loader config
ringUiWebpackConfig.loaders.svgInlineLoader.include.push(
require('@jetbrains/logos')
);

const webpackConfig = () => ({
entry: `${componentsPath}/app/app.js`,
resolve: {
Expand All @@ -31,6 +26,12 @@ const webpackConfig = () => ({
module: {
rules: [
...ringUiWebpackConfig.config.module.rules,
{
test: /\.svg$/,
loader: require.resolve('svg-inline-loader'),
options: {removeSVGTagAttrs: false},
include: [require('@jetbrains/logos')]
},
{
test: /\.css$/,
include: componentsPath,
Expand Down
15 changes: 6 additions & 9 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ function loadersObjectToArray(loaders) {
return Object.keys(loaders).map(name => loaders[name]);
}

const svgInlineLoader = {
test: /\.svg$/,
loader: require.resolve('svg-inline-loader'),
options: {removeSVGTagAttrs: false},
include: []
};

const svgLoader = {
test: /\.svg$/,
loader: require.resolve('url-loader'),
Expand Down Expand Up @@ -112,7 +105,6 @@ const gifLoader = {
};

const loaders = {
svgInlineLoader,
svgLoader,
cssLoader,
externalCssLoader,
Expand All @@ -133,5 +125,10 @@ module.exports = {

componentsPath,

loaders
loaders: {
...loaders,
get svgInlineLoader() {
throw new Error('***Ring UI embedded "svgInlineLoader" removed in 4.0. Please install and use own instance if you need it.***');
}
}
};

0 comments on commit 0d4edc5

Please sign in to comment.