Port onigasm fix for PHP

This commit is contained in:
Asher 2019-10-22 11:39:00 -05:00
parent 14a0cd3ffd
commit cc7585bbc2
No known key found for this signature in database
GPG key ID: D63C1EF81242354A

View file

@ -341,19 +341,25 @@ class Builder {
]);
});
// TODO: fix onigasm dep
// # onigasm 2.2.2 has a bug that makes it broken for PHP files so use 2.2.1.
// # https://github.com/NeekSandhu/onigasm/issues/17
// function fix-onigasm() {
// local onigasmPath="${buildPath}/node_modules/onigasm-umd"
// rm -rf "${onigasmPath}"
// git clone "https://github.com/alexandrudima/onigasm-umd" "${onigasmPath}"
// cd "${onigasmPath}" && yarn && yarn add --dev onigasm@2.2.1 && yarn package
// mkdir "${onigasmPath}-temp"
// mv "${onigasmPath}/"{release,LICENSE} "${onigasmPath}-temp"
// rm -rf "${onigasmPath}"
// mv "${onigasmPath}-temp" "${onigasmPath}"
// }
// onigasm 2.2.2 has a bug that makes it broken for PHP files so use 2.2.1.
// https://github.com/NeekSandhu/onigasm/issues/17
await this.task("Applying onigasm PHP fix", async () => {
const onigasmPath = path.join(finalBuildPath, "node_modules/onigasm-umd");
const onigasmTmpPath = `${onigasmPath}-temp`;
await Promise.all([
fs.remove(onigasmPath),
fs.mkdir(onigasmTmpPath),
]);
await util.promisify(cp.exec)(`git clone "https://github.com/alexandrudima/onigasm-umd" "${onigasmPath}"`);
await util.promisify(cp.exec)("yarn", { cwd: onigasmPath });
await util.promisify(cp.exec)("yarn add --dev onigasm@2.2.1", { cwd: onigasmPath });
await util.promisify(cp.exec)("yarn package", { cwd: onigasmPath });
await Promise.all(["release", "LICENSE", "package.json"].map((fileName) => {
return fs.copy(path.join(onigasmPath, fileName), path.join(onigasmTmpPath, fileName));
}));
await fs.remove(onigasmPath);
await fs.move(onigasmTmpPath, onigasmPath);
});
this.log(`Final build: ${finalBuildPath}`);
}