build: enable JS semicolons (#22783)

This commit is contained in:
Samuel Attard 2020-03-20 13:28:31 -07:00 committed by GitHub
parent 24e21467b9
commit 5d657dece4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
354 changed files with 21512 additions and 21510 deletions

View file

@ -1,17 +1,17 @@
const cp = require('child_process')
const fs = require('fs-extra')
const os = require('os')
const path = require('path')
const cp = require('child_process');
const fs = require('fs-extra');
const os = require('os');
const path = require('path');
const rootPath = path.resolve(__dirname, '..')
const gniPath = path.resolve(__dirname, '../filenames.auto.gni')
const rootPath = path.resolve(__dirname, '..');
const gniPath = path.resolve(__dirname, '../filenames.auto.gni');
const allDocs = fs.readdirSync(path.resolve(__dirname, '../docs/api'))
.map(doc => `docs/api/${doc}`)
.concat(
fs.readdirSync(path.resolve(__dirname, '../docs/api/structures'))
.map(doc => `docs/api/structures/${doc}`)
)
);
const main = async () => {
const webpackTargets = [
@ -39,30 +39,30 @@ const main = async () => {
name: 'worker_bundle_deps',
config: 'webpack.config.worker.js'
}
]
];
await Promise.all(webpackTargets.map(async webpackTarget => {
const tmpDir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-filenames-'))
const tmpDir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-filenames-'));
const child = cp.spawn('node', [
'build/webpack/get-outputs.js',
`./${webpackTarget.config}`,
path.resolve(tmpDir, `${webpackTarget.name}.measure.js`)
], {
cwd: path.resolve(__dirname, '..')
})
let output = ''
});
let output = '';
child.stdout.on('data', chunk => {
output += chunk.toString()
})
child.stderr.on('data', chunk => console.error(chunk.toString()))
output += chunk.toString();
});
child.stderr.on('data', chunk => console.error(chunk.toString()));
await new Promise((resolve, reject) => child.on('exit', (code) => {
if (code !== 0) {
console.error(output)
return reject(new Error(`Failed to list webpack dependencies for entry: ${webpackTarget.name}`))
console.error(output);
return reject(new Error(`Failed to list webpack dependencies for entry: ${webpackTarget.name}`));
}
resolve()
}))
resolve();
}));
webpackTarget.dependencies = JSON.parse(output)
// Remove whitespace
@ -76,9 +76,9 @@ const main = async () => {
// All webpack builds depend on the tsconfig and package json files
.concat(['tsconfig.json', 'tsconfig.electron.json', 'package.json'])
// Make the generated list easier to read
.sort()
await fs.remove(tmpDir)
}))
.sort();
await fs.remove(tmpDir);
}));
fs.writeFileSync(
gniPath,
@ -92,12 +92,12 @@ ${webpackTargets.map(target => ` ${target.name} = [
${target.dependencies.map(dep => ` "${dep}",`).join('\n')}
]`).join('\n\n')}
}
`)
}
`);
};
if (process.mainModule === module) {
main().catch((err) => {
console.error(err)
process.exit(1)
})
console.error(err);
process.exit(1);
});
}