diff --git a/.idx/dev.nix b/.idx/dev.nix new file mode 100644 index 0000000000..5f229d7167 --- /dev/null +++ b/.idx/dev.nix @@ -0,0 +1,51 @@ +# To learn more about how to use Nix to configure your environment +# see: https://developers.google.com/idx/guides/customize-idx-env +{ pkgs, ... }: { + # Which nixpkgs channel to use. + channel = "stable-24.05"; # or "unstable" + + # Use https://search.nixos.org/packages to find packages + packages = [ + pkgs.nodejs_22 + pkgs.pnpm + ]; + + # Sets environment variables in the workspace + env = {}; + idx = { + # Search for the extensions you want on https://open-vsx.org/ and use "publisher.id" + extensions = [ + "Dart-Code.flutter" + "Dart-Code.dart-code" + ]; + + # Enable previews + previews = { + enable = true; + previews = { + web = { + command = ["./dash_site" "serve"]; + manager = "web"; + env = { + # Environment variables to set for your server + PORT = "$PORT"; + }; + }; + }; + }; + + # Workspace lifecycle hooks + workspace = { + # Runs when a workspace is first created + onCreate = { + get-submodule = "git submodule update --init --recursive"; + pnpm-install = "pnpm install"; + }; + # Runs when the workspace is (re)started + onStart = { + # Example: start a background task to watch and re-build backend code + # watch-backend = "npm run watch-backend"; + }; + }; + }; +} diff --git a/README.md b/README.md index bc898f0ace..70d5cfe3ea 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,21 @@ built with [Eleventy][] and hosted on [Firebase][]. [Flutter]: https://docs.flutter.dev/ [Repo on GitHub Actions]: https://github.com/flutter/website/actions?query=workflow%3Abuild+branch%3Amain + + + + + Open in IDX + + + ## Issues, bugs, and requests We welcome contributions and feedback on our website. diff --git a/tool/flutter_site/lib/src/commands/serve.dart b/tool/flutter_site/lib/src/commands/serve.dart index 185566d02e..2c9bd9f2f7 100644 --- a/tool/flutter_site/lib/src/commands/serve.dart +++ b/tool/flutter_site/lib/src/commands/serve.dart @@ -32,7 +32,12 @@ final class ServeSiteCommand extends Command { final verbose = argResults.get(_verboseFlag, false); final process = await Process.start( 'npx', - const ['eleventy', '--serve', '--incremental'], + [ + 'eleventy', + '--serve', + '--incremental', + '--port=${Platform.environment['PORT'] ?? 4000}' + ], environment: { 'PRODUCTION': 'false', if (verbose) 'DEBUG': 'Eleventy*',