Lint scripts dir

This commit is contained in:
David Baker 2020-02-17 14:49:26 +00:00
parent 046170e3ec
commit 5fc72e8f73
9 changed files with 21 additions and 26 deletions

View file

@ -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,

View file

@ -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) {

View file

@ -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;

View file

@ -62,6 +62,6 @@ async function copy(hakEnv, moduleInfo) {
await fsProm.copyFile(src, dst);
}
}
};
}
module.exports = copy;

View file

@ -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'],
{

View file

@ -21,6 +21,6 @@ async function fetchDeps(hakEnv, moduleInfo) {
if (moduleInfo.scripts.fetchDeps) {
await moduleInfo.scripts.fetchDeps(hakEnv, moduleInfo);
}
};
}
module.exports = fetchDeps;

View file

@ -15,7 +15,6 @@ limitations under the License.
*/
const path = require('path');
const fsProm = require('fs').promises;
const findNpmPrefix = require('find-npm-prefix');

View file

@ -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;

View file

@ -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