diff --git a/.eslintrc.js b/.eslintrc.js index 9c1480f..35211a0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,6 +5,7 @@ module.exports = { ecmaVersion: 8, }, env: { + es6: true, node: true, // we also have some browser code (ie. the preload script) browser: true, diff --git a/scripts/fetch-package.js b/scripts/fetch-package.js index 106db3b..621cf0e 100755 --- a/scripts/fetch-package.js +++ b/scripts/fetch-package.js @@ -5,7 +5,7 @@ const path = require('path'); const fs = require('fs'); const fsPromises = require('fs').promises; const { https } = require('follow-redirects'); -const child_process = require('child_process'); +const childProcess = require('child_process'); const tar = require('tar'); const asar = require('asar'); @@ -43,7 +43,7 @@ async function downloadToFile(url, filename) { async function verifyFile(filename) { return new Promise((resolve, reject) => { - const gpgProc = child_process.execFile('gpg', ['--verify', filename + '.asc', filename], (error) => { + childProcess.execFile('gpg', ['--verify', filename + '.asc', filename], (error) => { if (error) { reject(error); } else { @@ -93,7 +93,7 @@ async function main() { } const haveGpg = await new Promise((resolve) => { - child_process.execFile('gpg', ['--version'], (error) => { + childProcess.execFile('gpg', ['--version'], (error) => { resolve(!error); }); }); @@ -105,7 +105,7 @@ async function main() { } await new Promise((resolve) => { - const gpgProc = child_process.execFile('gpg', ['--import'], (error) => { + const gpgProc = childProcess.execFile('gpg', ['--import'], (error) => { if (error) { console.log("Failed to import key", error); } else { @@ -131,16 +131,16 @@ async function main() { console.log("To build with no config (and no auto-update), pass the empty string (-d '')"); return 1; } - + if (verify && !haveGpg) { console.log("No working GPG binary: install GPG or pass --noverify to skip verification"); return 1; } - const haveDeploy = false; + let haveDeploy = false; const expectedDeployDir = path.join(deployDir, 'riot-' + targetVersion); try { - const webappDir = await fs.opendir(expectedDeployDir); + await fs.opendir(expectedDeployDir); console.log(expectedDeployDir + "already exists"); haveDeploy = true; } catch (e) { diff --git a/scripts/hak/build.js b/scripts/hak/build.js index 43891b4..8249d19 100644 --- a/scripts/hak/build.js +++ b/scripts/hak/build.js @@ -14,13 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -const path = require('path'); -const url = require('url'); -const fsProm = require('fs').promises; -const child_process = require('child_process'); - async function build(hakEnv, moduleInfo) { moduleInfo.scripts.build(hakEnv, moduleInfo); -}; +} module.exports = build; diff --git a/scripts/hak/copy.js b/scripts/hak/copy.js index 9356765..9ecf163 100644 --- a/scripts/hak/copy.js +++ b/scripts/hak/copy.js @@ -62,6 +62,6 @@ async function copy(hakEnv, moduleInfo) { await fsProm.copyFile(src, dst); } } -}; +} module.exports = copy; diff --git a/scripts/hak/fetch.js b/scripts/hak/fetch.js index 4587ce7..7714ad0 100644 --- a/scripts/hak/fetch.js +++ b/scripts/hak/fetch.js @@ -17,7 +17,7 @@ limitations under the License. const path = require('path'); const url = require('url'); const fsProm = require('fs').promises; -const child_process = require('child_process'); +const childProcess = require('child_process'); const npm = require('npm'); const semver = require('semver'); @@ -91,7 +91,7 @@ async function fetch(hakEnv, moduleInfo) { console.log("Running yarn install in " + moduleInfo.moduleBuildDir); await new Promise((resolve, reject) => { - const proc = child_process.spawn( + const proc = childProcess.spawn( hakEnv.isWin() ? 'yarn.cmd' : 'yarn', ['install', '--ignore-scripts'], { diff --git a/scripts/hak/fetchDeps.js b/scripts/hak/fetchDeps.js index 361e97b..90aba8e 100644 --- a/scripts/hak/fetchDeps.js +++ b/scripts/hak/fetchDeps.js @@ -21,6 +21,6 @@ async function fetchDeps(hakEnv, moduleInfo) { if (moduleInfo.scripts.fetchDeps) { await moduleInfo.scripts.fetchDeps(hakEnv, moduleInfo); } -}; +} module.exports = fetchDeps; diff --git a/scripts/hak/index.js b/scripts/hak/index.js index 143a9ce..61fcce0 100644 --- a/scripts/hak/index.js +++ b/scripts/hak/index.js @@ -15,7 +15,6 @@ limitations under the License. */ const path = require('path'); -const fsProm = require('fs').promises; const findNpmPrefix = require('find-npm-prefix'); diff --git a/scripts/hak/link.js b/scripts/hak/link.js index 3ed040f..db92920 100644 --- a/scripts/hak/link.js +++ b/scripts/hak/link.js @@ -17,7 +17,7 @@ limitations under the License. const path = require('path'); const os = require('os'); const fsProm = require('fs').promises; -const child_process = require('child_process'); +const childProcess = require('child_process'); async function link(hakEnv, moduleInfo) { const yarnrc = path.join(hakEnv.projectRoot, '.yarnrc'); @@ -31,7 +31,7 @@ async function link(hakEnv, moduleInfo) { await fsProm.stat(yarnrc); } catch (e) { await fsProm.writeFile( - yarnrc, + yarnrc, // XXX: 1. This must be absolute, as yarn will resolve link directories // relative to the closest project root, which means when we run it // in the dependency project, it will put the link directory in its @@ -47,7 +47,7 @@ async function link(hakEnv, moduleInfo) { const yarnCmd = 'yarn' + (hakEnv.isWin() ? '.cmd' : ''); await new Promise((resolve, reject) => { - const proc = child_process.spawn(yarnCmd, ['link'], { + const proc = childProcess.spawn(yarnCmd, ['link'], { cwd: moduleInfo.moduleOutDir, stdio: 'inherit', }); @@ -57,7 +57,7 @@ async function link(hakEnv, moduleInfo) { }); await new Promise((resolve, reject) => { - const proc = child_process.spawn(yarnCmd, ['link', moduleInfo.name], { + const proc = childProcess.spawn(yarnCmd, ['link', moduleInfo.name], { cwd: hakEnv.projectRoot, stdio: 'inherit', }); @@ -65,6 +65,6 @@ async function link(hakEnv, moduleInfo) { code ? reject(code) : resolve(); }); }); -}; +} module.exports = link; diff --git a/scripts/set-version.js b/scripts/set-version.js index f2528d9..ddf36bb 100755 --- a/scripts/set-version.js +++ b/scripts/set-version.js @@ -7,11 +7,11 @@ const fs = require('fs').promises; const asar = require('asar'); -const child_process = require('child_process'); +const childProcess = require('child_process'); async function main() { try { - const webappDir = await fs.stat('webapp.asar'); + await fs.stat('webapp.asar'); } catch (e) { console.log("No 'webapp.asar' found. Run 'yarn run fetch'"); return 1; @@ -22,7 +22,7 @@ async function main() { // set version in package.json: electron-builder will use this to populate // all the various version fields await new Promise((resolve, reject) => { - child_process.execFile('yarn', [ + childProcess.execFile('yarn', [ 'version', '-s', '--no-git-tag-version', // This also means "don't commit to git" as it turns out