From 805807dd3a66d4515fc7e43a082b8ea3e1a87eae Mon Sep 17 00:00:00 2001 From: Avi Sharvit Date: Thu, 7 Mar 2019 18:42:02 +0200 Subject: [PATCH] Migrate to @theforeman/vendor pkg --- .babelrc | 2 +- .eslintrc | 5 +- app/views/layouts/base.html.erb | 4 +- config/webpack.config.js | 12 +-- config/webpack.vendor.js | 74 +------------------ package.json | 55 +------------- script/npm_link_vendor.sh | 8 ++ script/webpack-analyze | 2 +- webpack/assets/javascripts/bundle.js | 13 ---- .../assets/javascripts/bundle_datatables.js | 2 - webpack/assets/javascripts/bundle_flot.js | 6 -- .../assets/javascripts/bundle_multiselect.js | 2 - webpack/assets/javascripts/bundle_select2.js | 3 - webpack/assets/javascripts/dashboard/index.js | 1 - .../assets/javascripts/dashboard/index.scss | 1 - .../javascripts/hosts/tableCheckboxes.js | 2 +- .../javascripts/react_app/common/helpers.js | 3 +- .../AutoComplete/AutoCompleteActions.js | 2 +- .../__tests__/AutoComplete.test.js | 3 +- .../__tests__/AutoCompleteActions.test.js | 2 +- .../__tests__/integration.test.js | 10 ++- .../AutoComplete/auto-complete.scss | 3 +- .../components/AutoCompleteMenu.js | 2 +- .../react_app/components/DiffView/DiffView.js | 1 - .../components/Editor/EditorActions.js | 2 +- .../Editor/components/EditorView.js | 13 ---- .../Editor/components/editorhostselect.scss | 3 - .../Layout/components/UserDropdowns.js | 2 +- .../PasswordStrength/PasswordStrength.scss | 3 +- .../components/SearchBar/SearchBar.js | 2 +- .../SearchBar/__tests__/integration.test.js | 2 +- .../DateComponents/DecadeView.js | 2 +- .../DateComponents/HeaderHelpers.js | 2 +- .../DateComponents/MonthView.js | 4 +- .../DateTimePicker/DateComponents/YearView.js | 2 +- webpack/simple_named_modules.js | 6 +- webpack/stories/index.js | 2 +- webpack/stories/index.scss | 2 +- 38 files changed, 57 insertions(+), 208 deletions(-) create mode 100755 script/npm_link_vendor.sh delete mode 100644 webpack/assets/javascripts/bundle_datatables.js delete mode 100644 webpack/assets/javascripts/bundle_flot.js delete mode 100644 webpack/assets/javascripts/bundle_multiselect.js delete mode 100644 webpack/assets/javascripts/bundle_select2.js diff --git a/.babelrc b/.babelrc index 0958433d3f97..c0d500a7ca82 100644 --- a/.babelrc +++ b/.babelrc @@ -1,5 +1,6 @@ { "presets": [ + "@theforeman/vendor-dev/babel.preset.js", "env", "react" ], @@ -7,7 +8,6 @@ "transform-class-properties", "transform-object-rest-spread", "transform-object-assign", - "lodash", "syntax-dynamic-import" ], "env": { diff --git a/.eslintrc b/.eslintrc index d5ef2eb0e763..957055466cb4 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,9 @@ { "plugins": ["patternfly-react"], - "extends": ["plugin:patternfly-react/recommended"], + "extends": [ + "plugin:patternfly-react/recommended", + "./node_modules/@theforeman/vendor-dev/eslint.extends.js" + ], "rules": { "prettier/prettier": ["error", { "singleQuote": true, diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index d61548f0741a..b04c527bfc12 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -10,8 +10,9 @@ <%= favicon_link_tag "favicon.ico"%> - <%= stylesheet_link_tag *webpack_asset_paths('bundle', :extension => 'css'), "data-turbolinks-track" => true %> <%= stylesheet_link_tag 'application', "data-turbolinks-track" => true %> + <%= stylesheet_link_tag *webpack_asset_paths('foreman-vendor', :extension => 'css'), "data-turbolinks-track" => true %> + <%= stylesheet_link_tag *webpack_asset_paths('bundle', :extension => 'css'), "data-turbolinks-track" => true %> <%= yield(:stylesheets) %> <%= csrf_meta_tags %> @@ -30,6 +31,7 @@ <% end %> <%= javascript_include_tag "locale/#{FastGettext.locale}/app", "data-turbolinks-track" => true %> + <%= javascript_include_tag *webpack_asset_paths('foreman-vendor', :extension => 'js'), "data-turbolinks-track" => true %> <%= javascript_include_tag *webpack_asset_paths('vendor', :extension => 'js'), "data-turbolinks-track" => true %> <%= javascript_include_tag *webpack_asset_paths('bundle', :extension => 'js'), "data-turbolinks-track" => true %> <%= javascript_include_tag 'application', "data-turbolinks-track" => true %> diff --git a/config/webpack.config.js b/config/webpack.config.js index 2bb234fe5361..6a3c3e96658c 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -3,11 +3,11 @@ var path = require('path'); var webpack = require('webpack'); +var ForemanVendorPlugin = require('@theforeman/vendor/webpack.plugin'); var UglifyJsPlugin = require('uglifyjs-webpack-plugin'); var StatsWriterPlugin = require("webpack-stats-plugin").StatsWriterPlugin; var ExtractTextPlugin = require('extract-text-webpack-plugin'); var CompressionPlugin = require('compression-webpack-plugin'); -var LodashModuleReplacementPlugin = require('lodash-webpack-plugin'); var pluginUtils = require('../script/plugin_webpack_directories'); var vendorEntry = require('./webpack.vendor'); var SimpleNamedModulesPlugin = require('../webpack/simple_named_modules'); @@ -142,7 +142,6 @@ module.exports = env => { path.join(__dirname, '..', 'node_modules/babel-plugin-transform-class-properties'), path.join(__dirname, '..', 'node_modules/babel-plugin-transform-object-rest-spread'), path.join(__dirname, '..', 'node_modules/babel-plugin-transform-object-assign'), - path.join(__dirname, '..', 'node_modules/babel-plugin-lodash'), path.join(__dirname, '..', 'node_modules/babel-plugin-syntax-dynamic-import') ] } @@ -169,12 +168,7 @@ module.exports = env => { }, plugins: [ - new LodashModuleReplacementPlugin({ - paths: true, - collections: true, - flattening: true, - shorthands: true - }), + new ForemanVendorPlugin(), // must match config.webpack.manifest_filename new StatsWriterPlugin({ filename: manifestFilename, @@ -208,6 +202,7 @@ module.exports = env => { /react-intl\/locale-data/, supportedLanguagesRE ), + new SimpleNamedModulesPlugin(), ] }; @@ -225,7 +220,6 @@ module.exports = env => { }, sourceMap: true }), - new SimpleNamedModulesPlugin(), new webpack.optimize.ModuleConcatenationPlugin(), new webpack.optimize.OccurrenceOrderPlugin(), new CompressionPlugin() diff --git a/config/webpack.vendor.js b/config/webpack.vendor.js index 97a1bbbf3bf6..d6f31b322278 100644 --- a/config/webpack.vendor.js +++ b/config/webpack.vendor.js @@ -1,73 +1 @@ -module.exports = [ - /** - * React related - */ - 'babel-polyfill', - 'react', - 'react-dom', - 'react-debounce-input', - 'react-diff-view', - 'react-ellipsis-with-tooltip', - 'react-numeric-input', - 'react-onclickoutside', - 'react-password-strength', - 'patternfly-react', - 'react-redux', - 'redux', - 'redux-form', - 'redux-form-validators', - 'redux-logger', - 'redux-thunk', - 'prop-types', - 'seamless-immutable', - 'isomorphic-fetch', - 'react-intl', - 'intl', - 'react-router-dom', - 'history', - - /* - * jquery related - */ - 'jquery', - 'jquery.cookie', - 'select2', - 'multiselect', - 'jquery-ujs', - 'datatables.net-bs', - // jquery-flot related - 'jquery-flot/excanvas', - 'jquery-flot', - 'jquery-flot/jquery.flot.pie', - 'jquery-flot/jquery.flot.selection', - 'jquery-flot/jquery.flot.stack', - 'jquery-flot/jquery.flot.time', - - /** - * Brace related - */ - 'brace', - 'brace/mode/ruby', - 'brace/mode/html_ruby', - 'brace/mode/json', - 'brace/mode/sh', - 'brace/mode/xml', - 'brace/mode/yaml', - 'brace/mode/diff', - 'brace/theme/twilight', - 'brace/theme/clouds', - 'brace/keybinding/vim', - 'brace/keybinding/emacs', - 'brace/ext/searchbox', - - /** - * Other packages - */ - 'axios', - 'diff', - 'ipaddr.js', - 'jstz', - 'urijs', - 'uuid', - '@novnc/novnc/core/rfb.js', -]; +module.exports = ['react-intl', 'intl']; diff --git a/package.json b/package.json index 9c0409e8ff1c..a6ce59bd840b 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "description": "Foreman isn't really a node module, these are just dependencies needed to build the webpack bundle. 'dependencies' are the asset libraries in use and 'devDependencies' are used for the build process.", "private": true, "devDependencies": { + "@theforeman/vendor-dev": "^0.1.0-alpha.4", "@storybook/addon-actions": "~3.4.12", "@storybook/addon-knobs": "~3.4.12", "@storybook/react": "~3.4.12", @@ -17,7 +18,6 @@ "babel-jest": "^23.6.0", "babel-loader": "^7.1.1", "babel-plugin-dynamic-import-node": "^2.0.0", - "babel-plugin-lodash": "^3.3.4", "babel-plugin-syntax-dynamic-import": "^6.18.0", "babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-object-assign": "^6.8.0", @@ -67,61 +67,14 @@ "chromedriver": "2.43.0" }, "dependencies": { - "@novnc/novnc": "^1.0.0", - "@spice-project/spice-html5": "^0.2.1", - "axios": "^0.19.0", - "babel-polyfill": "^6.26.0", - "bootstrap-sass": "^3.3.7", - "brace": "^0.11.1", - "classnames": "^2.2.5", - "datatables.net": "~1.10.12", - "datatables.net-bs": "~1.10.12", - "diff": "~3.0.0", - "file-saver": "^2.0.1", - "gridster": "^0.5.6", - "history": "^4.7.2", + "@theforeman/vendor": "^0.1.0-alpha.4", "intl": "~1.2.5", - "ipaddr.js": "~1.2.0", - "isomorphic-fetch": "^2.2.1", "jed": "^1.1.1", - "jquery": "~2.2.4", - "jquery-flot": "~0.8.3", - "jquery-ujs": "~1.2.0", - "jquery.cookie": "~1.4.1", - "jstz": "~1.0.7", - "lodash": "^4.17.11", - "multiselect": "~0.9.12", - "number_helpers": "^0.1.1", - "patternfly": "^3.58.0", - "patternfly-react": "^2.34.1", - "patternfly-react-extensions": "^2.18.8", - "prop-types": "^15.6.0", - "react": "^16.8.1", - "react-ace": "^6.3.2", - "react-debounce-input": "^3.2.0", - "react-diff-view": "^1.8.1", - "react-dom": "^16.8.1", - "react-ellipsis-with-tooltip": "^1.0.8", - "react-intl": "^2.8.0", - "react-numeric-input": "^2.0.7", - "react-onclickoutside": "^6.6.2", - "react-password-strength": "^2.4.0", - "react-redux": "^5.1.1", - "react-router-dom": "^4.3.1", - "redux": "^3.6.0", - "redux-form": "8.2.0", - "redux-form-validators": "^2.1.2", - "redux-logger": "^2.8.1", - "redux-thunk": "^2.2.0", - "reselect": "^3.0.1", - "seamless-immutable": "^7.1.2", - "select2": "~3.5.2-browserify", - "unidiff": "^1.0.0", - "urijs": "^1.18.10", - "uuid": "^3.3.2" + "react-intl": "^2.8.0" }, "scripts": { "lint": "./node_modules/.bin/eslint -c .eslintrc webpack/ script/", + "link:vendor": "./script/npm_link_vendor.sh", "postlint": "node ./script/npm_lint_plugins.js", "test": "node node_modules/.bin/jest --no-cache", "test:watch": "node node_modules/.bin/jest --watchAll", diff --git a/script/npm_link_vendor.sh b/script/npm_link_vendor.sh new file mode 100755 index 000000000000..ce8290d263e8 --- /dev/null +++ b/script/npm_link_vendor.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +rm -rf ./node_modules/@theforeman +mkdir -p ./node_modules/@theforeman + +ln -s ../../../foreman-js/packages/vendor-core ./node_modules/@theforeman/vendor-core +ln -s ../../../foreman-js/packages/vendor-dev ./node_modules/@theforeman/vendor-dev +ln -s ../../../foreman-js/packages/vendor ./node_modules/@theforeman/vendor diff --git a/script/webpack-analyze b/script/webpack-analyze index b9c9c654759c..81aacc909ead 100755 --- a/script/webpack-analyze +++ b/script/webpack-analyze @@ -9,5 +9,5 @@ WEBPACK_DIR="$FOREMAN_PATH/public/webpack" REPORT="${WEBPACK_DIR}/report.html" mkdir -p $WEBPACK_DIR -$WEBPACK --profile --json > $WEBPACK_DIR/stats.json && \ +$WEBPACK --profile --json > $WEBPACK_DIR/stats.json webpack-bundle-analyzer --mode static -r $REPORT $WEBPACK_DIR/stats.json diff --git a/webpack/assets/javascripts/bundle.js b/webpack/assets/javascripts/bundle.js index 5e80aa3f13de..d65a39885ee5 100644 --- a/webpack/assets/javascripts/bundle.js +++ b/webpack/assets/javascripts/bundle.js @@ -25,22 +25,9 @@ import * as configReportsModalDiff from './foreman_config_reports_modal_diff'; import * as classEditor from './foreman_class_edit'; import * as dashboard from './dashboard'; import * as spice from './spice'; -import './bundle_datatables'; import './bundle_lodash'; import './bundle_novnc'; -/* eslint-disable-next-line */ -require('expose-loader?$!expose-loader?jQuery!jquery'); -require('jquery-ujs'); - -window.jstz = require('jstz'); -window.ipaddr = require('ipaddr.js'); -window.JsDiff = require('diff'); - -require('./bundle_flot'); -require('./bundle_multiselect'); -require('./bundle_select2'); - // Set the public path for dynamic imports if (process.env.NODE_ENV !== 'production') { /* eslint-disable-next-line */ diff --git a/webpack/assets/javascripts/bundle_datatables.js b/webpack/assets/javascripts/bundle_datatables.js deleted file mode 100644 index fb2cc41b9a3d..000000000000 --- a/webpack/assets/javascripts/bundle_datatables.js +++ /dev/null @@ -1,2 +0,0 @@ -import 'datatables.net-bs/css/dataTables.bootstrap.css'; -import 'datatables.net-bs'; diff --git a/webpack/assets/javascripts/bundle_flot.js b/webpack/assets/javascripts/bundle_flot.js deleted file mode 100644 index 3dd4a094b747..000000000000 --- a/webpack/assets/javascripts/bundle_flot.js +++ /dev/null @@ -1,6 +0,0 @@ -import 'jquery-flot/excanvas'; -import 'jquery-flot'; -import 'jquery-flot/jquery.flot.pie'; -import 'jquery-flot/jquery.flot.selection'; -import 'jquery-flot/jquery.flot.stack'; -import 'jquery-flot/jquery.flot.time'; diff --git a/webpack/assets/javascripts/bundle_multiselect.js b/webpack/assets/javascripts/bundle_multiselect.js deleted file mode 100644 index 3301e6f3b816..000000000000 --- a/webpack/assets/javascripts/bundle_multiselect.js +++ /dev/null @@ -1,2 +0,0 @@ -import 'multiselect/css/multi-select.css'; -import 'multiselect'; diff --git a/webpack/assets/javascripts/bundle_select2.js b/webpack/assets/javascripts/bundle_select2.js deleted file mode 100644 index 8463fc98a665..000000000000 --- a/webpack/assets/javascripts/bundle_select2.js +++ /dev/null @@ -1,3 +0,0 @@ -import 'select2'; -import 'select2/select2-bootstrap.css'; -import 'select2/select2.css'; diff --git a/webpack/assets/javascripts/dashboard/index.js b/webpack/assets/javascripts/dashboard/index.js index 6ecbd14e30e4..5efcc7f9936c 100644 --- a/webpack/assets/javascripts/dashboard/index.js +++ b/webpack/assets/javascripts/dashboard/index.js @@ -1,5 +1,4 @@ import $ from 'jquery'; -import 'gridster/dist/jquery.gridster'; import { doesDocumentHasFocus } from '../react_app/common/document'; import { notify } from '../foreman_toast_notifications'; import { activateTooltips, foremanUrl } from '../foreman_tools'; diff --git a/webpack/assets/javascripts/dashboard/index.scss b/webpack/assets/javascripts/dashboard/index.scss index b88e97359d5c..c66de976d0b6 100644 --- a/webpack/assets/javascripts/dashboard/index.scss +++ b/webpack/assets/javascripts/dashboard/index.scss @@ -1,4 +1,3 @@ -@import "~gridster/dist/jquery.gridster"; @import "gridster.scss"; .dashboard { diff --git a/webpack/assets/javascripts/hosts/tableCheckboxes.js b/webpack/assets/javascripts/hosts/tableCheckboxes.js index b17356cf1812..affa25572c07 100644 --- a/webpack/assets/javascripts/hosts/tableCheckboxes.js +++ b/webpack/assets/javascripts/hosts/tableCheckboxes.js @@ -1,5 +1,5 @@ import $ from 'jquery'; -import 'jquery.cookie'; + import { sprintf, ngettext as n__, diff --git a/webpack/assets/javascripts/react_app/common/helpers.js b/webpack/assets/javascripts/react_app/common/helpers.js index 46c9c28953e1..5bbaa84d9961 100644 --- a/webpack/assets/javascripts/react_app/common/helpers.js +++ b/webpack/assets/javascripts/react_app/common/helpers.js @@ -1,5 +1,4 @@ -import debounce from 'lodash/debounce'; -import { snakeCase, camelCase } from 'lodash'; +import { snakeCase, camelCase, debounce } from 'lodash'; import URI from 'urijs'; import { translate as __ } from './I18n'; diff --git a/webpack/assets/javascripts/react_app/components/AutoComplete/AutoCompleteActions.js b/webpack/assets/javascripts/react_app/components/AutoComplete/AutoCompleteActions.js index d0e67e78d1ff..f5f2558562c5 100644 --- a/webpack/assets/javascripts/react_app/components/AutoComplete/AutoCompleteActions.js +++ b/webpack/assets/javascripts/react_app/components/AutoComplete/AutoCompleteActions.js @@ -1,5 +1,5 @@ import URI from 'urijs'; -import debounce from 'lodash/debounce'; +import { debounce } from 'lodash'; import API from '../../API'; import { STATUS } from '../../constants'; import { clearSpaces } from '../../common/helpers'; diff --git a/webpack/assets/javascripts/react_app/components/AutoComplete/__tests__/AutoComplete.test.js b/webpack/assets/javascripts/react_app/components/AutoComplete/__tests__/AutoComplete.test.js index 998f5f4721c1..c8dc9a043ace 100644 --- a/webpack/assets/javascripts/react_app/components/AutoComplete/__tests__/AutoComplete.test.js +++ b/webpack/assets/javascripts/react_app/components/AutoComplete/__tests__/AutoComplete.test.js @@ -1,12 +1,13 @@ import React from 'react'; import { mount } from 'enzyme'; +import lodash from 'lodash'; import AutoComplete from '../AutoComplete'; import { AutoCompleteProps } from '../AutoComplete.fixtures'; import { testComponentSnapshotsWithFixtures } from '../../../common/testHelpers'; import { KEYCODES } from '../../../common/keyCodes'; import { noop } from '../../../common/helpers'; -jest.mock('lodash/debounce', () => jest.fn(fn => fn)); +lodash.debounce = jest.fn(fn => fn); const getProps = () => ({ ...AutoCompleteProps, diff --git a/webpack/assets/javascripts/react_app/components/AutoComplete/__tests__/AutoCompleteActions.test.js b/webpack/assets/javascripts/react_app/components/AutoComplete/__tests__/AutoCompleteActions.test.js index fb9a1d7013ac..48d86fb104fd 100644 --- a/webpack/assets/javascripts/react_app/components/AutoComplete/__tests__/AutoCompleteActions.test.js +++ b/webpack/assets/javascripts/react_app/components/AutoComplete/__tests__/AutoCompleteActions.test.js @@ -12,7 +12,7 @@ import { id, } from '../AutoComplete.fixtures'; -jest.mock('lodash/debounce', () => jest.fn(fn => fn)); +jest.mock('lodash', () => ({ debounce: jest.fn(fn => fn) })); jest.mock('../../../API'); const loadResults = (requestParams, serverMock) => { diff --git a/webpack/assets/javascripts/react_app/components/AutoComplete/__tests__/integration.test.js b/webpack/assets/javascripts/react_app/components/AutoComplete/__tests__/integration.test.js index e38e9801a4bd..e59113ca3274 100644 --- a/webpack/assets/javascripts/react_app/components/AutoComplete/__tests__/integration.test.js +++ b/webpack/assets/javascripts/react_app/components/AutoComplete/__tests__/integration.test.js @@ -5,7 +5,15 @@ import { AutoCompleteProps } from '../AutoComplete.fixtures'; import Autocomplete, { reducers } from '../index'; jest.mock('../../../API'); -jest.mock('lodash/debounce', () => jest.fn(fn => fn)); +jest.mock('lodash', () => ({ + debounce: jest.fn(fn => fn), + groupBy: jest.fn((list, getProps) => + list.reduce((a, b) => { + (a[getProps(b)] = a[getProps(b)] || []).push(b); + return a; + }, {}) + ), +})); jest.mock('uuid', () => jest.fn(fn => '1234')); global.Turbolinks = { visit: jest.fn(), diff --git a/webpack/assets/javascripts/react_app/components/AutoComplete/auto-complete.scss b/webpack/assets/javascripts/react_app/components/AutoComplete/auto-complete.scss index 8609cc2a0750..3424aa617d21 100644 --- a/webpack/assets/javascripts/react_app/components/AutoComplete/auto-complete.scss +++ b/webpack/assets/javascripts/react_app/components/AutoComplete/auto-complete.scss @@ -1,5 +1,4 @@ -@import "~patternfly/dist/sass/patternfly/_color-variables.scss"; -@import "~patternfly-react/dist/sass/_type-ahead-select.scss"; +@import "~@theforeman/vendor/scss/variables"; .foreman-autocomplete { .autocomplete-aux { diff --git a/webpack/assets/javascripts/react_app/components/AutoComplete/components/AutoCompleteMenu.js b/webpack/assets/javascripts/react_app/components/AutoComplete/components/AutoCompleteMenu.js index 007231585c38..a226fbad3365 100644 --- a/webpack/assets/javascripts/react_app/components/AutoComplete/components/AutoCompleteMenu.js +++ b/webpack/assets/javascripts/react_app/components/AutoComplete/components/AutoCompleteMenu.js @@ -1,6 +1,6 @@ import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; -import groupBy from 'lodash/groupBy'; +import { groupBy } from 'lodash'; import { TypeAheadSelect } from 'patternfly-react'; import SubstringWrapper from '../../common/SubstringWrapper'; diff --git a/webpack/assets/javascripts/react_app/components/DiffView/DiffView.js b/webpack/assets/javascripts/react_app/components/DiffView/DiffView.js index ef1fb8686348..2eac21e0bdb7 100644 --- a/webpack/assets/javascripts/react_app/components/DiffView/DiffView.js +++ b/webpack/assets/javascripts/react_app/components/DiffView/DiffView.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; import { parseDiff, Diff, markCharacterEdits } from 'react-diff-view'; import { formatLines, diffLines } from 'unidiff'; -import 'react-diff-view/index.css'; import './diffview.scss'; const getDiff = (oldText, newText) => { diff --git a/webpack/assets/javascripts/react_app/components/Editor/EditorActions.js b/webpack/assets/javascripts/react_app/components/Editor/EditorActions.js index 5a450cc8aad8..9c9bf2b18ffb 100644 --- a/webpack/assets/javascripts/react_app/components/Editor/EditorActions.js +++ b/webpack/assets/javascripts/react_app/components/Editor/EditorActions.js @@ -1,4 +1,4 @@ -import debounce from 'lodash/debounce'; +import { debounce } from 'lodash'; import API from '../../API'; import { translate as __ } from '../../common/I18n'; diff --git a/webpack/assets/javascripts/react_app/components/Editor/components/EditorView.js b/webpack/assets/javascripts/react_app/components/Editor/components/EditorView.js index 05f0fc7f3908..251478079d29 100644 --- a/webpack/assets/javascripts/react_app/components/Editor/components/EditorView.js +++ b/webpack/assets/javascripts/react_app/components/Editor/components/EditorView.js @@ -2,19 +2,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import AceEditor from 'react-ace'; -import 'brace/mode/ruby'; -import 'brace/mode/json'; -import 'brace/mode/sh'; -import 'brace/mode/html_ruby'; -import 'brace/mode/xml'; -import 'brace/mode/yaml'; - -import 'brace/theme/github'; -import 'brace/theme/monokai'; - -import 'brace/keybinding/vim'; -import 'brace/keybinding/emacs'; - import { noop } from '../../../common/helpers'; const EditorView = ({ diff --git a/webpack/assets/javascripts/react_app/components/Editor/components/editorhostselect.scss b/webpack/assets/javascripts/react_app/components/Editor/components/editorhostselect.scss index 1ee18ee1804d..6b41bb2f91bb 100644 --- a/webpack/assets/javascripts/react_app/components/Editor/components/editorhostselect.scss +++ b/webpack/assets/javascripts/react_app/components/Editor/components/editorhostselect.scss @@ -1,6 +1,3 @@ -@import '~patternfly/dist/sass/patternfly/_color-variables.scss'; -@import '~patternfly-react-extensions/dist/sass/_select.scss'; - .select-body-container { .select-input-search { input { diff --git a/webpack/assets/javascripts/react_app/components/Layout/components/UserDropdowns.js b/webpack/assets/javascripts/react_app/components/Layout/components/UserDropdowns.js index 11cd11ef29c2..2197fb8bff61 100644 --- a/webpack/assets/javascripts/react_app/components/Layout/components/UserDropdowns.js +++ b/webpack/assets/javascripts/react_app/components/Layout/components/UserDropdowns.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Dropdown, VerticalNav, Icon, MenuItem } from 'patternfly-react'; -import get from 'lodash/get'; +import { get } from 'lodash'; import NotificationContainer from '../../notifications'; import NavDropdown from './NavDropdown'; import NavItem from './NavItem'; diff --git a/webpack/assets/javascripts/react_app/components/PasswordStrength/PasswordStrength.scss b/webpack/assets/javascripts/react_app/components/PasswordStrength/PasswordStrength.scss index 3186ae139f76..db05e547a3c1 100644 --- a/webpack/assets/javascripts/react_app/components/PasswordStrength/PasswordStrength.scss +++ b/webpack/assets/javascripts/react_app/components/PasswordStrength/PasswordStrength.scss @@ -1,5 +1,4 @@ -@import '~patternfly/dist/sass/patternfly/variables'; -@import '~bootstrap-sass/assets/stylesheets/bootstrap/_variables'; +@import "~@theforeman/vendor/scss/variables"; @import '../../common/colors.scss'; .ReactPasswordStrength { diff --git a/webpack/assets/javascripts/react_app/components/SearchBar/SearchBar.js b/webpack/assets/javascripts/react_app/components/SearchBar/SearchBar.js index e7b60c1eea3b..d408ac109544 100644 --- a/webpack/assets/javascripts/react_app/components/SearchBar/SearchBar.js +++ b/webpack/assets/javascripts/react_app/components/SearchBar/SearchBar.js @@ -1,5 +1,5 @@ import React from 'react'; -import isEmpty from 'lodash/isEmpty'; +import { isEmpty } from 'lodash'; import PropTypes from 'prop-types'; import AutoComplete from '../AutoComplete'; import Bookmarks from '../bookmarks'; diff --git a/webpack/assets/javascripts/react_app/components/SearchBar/__tests__/integration.test.js b/webpack/assets/javascripts/react_app/components/SearchBar/__tests__/integration.test.js index e44ba88f4676..be2913d25263 100644 --- a/webpack/assets/javascripts/react_app/components/SearchBar/__tests__/integration.test.js +++ b/webpack/assets/javascripts/react_app/components/SearchBar/__tests__/integration.test.js @@ -8,7 +8,7 @@ import { reducers } from '../../AutoComplete'; import bookmarksReducer from '../../../redux/reducers/bookmarks'; jest.mock('../../../API'); -jest.mock('lodash/debounce', () => jest.fn(fn => fn)); +jest.mock('lodash', () => ({ debounce: jest.fn(fn => fn) })); global.Turbolinks = { visit: jest.fn(), }; diff --git a/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/DecadeView.js b/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/DecadeView.js index 8c82322cf70f..ab8c72d4077b 100644 --- a/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/DecadeView.js +++ b/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/DecadeView.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import times from 'lodash/times'; +import { times } from 'lodash'; import { addYears } from './helpers'; import { noop } from '../../../../common/helpers'; import { DecadeViewHeader } from './DecadeViewHeader'; diff --git a/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/HeaderHelpers.js b/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/HeaderHelpers.js index 710c6e8c2add..8227a4c7683a 100644 --- a/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/HeaderHelpers.js +++ b/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/HeaderHelpers.js @@ -1,4 +1,4 @@ -import times from 'lodash/times'; +import { times } from 'lodash'; import { addDays, getWeekStart } from './helpers'; export const getWeekArray = (weekStartsOn, locale) => { diff --git a/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/MonthView.js b/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/MonthView.js index e45cc5614c62..4b533cf84f23 100644 --- a/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/MonthView.js +++ b/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/MonthView.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; -import chunk from 'lodash/chunk'; -import times from 'lodash/times'; +import { chunk, times } from 'lodash'; + import Day from './Day'; import { addDays, diff --git a/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/YearView.js b/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/YearView.js index a49c6d201ae8..efb108c7e5a8 100644 --- a/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/YearView.js +++ b/webpack/assets/javascripts/react_app/components/common/DateTimePicker/DateComponents/YearView.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import times from 'lodash/times'; +import { times } from 'lodash'; import classNames from 'classnames'; import { addMonths, addYears } from './helpers'; import { noop } from '../../../../common/helpers'; diff --git a/webpack/simple_named_modules.js b/webpack/simple_named_modules.js index 8365cd7573f0..b91154677c74 100644 --- a/webpack/simple_named_modules.js +++ b/webpack/simple_named_modules.js @@ -22,9 +22,9 @@ class SimpleNamedModulesPlugin { module.id = module.libIdent({ context: this.options.context || compiler.options.context }); - if (module.id.includes('node_modules')) { - module.id = module.id.slice(module.id.indexOf('node_modules')) - } + // if (module.id.includes('node_modules')) { + // module.id = module.id.slice(module.id.indexOf('node_modules')) + // } } }); }); diff --git a/webpack/stories/index.js b/webpack/stories/index.js index 5ecfb5810f6c..6741e77ee36b 100644 --- a/webpack/stories/index.js +++ b/webpack/stories/index.js @@ -14,7 +14,7 @@ require('../assets/javascripts/bundle'); require('../../app/assets/javascripts/application'); require('../../app/assets/stylesheets/base.scss'); -require('patternfly/dist/js/patternfly'); +// require('patternfly/dist/js/patternfly'); require('./index.scss'); diff --git a/webpack/stories/index.scss b/webpack/stories/index.scss index 272685a79a5e..b0f786ab4299 100644 --- a/webpack/stories/index.scss +++ b/webpack/stories/index.scss @@ -3,4 +3,4 @@ $font-path: '~patternfly/dist/fonts/'; $icon-font-path: '~patternfly/dist/fonts/'; @import '~patternfly/dist/sass/patternfly'; -@import '~patternfly-react/dist/sass/patternfly-react'; +@import '~@theforeman/vendor/scss/vendor';