@storepress/create-plugin-html 0.1.2 → 0.2.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/index.js CHANGED
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@storepress/create-plugin-html",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "A template to be used with `@wordpress/create-block` to create a StorePress HTML based JS Extension.",
5
5
  "author": "StorePress",
6
6
  "main": "index.js",
@@ -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
- `${ packageName }.php`,
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( packageName, zipDirectory )
73
- : packageName;
76
+ ? join( packageSlug, zipDirectory )
77
+ : packageSlug;
74
78
  zip.addLocalFile( file, targetDir );
75
79
  } );
76
80
 
77
- zip.writeZip( `./${ packageName }-v${ packageVersion }.zip` );
81
+ zip.writeZip( `./${ packageSlug }-v${ packageVersion }.zip` );
78
82
  stdout.write(
79
- `\nDone. \`${ packageName }-v${ packageVersion }.zip\` is ready! 🎉\n`
83
+ `\nDone. \`${ packageSlug }-v${ packageVersion }.zip\` is ready! 🎉\n`
80
84
  );
81
85
  } else {
82
- fs.remove( packageName ).then( () => {
83
- fs.ensureDir( packageName, () => {
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 = `${ packageName }/${ file }`;
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. \`${ packageName }\` directory is ready! 🎉\n`
99
+ `\n\nDone. \`${ packageSlug }\` directory is ready! 🎉\n`
96
100
  );
97
101
  } );
98
102
  } );