Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Changelog

### Version 2.1.3

- Handle where the serve command cannot be determined.

### Version 2.1.2

- When you change package.json outside of the extension the UI will automatically update.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "webnative",
"displayName": "WebNative",
"description": "Create and maintain web and native projects",
"version": "2.1.2",
"version": "2.1.3",
"whatsNewRevision": 1,
"icon": "media/webnative.png",
"publisher": "WebNative",
Expand Down
19 changes: 15 additions & 4 deletions src/web-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from './workspace-state';
import { getWebConfiguration, WebConfigSetting } from './web-configuration';
import { window, workspace } from 'vscode';
import { write, writeError } from './logging';
import { showOutput, write, writeError } from './logging';
import { createServer } from 'http';
import { join } from 'path';
import { viewInEditor } from './preview';
Expand Down Expand Up @@ -121,6 +121,8 @@ async function runServe(
return `${preop}${npx(project)} ${serveCmd(project)}${serveFlags}`;
}

let serveUnknownMsg = false;

function serveCmd(project: Project): string {
switch (project.frameworkType) {
case 'angular':
Expand All @@ -134,11 +136,20 @@ function serveCmd(project: Project): string {
case 'vue':
return 'vue-cli-service serve';
default: {
const cmd = guessServeCommand(project) + ' -- ';
const cmd = guessServeCommand(project);
if (cmd) {
return cmd;
return cmd + ' -- ';
}
if (!serveUnknownMsg) {
window.showErrorMessage(
`Unable to determine the command used to serve your web application. Please add a "serve" script to your package.json to define this.`,
);
serveUnknownMsg = true;
}
writeError(`serve command is not know for this project type`);
writeError(
`Unable to determine the command used to serve your web application (start, dev and serve scripts were not found in package.json). Please add a "serve" script to your package.json to define this.`,
);
showOutput();
}
}
}
Expand Down
Loading