diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..fd80c96 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,21 @@ +name: Validate Build + +on: [pull_request, push] + +jobs: + validate-build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install dependencies + run: npm Install + + - name: Run Gulp tasks + run: npx gulp diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..373d3ed --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,29 @@ +name: Gitea Release Actions + +on: + release: + types: [published] + +jobs: + upload-release-assets: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install dependencies + run: npm Install + + - name: Run Gulp tasks + run: npx gulp + + - name: Upload release assets + uses: akkuman/gitea-release-action@v1 + with: + files: |- + *.zip diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..bc06049 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,25 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Package", + "type": "shell", + "command": "gulp", + "group": "build", + "presentation": { + "reveal": "silent", + "panel": "shared", + } + }, + { + "label": "Install", + "type": "shell", + "command": "make install", + "group": "build", + "presentation": { + "reveal": "silent", + "panel": "shared", + } + } + ] +} diff --git a/Makefile b/Makefile index 4cb6823..9a7d76e 100644 --- a/Makefile +++ b/Makefile @@ -18,4 +18,4 @@ install: npm install package: install - gulp package + gulp diff --git a/gulpfile.js b/gulpfile.js index d1ee767..d18c1ab 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,14 +1,22 @@ +/** + * @package ogre-suspension + * @author cleverogre + * @version 1.0.0 + * @since 1.0.0 + */ + const gulp = require('gulp'), clean = require('gulp-clean'), - concatCss = require('gulp-concat-css'), - postcss = require('gulp-postcss'), - cssnano = require('cssnano'), - sass = require('gulp-sass')(require('sass')); + filter = require('gulp-filter').default, + zip = require('gulp-zip').default, + path = require('path'); + +const NAME = path.basename(__dirname); // Clean Tasks -gulp.task('clean-style', function () { - return gulp.src('style.css', { +gulp.task('clean-package', () => { + return gulp.src(`${NAME}.zip`, { read: false, allowEmpty: true, }).pipe(clean()); @@ -17,40 +25,37 @@ gulp.task('clean-style', function () { gulp.task( 'clean', gulp.series( - 'clean-style' + 'clean-package' ) ); -// Compile Tasks +// Package Tasks -gulp.task('compile-style', function () { - return gulp.src('assets/sass/style.scss', { base: './' }) - .pipe(sass().on('error', sass.logError)) - .pipe(concatCss('style.css')) - .pipe(postcss(cssnano())) - .pipe(gulp.dest('assets/css')); +gulp.task('package', () => { + return gulp.src([ + 'assets/**/*', + 'inc/**/*', + 'templates/**/*', + 'vendor/**/*', + '!vendor/**/node_modules/**/*', + 'LICENSE', + `${NAME}.php`, + 'readme.txt' + ], { + base: './', + allowEmpty: true + }) + .pipe(filter((file) => !file.path.includes('/node_modules'))) + .pipe(zip(`${NAME}.zip`)) + .pipe(gulp.dest('./')); }); -gulp.task( - 'compile', - gulp.series( - 'compile-style' - ) -); - // Default Tasks gulp.task( 'default', gulp.series( 'clean', - 'compile' + 'package' ) ); - -gulp.task('watch', function () { - gulp.watch(['assets/sass/**/*.scss']).on( - 'change', - 'default' - ); -}); diff --git a/package-lock.json b/package-lock.json index 391b5bd..229bad5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "gulp": "^5.0.0", "gulp-clean": "^0.4.0", "gulp-cli": "^2.3.0", + "gulp-filter": "^9.0.1", "gulp-zip": "^6.1.0" }, "engines": { @@ -216,6 +217,19 @@ "node": ">=0.10.0" } }, + "node_modules/array-differ": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-4.0.0.tgz", + "integrity": "sha512-Q6VPTLMsmXZ47ENG3V+wQyZS1ZxXMxFyYzA+Z/GMrJ6yIutAIEf9wTyroTzmGjNfox9/h3GdGBCVh43GVFx4Uw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/array-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", @@ -251,6 +265,19 @@ "node": ">=0.10.0" } }, + "node_modules/array-union": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-3.0.1.tgz", + "integrity": "sha512-1OvF9IbWwaeiM9VhzYXVQacMibxpXOMYVNIvMtKRyX9SImBXpKcFr8XvFDeEslCyuH/t6KRt7HEO94AlP8Iatw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/array-unique": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", @@ -1863,6 +1890,47 @@ "node": ">= 0.10" } }, + "node_modules/gulp-filter": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/gulp-filter/-/gulp-filter-9.0.1.tgz", + "integrity": "sha512-knVYL8h9bfYIeft3VokVTkuaWJkQJMrFCS3yVjZQC6BGg+1dZFoeUY++B9D2X4eFpeNTx9StWK0qnDby3NO3PA==", + "dev": true, + "license": "MIT", + "dependencies": { + "multimatch": "^7.0.0", + "plugin-error": "^2.0.1", + "slash": "^5.1.0", + "streamfilter": "^3.0.0", + "to-absolute-glob": "^3.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + }, + "peerDependencies": { + "gulp": ">=4" + }, + "peerDependenciesMeta": { + "gulp": { + "optional": true + } + } + }, + "node_modules/gulp-filter/node_modules/plugin-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-2.0.1.tgz", + "integrity": "sha512-zMakqvIDyY40xHOvzXka0kUvf40nYIuwRE8dWhti2WtjQZ31xAgBZBhxsK7vK3QbRXS1Xms/LO7B5cuAsfB2Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^1.0.1" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/gulp-plugin-extras": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/gulp-plugin-extras/-/gulp-plugin-extras-1.1.0.tgz", @@ -3161,6 +3229,50 @@ "dev": true, "license": "MIT" }, + "node_modules/multimatch": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-7.0.0.tgz", + "integrity": "sha512-SYU3HBAdF4psHEL/+jXDKHO95/m5P2RvboHT2Y0WtTttvJLP4H/2WS9WlQPFvF6C8d6SpLw8vjCnQOnVIVOSJQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-differ": "^4.0.0", + "array-union": "^3.0.1", + "minimatch": "^9.0.3" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/multimatch/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/multimatch/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/mute-stdout": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-1.0.1.tgz", @@ -4053,6 +4165,19 @@ "node": ">=0.10.0" } }, + "node_modules/slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -4337,6 +4462,34 @@ "dev": true, "license": "MIT" }, + "node_modules/streamfilter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/streamfilter/-/streamfilter-3.0.0.tgz", + "integrity": "sha512-kvKNfXCmUyC8lAXSSHCIXBUlo/lhsLcCU/OmzACZYpRUdtKIH68xYhm/+HI15jFJYtNJGYtCgn2wmIiExY1VwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "^3.0.6" + }, + "engines": { + "node": ">=8.12.0" + } + }, + "node_modules/streamfilter/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/streamx": { "version": "2.23.0", "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.23.0.tgz", @@ -4499,6 +4652,20 @@ "node": ">=0.10.0" } }, + "node_modules/to-absolute-glob": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-3.0.0.tgz", + "integrity": "sha512-loO/XEWTRqpfcpI7+Jr2RR2Umaaozx1t6OSVWtMi0oy5F/Fxg3IC+D/TToDnxyAGs7uZBGT/6XmyDUxgsObJXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-absolute": "^1.0.0", + "is-negated-glob": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/to-object-path": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", diff --git a/package.json b/package.json index b1032de..44dbc8a 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,18 @@ { "$schema": "https://www.schemastore.org/package.json", - "name": "cleverogre/ogre-suspension", - "version": "1.0.0", - "title": "OgreSuspension", + "name": "cleverogre/ogre-suspension", + "version": "1.0.0", + "title": "OgreSuspension", "description": "OgreSuspension will lock down a WordPress instance with a custom suspension page and prevent access to the admin dashboard. Use with caution!", - "author": "CleverOgre", + "author": "CleverOgre", "license": "GPL-3.0+", "keywords": [ - "WordPress", + "WordPress", "Plugin", - "suspension", - "lockdown", - "shutdown", - "suspend" + "suspension", + "lockdown", + "shutdown", + "suspend" ], "homepage": "https://cleverogre.com", "engines": { @@ -23,6 +23,7 @@ "gulp": "^5.0.0", "gulp-clean": "^0.4.0", "gulp-cli": "^2.3.0", + "gulp-filter": "^9.0.1", "gulp-zip": "^6.1.0" } }