@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.
Files changed (27) hide show
  1. package/README.md +5 -7
  2. package/index.js +136 -125
  3. package/package.json +1 -1
  4. package/plugin-templates/.eslintrc.js.mustache +1 -0
  5. package/plugin-templates/.github/workflows/release.yaml.mustache +9 -0
  6. package/plugin-templates/.gitignore.mustache +1 -1
  7. package/plugin-templates/README.md.mustache +4 -1
  8. package/plugin-templates/changelog.txt.mustache +12 -0
  9. package/plugin-templates/index-module.html.mustache +30 -0
  10. package/plugin-templates/index.html.mustache +47 -7
  11. package/plugin-templates/src/interactive/index.js.mustache +19 -0
  12. package/plugin-templates/src/react/index.js.mustache +38 -0
  13. package/{block-templates → plugin-templates/src/storepress}/Plugin.js.mustache +2 -2
  14. package/plugin-templates/src/storepress/index.js.mustache +20 -0
  15. package/plugin-templates/src/storepress/script.js.mustache +9 -0
  16. package/{block-templates → plugin-templates/src/storepress}/style.scss.mustache +2 -2
  17. package/plugin-templates/tools/changelog.js.mustache +60 -0
  18. package/plugin-templates/tools/packages-install.js.mustache +98 -0
  19. package/plugin-templates/tools/packages-update.js.mustache +90 -0
  20. package/plugin-templates/tools/webpack-helpers.js.mustache +61 -39
  21. package/plugin-templates/tools/webpack.config.externals.js.mustache +131 -0
  22. package/plugin-templates/webpack.config.js.mustache +99 -83
  23. package/block-templates/index.js.mustache +0 -20
  24. package/plugin-templates/global-style.css.mustache +0 -14
  25. package/plugin-templates/script.js.mustache +0 -8
  26. package/plugin-templates/style.scss.mustache +0 -10
  27. /package/{block-templates → plugin-templates/src/storepress}/_mixins.scss.mustache +0 -0
@@ -1,98 +1,114 @@
1
1
  const [
2
- defaultJSConfig,
3
- defaultModuleConfig,
4
- ] = require( '@wordpress/scripts/config/webpack.config' );
2
+ defaultJSConfig,
3
+ defaultModuleConfig,
4
+ ] = require('@wordpress/scripts/config/webpack.config');
5
5
  const {
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' );
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
- ...defaultJSConfig,
19
- entry: {
20
- [`plugin`]: [
21
- getRootFile('style.scss'),
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
- resolve: {
34
- ...defaultJSConfig.resolve,
35
- alias: {
36
- ...defaultJSConfig.resolve.alias,
37
- ...getWebPackAlias(),
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
- plugins: [
42
- // ...defaultJSConfig.plugins,
43
- ...defaultJSConfig.plugins.filter(
44
- ( plugin ) =>
45
- plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
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
- // Removes the empty `.js` files generated by webpack but
54
- // sets it after WP has generated its `*.asset.php` file.
55
- new RemoveEmptyScriptsPlugin( {
56
- stage: RemoveEmptyScriptsPlugin.STAGE_AFTER_PROCESS_PLUGINS,
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
- ...defaultModuleConfig,
63
- output: { ...defaultModuleConfig.output, module: true },
64
- experiments: { outputModule: true },
65
- entry: {
66
- // ...defaultModuleConfig.entry(),
67
- // 'custom-module': getFile( 'custom-module.js' ),
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
- resolve: {
71
- ...defaultModuleConfig.resolve,
72
- alias: {
73
- ...defaultModuleConfig.resolve.alias,
74
- ...getWebPackAlias(),
75
- },
76
- },
95
+ ...defaultModuleConfig.plugins.filter(
96
+ (plugin) =>
97
+ plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
98
+ ),
77
99
 
78
- plugins: [
79
- // ...defaultModuleConfig.plugins,
80
- ...defaultModuleConfig.plugins.filter(
81
- ( plugin ) =>
82
- plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
83
- ),
84
- new DependencyExtractionWebpackPlugin( {
85
- requestToExternal,
86
- requestToHandle,
87
- requestToExternalModule,
88
- } ),
100
+ new DependencyExtractionWebpackPlugin({
101
+ requestToExternal,
102
+ requestToHandle,
103
+ requestToExternalModule,
104
+ }),
89
105
 
90
- // Removes the empty `.js` files generated by webpack but
91
- // sets it after WP has generated its `*.asset.php` file.
92
- new RemoveEmptyScriptsPlugin( {
93
- stage: RemoveEmptyScriptsPlugin.STAGE_AFTER_PROCESS_PLUGINS,
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 = [ scriptConfig, moduleConfig ];
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}};
@@ -1,14 +0,0 @@
1
- body {
2
- font-family: sans-serif;
3
- }
4
-
5
- .wrapper {
6
- width: 80%;
7
- height: 80dvh;
8
-
9
- display: flex;
10
- justify-content: center;
11
- align-items: center;
12
-
13
- margin-inline: auto;
14
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import {{pascaleSlug}} from '@{{kebabNamespace}}/{{kebabSlug}}';
5
-
6
- document.addEventListener( 'DOMContentLoaded', () => {
7
- {{pascaleSlug}}.init();
8
- } );
@@ -1,10 +0,0 @@
1
- @charset "UTF-8";
2
-
3
- @use "./src/mixins" as plugin;
4
-
5
- :where([data-{{kebabSlug}}]) {
6
- @include plugin.init();
7
- & {
8
- --custom-variable: 1px;
9
- }
10
- }