-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Manage WordPress build tasks using a gulpfile
- Loading branch information
Showing
8 changed files
with
72 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const { spawn, exec, execSync } = require('child_process'); | ||
const os = require('os'); | ||
const gulp = require('gulp'); | ||
const path = require('path'); | ||
const util = require('util'); | ||
const fs = require('fs'); | ||
const asyncExec = util.promisify(require('child_process').exec); | ||
|
||
const sourcePath = __dirname; | ||
const buildPath = path.join(__dirname, '..', 'build-wp'); | ||
const tmpWorkDir = fs.mkdtempSync(path.join(os.tmpdir(), 'wp-')); | ||
|
||
async function prepareWordPress() { | ||
await asyncPipe( | ||
gulp.src([ | ||
`${sourcePath}/prepare-wordpress.sh`, | ||
`${sourcePath}/request_transport_fetch.php` | ||
]).pipe(gulp.dest(tmpWorkDir)) | ||
) | ||
|
||
await asyncExec('bash prepare-wordpress.sh', [''], { cwd: tmpWorkDir, stdio: 'inherit' }); | ||
} | ||
|
||
async function bundleWordPress() { | ||
await asyncPipe( | ||
gulp.src([ | ||
`${sourcePath}/Dockefile`, | ||
`${sourcePath}/bundle-data.sh` | ||
]).pipe(gulp.dest(tmpWorkDir)) | ||
) | ||
|
||
await asyncExec('bash bundle-data.sh', [''], { cwd: tmpWorkDir, stdio: 'inherit' }); | ||
|
||
return asyncPipe( | ||
gulp.src([ | ||
`${tmpWorkDir}/wp.js`, | ||
`${tmpWorkDir}/wp.data`, | ||
`${tmpWorkDir}/wp-admin`, | ||
`${tmpWorkDir}/wp-content`, | ||
`${tmpWorkDir}/wp-includes`, | ||
]).pipe(gulp.dest(buildPath)) | ||
); | ||
} | ||
|
||
exports.build = gulp.series(prepareWordPress, bundleWordPress); | ||
|
||
function asyncPipe(pipe) { | ||
return new Promise(async (resolve, reject) => { | ||
pipe.on('finish', resolve) | ||
.on('error', reject); | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
#!/bin/bash | ||
|
||
# set -e | ||
mkdir -p preload | ||
cd preload | ||
|
||
# Remove previous WordPress installation | ||
rm -rf wordpress | ||
|
This file was deleted.
Oops, something went wrong.