Skip to content
Permalink
Browse files
fix(web): update http-server lookup so it works with pnpm (#12269)
  • Loading branch information
jaysoo committed Sep 28, 2022
1 parent bd73e31 commit 4b491c86f2356b4d8a8839824a1ebb5a8a590738
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
@@ -8,6 +8,7 @@ import {
readProjectConfig,
runCLI,
runCLIAsync,
runCommand,
uniq,
updateFile,
} from '@nrwl/e2e/utils';
@@ -19,8 +20,7 @@ describe('React Module Federation', () => {

afterEach(() => cleanupProject());

// TODO: Re-enable this to work with pnpm
xit('should generate host and remote apps', async () => {
it('should generate host and remote apps', async () => {
const shell = uniq('shell');
const remote1 = uniq('remote1');
const remote2 = uniq('remote2');
@@ -94,7 +94,7 @@ describe('React Module Federation', () => {
`
);

const e2eResults = runCLI(`e2e ${shell}-e2e --no-watch`);
const e2eResults = runCLI(`e2e ${shell}-e2e --no-watch --verbose`);
expect(e2eResults).toContain('All specs passed!');
expect(
await killPorts([
@@ -2,6 +2,7 @@ import { ExecutorContext, logger, runExecutor } from '@nrwl/devkit';
import devServerExecutor from '@nrwl/webpack/src/executors/dev-server/dev-server.impl';
import { WebDevServerOptions } from '@nrwl/webpack/src/executors/dev-server/schema';
import { join } from 'path';
import * as chalk from 'chalk';
import {
combineAsyncIterators,
tapAsyncIterator,
@@ -66,7 +67,9 @@ export default async function* moduleFederationDevServer(
numAwaiting--;
if (numAwaiting === 0) {
logger.info(
`Host is ready: ${options.host ?? 'localhost'}:${options.port ?? 4200}`
`[ ${chalk.green('ready')} ] http://${options.host ?? 'localhost'}:${
options.port ?? 4200
}`
);
}
});
@@ -90,7 +90,7 @@ export function getNpmPackageSharedConfig(
return undefined;
}

return { singleton: true, strictVersion: true, requiredVersion: version };
return { singleton: true, requiredVersion: version };
}

export function sharePackages(
@@ -50,7 +50,7 @@
"babel-plugin-transform-typescript-metadata": "^0.3.1",
"chalk": "4.1.0",
"chokidar": "^3.5.1",
"http-server": "14.1.0",
"http-server": "^14.1.0",
"ignore": "^5.0.4",
"tslib": "^2.3.0"
},
@@ -159,8 +159,10 @@ export default async function* fileServerExecutor(

const args = getHttpServerArgs(options);

const { path: pathToHttpServerPkgJson, packageJson } =
readModulePackageJson('http-server');
const { path: pathToHttpServerPkgJson, packageJson } = readModulePackageJson(
'http-server',
module.paths
);
const pathToHttpServerBin = packageJson.bin['http-server'];
const pathToHttpServer = resolve(
pathToHttpServerPkgJson.replace('package.json', ''),

0 comments on commit 4b491c8

Please sign in to comment.