22
33All it does is run some pre-configured tasks for you, like running your applications, tests, building binaries, or some other scripts.
44
5- It is inspired by other task runners like Taskfile, Make etc.
5+ It is inspired by other task runners like [ Taskfile] ( https://taskfile.dev ) , [ Make] ( https://www.gnu.org/software/make/manual/make.html ) etc.
6+ I decided to build my version of it, accounting the experiences that i want to see in a task runner.
67
7- But source code of those tools are like super big, and complex. So I decided to make a simpler one.
8+ ### Features
9+
10+ - [x] Run tasks (commands)
11+ - [x] Run tasks with Key-Value environment variables
12+ - [x] Run tasks with dynamic environment variables (referencing values by shell execution)
13+ - [x] Run tasks with dotenv files as their environment variables
14+ - [x] Importing tasks from different working directory (must in a monorepo) [ reference] ( https://taskfile.dev/reference/schema/#task )
15+ - [x] Running tasks in parallel (e.g. css generation and build in parallel)
16+ - [x] Running tasks with watch mode (e.g. like hot reload)
17+ - [x] Requirements prior to running a target (e.g. sanity tests)
18+ - [x] Environment validations and default value
19+
20+ ### Installation
21+
22+ | Tool | Command |
23+ | :---: | :---: |
24+ | Go | ` go install github.com/nxtcoder17/runfile/cmd/run@latest ` |
825
9- ## Installation
1026
1127``` bash
1228go install github.com/nxtcoder17/runfile/cmd/run@latest
@@ -18,66 +34,90 @@ go install github.com/nxtcoder17/runfile/cmd/run@latest
1834
1935Create a ` Runfile ` in the root of your project, and add tasks to it.
2036
21- ### Features
37+ ### Examples
2238
23- - [x] Run tasks
24- - [x] Run tasks with Key-Value environment variables
25- - [x] Run tasks with dynamic environment variables (by shell execution)
26- - [x] Run tasks with dotenv files as their environment variables
27- - [x] Running tasks in different working directory [ reference] ( https://taskfile.dev/reference/schema/#task )
28- - [x] Running tasks in parallel
29- - [ ] Running tasks with watch mode
30- - [x] Requirements prior to running a target
31- - [x] Environment validations and default value
39+ 1 . simple tasks
40+
41+ ``` yaml
42+ tasks :
43+ example :
44+ cmd :
45+ - echo "example"
46+ ` ` `
47+
48+ 
3249
33- ### Example
50+ 2. using environment variables
3451
3552` ` ` yaml
36- version : 0.0.1
53+ tasks :
54+ example :
55+ env :
56+ key : " hello world"
57+ cmd :
58+ - echo $key
59+ ` ` `
60+
61+ 
62+
63+ 3. using dynamic environment variables
3764
65+ ` ` ` yaml
3866tasks :
39- test :
67+ example :
4068 env :
41- key1 : value1
42- key2 : value2
43- key3 :
44- sh : echo -n "hello"
45- dotenv :
46- - .secrets/env # load dotenv file
69+ key :
70+ sh : echo $HOME
4771 cmd :
48- - echo "value of key1 is '$key1'"
49- - echo "value of key2 is '$key2'"
50- - echo "value of key3 is '$key3'"
51- - echo "value of key4 is '$key4'" # assuming key4 is defined in .secrets/env
72+ - echo $key
5273` ` `
5374
54- ## Updates with example runfile with all the features
75+ 
76+
77+ 4. using dotenv based environment variables
5578
5679` ` ` yaml
57- version : 0.0.1
80+ tasks :
81+ example :
82+ dotenv :
83+ - .env
84+ cmd :
85+ - echo $key
86+ ` ` `
87+
88+ ` ` ` bash
89+ # file: .env
90+ key="my-dotenv-secret"
91+ ```
92+
93+ ![ Image] ( https://github.com/user-attachments/assets/941b6a9d-57ae-46f1-a320-e76278d6b1e2 )
94+
95+ 5 . validating required environment variable
5896
97+ ``` yaml
5998tasks :
60- test :
99+ example :
61100 env :
62- key1 : value1
63- key2 : value2
64- key3 :
65- sh : echo -n "hello"
66- key4 :
101+ key :
67102 required : true
68- dotenv :
69- - .secrets/env # load dotenv file
70103 cmd :
71- - echo "value of key1 is '$key1'"
72- - echo "value of key2 is '$key2'"
73- - echo "value of key3 is '$key3'"
74- - echo "value of key4 is '$key4'" # assuming key4 is defined in .secrets/env
75- build :
76- dir : cmd/app
104+ - echo $key
105+ ` ` `
106+ 
107+
108+ 6. referencing other tasks
109+
110+ ` ` ` yaml
111+ tasks :
112+ script1 :
77113 cmd :
78- - go build -o app
79- run :
80- dir : cmd/app
114+ - echo "i am script 1 (key=$key)"
115+
116+ example :
81117 cmd :
82- - go run .
118+ - run : script1
119+ env :
120+ key : " hello"
121+ - echo this is example (key=$key)
83122` ` `
123+ 
0 commit comments