diff --git a/modules/home-manager/scripts/common/bin/emoji b/modules/home-manager/scripts/common/bin/emoji index 7955e0a..9ba2241 100755 --- a/modules/home-manager/scripts/common/bin/emoji +++ b/modules/home-manager/scripts/common/bin/emoji @@ -1,5 +1,5 @@ #!/usr/bin/env sh -r="$(< "$HOME/.emoji.txt" sk --height 40%)" +r="$(< "$HOME/.emoji.txt" fzf --height 40%)" echo "$r" | awk '$0=$1' | tr -d '\n' | clip echo "Copied $r emoji to your clipboard" diff --git a/templates/all.nix b/templates/all.nix index 60fbb0e..87b014a 100644 --- a/templates/all.nix +++ b/templates/all.nix @@ -3,4 +3,8 @@ path = ./rust; description = "A template for working on a Rust project"; }; + deno = { + path = ./deno; + description = "A template for working on a TypeScript and Deno project"; + }; } diff --git a/templates/deno/.envrc b/templates/deno/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/templates/deno/.envrc @@ -0,0 +1 @@ +use flake diff --git a/templates/deno/.gitignore b/templates/deno/.gitignore new file mode 100644 index 0000000..6abfe1b --- /dev/null +++ b/templates/deno/.gitignore @@ -0,0 +1,2 @@ +/target +/.direnv diff --git a/templates/deno/.helix/languages.toml b/templates/deno/.helix/languages.toml new file mode 100644 index 0000000..b05ee97 --- /dev/null +++ b/templates/deno/.helix/languages.toml @@ -0,0 +1,49 @@ +[language-server.deno] +command = "deno" +args = ["lsp"] +config.hostInfo = "helix" + +[[language]] +name = "javascript" +scope = "source.js" +injection-regex = "(js|javascript)" +language-id = "javascript" +file-types = ["js", "mjs", "cjs", "rules", "es6", "pac", "jakefile"] +shebangs = ["node"] +comment-token = "//" +language-servers = [ "deno" ] +indent = { tab-width = 2, unit = "\t" } +auto-format = true + +[[language]] +name = "jsx" +scope = "source.jsx" +injection-regex = "jsx" +language-id = "javascriptreact" +file-types = ["jsx"] +comment-token = "//" +language-servers = [ "deno" ] +indent = { tab-width = 2, unit = "\t" } +grammar = "javascript" +auto-format = true + +[[language]] +name = "typescript" +scope = "source.ts" +injection-regex = "(ts|typescript)" +file-types = ["ts", "mts", "cts"] +language-id = "typescript" +shebangs = ["deno", "ts-node"] +language-servers = [ "deno" ] +indent = { tab-width = 2, unit = "\t" } +auto-format = true + +[[language]] +name = "tsx" +scope = "source.tsx" +injection-regex = "(tsx)" +language-id = "typescriptreact" +file-types = ["tsx"] +language-servers = [ "deno" ] +indent = { tab-width = 2, unit = "\t" } +auto-format = true diff --git a/templates/deno/deno.jsonc b/templates/deno/deno.jsonc new file mode 100644 index 0000000..8d93ce9 --- /dev/null +++ b/templates/deno/deno.jsonc @@ -0,0 +1,10 @@ +{ + "tasks": { + "dev": "deno run -A --watch=src src/mod.ts", + }, + "fmt": { + "useTabs": true, + "semiColons": false, + "singleQuote": true, + }, +} diff --git a/templates/deno/flake.nix b/templates/deno/flake.nix new file mode 100644 index 0000000..e3c62d2 --- /dev/null +++ b/templates/deno/flake.nix @@ -0,0 +1,23 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs?rev=2c7f3c0fb7c08a0814627611d9d7d45ab6d75335"; + outputs = { + self, + nixpkgs, + }: let + inherit (self) outputs; + supportedSystems = ["x86_64-linux"]; + forEachSupportedSystem = nixpkgs.lib.genAttrs supportedSystems; + in { + devShells = forEachSupportedSystem (system: let + pkgs = import nixpkgs {inherit system;}; + in { + deno-dev = pkgs.mkShell { + buildInputs = with pkgs; [ + deno + ]; + }; + + default = outputs.devShells.${system}.deno-dev; + }); + }; +} diff --git a/templates/deno/src/mod.ts b/templates/deno/src/mod.ts new file mode 100644 index 0000000..747e199 --- /dev/null +++ b/templates/deno/src/mod.ts @@ -0,0 +1,5 @@ +console.log("Hello, world!") + +if (true) { + console.log("Truth!") +}