Lint hak scripts

This commit is contained in:
David Baker 2020-02-17 14:52:24 +00:00
parent 5fc72e8f73
commit fa3925194d
3 changed files with 19 additions and 19 deletions

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
const path = require('path'); const path = require('path');
const child_process = require('child_process'); const childProcess = require('child_process');
const mkdirp = require('mkdirp'); const mkdirp = require('mkdirp');
const fsExtra = require('fs-extra'); const fsExtra = require('fs-extra');
@ -28,7 +28,7 @@ module.exports = async function(hakEnv, moduleInfo) {
await buildSqlCipherUnix(hakEnv, moduleInfo); await buildSqlCipherUnix(hakEnv, moduleInfo);
} }
await buildMatrixSeshat(hakEnv, moduleInfo); await buildMatrixSeshat(hakEnv, moduleInfo);
} };
async function buildOpenSslWin(hakEnv, moduleInfo) { async function buildOpenSslWin(hakEnv, moduleInfo) {
const openSslDir = path.join(moduleInfo.moduleDotHakDir, 'openssl-1.1.1d'); const openSslDir = path.join(moduleInfo.moduleDotHakDir, 'openssl-1.1.1d');
@ -37,7 +37,7 @@ async function buildOpenSslWin(hakEnv, moduleInfo) {
console.log("Building openssl in " + openSslDir); console.log("Building openssl in " + openSslDir);
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
const proc = child_process.spawn( const proc = childProcess.spawn(
'perl', 'perl',
[ [
'Configure', 'Configure',
@ -103,7 +103,7 @@ async function buildOpenSslWin(hakEnv, moduleInfo) {
}); });
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
const proc = child_process.spawn( const proc = childProcess.spawn(
'nmake', 'nmake',
['build_libs'], ['build_libs'],
{ {
@ -117,7 +117,7 @@ async function buildOpenSslWin(hakEnv, moduleInfo) {
}); });
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
const proc = child_process.spawn( const proc = childProcess.spawn(
'nmake', 'nmake',
['install_dev'], ['install_dev'],
{ {
@ -138,13 +138,13 @@ async function buildSqlCipherWin(hakEnv, moduleInfo) {
await mkdirp(buildDir); await mkdirp(buildDir);
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
const proc = child_process.spawn( const proc = childProcess.spawn(
'nmake', 'nmake',
['/f', path.join('..', 'Makefile.msc'), 'libsqlite3.lib', 'TOP=..'], ['/f', path.join('..', 'Makefile.msc'), 'libsqlite3.lib', 'TOP=..'],
{ {
cwd: buildDir, cwd: buildDir,
stdio: 'inherit', stdio: 'inherit',
env: Object.assign({}, process.env, { env: Object.assign({}, process.env, {
CCOPTS: "-DSQLITE_HAS_CODEC -I" + path.join(moduleInfo.depPrefix, 'include'), CCOPTS: "-DSQLITE_HAS_CODEC -I" + path.join(moduleInfo.depPrefix, 'include'),
LTLIBPATHS: "/LIBPATH:" + path.join(moduleInfo.depPrefix, 'lib'), LTLIBPATHS: "/LIBPATH:" + path.join(moduleInfo.depPrefix, 'lib'),
LTLIBS: "libcrypto.lib", LTLIBS: "libcrypto.lib",
@ -185,7 +185,7 @@ async function buildSqlCipherUnix(hakEnv, moduleInfo) {
} }
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
const proc = child_process.spawn( const proc = childProcess.spawn(
path.join(sqlCipherDir, 'configure'), path.join(sqlCipherDir, 'configure'),
args, args,
{ {
@ -199,7 +199,7 @@ async function buildSqlCipherUnix(hakEnv, moduleInfo) {
}); });
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
const proc = child_process.spawn( const proc = childProcess.spawn(
'make', 'make',
[], [],
{ {
@ -213,7 +213,7 @@ async function buildSqlCipherUnix(hakEnv, moduleInfo) {
}); });
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
const proc = child_process.spawn( const proc = childProcess.spawn(
'make', 'make',
['install'], ['install'],
{ {
@ -240,7 +240,7 @@ async function buildMatrixSeshat(hakEnv, moduleInfo) {
console.log("Running neon with env", env); console.log("Running neon with env", env);
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
const proc = child_process.spawn( const proc = childProcess.spawn(
path.join(moduleInfo.nodeModuleBinDir, 'neon' + (hakEnv.isWin() ? '.cmd' : '')), path.join(moduleInfo.nodeModuleBinDir, 'neon' + (hakEnv.isWin() ? '.cmd' : '')),
['build', '--release'], ['build', '--release'],
{ {

View File

@ -15,7 +15,7 @@ limitations under the License.
*/ */
const path = require('path'); const path = require('path');
const child_process = require('child_process'); const childProcess = require('child_process');
const fs = require('fs'); const fs = require('fs');
const fsProm = require('fs').promises; const fsProm = require('fs').promises;
@ -28,7 +28,7 @@ module.exports = async function(hakEnv, moduleInfo) {
if (hakEnv.isWin()) { if (hakEnv.isWin()) {
getOpenSsl(hakEnv, moduleInfo); getOpenSsl(hakEnv, moduleInfo);
} }
} };
async function getSqlCipher(hakEnv, moduleInfo) { async function getSqlCipher(hakEnv, moduleInfo) {
const sqlCipherDir = path.join(moduleInfo.moduleDotHakDir, 'sqlcipher-4.3.0'); const sqlCipherDir = path.join(moduleInfo.moduleDotHakDir, 'sqlcipher-4.3.0');
@ -52,7 +52,7 @@ async function getSqlCipher(hakEnv, moduleInfo) {
haveSqlcipherTar = false; haveSqlcipherTar = false;
} }
if (!haveSqlcipherTar) { if (!haveSqlcipherTar) {
const bob = needle('get', 'https://github.com/sqlcipher/sqlcipher/archive/v4.3.0.tar.gz', { const bob = needle('get', 'https://github.com/sqlcipher/sqlcipher/archive/v4.3.0.tar.gz', {
follow: 10, follow: 10,
output: sqlCipherTarball, output: sqlCipherTarball,
}); });
@ -71,9 +71,9 @@ async function getSqlCipher(hakEnv, moduleInfo) {
const patchFile = path.join(moduleInfo.moduleHakDir, 'sqlcipher-4.3.0-win.patch'); const patchFile = path.join(moduleInfo.moduleHakDir, 'sqlcipher-4.3.0-win.patch');
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
const readStream = fs.createReadStream(patchFile); const readStream = fs.createReadStream(patchFile);
const proc = child_process.spawn( const proc = childProcess.spawn(
'patch', 'patch',
['-p1'], ['-p1'],
{ {
@ -84,7 +84,7 @@ async function getSqlCipher(hakEnv, moduleInfo) {
proc.on('exit', (code) => { proc.on('exit', (code) => {
code ? reject(code) : resolve(); code ? reject(code) : resolve();
}); });
readStream.pipe(proc.stdin); readStream.pipe(proc.stdin);
}); });
} }
} }
@ -117,7 +117,7 @@ async function getOpenSsl(hakEnv, moduleInfo) {
}); });
} }
console.log("extracting " + openSslTarball + " in " + moduleInfo.moduleDotHakDir); console.log("extracting " + openSslTarball + " in " + moduleInfo.moduleDotHakDir);
await tar.x({ await tar.x({
file: openSslTarball, file: openSslTarball,
cwd: moduleInfo.moduleDotHakDir, cwd: moduleInfo.moduleDotHakDir,

View File

@ -16,7 +16,7 @@
"fetch": "yarn run mkdirs && node scripts/fetch-package.js", "fetch": "yarn run mkdirs && node scripts/fetch-package.js",
"setversion": "node scripts/set-version.js", "setversion": "node scripts/set-version.js",
"start": "electron .", "start": "electron .",
"lint": "eslint src/ scripts/", "lint": "eslint src/ scripts/ hak/",
"build": "yarn run setversion && electron-builder", "build": "yarn run setversion && electron-builder",
"in-docker": "scripts/in-docker.sh", "in-docker": "scripts/in-docker.sh",
"docker:build": "yarn run in-docker yarn run build", "docker:build": "yarn run in-docker yarn run build",