@storepress/create-plugin-html 0.1.2 → 0.2.1
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
CHANGED
|
@@ -7,7 +7,7 @@ This is a template for [`@wordpress/create-block`](https://developer.wordpress.o
|
|
|
7
7
|
This template can be used by running the following command:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npx -y @wordpress/create-block@latest --template @storepress/create-plugin-html
|
|
10
|
+
npx -y @wordpress/create-block@latest --template @storepress/create-plugin-html example-html-extension && cd "$_"
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Navigate to the newly created folder and get started.
|
|
@@ -23,7 +23,7 @@ npx -y http-server # Start Server
|
|
|
23
23
|
For development on this tool itself, you can also install from a local directory.
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
npx -y @wordpress/create-block@latest --template ./create-plugin-html
|
|
26
|
+
npx -y @wordpress/create-block@latest --template ./storepress-create-plugin-html example-html-extension && cd "$_"
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
### Add Tests
|
package/index.js
CHANGED
|
@@ -96,7 +96,7 @@ module.exports = {
|
|
|
96
96
|
attributes : {},
|
|
97
97
|
license : 'GPL-2.0-or-later',
|
|
98
98
|
customScripts : {
|
|
99
|
-
'postinstall' : 'npm run packages-install:all && git init -q && rimraf .husky && npx husky
|
|
99
|
+
'postinstall' : 'npm run packages-install:all && git init -q && rimraf .husky && npx husky && echo "npx lint-staged" > .husky/pre-commit',
|
|
100
100
|
|
|
101
101
|
'prebuild' : 'rimraf build && npm run external:build',
|
|
102
102
|
'build' : 'wp-scripts build --webpack-copy-php --experimental-modules',
|
|
@@ -207,6 +207,7 @@ module.exports = {
|
|
|
207
207
|
GITHUB_TOKEN : '${{ secrets.GITHUB_TOKEN }}',
|
|
208
208
|
GITHUB_PAGE_URL : '${{ steps.deployment.outputs.page_url }}',
|
|
209
209
|
GITHUB_CHANGELOG_CONTENT : "${{ steps.changelog.outputs.changelog }}",
|
|
210
|
+
PLAIN_PACKAGE_NAME : "${{ env.PLAIN_PACKAGE_NAME }}",
|
|
210
211
|
}
|
|
211
212
|
},
|
|
212
213
|
},
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
package-lock=
|
|
1
|
+
package-lock=true
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"value-keyword-case" : null,
|
|
16
16
|
"scss/operator-no-unspaced" : null,
|
|
17
17
|
"scss/selector-no-redundant-nesting-selector" : null,
|
|
18
|
-
"scss/at-import-partial-extension" : null,
|
|
19
18
|
"scss/no-global-function-names" : null,
|
|
20
19
|
"scss/comment-no-empty" : null,
|
|
21
20
|
"scss/at-extend-no-missing-placeholder" : null,
|
|
@@ -20,6 +20,10 @@ const {
|
|
|
20
20
|
|
|
21
21
|
const packageName = getPackageProp( 'name' );
|
|
22
22
|
const packageVersion = getPackageProp( 'version' );
|
|
23
|
+
const packageSlug = packageName
|
|
24
|
+
.replace( /^@/, '' )
|
|
25
|
+
.replace( '/', '-' )
|
|
26
|
+
.toLowerCase();
|
|
23
27
|
|
|
24
28
|
stdout.write( `Creating package for \`${ packageName }\` plugin... 🎁\n\n` );
|
|
25
29
|
const zip = new AdmZip();
|
|
@@ -46,7 +50,7 @@ if ( hasPackageProp( 'files' ) ) {
|
|
|
46
50
|
'includes/**',
|
|
47
51
|
'languages/**',
|
|
48
52
|
'templates/**',
|
|
49
|
-
`${
|
|
53
|
+
`${ packageSlug }.php`,
|
|
50
54
|
'uninstall.php',
|
|
51
55
|
'block.json',
|
|
52
56
|
'changelog.*',
|
|
@@ -69,30 +73,30 @@ if ( isZip ) {
|
|
|
69
73
|
// Prefix every entry with the slug folder
|
|
70
74
|
const targetDir =
|
|
71
75
|
zipDirectory !== '.'
|
|
72
|
-
? join(
|
|
73
|
-
:
|
|
76
|
+
? join( packageSlug, zipDirectory )
|
|
77
|
+
: packageSlug;
|
|
74
78
|
zip.addLocalFile( file, targetDir );
|
|
75
79
|
} );
|
|
76
80
|
|
|
77
|
-
zip.writeZip( `./${
|
|
81
|
+
zip.writeZip( `./${ packageSlug }-v${ packageVersion }.zip` );
|
|
78
82
|
stdout.write(
|
|
79
|
-
`\nDone. \`${
|
|
83
|
+
`\nDone. \`${ packageSlug }-v${ packageVersion }.zip\` is ready! 🎉\n`
|
|
80
84
|
);
|
|
81
85
|
} else {
|
|
82
|
-
fs.remove(
|
|
83
|
-
fs.ensureDir(
|
|
86
|
+
fs.remove( packageSlug ).then( () => {
|
|
87
|
+
fs.ensureDir( packageSlug, () => {
|
|
84
88
|
stdout.write(
|
|
85
89
|
`Creating directory for \`${ packageName }\` plugin... 🎁\n\n`
|
|
86
90
|
);
|
|
87
91
|
|
|
88
92
|
files.forEach( ( file ) => {
|
|
89
|
-
const to = `${
|
|
93
|
+
const to = `${ packageSlug }/${ file }`;
|
|
90
94
|
stdout.write( ` 🥳 Adding \`${ file }\`.\n` );
|
|
91
95
|
fs.copy( file, to );
|
|
92
96
|
} );
|
|
93
97
|
|
|
94
98
|
stdout.write(
|
|
95
|
-
`\n\nDone. \`${
|
|
99
|
+
`\n\nDone. \`${ packageSlug }\` directory is ready! 🎉\n`
|
|
96
100
|
);
|
|
97
101
|
} );
|
|
98
102
|
} );
|