Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace default port #195

Merged
merged 8 commits into from
Sep 18, 2023
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
2 changes: 1 addition & 1 deletion e2e/qwik-nx-e2e/tests/application-basic-behavior.suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ async function checkPageResponses(host: string) {
function getHostOutput(output: string, port: number): string | undefined {
// extracts the host url from the output message
// the reason it's done is because it can either be in these formats:
// http://localhost:4200 or https://127.0.0.1:4200
// http://localhost:5173 or https://127.0.0.1:5173
const regexp = new RegExp(
`Local:(?:\\s{3})(http(?:s)?:\\/\\/(?:.+):${port})`
);
Expand Down
24 changes: 12 additions & 12 deletions e2e/qwik-nx-e2e/tests/micro-frontends.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
DEFAULT_E2E_TIMEOUT,
} from '@qwikifiers/e2e/utils';

const PORTS = [4200, 4201, 4202, 4203];
const PORTS = [5173, 5174, 5175, 5175];

describe('Micro-frontends e2e', () => {
let project: string, remote1: string, remote2: string;
Expand Down Expand Up @@ -52,8 +52,8 @@ describe('Micro-frontends e2e', () => {
const configFilePath = `apps/${project}/src/config/remotes.json`;
expect(() => checkFilesExist(configFilePath)).not.toThrow();
const config = readJson(configFilePath);
expect(config[remote1]).toEqual('http://localhost:4201');
expect(config[remote2]).toEqual('http://localhost:4202');
expect(config[remote1]).toEqual('http://localhost:5174');
expect(config[remote2]).toEqual('http://localhost:5175');
},
DEFAULT_E2E_TIMEOUT
);
Expand Down Expand Up @@ -155,7 +155,7 @@ describe('Micro-frontends e2e', () => {
async () => {
const remote3 = uniq('qwik-nx');
await runNxCommandAsync(
`generate qwik-nx:remote ${remote3} --host=${project} --port=4203 --no-interactive`
`generate qwik-nx:remote ${remote3} --host=${project} --port=5176 --no-interactive`
);
const result = await runNxCommandAsync(`build ${remote3}`);
expect(result.stdout).toContain(
Expand Down Expand Up @@ -214,10 +214,10 @@ async function runHostAndRemotes(
const localhost = `${prefix}Local: http://localhost:${port}/`;
return stripped.includes(ip) || stripped.includes(localhost);
};
invokedHost ||= includesInvokeMessage(hostName, 4200, false);
invokedRemote1 ||= includesInvokeMessage(remote1, 4201);
invokedRemote2 ||= includesInvokeMessage(remote2, 4202);
invokedRemote3 ||= !!remote3 && includesInvokeMessage(remote3, 4203);
invokedHost ||= includesInvokeMessage(hostName, 5173, false);
invokedRemote1 ||= includesInvokeMessage(remote1, 5174);
invokedRemote2 ||= includesInvokeMessage(remote2, 5175);
invokedRemote3 ||= !!remote3 && includesInvokeMessage(remote3, 5176);

showedAllRemotesInvokedInfo ||= stripConsoleColors(
output.replace(/\n|\s/g, '')
Expand Down Expand Up @@ -307,10 +307,10 @@ async function previewHostAndRemotes(
builtRemote3 ||= !!remote3 && includesBuiltMessage(remote3);

// serve output
invokedHost ||= includesInvokeMessage(hostName, 4200, false);
invokedRemote1 ||= includesInvokeMessage(remote1, 4201);
invokedRemote2 ||= includesInvokeMessage(remote2, 4202);
invokedRemote3 ||= !!remote3 && includesInvokeMessage(remote3, 4203);
invokedHost ||= includesInvokeMessage(hostName, 5173, false);
invokedRemote1 ||= includesInvokeMessage(remote1, 5174);
invokedRemote2 ||= includesInvokeMessage(remote2, 5175);
invokedRemote3 ||= !!remote3 && includesInvokeMessage(remote3, 5176);

showedAllRemotesInvokedInfo ||= stripConsoleColors(
output.replace(/\n|\s/g, '')
Expand Down
2 changes: 1 addition & 1 deletion e2e/qwik-nx-e2e/tests/qwik-nx-cloudflare.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
DEFAULT_E2E_TIMEOUT,
} from '@qwikifiers/e2e/utils';

const CLOUDFLARE_PREVIEW_PORT = 4300;
const CLOUDFLARE_PREVIEW_PORT = 4173;

describe('qwik nx cloudflare generator', () => {
// Setting up individual workspaces per
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ Object {
"executor": "@nx/vite:preview-server",
"options": Object {
"buildTarget": "frontend-myapp:build",
"port": 4300,
"port": 4173,
},
},
"serve": Object {
"executor": "@nx/vite:dev-server",
"options": Object {
"buildTarget": "frontend-myapp:build.client",
"mode": "ssr",
"port": 4200,
"port": 5173,
},
},
"serve.debug": Object {
Expand Down Expand Up @@ -114,15 +114,15 @@ Object {
"executor": "@nx/vite:preview-server",
"options": Object {
"buildTarget": "frontend-myapp:build",
"port": 4300,
"port": 4173,
},
},
"serve": Object {
"executor": "@nx/vite:dev-server",
"options": Object {
"buildTarget": "frontend-myapp:build.client",
"mode": "ssr",
"port": 4200,
"port": 5173,
},
},
"serve.debug": Object {
Expand Down Expand Up @@ -182,15 +182,15 @@ Object {
"executor": "@nx/vite:preview-server",
"options": Object {
"buildTarget": "myapp:build",
"port": 4300,
"port": 4173,
},
},
"serve": Object {
"executor": "@nx/vite:dev-server",
"options": Object {
"buildTarget": "myapp:build.client",
"mode": "ssr",
"port": 4200,
"port": 5173,
},
},
"serve.debug": Object {
Expand Down Expand Up @@ -250,15 +250,15 @@ Object {
"executor": "@nx/vite:preview-server",
"options": Object {
"buildTarget": "frontend-myapp:build",
"port": 4300,
"port": 4173,
},
},
"serve": Object {
"executor": "@nx/vite:dev-server",
"options": Object {
"buildTarget": "frontend-myapp:build.client",
"mode": "ssr",
"port": 4200,
"port": 5173,
},
},
"serve.debug": Object {
Expand Down Expand Up @@ -318,15 +318,15 @@ Object {
"executor": "@nx/vite:preview-server",
"options": Object {
"buildTarget": "myapp:build",
"port": 4300,
"port": 4173,
},
},
"serve": Object {
"executor": "@nx/vite:dev-server",
"options": Object {
"buildTarget": "myapp:build.client",
"mode": "ssr",
"port": 4200,
"port": 5173,
},
},
"serve.debug": Object {
Expand Down Expand Up @@ -386,15 +386,15 @@ Object {
"executor": "@nx/vite:preview-server",
"options": Object {
"buildTarget": "frontend-myapp:build",
"port": 4300,
"port": 4173,
},
},
"serve": Object {
"executor": "@nx/vite:dev-server",
"options": Object {
"buildTarget": "frontend-myapp:build.client",
"mode": "ssr",
"port": 4200,
"port": 5173,
},
},
"serve.debug": Object {
Expand Down Expand Up @@ -486,15 +486,15 @@ exports[`qwik-nx generator should run successfully 2`] = `
\\"executor\\": \\"@nx/vite:preview-server\\",
\\"options\\": {
\\"buildTarget\\": \\"myapp:build\\",
\\"port\\": 4300
\\"port\\": 4173
}
},
\\"serve\\": {
\\"executor\\": \\"@nx/vite:dev-server\\",
\\"options\\": {
\\"buildTarget\\": \\"myapp:build.client\\",
\\"mode\\": \\"ssr\\",
\\"port\\": 4200
\\"port\\": 5173
}
},
\\"serve.debug\\": {
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-nx/src/generators/application/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@
"devServerPort": {
"type": "number",
"description": "The port for the dev server of the app.",
"default": 4200
"default": 5173
},
"previewServerPort": {
"type": "number",
"description": "The port for the preview server of the app.",
"default": 4300
"default": 4173
}
},
"required": ["name"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function normalizeOptions(
styleExtension,
setupVitest: options.unitTestRunner === 'vitest',
parsedTags,
devServerPort: options.devServerPort ?? 4200,
previewServerPort: options.previewServerPort ?? 4300,
devServerPort: options.devServerPort ?? 5173,
previewServerPort: options.previewServerPort ?? 4173,
};
}
Loading
Loading