This repository has been archived by the owner on Nov 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Update versions in package.json, use @wordpress/scripts for build process #492
Merged
Merged
Changes from 4 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
0c57b81
Update npm packages to the latest versions
kienstra 7b643f4
Update some more npm packages and webpack.config.js
kienstra e6cbebe
Use the @wordpress/scripts package to build JS
kienstra 057e2b3
Add trailing commas to object values, from doing npm run lint:js:fix
kienstra 66e1649
Commit package-lock.json, exclude map files from build in gulpfile.js
kienstra 4005f48
Use wordpress/scripts package for ESLint
kienstra 0bb5545
Remove UglifyJSPlugin from webpack.config.js
kienstra 88c792d
Add a rule to .eslintrc of no-unused-vars
kienstra 8c2eee5
Don't require trailing commas for function calls
kienstra ccdc727
Always require a trailing comma on multiline import and export statem…
kienstra fc86cb9
Remove require() statement for 'uglifyjs-webpack-plugin'
kienstra 3ced431
Add wp-scripts lint-pkg-json script, correct package.json
kienstra 1813c71
Add wp-scripts check-licenses to package.json
kienstra 9fdcf9f
Import the WordPress dependencies as modules, use dependency plugin
kienstra 2fd6706
Remove a duplicate 'WordPress dependencies' DocBlock
kienstra edd1bfd
Address console warnings for deprecations
kienstra 440f50a
Remove the <DotTip>, as its package is deprecated
kienstra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,7 @@ package-lock.json | |
*.swp | ||
*.tmp | ||
*.bak | ||
*.map | ||
|
||
# Sass # | ||
####### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ const simplifiedFields = ( fields ) => { | |
{ | ||
...field, | ||
name: fieldName, | ||
} | ||
}, | ||
); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,11 @@ | ||
const path = require( 'path' ); | ||
const ExtractTextPlugin = require( 'extract-text-webpack-plugin' ); | ||
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' ); | ||
kienstra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const UglifyJSPlugin = require( 'uglifyjs-webpack-plugin' ); | ||
|
||
// Set different CSS extraction for editor only and common block styles | ||
const blocksCSSPlugin = new ExtractTextPlugin( { | ||
filename: './css/blocks.style.css', | ||
} ); | ||
const editBlocksCSSPlugin = new ExtractTextPlugin( { | ||
filename: './css/blocks.editor.css', | ||
} ); | ||
const uglifyJSPlugin = new UglifyJSPlugin( { | ||
uglifyOptions: { | ||
mangle: {}, | ||
compress: true | ||
}, | ||
sourceMap: false | ||
} ); | ||
|
||
// Configuration for the ExtractTextPlugin. | ||
const extractConfig = { | ||
use: [ | ||
{ loader: 'raw-loader' }, | ||
{ | ||
loader: 'postcss-loader', | ||
options: { | ||
plugins: [ require( 'autoprefixer' ) ], | ||
}, | ||
}, | ||
{ | ||
loader: 'sass-loader', | ||
query: { | ||
outputStyle: 'compressed', | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' ); | ||
const isProduction = process.env.NODE_ENV === 'production'; | ||
|
||
module.exports = { | ||
...defaultConfig, | ||
entry: { | ||
'./js/editor.blocks': './js/blocks/index.js', | ||
'./js/scripts': './js/src/index.js', | ||
|
@@ -47,7 +15,7 @@ module.exports = { | |
filename: '[name].js', | ||
}, | ||
watch: false, | ||
// devtool: 'cheap-eval-source-map', | ||
mode: isProduction ? 'production' : 'development', | ||
module: { | ||
rules: [ | ||
{ | ||
|
@@ -57,19 +25,42 @@ module.exports = { | |
loader: 'babel-loader', | ||
}, | ||
}, | ||
{ | ||
test: /style\.s?css$/, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this plugin doesn't use |
||
use: blocksCSSPlugin.extract( extractConfig ), | ||
}, | ||
{ | ||
test: /editor\.s?css$/, | ||
use: editBlocksCSSPlugin.extract( extractConfig ), | ||
use: [ | ||
{ | ||
loader: MiniCssExtractPlugin.loader, | ||
options: { | ||
// Only allow hot module reloading in development. | ||
hmr: process.env.NODE_ENV === 'development', | ||
// Force reloading if hot module reloading does not work. | ||
reloadAll: true, | ||
}, | ||
}, | ||
'css-loader', | ||
{ | ||
loader: 'postcss-loader', | ||
options: { | ||
plugins: [ require( 'autoprefixer' ) ], | ||
}, | ||
}, | ||
{ | ||
loader: 'sass-loader', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
blocksCSSPlugin, | ||
editBlocksCSSPlugin, | ||
uglifyJSPlugin, | ||
new MiniCssExtractPlugin( { | ||
filename: './css/blocks.editor.css', | ||
} ), | ||
new UglifyJSPlugin( { | ||
uglifyOptions: { | ||
mangle: {}, | ||
compress: true, | ||
}, | ||
sourceMap: ! isProduction, | ||
} ), | ||
], | ||
}; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new build process creates
.map
files, likeblock-lab/css/blocks.editor.css.map
.