Skip to content

Commit

Permalink
Add IDX support
Browse files Browse the repository at this point in the history
  • Loading branch information
rodydavis committed Nov 5, 2024
1 parent 672d445 commit ee76e74
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
51 changes: 51 additions & 0 deletions .idx/dev.nix
Original file line number Diff line number Diff line change
@@ -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";
};
};
};
}
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<a href="https://idx.google.com/import?url=https%3A%2F%2Fgithub.com%2Fflutter%2Fwebsite">
<picture>
<source
media="(prefers-color-scheme: dark)"
srcset="https://cdn.idx.dev/btn/open_dark_32.svg">
<source
media="(prefers-color-scheme: light)"
srcset="https://cdn.idx.dev/btn/open_light_32.svg">
<img
height="32"
alt="Open in IDX"
src="https://cdn.idx.dev/btn/open_purple_32.svg">
</picture>
</a>

## Issues, bugs, and requests

We welcome contributions and feedback on our website.
Expand Down
7 changes: 6 additions & 1 deletion tool/flutter_site/lib/src/commands/serve.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ final class ServeSiteCommand extends Command<int> {
final verbose = argResults.get<bool>(_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*',
Expand Down

0 comments on commit ee76e74

Please sign in to comment.