@lipemat/js-boilerplate 9.4.4 → 9.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/helpers/WebpackAssetsHash.js +1 -1
- package/package.json +1 -1
- package/scripts/lint.js +13 -0
|
@@ -51,7 +51,7 @@ class WebpackAssetsHash {
|
|
|
51
51
|
*/
|
|
52
52
|
storeContentHash( compilation ) {
|
|
53
53
|
for ( const asset of compilation.getAssets() ) {
|
|
54
|
-
this.assets[ asset.name ] = crypto.createHash( '
|
|
54
|
+
this.assets[ asset.name ] = crypto.createHash( 'md5' )
|
|
55
55
|
.update( asset.source.source() )
|
|
56
56
|
.digest( 'hex' )
|
|
57
57
|
.substring( 0, 20 );
|
package/package.json
CHANGED
package/scripts/lint.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
const {ESLint} = require( 'eslint' );
|
|
2
2
|
const packageConfig = require( '../helpers/package-config' );
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* ESLint does not have a utility method for detecting if
|
|
6
|
+
* any error has occurred, nor does it set the exit code.
|
|
7
|
+
*
|
|
8
|
+
* We can use this function to determine if any error has
|
|
9
|
+
* occurred and set the exit code accordingly.
|
|
10
|
+
*/
|
|
11
|
+
function errorOccurred( results ) {
|
|
12
|
+
return results.some( result => result.errorCount > 0 || result.warningCount > 0 );
|
|
13
|
+
}
|
|
14
|
+
|
|
4
15
|
/**
|
|
5
16
|
* Use the public API to run the eslint commands.
|
|
6
17
|
*
|
|
@@ -29,6 +40,8 @@ const packageConfig = require( '../helpers/package-config' );
|
|
|
29
40
|
if ( '' === resultText ) {
|
|
30
41
|
console.log( '>> Linted JS files without errors.' );
|
|
31
42
|
console.log( '-----------------------------------' );
|
|
43
|
+
} else if ( errorOccurred( results ) ) {
|
|
44
|
+
process.exitCode = 1;
|
|
32
45
|
}
|
|
33
46
|
}() ).catch( error => {
|
|
34
47
|
process.exitCode = 1;
|