Skip to content

Commit

Permalink
fix(web): update http-server lookup so it works with pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo authored and Jack Hsu committed Sep 28, 2022
1 parent 9b63ce1 commit 98352f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions e2e/react/src/react.module-federation.test.ts
Expand Up @@ -8,6 +8,7 @@ import {
readProjectConfig,
runCLI,
runCLIAsync,
runCommand,
uniq,
updateFile,
} from '@nrwl/e2e/utils';
Expand All @@ -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');
Expand All @@ -37,6 +37,8 @@ describe('React Module Federation', () => {
`generate @nrwl/react:remote ${remote3} --style=css --host=${shell} --no-interactive`
);

runCommand('ls -lsa node_modules/.pnpm/http-server');
runCommand('cat node_modules/.pnpm/http-server/package.json');
checkFilesExist(`apps/${shell}/module-federation.config.js`);
checkFilesExist(`apps/${remote1}/module-federation.config.js`);
checkFilesExist(`apps/${remote2}/module-federation.config.js`);
Expand Down Expand Up @@ -94,7 +96,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([
Expand Down
2 changes: 1 addition & 1 deletion packages/web/package.json
Expand Up @@ -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"
},
Expand Down
6 changes: 4 additions & 2 deletions packages/web/src/executors/file-server/file-server.impl.ts
Expand Up @@ -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', ''),
Expand Down

0 comments on commit 98352f8

Please sign in to comment.