@storepress/create-plugin-html 0.0.5 → 0.1.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/README.md +5 -7
- package/index.js +136 -125
- package/package.json +1 -1
- package/plugin-templates/.eslintrc.js.mustache +1 -0
- package/plugin-templates/.github/workflows/release.yaml.mustache +9 -0
- package/plugin-templates/.gitignore.mustache +1 -1
- package/plugin-templates/README.md.mustache +4 -1
- package/plugin-templates/changelog.txt.mustache +12 -0
- package/plugin-templates/index-module.html.mustache +30 -0
- package/plugin-templates/index.html.mustache +47 -7
- package/plugin-templates/src/interactive/index.js.mustache +19 -0
- package/plugin-templates/src/react/index.js.mustache +38 -0
- package/{block-templates → plugin-templates/src/storepress}/Plugin.js.mustache +2 -2
- package/plugin-templates/src/storepress/index.js.mustache +20 -0
- package/plugin-templates/src/storepress/script.js.mustache +9 -0
- package/{block-templates → plugin-templates/src/storepress}/style.scss.mustache +2 -2
- package/plugin-templates/tools/changelog.js.mustache +60 -0
- package/plugin-templates/tools/packages-install.js.mustache +98 -0
- package/plugin-templates/tools/packages-update.js.mustache +90 -0
- package/plugin-templates/tools/webpack-helpers.js.mustache +61 -39
- package/plugin-templates/tools/webpack.config.externals.js.mustache +131 -0
- package/plugin-templates/webpack.config.js.mustache +99 -83
- package/block-templates/index.js.mustache +0 -20
- package/plugin-templates/global-style.css.mustache +0 -14
- package/plugin-templates/script.js.mustache +0 -8
- package/plugin-templates/style.scss.mustache +0 -10
- /package/{block-templates → plugin-templates/src/storepress}/_mixins.scss.mustache +0 -0
|
@@ -1,98 +1,114 @@
|
|
|
1
1
|
const [
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
]
|
|
2
|
+
defaultJSConfig,
|
|
3
|
+
defaultModuleConfig,
|
|
4
|
+
] = require('@wordpress/scripts/config/webpack.config');
|
|
5
5
|
const {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
const WoocommerceDependencyExtractionWebpackPlugin = require(
|
|
14
|
-
const DependencyExtractionWebpackPlugin
|
|
15
|
-
const RemoveEmptyScriptsPlugin
|
|
6
|
+
requestToExternal,
|
|
7
|
+
requestToHandle,
|
|
8
|
+
requestToExternalModule,
|
|
9
|
+
getFile,
|
|
10
|
+
getRootFile,
|
|
11
|
+
getWebPackAlias,
|
|
12
|
+
} = require('./tools/webpack-helpers');
|
|
13
|
+
const WoocommerceDependencyExtractionWebpackPlugin = require('@woocommerce/dependency-extraction-webpack-plugin');
|
|
14
|
+
const DependencyExtractionWebpackPlugin = require('@wordpress/dependency-extraction-webpack-plugin');
|
|
15
|
+
const RemoveEmptyScriptsPlugin = require('webpack-remove-empty-scripts');
|
|
16
16
|
|
|
17
17
|
const scriptConfig = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
getRootFile('script.js'),
|
|
18
|
+
...defaultJSConfig,
|
|
19
|
+
entry : {
|
|
20
|
+
[`react-example`] : [
|
|
21
|
+
getFile('react/index.js'),
|
|
23
22
|
],
|
|
24
|
-
'storepress-utils': {
|
|
25
|
-
import: '@storepress/utils/build-module/index.js',
|
|
26
|
-
library: {
|
|
27
|
-
name: ['StorePress','Utils'],
|
|
28
|
-
type: 'window'
|
|
29
|
-
},
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
23
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
'storepress-utils' : {
|
|
25
|
+
import : '@storepress/utils/build-module/index.js',
|
|
26
|
+
library : {
|
|
27
|
+
name : ['StorePress', 'Utils'],
|
|
28
|
+
type : 'window',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
),
|
|
47
|
-
new WoocommerceDependencyExtractionWebpackPlugin( {
|
|
48
|
-
requestToExternal,
|
|
49
|
-
requestToHandle,
|
|
50
|
-
requestToExternalModule,
|
|
51
|
-
} ),
|
|
32
|
+
[`script-example`] : [
|
|
33
|
+
getFile('storepress/style.scss'),
|
|
34
|
+
getFile('storepress/script.js'),
|
|
35
|
+
],
|
|
36
|
+
},
|
|
52
37
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
38
|
+
resolve : {
|
|
39
|
+
...defaultJSConfig.resolve,
|
|
40
|
+
alias : {
|
|
41
|
+
...defaultJSConfig.resolve.alias,
|
|
42
|
+
...getWebPackAlias(),
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
plugins : [
|
|
47
|
+
...defaultJSConfig.plugins,
|
|
48
|
+
...defaultJSConfig.plugins.filter(
|
|
49
|
+
(plugin) =>
|
|
50
|
+
plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
|
|
51
|
+
),
|
|
52
|
+
|
|
53
|
+
new DependencyExtractionWebpackPlugin({
|
|
54
|
+
requestToExternal,
|
|
55
|
+
requestToHandle,
|
|
56
|
+
requestToExternalModule,
|
|
57
|
+
}),
|
|
58
|
+
|
|
59
|
+
// Removes the empty `.js` files generated by webpack but
|
|
60
|
+
// sets it after WP has generated its `*.asset.php` file.
|
|
61
|
+
new RemoveEmptyScriptsPlugin({
|
|
62
|
+
stage : RemoveEmptyScriptsPlugin.STAGE_AFTER_PROCESS_PLUGINS,
|
|
63
|
+
}),
|
|
64
|
+
],
|
|
65
|
+
}
|
|
60
66
|
|
|
61
67
|
const moduleConfig = {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
...defaultModuleConfig,
|
|
69
|
+
entry : {
|
|
70
|
+
'interactive-example' : getFile('interactive/index.js'),
|
|
71
|
+
'storepress-utils-module': {
|
|
72
|
+
import: '@storepress/utils/build-module/index.js',
|
|
73
|
+
library: {
|
|
74
|
+
type: 'module',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
[`module-example`] : [
|
|
79
|
+
getFile('storepress/style.scss'),
|
|
80
|
+
getFile('storepress/script.js'),
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
resolve : {
|
|
85
|
+
...defaultModuleConfig.resolve,
|
|
86
|
+
alias : {
|
|
87
|
+
...defaultModuleConfig.resolve.alias,
|
|
88
|
+
...getWebPackAlias(),
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
plugins : [
|
|
93
|
+
...defaultModuleConfig.plugins,
|
|
69
94
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
...getWebPackAlias(),
|
|
75
|
-
},
|
|
76
|
-
},
|
|
95
|
+
...defaultModuleConfig.plugins.filter(
|
|
96
|
+
(plugin) =>
|
|
97
|
+
plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
|
|
98
|
+
),
|
|
77
99
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
),
|
|
84
|
-
new DependencyExtractionWebpackPlugin( {
|
|
85
|
-
requestToExternal,
|
|
86
|
-
requestToHandle,
|
|
87
|
-
requestToExternalModule,
|
|
88
|
-
} ),
|
|
100
|
+
new DependencyExtractionWebpackPlugin({
|
|
101
|
+
requestToExternal,
|
|
102
|
+
requestToHandle,
|
|
103
|
+
requestToExternalModule,
|
|
104
|
+
}),
|
|
89
105
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
106
|
+
// Removes the empty `.js` files generated by webpack but
|
|
107
|
+
// sets it after WP has generated its `*.asset.php` file.
|
|
108
|
+
new RemoveEmptyScriptsPlugin({
|
|
109
|
+
stage : RemoveEmptyScriptsPlugin.STAGE_AFTER_PROCESS_PLUGINS,
|
|
110
|
+
}),
|
|
111
|
+
],
|
|
96
112
|
};
|
|
97
113
|
|
|
98
|
-
module.exports = [
|
|
114
|
+
module.exports = [scriptConfig, moduleConfig];
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { createStorePressPlugin } from '@storepress/utils';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { Plugin } from './Plugin';
|
|
10
|
-
|
|
11
|
-
const {{pascaleSlug}} = createStorePressPlugin( {
|
|
12
|
-
selector: '[data-{{kebabSlug}}]',
|
|
13
|
-
options: {},
|
|
14
|
-
plugin: Plugin,
|
|
15
|
-
namespace: '{{pascaleSlug}}',
|
|
16
|
-
} );
|
|
17
|
-
|
|
18
|
-
{{pascaleSlug}}.setup();
|
|
19
|
-
|
|
20
|
-
export default {{pascaleSlug}};
|
|
File without changes
|