Skip to content

Commit

Permalink
feat(mf): dev-server (run:all) accepts project names via command line…
Browse files Browse the repository at this point in the history
… args

Before, all apps were started.
Now, if one calls the server (or run:all) with app names,
only these apps are started. End-2-End tests are never started.
  • Loading branch information
manfredsteyer committed Jun 4, 2022
1 parent c57d87f commit b765515
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions libs/mf/src/server/mf-dev-server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { exec } from 'child_process';
import { isWorkspace, ProjectInfo, readProjectInfos } from './workspace';
import { print } from './colors';
import { argv } from 'process';

let padding;

Expand All @@ -18,7 +19,7 @@ function startCmd(name: string, cmd: string): void {
function startApps(apps: ProjectInfo[]): void {
for (const app of apps) {
const cmd = `ng serve ${app.name} -o`;
print('DEVSVR', padding, app.name + ' ' + app.port);
print('DEVSVR', padding, app.name + ' ' + (app.port || '4200'));
startCmd(app.name, cmd);
}
}
Expand All @@ -28,8 +29,15 @@ if (!isWorkspace()) {
process.exit(0);
}

const [,, ...filter] = argv;
const startAll = filter.length === 0;

const projects = readProjectInfos();
const apps = projects.filter(p => p.projectType === 'application');
const apps = projects.filter(p =>
p.projectType === 'application'
&& !p.name.endsWith('-e2e')
&& (startAll || filter.includes(p.name))
);
padding = apps.reduce((acc, p) => Math.max(acc, p.name.length), 0);
padding = Math.max(6, padding)
startApps(apps);

0 comments on commit b765515

Please sign in to comment.