mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-22 23:25:20 +00:00
@@ -210,7 +210,7 @@ export default async function dev(port: number) {
|
|||||||
|
|
||||||
deferreds.client.promise.then(() => {
|
deferreds.client.promise.then(() => {
|
||||||
function restart() {
|
function restart() {
|
||||||
ports.wait(3000).then(deferreds.server.fulfil); // TODO control port
|
ports.wait(port).then(deferreds.server.fulfil);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proc) {
|
if (proc) {
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ const prog = sade('sapper').version(pkg.version);
|
|||||||
prog.command('dev')
|
prog.command('dev')
|
||||||
.describe('Start a development server')
|
.describe('Start a development server')
|
||||||
.option('-p, --port', 'Specify a port')
|
.option('-p, --port', 'Specify a port')
|
||||||
.action(async ({ port }: { port: number }) => {
|
.action(async (opts: { port: number }) => {
|
||||||
|
let port = opts.port || +process.env.PORT;
|
||||||
|
|
||||||
if (port) {
|
if (port) {
|
||||||
if (!await ports.check(port)) {
|
if (!await ports.check(port)) {
|
||||||
console.log(chalk.bold.red(`> Port ${port} is unavailable`));
|
console.log(chalk.bold.red(`> Port ${port} is unavailable`));
|
||||||
@@ -53,7 +55,9 @@ prog.command('build [dest]')
|
|||||||
prog.command('start [dir]')
|
prog.command('start [dir]')
|
||||||
.describe('Start your app')
|
.describe('Start your app')
|
||||||
.option('-p, --port', 'Specify a port')
|
.option('-p, --port', 'Specify a port')
|
||||||
.action(async (dir = 'build', { port }: { port: number }) => {
|
.action(async (dir = 'build', opts: { port: number }) => {
|
||||||
|
let port = opts.port || +process.env.PORT;
|
||||||
|
|
||||||
const resolved = path.resolve(dir);
|
const resolved = path.resolve(dir);
|
||||||
const server = path.resolve(dir, 'server.js');
|
const server = path.resolve(dir, 'server.js');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user