Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
move and unify postcss config into @kbn/optimizer (elastic#73633)
Browse files Browse the repository at this point in the history
Co-authored-by: spalger <spalger@users.noreply.github.com>
  • Loading branch information
Spencer and spalger committed Jul 30, 2020
1 parent 4f92b68 commit 9858651
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 37 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ module.exports = {
'x-pack/test_utils/**/*',
'x-pack/gulpfile.js',
'x-pack/plugins/apm/public/utils/testHelpers.js',
'x-pack/plugins/canvas/shareable_runtime/postcss.config.js',
],
rules: {
'import/no-extraneous-dependencies': [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@
"pixelmatch": "^5.1.0",
"pkg-up": "^2.0.0",
"pngjs": "^3.4.0",
"postcss": "^7.0.26",
"postcss": "^7.0.32",
"postcss-url": "^8.0.0",
"prettier": "^2.0.5",
"proxyquire": "1.8.0",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"loader-utils": "^1.2.3",
"node-sass": "^4.13.0",
"normalize-path": "^3.0.0",
"postcss": "^7.0.32",
"postcss-loader": "^3.0.0",
"raw-loader": "^3.1.0",
"resolve-url-loader": "^3.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
Array [
<absolute path>/node_modules/css-loader/package.json,
<absolute path>/node_modules/style-loader/package.json,
<absolute path>/packages/kbn-optimizer/postcss.config.js,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/kibana.json,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/index.scss,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/index.ts,
Expand All @@ -171,7 +172,6 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/src/legacy/ui/public/styles/_globals_v7dark.scss,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/src/legacy/ui/public/styles/_globals_v7light.scss,
<absolute path>/packages/kbn-optimizer/target/worker/entry_point_creator.js,
<absolute path>/packages/kbn-optimizer/target/worker/postcss.config.js,
<absolute path>/packages/kbn-ui-shared-deps/public_path_module_creator.js,
]
`);
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/src/worker/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker:
options: {
sourceMap: !worker.dist,
config: {
path: require.resolve('./postcss.config'),
path: require.resolve('@kbn/optimizer/postcss.config.js'),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-storybook/lib/webpack.dll.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ module.exports = {
loader: 'postcss-loader',
options: {
config: {
path: path.resolve(REPO_ROOT, 'src/optimize/postcss.config.js'),
path: require.resolve('@kbn/optimizer/postcss.config.js'),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-storybook/storybook_config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ module.exports = async ({ config }) => {
loader: 'postcss-loader',
options: {
config: {
path: resolve(REPO_ROOT, 'src/optimize/'),
path: require.resolve('@kbn/optimizer/postcss.config.js'),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-framework/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

const sass = require('node-sass');
const postcss = require('postcss');
const postcssConfig = require('../../src/optimize/postcss.config');
const postcssConfig = require('@kbn/optimizer/postcss.config.js');
const chokidar = require('chokidar');
const { debounce } = require('lodash');

Expand Down
22 changes: 0 additions & 22 deletions packages/kbn-ui-framework/doc_site/postcss.config.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/kbn-ui-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@babel/core": "^7.10.2",
"@elastic/eui": "0.0.55",
"@kbn/babel-preset": "1.0.0",
"autoprefixer": "^9.7.4",
"@kbn/optimizer": "1.0.0",
"babel-loader": "^8.0.6",
"brace": "0.11.1",
"chalk": "^2.4.2",
Expand All @@ -54,7 +54,7 @@
"keymirror": "0.1.1",
"moment": "^2.24.0",
"node-sass": "^4.13.1",
"postcss": "^7.0.26",
"postcss": "^7.0.32",
"postcss-loader": "^3.0.0",
"raw-loader": "^3.1.0",
"react-dom": "^16.12.0",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-ui-shared-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"custom-event-polyfill": "^0.3.0",
"elasticsearch-browser": "^16.7.0",
"jquery": "^3.5.0",
"mini-css-extract-plugin": "0.8.0",
"moment": "^2.24.0",
"moment-timezone": "^0.5.27",
"react": "^16.12.0",
Expand Down
2 changes: 1 addition & 1 deletion src/optimize/base_optimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { IS_KIBANA_DISTRIBUTABLE } from '../legacy/utils';
import { fromRoot } from '../core/server/utils';
import { PUBLIC_PATH_PLACEHOLDER } from './public_path_placeholder';

const POSTCSS_CONFIG_PATH = require.resolve('./postcss.config');
const POSTCSS_CONFIG_PATH = require.resolve('./postcss.config.js');
const BABEL_PRESET_PATH = require.resolve('@kbn/babel-preset/webpack_preset');
const EMPTY_MODULE_PATH = require.resolve('./intentionally_empty_module.js');
const BABEL_EXCLUDE_RE = [/[\/\\](webpackShims|node_modules|bower_components)[\/\\]/];
Expand Down
7 changes: 6 additions & 1 deletion x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@
"@types/pretty-ms": "^5.0.0",
"@welldone-software/why-did-you-render": "^4.0.0",
"abab": "^1.0.4",
"autoprefixer": "^9.7.4",
"axios": "^0.19.0",
"babel-jest": "^25.5.1",
"babel-loader": "^8.0.6",
"babel-plugin-require-context-hook": "npm:babel-plugin-require-context-hook-babel7@1.0.0",
"base64-js": "^1.3.1",
"base64url": "^3.0.1",
Expand Down Expand Up @@ -159,6 +161,7 @@
"loader-utils": "^1.2.3",
"madge": "3.4.4",
"marge": "^1.0.1",
"mini-css-extract-plugin": "0.8.0",
"mocha": "^7.1.1",
"mocha-junit-reporter": "^1.23.1",
"mochawesome": "^4.1.0",
Expand All @@ -170,6 +173,9 @@
"pdf-image": "2.0.0",
"pdfjs-dist": "^2.0.943",
"pixelmatch": "^5.1.0",
"postcss": "^7.0.32",
"postcss-loader": "^3.0.0",
"postcss-prefix-selector": "^1.7.2",
"proxyquire": "1.8.0",
"react-docgen-typescript-loader": "^3.1.1",
"react-is": "^16.8.0",
Expand Down Expand Up @@ -309,7 +315,6 @@
"pluralize": "3.1.0",
"pngjs": "3.4.0",
"polished": "^1.9.2",
"postcss-prefix-selector": "^1.7.2",
"prop-types": "^15.6.0",
"proper-lockfile": "^3.2.0",
"puid": "1.0.7",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/canvas/shareable_runtime/postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

// eslint-disable-next-line
const autoprefixer = require('autoprefixer');
const prefixer = require('postcss-prefix-selector');

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/canvas/shareable_runtime/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module.exports = {
loader: 'postcss-loader',
options: {
config: {
path: path.resolve(KIBANA_ROOT, 'src/optimize/postcss.config.js'),
path: require.resolve('@kbn/optimizer/postcss.config.js'),
},
},
},
Expand Down
8 changes: 6 additions & 2 deletions x-pack/plugins/canvas/storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ module.exports = async ({ config }) => {
{
loader: 'postcss-loader',
options: {
path: path.resolve(KIBANA_ROOT, 'src/optimize/postcss.config.js'),
config: {
path: require.resolve('@kbn/optimizer/postcss.config.js'),
},
},
},
{
Expand Down Expand Up @@ -114,7 +116,9 @@ module.exports = async ({ config }) => {
{
loader: 'postcss-loader',
options: {
path: path.resolve(KIBANA_ROOT, 'src/optimize/postcss.config.js'),
config: {
path: require.resolve('@kbn/optimizer/postcss.config.js'),
},
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/canvas/storybook/webpack.dll.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module.exports = {
loader: 'postcss-loader',
options: {
config: {
path: path.resolve(KIBANA_ROOT, 'src/optimize/postcss.config.js'),
path: require.resolve('@kbn/optimizer/postcss.config.js'),
},
},
},
Expand Down

0 comments on commit 9858651

Please sign in to comment.