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

Add: dart create template #28

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions dart-create/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Dart Create Template

Most options available in the `dart create` cli.

<a href="https://idx.google.com/new?template=https://github.com/project-idx/community-templates/tree/main/dart-create">
<img height="32" alt="Try in IDX" src="https://cdn.idx.dev/btn/try_dark_32.svg">
</a>
37 changes: 37 additions & 0 deletions dart-create/dev-web.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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.nodePackages.firebase-tools
pkgs.dart
];
# Sets environment variables in the workspace
env = {
PATH = ["/home/user/.pub-cache/bin" "/home/user/flutter/bin" "./.flutter-sdk/flutter/bin"];
};
idx = {
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
extensions = [
"Dart-Code.dart-code"
];
workspace = {
# Runs when a workspace is first created with this `dev.nix` file
onCreate = {
install-dependencies = "dart pub get";
install-cli = "dart pub global activate webdev";
};
};
previews = {
enable = true;
previews = {
web = {
command = ["webdev" "serve" "--auto=refresh" "--hostname" "0.0.0.0" "--no-launch-in-chrome" "web:$PORT"];
manager = "web";
};
};
};
};
}
37 changes: 37 additions & 0 deletions dart-create/dev.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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.nodePackages.firebase-tools
pkgs.dart
];
# Sets environment variables in the workspace
env = {
PATH = ["/home/user/.pub-cache/bin" "/home/user/flutter/bin" "./.flutter-sdk/flutter/bin"];
};
idx = {
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
extensions = [
"Dart-Code.dart-code"
];
workspace = {
# Runs when a workspace is first created with this `dev.nix` file
onCreate = {
install-dependencies = "dart pub get";
# install-cli = "dart pub global activate webdev";
};
};
# previews = {
# enable = true;
# previews = {
# web = {
# command = ["webdev" "serve" "--auto=refresh" "--hostname" "0.0.0.0" "--no-launch-in-chrome" "web:$PORT"];
# manager = "web";
# };
# };
# };
};
}
25 changes: 25 additions & 0 deletions dart-create/idx-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "Dart",
"description": "Dart create template",
"categories": ["Mobile"],
"icon": "https://www.gstatic.com/images/branding/productlogos/dart/v6/192px.svg",
"publisher": "Rody Davis",
"host": {
"virtualization": "true"
},
"params": [
{
"id": "template",
"name": "Template",
"type": "enum",
"default": "web",
"options": {
"cli": "CLI",
"console": "Console",
"package": "Package",
"server-shelf": "Server (Shelf)",
"web": "Web"
}
}
]
}
17 changes: 17 additions & 0 deletions dart-create/idx-template.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{pkgs, template ? "web", ...}: {
packages = [
pkgs.curl
pkgs.gnutar
pkgs.xz
pkgs.git
pkgs.busybox
pkgs.dart
];
bootstrap = ''
dart create --template="${template}" --no-pub "$out"
mkdir "$out"/.idx
cp ${./dev.nix} "$out"/.idx/dev.nix
install --mode u+rw ${./dev.nix} "$out"/.idx/dev.nix
chmod -R u+w "$out"
'';
}
13 changes: 13 additions & 0 deletions dart-static-server/dev/pubspec.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
path:
dependency: "direct main"
description:
name: path
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
url: "https://pub.dev"
source: hosted
version: "1.9.1"
sdks:
dart: ">=3.4.0 <4.0.0"