feat(angular): add static-server target to ssr mf remote (#13440)
This commit is contained in:
parent
fd1e478b80
commit
9469dbaac9
@ -182,6 +182,26 @@ Object {
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`MF Remote App Generator --ssr should generate the correct files 12`] = `
|
||||||
|
"import { Route } from '@angular/router';
|
||||||
|
import { RemoteEntryComponent } from './entry.component';
|
||||||
|
|
||||||
|
export const remoteRoutes: Route[] = [{ path: '', component: RemoteEntryComponent }];"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`MF Remote App Generator --ssr should generate the correct files 13`] = `
|
||||||
|
Object {
|
||||||
|
"dependsOn": Array [
|
||||||
|
"build",
|
||||||
|
"server",
|
||||||
|
],
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": Object {
|
||||||
|
"command": "PORT=4201 node dist/apps/test/server/main.js",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`MF Remote App Generator should generate a remote mf app with a host 1`] = `
|
exports[`MF Remote App Generator should generate a remote mf app with a host 1`] = `
|
||||||
"const { withModuleFederation } = require('@nrwl/angular/module-federation');
|
"const { withModuleFederation } = require('@nrwl/angular/module-federation');
|
||||||
const config = require('./module-federation.config');
|
const config = require('./module-federation.config');
|
||||||
|
|||||||
@ -50,6 +50,17 @@ export async function addSsr(
|
|||||||
port,
|
port,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
project.targets['static-server'] = {
|
||||||
|
dependsOn: ['build', 'server'],
|
||||||
|
executor: 'nx:run-commands',
|
||||||
|
options: {
|
||||||
|
command: `PORT=${port} node ${joinPathFragments(
|
||||||
|
project.targets.server.options.outputPath,
|
||||||
|
'main.js'
|
||||||
|
)}`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
updateProjectConfiguration(tree, appName, project);
|
updateProjectConfiguration(tree, appName, project);
|
||||||
|
|
||||||
const installTask = addDependenciesToPackageJson(
|
const installTask = addDependenciesToPackageJson(
|
||||||
|
|||||||
@ -241,6 +241,10 @@ describe('MF Remote App Generator', () => {
|
|||||||
tree.read(`apps/test/src/app/remote-entry/entry.routes.ts`, 'utf-8')
|
tree.read(`apps/test/src/app/remote-entry/entry.routes.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(project.targets.server).toMatchSnapshot();
|
expect(project.targets.server).toMatchSnapshot();
|
||||||
|
expect(
|
||||||
|
tree.read(`apps/test/src/app/remote-entry/entry.routes.ts`, 'utf-8')
|
||||||
|
).toMatchSnapshot();
|
||||||
|
expect(project.targets['static-server']).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user