mirror of
https://github.com/sajenim/javascript-template.git
synced 2025-12-29 09:46:57 +08:00
Compare commits
5 commits
c497b0fc1d
...
1413b1b10d
| Author | SHA1 | Date | |
|---|---|---|---|
| 1413b1b10d | |||
| 2b228ebd52 | |||
| 304367cde5 | |||
| b558e10bdb | |||
| 187ad24404 |
14 changed files with 322 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,5 +1,6 @@
|
|||
# Dependencies
|
||||
node_modules/
|
||||
bun.lockb
|
||||
|
||||
# Build output
|
||||
dist/
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
systems = import inputs.systems;
|
||||
imports = [
|
||||
./nix/modules/devshell.nix
|
||||
./nix/modules/template.nix
|
||||
];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ in {
|
|||
};
|
||||
|
||||
nextjs = {
|
||||
description = "Next.js TypeScript template with App Router for Vercel";
|
||||
description = "Next.js TypeScript template with App Router";
|
||||
path = "${root}/templates/nextjs";
|
||||
};
|
||||
};
|
||||
|
||||
om.templates = {
|
||||
javascript-vanilla = {
|
||||
default = {
|
||||
template = templates.default;
|
||||
params = [
|
||||
{
|
||||
|
|
@ -26,7 +26,7 @@ in {
|
|||
];
|
||||
};
|
||||
|
||||
javascript-nextjs = {
|
||||
nextjs = {
|
||||
template = templates.nextjs;
|
||||
params = [
|
||||
{
|
||||
|
|
|
|||
77
templates/nextjs/flake.lock
generated
Normal file
77
templates/nextjs/flake.lock
generated
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1760948891,
|
||||
"narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1751274312,
|
||||
"narHash": "sha256-/bVBlRpECLVzjV19t5KMdMFWSwKLtb5RyXdjz3LJT+g=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "50ab793786d9de88ee30ec4e4c24fb4236fc2674",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-24.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1754788789,
|
||||
"narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "a73b9c743612e4244d865a2fdee11865283c04e6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
18
templates/nextjs/flake.nix
Normal file
18
templates/nextjs/flake.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
description = "Nix templates for JavaScript projects, powered by Bun";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
systems.url = "github:nix-systems/default";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
};
|
||||
|
||||
outputs = inputs:
|
||||
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
systems = import inputs.systems;
|
||||
imports = [
|
||||
./nix/modules/devshell.nix
|
||||
./nix/modules/template.nix
|
||||
];
|
||||
};
|
||||
}
|
||||
41
templates/nextjs/nix/modules/template.nix
Normal file
41
templates/nextjs/nix/modules/template.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{inputs, ...}: let
|
||||
root = inputs.self;
|
||||
in {
|
||||
flake = rec {
|
||||
templates = {
|
||||
default = {
|
||||
description = "Minimal JavaScript template with Vite and Bun";
|
||||
path = "${root}/vanilla";
|
||||
};
|
||||
|
||||
nextjs = {
|
||||
description = "Next.js TypeScript template with App Router";
|
||||
path = "${root}/nextjs";
|
||||
};
|
||||
};
|
||||
|
||||
om.templates = {
|
||||
default = {
|
||||
template = templates.default;
|
||||
params = [
|
||||
{
|
||||
name = "package-name";
|
||||
description = "Name of the JavaScript package";
|
||||
placeholder = "my-project";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
nextjs = {
|
||||
template = templates.nextjs;
|
||||
params = [
|
||||
{
|
||||
name = "package-name";
|
||||
description = "Name of the Next.js project";
|
||||
placeholder = "my-nextjs-app";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
1
templates/vanilla/.envrc
Normal file
1
templates/vanilla/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
Binary file not shown.
77
templates/vanilla/flake.lock
generated
Normal file
77
templates/vanilla/flake.lock
generated
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1760948891,
|
||||
"narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1751274312,
|
||||
"narHash": "sha256-/bVBlRpECLVzjV19t5KMdMFWSwKLtb5RyXdjz3LJT+g=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "50ab793786d9de88ee30ec4e4c24fb4236fc2674",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-24.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1754788789,
|
||||
"narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "a73b9c743612e4244d865a2fdee11865283c04e6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
18
templates/vanilla/flake.nix
Normal file
18
templates/vanilla/flake.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
description = "Nix templates for JavaScript projects, powered by Bun";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
systems.url = "github:nix-systems/default";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
};
|
||||
|
||||
outputs = inputs:
|
||||
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
systems = import inputs.systems;
|
||||
imports = [
|
||||
./nix/modules/devshell.nix
|
||||
./nix/modules/template.nix
|
||||
];
|
||||
};
|
||||
}
|
||||
45
templates/vanilla/nix/modules/devshell.nix
Normal file
45
templates/vanilla/nix/modules/devshell.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{inputs, lib, ...}: let
|
||||
# FHS compatibility for NixOS (steam-run wrapper)
|
||||
# Enable if bun-installed binaries fail to find system libraries
|
||||
fhs = false;
|
||||
in {
|
||||
perSystem = {system, ...}: let
|
||||
pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = fhs;
|
||||
};
|
||||
|
||||
fhsPackages = lib.optionals fhs [
|
||||
pkgs.steam-run
|
||||
];
|
||||
|
||||
fhsSetup = lib.optionalString fhs ''
|
||||
alias bun="steam-run bun"
|
||||
'';
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs;
|
||||
[
|
||||
bun
|
||||
nodejs
|
||||
typescript
|
||||
eslint
|
||||
just
|
||||
prettierd
|
||||
]
|
||||
++ fhsPackages;
|
||||
|
||||
shellHook = ''
|
||||
${fhsSetup}
|
||||
|
||||
if [ -f package.json ]; then
|
||||
echo "Installing dependencies..."
|
||||
bun install
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "💡 Run 'just' to see available commands"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
41
templates/vanilla/nix/modules/template.nix
Normal file
41
templates/vanilla/nix/modules/template.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{inputs, ...}: let
|
||||
root = inputs.self;
|
||||
in {
|
||||
flake = rec {
|
||||
templates = {
|
||||
default = {
|
||||
description = "Minimal JavaScript template with Vite and Bun";
|
||||
path = "${root}/vanilla";
|
||||
};
|
||||
|
||||
nextjs = {
|
||||
description = "Next.js TypeScript template with App Router";
|
||||
path = "${root}/nextjs";
|
||||
};
|
||||
};
|
||||
|
||||
om.templates = {
|
||||
default = {
|
||||
template = templates.default;
|
||||
params = [
|
||||
{
|
||||
name = "package-name";
|
||||
description = "Name of the JavaScript package";
|
||||
placeholder = "my-project";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
nextjs = {
|
||||
template = templates.nextjs;
|
||||
params = [
|
||||
{
|
||||
name = "package-name";
|
||||
description = "Name of the Next.js project";
|
||||
placeholder = "my-nextjs-app";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue