Setup project with devenv instead of docker

This commit is contained in:
Sravan Balaji
2025-01-04 22:10:54 -05:00
parent 660c328c86
commit 041164f1d2
9 changed files with 2615 additions and 31 deletions

3
.envrc Normal file
View File

@@ -0,0 +1,3 @@
source_url "https://raw.githubusercontent.com/cachix/devenv/82c0147677e510b247d8b9165c54f73d32dfd899/direnvrc" "sha256-7u4iDd1nZpxL4tCzmPG0dQgC5V+/44Ba+tHkPob1v2k="
use devenv

14
.gitignore vendored
View File

@@ -1 +1,15 @@
# eleventy output
dist
# Devenv
.devenv*
devenv.local.nix
# direnv
.direnv
# pre-commit
.pre-commit-config.yaml
# NodeJS
node_modules/

100
devenv.lock Normal file
View File

@@ -0,0 +1,100 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1735883199,
"owner": "cachix",
"repo": "devenv",
"rev": "d67d04ae2dd3bc3723e615003034ba752e8db8c3",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1733328505,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1733477122,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1735882644,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "a5a961387e75ae44cc20f0a57ae463da5e959656",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
}
},
"root": "root",
"version": 7
}

20
devenv.nix Normal file
View File

@@ -0,0 +1,20 @@
{ pkgs, lib, config, inputs, ... }:
{
# https://devenv.sh/packages/
packages = [
pkgs.git
pkgs.yaml-language-server
pkgs.typescript-language-server
pkgs.nodePackages.prettier
];
# https://devenv.sh/languages/
# languages.rust.enable = true;
languages.javascript = {
enable = true;
npm.enable = true;
npm.install.enable = true;
};
languages.nix.enable = true;
}

15
devenv.yaml Normal file
View File

@@ -0,0 +1,15 @@
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
# If you're using non-OSS software, you can set allowUnfree to true.
# allowUnfree: true
# If you're willing to use a package that's vulnerable
# permittedInsecurePackages:
# - "openssl-1.1.1w"
# If you have more than one devenv you can merge them
#imports:
# - ./backend

View File

@@ -1,8 +0,0 @@
FROM node:latest
WORKDIR /opt/app
RUN npm init -y
RUN npm install @11ty/eleventy
CMD [ "npx", "@11ty/eleventy" ]

View File

@@ -1,34 +1,21 @@
set shell := ["bash", "-c"]
HOST_PORT := "1280"
PORT := "1280"
# List just commands by default
default:
@just --list
# Build the docker image
docker-build:
docker buildx build \
-f ./docker/Dockerfile \
--tag 11ty:latest \
.
# Update development environment
update:
devenv update
# Run development server
dev: docker-build
docker run \
-it \
-p {{HOST_PORT}}:8080 \
-v ./src:/opt/app/src \
-v ./.eleventy.js:/opt/app/.eleventy.js \
11ty:latest \
npx @11ty/eleventy --serve
dev:
npx @11ty/eleventy \
--serve \
--port={{ PORT }};
# Build static site files
build-site: docker-build
docker run \
-it \
-v ./src:/opt/app/src \
-v ./dist:/opt/app/dist \
-v ./.eleventy.js:/opt/app/.eleventy.js \
11ty:latest \
npx @11ty/eleventy
build-site:
npx @11ty/eleventy

2448
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

5
package.json Normal file
View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"@11ty/eleventy": "^3.0.0"
}
}