@sumotto/configs 0.0.29 → 0.0.31
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sumotto/configs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"description": "Configs for my work",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"release": "np --yolo",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"wp/*"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@wordpress/dependency-extraction-webpack-plugin": "^6.
|
|
32
|
-
"@wordpress/scripts": "^30.
|
|
31
|
+
"@wordpress/dependency-extraction-webpack-plugin": "^6.14.0",
|
|
32
|
+
"@wordpress/scripts": "^30.7.0",
|
|
33
33
|
"chokidar": "^4.0.1",
|
|
34
34
|
"copy-webpack-plugin": "^12.0.2",
|
|
35
35
|
"dotenv": "^16.4.7",
|
|
@@ -1,12 +1,47 @@
|
|
|
1
1
|
const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' );
|
|
2
|
+
const RemoveEmptyScriptsPlugin = require( 'webpack-remove-empty-scripts' );
|
|
3
|
+
const RtlCssPlugin = require( 'rtlcss-webpack-plugin' );
|
|
2
4
|
const CleanWebpackPlugin = require( '../helpers/clean-webpack-plugin' );
|
|
3
5
|
const SyncWebpackPlugin = require( '../helpers/sync-webpack-plugin' );
|
|
4
6
|
const { resolve } = require( 'node:path' );
|
|
5
|
-
const { Config, modulesConfigWP } = require( '../helpers/webpack' );
|
|
7
|
+
const { Config, defaultConfigWP, modulesConfigWP } = require( '../helpers/webpack' );
|
|
8
|
+
const findFreePort = require( 'find-free-port-sync' );
|
|
6
9
|
const rootPath = process.cwd().replace( /\\/g, '/' );
|
|
7
10
|
const outputPath = process.env.WP_CONTENT_DIR
|
|
8
11
|
? resolve( process.env.WP_CONTENT_DIR, 'plugins/the-woocommerce' )
|
|
9
12
|
: rootPath;
|
|
13
|
+
const port =
|
|
14
|
+
process.env.WOOCOMMERCE_DEV_SERVER_PORT ||
|
|
15
|
+
findFreePort( { start: 10000, end: 10999 } );
|
|
16
|
+
|
|
17
|
+
const defaultConfig = new Config( defaultConfigWP, 'default', port )
|
|
18
|
+
.resetEntries()
|
|
19
|
+
.addEntries(
|
|
20
|
+
'src/styles/{*.{pc,sc,sa,c}ss,{blocks,variations,patterns}/**/*.{pc,sc,sa,c}ss}'
|
|
21
|
+
)
|
|
22
|
+
.addEntries( 'src/scripts/*.{j,t}s' )
|
|
23
|
+
.changeRule( '/\\.(sc|sa)ss$/', ( rule ) => {
|
|
24
|
+
const last = rule.use.length - 1;
|
|
25
|
+
|
|
26
|
+
rule.use[ last ].options.sassOptions = {
|
|
27
|
+
includePaths: [ resolve( rootPath, 'src/styles/partials' ) ],
|
|
28
|
+
};
|
|
29
|
+
} )
|
|
30
|
+
.removePlugin( RtlCssPlugin )
|
|
31
|
+
.addPlugin(
|
|
32
|
+
new CleanWebpackPlugin( {
|
|
33
|
+
patterns: [
|
|
34
|
+
resolve( outputPath, 'build/**/*' ),
|
|
35
|
+
'!' + resolve( outputPath, 'build/scripts/modules/**/*' ),
|
|
36
|
+
],
|
|
37
|
+
} )
|
|
38
|
+
)
|
|
39
|
+
.addPlugin(
|
|
40
|
+
// For styles remove JS and styles .asset.php
|
|
41
|
+
new RemoveEmptyScriptsPlugin( {
|
|
42
|
+
enabled: ! Config.hasDevServer( defaultConfigWP ),
|
|
43
|
+
} )
|
|
44
|
+
);
|
|
10
45
|
|
|
11
46
|
const modulesConfig = new Config( modulesConfigWP, 'modules' )
|
|
12
47
|
.resetEntries()
|
|
@@ -30,7 +65,9 @@ const modulesConfig = new Config( modulesConfigWP, 'modules' )
|
|
|
30
65
|
);
|
|
31
66
|
|
|
32
67
|
if ( process.env.WP_CONTENT_DIR ) {
|
|
33
|
-
|
|
68
|
+
const buildPath = resolve( outputPath, 'build' );
|
|
69
|
+
defaultConfigWP.output.path = buildPath;
|
|
70
|
+
modulesConfigWP.output.path = buildPath;
|
|
34
71
|
|
|
35
72
|
const syncDirectory = new SyncWebpackPlugin( {
|
|
36
73
|
sourceDir: rootPath,
|
|
@@ -38,7 +75,8 @@ if ( process.env.WP_CONTENT_DIR ) {
|
|
|
38
75
|
exclude: [ /[\/\\]build[\/\\]/ ],
|
|
39
76
|
} );
|
|
40
77
|
|
|
78
|
+
defaultConfig.addPlugin( syncDirectory );
|
|
41
79
|
modulesConfig.addPlugin( syncDirectory );
|
|
42
80
|
}
|
|
43
81
|
|
|
44
|
-
module.exports = [ modulesConfig.get() ];
|
|
82
|
+
module.exports = [ defaultConfig.get(), modulesConfig.get() ];
|
|
@@ -30,7 +30,8 @@ const defaultConfig = new Config( defaultConfigWP, 'default', port )
|
|
|
30
30
|
const last = rule.use.length - 1;
|
|
31
31
|
|
|
32
32
|
rule.use[ last ].options.sassOptions = {
|
|
33
|
-
|
|
33
|
+
loadPaths: [ resolve( rootPath, 'src/styles/partials' ) ],
|
|
34
|
+
silenceDeprecations: [ 'mixed-decls' ],
|
|
34
35
|
};
|
|
35
36
|
} )
|
|
36
37
|
.removePlugin( RtlCssPlugin )
|