From 9f70391f56fe0cadf317ef40131843a30b9f6bab Mon Sep 17 00:00:00 2001 From: Rody Davis Date: Tue, 22 Oct 2024 16:35:44 -0700 Subject: [PATCH 1/3] Add open in IDX button --- .idx/dev.nix | 50 ++++++++++++++++++++++ README.md | 15 +++++++ tool/dart_site/lib/src/commands/serve.dart | 2 +- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 .idx/dev.nix diff --git a/.idx/dev.nix b/.idx/dev.nix new file mode 100644 index 0000000000..3fe292e6ec --- /dev/null +++ b/.idx/dev.nix @@ -0,0 +1,50 @@ +# 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-23.11"; # or "unstable" + + # Use https://search.nixos.org/packages to find packages + packages = [ + pkgs.nodejs_20 + pkgs.nodePackages.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 = [ + # "vscodevim.vim" + ]; + + # Enable previews + previews = { + enable = true; + previews = { + web = { + command = ["./dash_site" "serve" "-p" "$PORT"]; + 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 de75eebed0..68316db104 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,21 @@ [![Build Status SVG][]][Repo on GitHub Actions] [![OpenSSF Scorecard SVG][]][Scorecard Results] + + + + + Open in IDX + + + The documentation site for the [Dart programming language](https://dart.dev), built with [Eleventy][] and hosted on [Firebase][]. diff --git a/tool/dart_site/lib/src/commands/serve.dart b/tool/dart_site/lib/src/commands/serve.dart index 8d73041728..f76d11259f 100644 --- a/tool/dart_site/lib/src/commands/serve.dart +++ b/tool/dart_site/lib/src/commands/serve.dart @@ -13,7 +13,7 @@ final class ServeSiteCommand extends Command { Future run() async { final process = await Process.start( 'npx', - const ['eleventy', '--serve', '--incremental'], + ['eleventy', '--serve', '--incremental', '--port=${Platform.environment['PORT'] ?? 4000}'], environment: const { 'PRODUCTION': 'false', }, From 3751cb6b465aa53708dd9bbedc2a65f0bdb4c4b3 Mon Sep 17 00:00:00 2001 From: Rody Davis Date: Tue, 22 Oct 2024 16:43:43 -0700 Subject: [PATCH 2/3] Update dev.nix --- .idx/dev.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.idx/dev.nix b/.idx/dev.nix index 3fe292e6ec..20db14f6a0 100644 --- a/.idx/dev.nix +++ b/.idx/dev.nix @@ -2,11 +2,11 @@ # see: https://developers.google.com/idx/guides/customize-idx-env { pkgs, ... }: { # Which nixpkgs channel to use. - channel = "stable-23.11"; # or "unstable" + channel = "stable-24.05"; # or "unstable" # Use https://search.nixos.org/packages to find packages packages = [ - pkgs.nodejs_20 + pkgs.nodejs_22 pkgs.nodePackages.pnpm ]; @@ -23,7 +23,7 @@ enable = true; previews = { web = { - command = ["./dash_site" "serve" "-p" "$PORT"]; + command = ["./dash_site" "serve"]; manager = "web"; env = { # Environment variables to set for your server From 808ab654f857671e65cc274d4a240962ef6b056a Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Tue, 5 Nov 2024 13:08:40 +0800 Subject: [PATCH 3/3] Format Dart code --- tool/dart_site/lib/src/commands/serve.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tool/dart_site/lib/src/commands/serve.dart b/tool/dart_site/lib/src/commands/serve.dart index f76d11259f..80c68b7e35 100644 --- a/tool/dart_site/lib/src/commands/serve.dart +++ b/tool/dart_site/lib/src/commands/serve.dart @@ -13,7 +13,12 @@ final class ServeSiteCommand extends Command { Future run() async { final process = await Process.start( 'npx', - ['eleventy', '--serve', '--incremental', '--port=${Platform.environment['PORT'] ?? 4000}'], + [ + 'eleventy', + '--serve', + '--incremental', + '--port=${Platform.environment['PORT'] ?? 4000}' + ], environment: const { 'PRODUCTION': 'false', },