@storepress/create-plugin-html 0.1.1 → 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/README.md
CHANGED
|
@@ -13,9 +13,9 @@ npx -y @wordpress/create-block@latest --template @storepress/create-plugin-html
|
|
|
13
13
|
Navigate to the newly created folder and get started.
|
|
14
14
|
|
|
15
15
|
```
|
|
16
|
-
npm i
|
|
17
|
-
npm run build
|
|
18
|
-
npx -y http-server
|
|
16
|
+
npm i # Install dependencies and Update package dependency
|
|
17
|
+
npm run build # Build the javascript
|
|
18
|
+
npx -y http-server # Start Server
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Development
|
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
|
@@ -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
|
} );
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# Simple workflow for deploying static content to GitHub Pages
|
|
2
|
-
name: Deploy to Pages
|
|
3
|
-
|
|
4
|
-
on:
|
|
5
|
-
# Runs on pushes targeting the default branch
|
|
6
|
-
push:
|
|
7
|
-
branches: [$default-branch]
|
|
8
|
-
|
|
9
|
-
# Allows you to run this workflow manually from the Actions tab
|
|
10
|
-
workflow_dispatch:
|
|
11
|
-
|
|
12
|
-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
13
|
-
permissions:
|
|
14
|
-
contents: read
|
|
15
|
-
pages: write
|
|
16
|
-
id-token: write
|
|
17
|
-
|
|
18
|
-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
|
19
|
-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
|
20
|
-
concurrency:
|
|
21
|
-
group: "pages"
|
|
22
|
-
cancel-in-progress: false
|
|
23
|
-
|
|
24
|
-
jobs:
|
|
25
|
-
# Single deploy job since we're just deploying
|
|
26
|
-
deploy:
|
|
27
|
-
environment:
|
|
28
|
-
name: github-pages
|
|
29
|
-
url: {{ GITHUB_PAGE_URL }}
|
|
30
|
-
runs-on: ubuntu-latest
|
|
31
|
-
steps:
|
|
32
|
-
- name: "Checkout"
|
|
33
|
-
uses: actions/checkout@v4
|
|
34
|
-
|
|
35
|
-
- name: "Setup Node"
|
|
36
|
-
uses: actions/setup-node@v4
|
|
37
|
-
with:
|
|
38
|
-
node-version: '20.x'
|
|
39
|
-
|
|
40
|
-
- name: "Install and Build"
|
|
41
|
-
run: |
|
|
42
|
-
npm install
|
|
43
|
-
npm run build
|
|
44
|
-
rm -rf node_modules
|
|
45
|
-
|
|
46
|
-
- name: "Upload Page Contents"
|
|
47
|
-
uses: actions/upload-pages-artifact@v3
|
|
48
|
-
with:
|
|
49
|
-
path: '.'
|
|
50
|
-
|
|
51
|
-
- name: "Deploy to GitHub Pages"
|
|
52
|
-
id: deployment
|
|
53
|
-
uses: actions/deploy-pages@v4
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
on:
|
|
2
|
-
push:
|
|
3
|
-
# Sequence of patterns matched against refs/tags
|
|
4
|
-
tags:
|
|
5
|
-
- '**' # Push events to matching i.e. 1.0, 20.15.10, including hierarchical tags like v1.0/beta
|
|
6
|
-
# Semver (https://semver.org/) release pattern.
|
|
7
|
-
# - '[0-9]+.[0-9]+.[0-9]+*'
|
|
8
|
-
|
|
9
|
-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
10
|
-
permissions: write-all
|
|
11
|
-
|
|
12
|
-
env:
|
|
13
|
-
REPOSITORY_NAME: {{ GITHUB_REPOSITORY_NAME }}
|
|
14
|
-
|
|
15
|
-
name: Release
|
|
16
|
-
|
|
17
|
-
jobs:
|
|
18
|
-
|
|
19
|
-
# Build distribution release.
|
|
20
|
-
#
|
|
21
|
-
# Performs the following steps:
|
|
22
|
-
# - Checks out the repository
|
|
23
|
-
# - Setup and Install Node.js
|
|
24
|
-
# - NPM Install
|
|
25
|
-
# - Make Zip
|
|
26
|
-
# - Get Release Version
|
|
27
|
-
# - Get Release Filename
|
|
28
|
-
# - Get Changelog
|
|
29
|
-
# - Make Release
|
|
30
|
-
|
|
31
|
-
build:
|
|
32
|
-
name: Release
|
|
33
|
-
runs-on: ubuntu-latest
|
|
34
|
-
steps:
|
|
35
|
-
- name: "Checks out the repository"
|
|
36
|
-
uses: actions/checkout@v4
|
|
37
|
-
|
|
38
|
-
- name: "Setup and Install Node.js"
|
|
39
|
-
uses: actions/setup-node@v4
|
|
40
|
-
with:
|
|
41
|
-
node-version: '20.x'
|
|
42
|
-
|
|
43
|
-
- name: "NPM Install"
|
|
44
|
-
run: npm install
|
|
45
|
-
|
|
46
|
-
- name: "Make Zip"
|
|
47
|
-
run: npm run plugin-zip --if-present
|
|
48
|
-
|
|
49
|
-
- name: "Get Release Version"
|
|
50
|
-
run: |
|
|
51
|
-
echo "RELEASE_TAG=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
|
|
52
|
-
|
|
53
|
-
- name: "Get Release Filename"
|
|
54
|
-
run: |
|
|
55
|
-
echo "RELEASE_NAME=$(node -p -e "require('./package.json').name")" >> $GITHUB_ENV
|
|
56
|
-
|
|
57
|
-
- name: "Get Changelog"
|
|
58
|
-
id: changelog
|
|
59
|
-
run: |
|
|
60
|
-
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
|
61
|
-
node ./tools/changelog.js >> $GITHUB_OUTPUT
|
|
62
|
-
echo "EOF" >> $GITHUB_OUTPUT
|
|
63
|
-
|
|
64
|
-
- name: "Make Release"
|
|
65
|
-
uses: softprops/action-gh-release@v2
|
|
66
|
-
with:
|
|
67
|
-
files: ./{{ GITHUB_RELEASE_NAME }}.zip
|
|
68
|
-
make_latest: true
|
|
69
|
-
name: Release - v{{ GITHUB_RELEASE_TAG }}
|
|
70
|
-
body: {{ GITHUB_CHANGELOG_CONTENT }}
|
|
71
|
-
env:
|
|
72
|
-
GITHUB_TOKEN: {{ GITHUB_TOKEN }}
|