feat: change default port to 4321 (#7874)

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
This commit is contained in:
Emanuele Stoppa 2023-08-01 16:31:42 +01:00 committed by GitHub
parent 7822777300
commit 1b7dd11823
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
75 changed files with 108 additions and 101 deletions

View file

@ -0,0 +1,7 @@
---
'astro': major
---
Astro's default port when running the dev or preview server is now `4321`.
This will reduce conflicts with ports used by other tools.

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/basics",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/blog",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/deno",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/docs",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/framework-alpine",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/framework-lit",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/framework-multiple",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/framework-preact",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/framework-react",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/framework-solid",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/framework-svelte",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/framework-vue",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/hackernews",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/minimal",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/non-html-pages",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/portfolio",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/ssr",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/with-markdown-plugins",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/with-markdown-shiki",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/with-mdx",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/with-nanostores",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/with-tailwindcss",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/with-vite-plugin-pwa",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -7,13 +7,13 @@
"workspaceFolder": "/workspaces/astro/examples/with-vitest",
"portsAttributes": {
"3000": {
"4321": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [3000],
"forwardPorts": [4321],
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",

View file

@ -18,7 +18,7 @@ vscode:
- esbenp.prettier-vscode
- dbaeumer.vscode-eslint
ports:
- port: 3000
- port: 4321
onOpen: open-preview
github:
prebuilds:

View file

@ -43,7 +43,7 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -53,7 +53,7 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -42,7 +42,7 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| | (preview uses Deno CLI) |

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -48,7 +48,7 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -36,7 +36,7 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -41,7 +41,7 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -19,7 +19,7 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -45,7 +45,7 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -36,7 +36,7 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -4,7 +4,7 @@
"view": "browser",
"template": "node",
"container": {
"port": 3000,
"port": 4321,
"startScript": "start",
"node": "14"
}

View file

@ -326,7 +326,7 @@ type ServerConfig = {
/**
* @name server.port
* @type {number}
* @default `3000`
* @default `4321`
* @description
* Set which port the dev server should listen on.
*
@ -914,7 +914,7 @@ export interface AstroUserConfig {
* ```js
* {
* // Example: Use the function syntax to customize based on command
* server: ({ command }) => ({ port: command === 'dev' ? 3000 : 4000 })
* server: ({ command }) => ({ port: command === 'dev' ? 4321 : 4000 })
* }
* ```
*/
@ -936,7 +936,7 @@ export interface AstroUserConfig {
* @docs
* @name server.port
* @type {number}
* @default `3000`
* @default `4321`
* @description
* Set which port the server should listen on.
*

View file

@ -15,7 +15,7 @@ export async function dev({ flags }: DevOptions) {
usage: '[...flags]',
tables: {
Flags: [
['--port', `Specify which port to run on. Defaults to 3000.`],
['--port', `Specify which port to run on. Defaults to 4321.`],
['--host', `Listen on all addresses, including LAN and public addresses.`],
['--host <custom-address>', `Expose on a network IP address at <custom-address>`],
['--open', 'Automatically open the app in the browser on server start'],

View file

@ -32,7 +32,7 @@ const ASTRO_CONFIG_DEFAULTS = {
compressHTML: false,
server: {
host: false,
port: 3000,
port: 4321,
open: false,
},
integrations: [],

View file

@ -131,8 +131,8 @@ describe('astro cli', () => {
// Note: our tests run in parallel so this could be 3000+!
expect(Number.parseInt(localURL.port)).to.be.greaterThanOrEqual(
3000,
`Expected Port to be >= 3000`
4321,
`Expected Port to be >= 4321`
);
expect(networkURL.port).to.be.equal(
localURL.port,

View file

@ -5,5 +5,5 @@ import preact from '@astrojs/preact';
export default defineConfig({
integrations: [preact()],
// make sure CLI flags have precedence
server: () => ({ port: 3000 })
server: () => ({ port: 4321 })
});

View file

@ -1,7 +1,7 @@
export default () => {
// noop
return {
port: 3000,
port: 4321,
closed() {},
stop() {}
}

View file

@ -3,6 +3,6 @@ import image from '@astrojs/image';
// https://astro.build/config
export default defineConfig({
site: 'http://localhost:3000',
site: 'http://localhost:4321',
integrations: [image({ logLevel: 'silent', serviceEntryPoint: '@astrojs/image/sharp' })]
});

View file

@ -3,6 +3,6 @@ import image from '@astrojs/image';
// https://astro.build/config
export default defineConfig({
site: 'http://localhost:3000',
site: 'http://localhost:4321',
integrations: [image({ logLevel: 'silent', serviceEntryPoint: '@astrojs/image/sharp' })]
});

View file

@ -3,6 +3,6 @@ import image from '@astrojs/image';
// https://astro.build/config
export default defineConfig({
site: 'http://localhost:3000',
site: 'http://localhost:4321',
integrations: [image({ logLevel: 'silent', serviceEntryPoint: '@astrojs/image/sharp' })]
});

View file

@ -3,6 +3,6 @@ import image from '@astrojs/image';
// https://astro.build/config
export default defineConfig({
site: 'http://localhost:3000',
site: 'http://localhost:4321',
integrations: [image({ logLevel: 'silent', serviceEntryPoint: '@astrojs/image/sharp' })]
});

View file

@ -3,6 +3,6 @@ import image from '@astrojs/image';
// https://astro.build/config
export default defineConfig({
site: 'http://localhost:3000',
site: 'http://localhost:4321',
integrations: [image({ logLevel: 'silent', serviceEntryPoint: '@astrojs/image/sharp' })]
});

View file

@ -3,6 +3,6 @@ import image from '@astrojs/image';
// https://astro.build/config
export default defineConfig({
site: 'http://localhost:3000',
site: 'http://localhost:4321',
integrations: [image({ logLevel: 'silent', serviceEntryPoint: '@astrojs/image/sharp' })]
});

View file

@ -3,6 +3,6 @@ import image from '@astrojs/image';
// https://astro.build/config
export default defineConfig({
site: 'http://localhost:3000',
site: 'http://localhost:4321',
integrations: [image({ logLevel: 'silent', serviceEntryPoint: '@astrojs/image/sharp' })]
});

View file

@ -3,6 +3,6 @@ import image from '@astrojs/image';
// https://astro.build/config
export default defineConfig({
site: 'http://localhost:3000',
site: 'http://localhost:4321',
integrations: [image({ logLevel: 'silent' })]
});

View file

@ -4,6 +4,6 @@ import mdx from '@astrojs/mdx';
// https://astro.build/config
export default defineConfig({
site: 'http://localhost:3000',
site: 'http://localhost:4321',
integrations: [image({ logLevel: 'silent', serviceEntryPoint: '@astrojs/image/sharp' }), mdx()]
});

View file

@ -159,7 +159,7 @@ For standalone mode the server handles file servering in addition to the page an
You can override the host and port the standalone server runs on by passing them as environment variables at runtime:
```shell
HOST=0.0.0.0 PORT=3000 node ./dist/server/entry.mjs
HOST=0.0.0.0 PORT=4321 node ./dist/server/entry.mjs
```
#### HTTPS

View file

@ -25,7 +25,7 @@ const config = {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:3000',
baseURL: process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:4321',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',