mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-27 21:48:41 +02:00
ESLintify Part 3 (#846)
* ESLintify Part 3 * ESLintify Part 3 * ESLintify Part 3
This commit is contained in:
parent
5ac2cee658
commit
a7a214fb3a
54 changed files with 435 additions and 497 deletions
|
@ -9,7 +9,7 @@
|
|||
|
||||
require('babel-register')({
|
||||
babelrc: false,
|
||||
only: [__dirname, process.cwd() + '/core'],
|
||||
only: [__dirname, `${process.cwd()}/core`],
|
||||
plugins: [
|
||||
require('./server/translate-plugin.js'),
|
||||
'transform-class-properties',
|
||||
|
@ -27,7 +27,7 @@ const tcpPortUsed = require('tcp-port-used');
|
|||
const CWD = process.cwd();
|
||||
const env = require('./server/env.js');
|
||||
|
||||
if (!fs.existsSync(CWD + '/siteConfig.js')) {
|
||||
if (!fs.existsSync(`${CWD}/siteConfig.js`)) {
|
||||
console.error(
|
||||
chalk.red('Error: No siteConfig.js file found in website folder!')
|
||||
);
|
||||
|
@ -51,7 +51,7 @@ const MAX_ATTEMPTS = 10;
|
|||
function checkPort() {
|
||||
tcpPortUsed
|
||||
.check(port, 'localhost')
|
||||
.then(function(inUse) {
|
||||
.then(inUse => {
|
||||
if (inUse && numAttempts >= MAX_ATTEMPTS) {
|
||||
console.log(
|
||||
'Reached max attempts, exiting. Please open up some ports or ' +
|
||||
|
@ -59,7 +59,7 @@ function checkPort() {
|
|||
);
|
||||
process.exit(1);
|
||||
} else if (inUse) {
|
||||
console.error(chalk.red('Port ' + port + ' is in use'));
|
||||
console.error(chalk.red(`Port ${port} is in use`));
|
||||
// Try again but with port + 1
|
||||
port += 1;
|
||||
numAttempts += 1;
|
||||
|
@ -68,14 +68,14 @@ function checkPort() {
|
|||
// start local server on specified port
|
||||
const server = require('./server/server.js');
|
||||
server(port, program.opts());
|
||||
const {baseUrl} = require(CWD + '/siteConfig.js');
|
||||
const {baseUrl} = require(`${CWD}/siteConfig.js`);
|
||||
const host = `http://localhost:${port}${baseUrl}`;
|
||||
console.log('Docusaurus server started on port %d', port);
|
||||
openBrowser(host);
|
||||
}
|
||||
})
|
||||
.catch(function(ex) {
|
||||
setTimeout(function() {
|
||||
.catch(ex => {
|
||||
setTimeout(() => {
|
||||
throw ex;
|
||||
}, 0);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue