feat: init 11ty
This commit is contained in:
5 files changed
+2579
-13
No files matched your search
@@ -0,0 +1,2 @@
|
||||
_site
|
||||
node_modules
|
||||
@@ -1,14 +1,28 @@
|
||||
---
|
||||
permalink: /
|
||||
---
|
||||
|
||||
# task
|
||||
|
||||
Run any project.
|
||||
|
||||
The task file is a simple bash script to run install, configure and run a software project.
|
||||
The task file is a simple bash script to install, configure and run a software project.
|
||||
|
||||
## Spec
|
||||
|
||||
The specification is a short tutorial to setup a task file for a python project.
|
||||
|
||||
Create a file `task` in your project.
|
||||
* Create a file `task` in your project.
|
||||
|
||||
```bash
|
||||
touch task
|
||||
```
|
||||
|
||||
* Make sure it is executable.
|
||||
|
||||
```bash
|
||||
chmod +x task
|
||||
```
|
||||
|
||||
* Add the shebang for bash.
|
||||
|
||||
@@ -50,10 +64,10 @@ function help() {
|
||||
|
||||
# Print table rows
|
||||
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "all" "" "Run all tasks."
|
||||
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "version" "" "Show version of required tools."
|
||||
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "install" "" "Setup the local environment."
|
||||
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "lint" "" "Run pre-commit and update index.html."
|
||||
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "source" "" "Source the Python virtual env."
|
||||
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "version" "" "Show version of required tools."
|
||||
|
||||
echo
|
||||
}
|
||||
@@ -83,21 +97,17 @@ function lint() {
|
||||
|
||||
* Finally, add the switch cases.
|
||||
|
||||
```
|
||||
```bash
|
||||
case "$1" in
|
||||
help)
|
||||
help
|
||||
;;
|
||||
all)
|
||||
version
|
||||
init
|
||||
install
|
||||
lint
|
||||
;;
|
||||
version)
|
||||
version
|
||||
;;
|
||||
init)
|
||||
init
|
||||
install)
|
||||
install
|
||||
;;
|
||||
lint)
|
||||
lint
|
||||
@@ -105,6 +115,9 @@ case "$1" in
|
||||
source)
|
||||
source env/bin/activate
|
||||
;;
|
||||
version)
|
||||
version
|
||||
;;
|
||||
*)
|
||||
help
|
||||
exit 1;
|
||||
@@ -173,7 +186,7 @@ esac
|
||||
|
||||
## Examples
|
||||
|
||||
* [janikvonrotz/taskfile.build](https://github.com/janikvonrotz/taskfile.build/blob/main/task)
|
||||
* [janikvonrotz/dotfiles](https://github.com/janikvonrotz/dotfiles/blob/master/task)
|
||||
* [Mint-System/Odoo-Build](https://github.com/Mint-System/Odoo-Build/blob/16.0/task)
|
||||
* [Mint-System/Ansible-Build](https://github.com/Mint-System/Ansible-Build/blob/main/task)
|
||||
* [janikvonrotz/dotfiles](https://github.com/janikvonrotz/dotfiles/blob/master/task)
|
||||
|
||||
Generated
+2458
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "taskfile.build",
|
||||
"version": "1.0.0",
|
||||
"description": "Run any project.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/janikvonrotz/taskfile.build.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/janikvonrotz/taskfile.build/issues"
|
||||
},
|
||||
"homepage": "https://github.com/janikvonrotz/taskfile.build#readme",
|
||||
"dependencies": {
|
||||
"@11ty/eleventy": "^3.0.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
function help() {
|
||||
echo
|
||||
echo "task <command> [options]"
|
||||
echo
|
||||
echo "commands:"
|
||||
echo
|
||||
|
||||
# Define column widths
|
||||
cmd_width=10
|
||||
opt_width=6
|
||||
desc_width=40
|
||||
|
||||
# Print table header
|
||||
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "Command" "Option" "Description"
|
||||
echo "|$(printf '%*s' $((cmd_width + 2)) '' | tr ' ' '-')|$(printf '%*s' $((opt_width + 2)) '' | tr ' ' '-')|$(printf '%*s' $((desc_width + 2)) '' | tr ' ' '-')|"
|
||||
|
||||
# Print table rows
|
||||
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "all" "" "Run all tasks."
|
||||
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "install" "" "Install node packages."
|
||||
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "dev" "" "Run 11ty server."
|
||||
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "build" "" "Build the 11ty website."
|
||||
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "version" "" "Show version of required tools."
|
||||
|
||||
echo
|
||||
}
|
||||
|
||||
|
||||
function install() {
|
||||
npm install
|
||||
}
|
||||
|
||||
function dev() {
|
||||
npx eleventy --serve
|
||||
}
|
||||
|
||||
function build() {
|
||||
npx eleventy
|
||||
}
|
||||
|
||||
function version() {
|
||||
echo "eleventy: $(npx eleventy --version)"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
help)
|
||||
help
|
||||
;;
|
||||
all)
|
||||
install
|
||||
build
|
||||
;;
|
||||
install)
|
||||
install
|
||||
;;
|
||||
dev)
|
||||
dev
|
||||
;;
|
||||
build)
|
||||
build
|
||||
;;
|
||||
version)
|
||||
version
|
||||
;;
|
||||
*)
|
||||
help
|
||||
exit 1;
|
||||
esac
|
||||
Reference in new issue
Block a user