Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 92a1840

Browse files
태재영Matt Goo
태재영
authored and
Matt Goo
committed
fix: npm vulnerabilities (#903)
1 parent 2541ce2 commit 92a1840

File tree

9 files changed

+13914
-11749
lines changed

9 files changed

+13914
-11749
lines changed

karma.ci.js

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ process.env.CHROME_BIN = require('puppeteer').executablePath();
55

66
module.exports = function(config) {
77
karmaConfig.browsers = ['ChromeHeadless'];
8+
karmaConfig.webpack.mode = 'production';
89
config.set(karmaConfig);
910
};

karma.local.js

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ const karmaConfig = require('./scripts/karma/config');
22

33
module.exports = function(config) {
44
karmaConfig.browsers = ['Chrome'];
5+
karmaConfig.webpack.mode = 'development';
56
config.set(karmaConfig);
67
};

package-lock.json

+13,848-11,683
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+20-18
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,19 @@
9595
"@types/enzyme-adapter-react-16": "^1.0.3",
9696
"@types/google-cloud__storage": "^1.7.2",
9797
"@types/mkdirp": "^0.5.2",
98-
"@types/mocha": "^5.2.5",
98+
"@types/mocha": "^5.2.7",
9999
"@types/prop-types": "^15.5.6",
100100
"@types/puppeteer": "^1.11.1",
101101
"@types/react": "^16.4.4",
102102
"@types/react-dom": "^16.0.11",
103103
"@types/react-is": "^16.7.1",
104104
"@types/react-router-dom": "^4.3.1",
105105
"@types/uuid": "^3.4.4",
106-
"@types/webpack-env": "^1.13.6",
106+
"@types/webpack-env": "^1.13.9",
107107
"@typescript-eslint/eslint-plugin": "^1.9.0",
108108
"@typescript-eslint/parser": "^1.9.0",
109109
"autoprefixer": "^8.5.1",
110-
"axios": "^0.18.0",
110+
"axios": "^0.19.0",
111111
"babel-core": "^6.26.3",
112112
"babel-eslint": "^7.2.3",
113113
"babel-loader": "^7.1.4",
@@ -122,49 +122,51 @@
122122
"chai": "^4.1.2",
123123
"cp-file": "^6.0.0",
124124
"cross-env": "^5.2.0",
125-
"css-loader": "^0.28.10",
125+
"cssnano": "^4.1.10",
126+
"css-loader": "^1.0.1",
126127
"enzyme": "^3.9.0",
127128
"enzyme-adapter-react-16": "^1.11.2",
128129
"enzyme-adapter-utils": "^1.10.1",
129-
"eslint": "^5.9.0",
130+
"eslint": "^5.16.0",
130131
"eslint-config-google": "^0.9.1",
131132
"eslint-config-prettier": "^4.2.0",
132133
"eslint-plugin-prettier": "^3.1.0",
133134
"eslint-plugin-react": "^7.7.0",
134135
"eslint-plugin-typescript": "^0.14.0",
135-
"extract-text-webpack-plugin": "^3.0.2",
136+
"mini-css-extract-plugin": "^0.7.0",
136137
"gts": "^0.9.0",
137138
"husky": "^2.3.0",
138139
"istanbul": "^0.4.5",
139140
"istanbul-instrumenter-loader": "^3.0.1",
140141
"karma": "^2.0.4",
141142
"karma-chrome-launcher": "^2.2.0",
142-
"karma-coverage-istanbul-reporter": "^2.0.4",
143+
"karma-coverage-istanbul-reporter": "^2.0.5",
143144
"karma-mocha": "^1.3.0",
144145
"karma-sourcemap-loader": "^0.3.7",
145146
"karma-webpack": "^2.0.13",
146147
"lerna": "^2.9.0",
147-
"mocha": "^5.0.2",
148-
"node-sass": "^4.9.2",
149-
"optimize-css-assets-webpack-plugin": "^3.2.0",
150-
"postcss-loader": "^2.1.5",
148+
"mocha": "^6.1.4",
149+
"node-sass": "^4.12.0",
150+
"optimize-css-assets-webpack-plugin": "^5.0.1",
151+
"postcss-loader": "^3.0.0",
151152
"prettier": "^1.17.1",
152-
"puppeteer": "^1.1.1",
153+
"puppeteer": "^1.17.0",
153154
"react": "^16.4.2",
154155
"react-dom": "^16.4.2",
155156
"react-router-dom": "^4.3.1",
156157
"remap-istanbul": "^0.12.0",
157158
"resemblejs": "^3.0.1",
158159
"rimraf": "^2.6.3",
159-
"sass-loader": "^6.0.7",
160-
"testdouble": "^3.6.0",
161-
"ts-loader": "^3.5.0",
162-
"ts-node": "^7.0.1",
160+
"sass-loader": "^7.1.0",
161+
"testdouble": "^3.11.0",
162+
"ts-loader": "^6.0.2",
163+
"ts-node": "^8.2.0",
163164
"typescript": "^3.3.3",
164165
"utility-types": "^2.1.0",
165166
"uuid": "^3.3.2",
166167
"validate-commit-msg": "^2.14.0",
167-
"webpack": "^3.11.0",
168-
"webpack-dev-server": "^2.11.2"
168+
"webpack": "^4.32.2",
169+
"webpack-cli": "^3.3.2",
170+
"webpack-dev-server": "^3.5.1"
169171
}
170172
}

packages/webpack.config.js

+24-27
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23-
const webpack = require('webpack');
2423
const {readdirSync, lstatSync} = require('fs');
2524
const path = require('path');
26-
const ExtractTextPlugin = require('extract-text-webpack-plugin');
25+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
2726
const {readMaterialPackages} = require('../scripts/package-json-reader');
2827
const {
2928
convertToImportMDCWebPaths,
@@ -58,7 +57,6 @@ function getWebpackConfigs() {
5857
const tsxPath = getAbsolutePath(`${chunk}/index.tsx`);
5958
const cssPath = getAbsolutePath(`${chunk}/index.scss`);
6059
webpackEntries[chunk] = tsxPath;
61-
webpackEntries[`${chunk}.min`] = tsxPath;
6260
cssWebpackEntries[chunk] = cssPath;
6361
cssWebpackEntriesMin[`${chunk}.min`] = cssPath;
6462
});
@@ -72,6 +70,7 @@ function getWebpackConfigs() {
7270

7371
function getCommonWebpackParams({isCss} = {}) {
7472
return {
73+
mode: 'production',
7574
output: {
7675
path: getAbsolutePath('../build'),
7776
filename: `${filename}${isCss ? '.css' : ''}.js`,
@@ -138,11 +137,6 @@ function getJavaScriptWebpackConfig() {
138137
},
139138
],
140139
},
141-
plugins: [
142-
new webpack.optimize.UglifyJsPlugin({
143-
include: /\.min\.js$/,
144-
}),
145-
],
146140
});
147141
}
148142

@@ -152,30 +146,33 @@ function getCssWebpackConfig(shouldMinify) {
152146
rules: [
153147
{
154148
test: /\.scss$/,
155-
use: ExtractTextPlugin.extract({
156-
use: [
157-
{
158-
loader: 'css-loader',
159-
options: {
160-
minimize: shouldMinify,
161-
},
149+
use: [
150+
MiniCssExtractPlugin.loader,
151+
{
152+
loader: 'css-loader',
153+
options: {
154+
modules: 'global',
155+
localIdentName: '[local]',
162156
},
163-
{
164-
loader: 'postcss-loader',
165-
options: {
166-
plugins: () => [require('autoprefixer')()],
167-
},
157+
},
158+
{
159+
loader: 'postcss-loader',
160+
options: {
161+
plugins: () =>
162+
[require('autoprefixer')()].concat(
163+
shouldMinify ? require('cssnano')() : []
164+
),
168165
},
169-
{
170-
loader: 'sass-loader',
171-
options: {importer},
172-
},
173-
],
174-
}),
166+
},
167+
{
168+
loader: 'sass-loader',
169+
options: {importer},
170+
},
171+
],
175172
},
176173
],
177174
},
178-
plugins: [new ExtractTextPlugin(`${filename}.css`)],
175+
plugins: [new MiniCssExtractPlugin({filename: `${filename}.css`})],
179176
});
180177
}
181178

scripts/karma/config.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Karma configuration
22
// Generated on Tue Mar 06 2018 14:20:28 GMT-0800 (PST)
3-
const webpack = require('webpack');
43

54
module.exports = {
65
// base path that will be used to resolve all patterns (eg. files, exclude)

test/screenshot/webpack.config.js

+19-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const webpack = require('webpack');
2-
const ExtractTextPlugin = require('extract-text-webpack-plugin');
2+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
33
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
44
const {read: readComponents} = require('../../scripts/directory-reader');
55
const {importer} = require('../../packages/webpack.util');
@@ -26,28 +26,29 @@ module.exports = {
2626
},
2727
{
2828
test: /\.scss$/,
29-
use: ExtractTextPlugin.extract({
30-
use: [
31-
{
32-
loader: 'css-loader',
29+
use: [
30+
{
31+
loader: MiniCssExtractPlugin.loader,
32+
},
33+
{
34+
loader: 'css-loader',
35+
},
36+
{
37+
loader: 'postcss-loader',
38+
options: {
39+
plugins: () => [require('autoprefixer')()],
3340
},
34-
{
35-
loader: 'postcss-loader',
36-
options: {
37-
plugins: () => [require('autoprefixer')()],
38-
},
39-
},
40-
{
41-
loader: 'sass-loader',
42-
options: {importer},
43-
},
44-
],
45-
}),
41+
},
42+
{
43+
loader: 'sass-loader',
44+
options: {importer},
45+
},
46+
],
4647
},
4748
],
4849
},
4950
plugins: [
50-
new ExtractTextPlugin('bundle.css'),
51+
new MiniCssExtractPlugin({filename: 'bundle.css'}),
5152
new OptimizeCssAssetsPlugin(),
5253
new webpack.DefinePlugin({
5354
COMPONENTS: JSON.stringify(readComponents()),

test/unit/floating-label/index.test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import td from 'testdouble';
3-
import {suite, test} from 'mocha';
43
import {assert} from 'chai';
54
import {mount, shallow} from 'enzyme';
65
import FloatingLabel from '../../../packages/floating-label/index';

test/unit/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Enzyme from 'enzyme';
22
import Adapter from 'enzyme-adapter-react-16';
33
Enzyme.configure({adapter: new Adapter()});
4-
const context = require.context('.', true, /\.test\.(j|t)sx?$/);
4+
const context = require.context('.', true, /\.test\.[tj]sx?$/);
55
context.keys().forEach(context);

0 commit comments

Comments
 (0)