diff --git a/bin/build-plugin-zip.sh b/bin/build-plugin-zip.sh new file mode 100755 index 00000000000000..91e76bd8fa92cb --- /dev/null +++ b/bin/build-plugin-zip.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# Exit if any command fails +set -e + +# Change to the expected directory +cd "$(dirname "$0")" +cd .. + +# Run the build +npm install +npm run build + +# Remove any existing zip file +rm -f gutenberg.zip + +# Generate the plugin zip file +zip -r gutenberg.zip \ + index.php \ + post-content.js \ + blocks/build \ + editor/build \ + element/build \ + i18n/build \ + README.md diff --git a/package.json b/package.json index f9d5cf293845d4..47a947f448044a 100644 --- a/package.json +++ b/package.json @@ -10,14 +10,6 @@ "WordPress", "editor" ], - "files": [ - "index.php", - "post-content.js", - "editor/build", - "i18n/build", - "element/build", - "blocks/build" - ], "scripts": { "test-unit": "cross-env NODE_ENV=test webpack && mocha build --require bootstrap-test.js", "build": "cross-env BABEL_ENV=default NODE_ENV=production webpack", @@ -26,9 +18,7 @@ "dev": "cross-env BABEL_ENV=default webpack --watch", "test": "npm run lint && npm run test-unit", "ci": "concurrently \"npm run build\" \"npm test\"", - "prepackage-plugin": "rm -f gutenberg.zip && npm install && npm run build", - "package-plugin": "cat \"$(npm pack)\" | tar xzf - && cd package && zip -r ../gutenberg.zip *", - "postpackage-plugin": "rm -r package gutenberg*.tgz" + "package-plugin": "./bin/build-plugin-zip.sh" }, "devDependencies": { "autoprefixer": "^6.7.7",