mirror of
https://github.com/docsifyjs/docsify.git
synced 2026-10-29 03:47:04 +08:00
Clean up server properties
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const stripIndent = require('common-tags/lib/stripIndent');
|
||||
const { serverIP, serverPort } = require('./server.js');
|
||||
const { URL: serverURL } = require('./server.js');
|
||||
|
||||
/**
|
||||
* Playwright helper for dynamically creating custom docsify sites.
|
||||
@@ -16,7 +16,7 @@ const { serverIP, serverPort } = require('./server.js');
|
||||
* @param {string|String[]} [options.styleURLs=['/lib/themes/vue.css']] External CSS to inject via <link rel="stylesheet"> tag(s)
|
||||
* @param {String} [options.script] JS to inject via <script> tag
|
||||
* @param {string|String[]} [options.scriptURLs] External JS to inject via <script src="..."> tag(s)
|
||||
* @param {String} [options.url=`http://${serverIP}:${serverPort}`] URL of local test server
|
||||
* @param {String} [options.url=serverURL] URL of local test server
|
||||
* @param {String} [options.docsifyURL='/lib/docsify.js']
|
||||
* @param {String} [options.waitForSelector='#main']
|
||||
*/
|
||||
@@ -32,7 +32,7 @@ async function docsifyInit(page, options) {
|
||||
styleURLs: ['/lib/themes/vue.css'],
|
||||
script: '',
|
||||
scriptURLs: [],
|
||||
url: `http://${serverIP}:${serverPort}`,
|
||||
url: serverURL,
|
||||
docsifyURL: '/lib/docsify.js',
|
||||
waitForSelector: '#main',
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
serverIP: '127.0.0.1',
|
||||
serverPort: 8080,
|
||||
get serverURL() {
|
||||
return `http://${this.serverIP}:${this.serverPort}`;
|
||||
host: 'localhost',
|
||||
port: 8080,
|
||||
get URL() {
|
||||
return `http://${this.host}:${this.port}`;
|
||||
},
|
||||
};
|
||||
|
||||
+4
-4
@@ -1,13 +1,13 @@
|
||||
const path = require('path');
|
||||
const liveServer = require('live-server');
|
||||
const { serverIP, serverPort } = require('./helpers/server.js');
|
||||
const { host, port } = require('./helpers/server.js');
|
||||
|
||||
module.exports = async () => {
|
||||
global.__SERVER__ = liveServer;
|
||||
global.__SERVER__ = liveServer; // Instance reference for teardown script
|
||||
|
||||
liveServer.start({
|
||||
host: serverIP,
|
||||
port: serverPort,
|
||||
host,
|
||||
port,
|
||||
root: path.resolve(__dirname, 'fixtures'),
|
||||
open: false,
|
||||
logLevel: 0,
|
||||
|
||||
Reference in New Issue
Block a user