Add deno flake template and fix emoji script

This commit is contained in:
Daniel Flanagan 2024-01-05 09:44:06 -06:00
parent f48badb047
commit 0925b57461
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
8 changed files with 95 additions and 1 deletions

View file

@ -1,5 +1,5 @@
#!/usr/bin/env sh #!/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 "$r" | awk '$0=$1' | tr -d '\n' | clip
echo "Copied $r emoji to your clipboard" echo "Copied $r emoji to your clipboard"

View file

@ -3,4 +3,8 @@
path = ./rust; path = ./rust;
description = "A template for working on a Rust project"; description = "A template for working on a Rust project";
}; };
deno = {
path = ./deno;
description = "A template for working on a TypeScript and Deno project";
};
} }

1
templates/deno/.envrc Normal file
View file

@ -0,0 +1 @@
use flake

2
templates/deno/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/target
/.direnv

View file

@ -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

10
templates/deno/deno.jsonc Normal file
View file

@ -0,0 +1,10 @@
{
"tasks": {
"dev": "deno run -A --watch=src src/mod.ts",
},
"fmt": {
"useTabs": true,
"semiColons": false,
"singleQuote": true,
},
}

23
templates/deno/flake.nix Normal file
View file

@ -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;
});
};
}

View file

@ -0,0 +1,5 @@
console.log("Hello, world!")
if (true) {
console.log("Truth!")
}