dev icon indicating copy to clipboard operation
dev copied to clipboard

feat: Turn Core←→Plug-ins

Open dohernandez opened this issue 1 year ago • 1 comments

Description

Turn dev pkg into a Plug-ins architecture allowing to add plugins on the based targets enriching the experience of the make command for development.

With this change now it is possible to extends the basic targets defined in the package just by including the a key=value item into the MODULES var.

# MODULES is a list of dev modules (mk) to be included in the project.
MODULES := \
	DEVGO_PATH=github.com/bool64/dev

to add another module, right now is as simple as

# MODULES is a list of dev modules (mk) to be included in the project.
MODULES := \
	DEVGO_PATH=github.com/bool64/dev \
	DEVGRPCGO_PATH=github.com/dohernandez/dev-grpc

where the key value DEVGO_PATH is the root path and var that will be exported for further use. The value github.com/bool64/dev represents the github repository where the mk files are stored.

Example of how to add a plugin, github.com/dohernandez/dev-grpc:

  1. Add the module and import the mk
# Makefile

# MODULES is a list of dev modules (mk) to be included in the project.
MODULES := \
	DEVGO_PATH=github.com/bool64/dev \
	DEVGRPCGO_PATH=github.com/dohernandez/dev-grpc

  ...	
	
-include $(DEVGO_PATH)/makefiles/bench.mk
-include $(DEVGO_PATH)/makefiles/reset-ci.mk

-include $(DEVGRPCGO_PATH)/makefiles/protoc.mk

2.Add the module into the dev_test.go to your unused import

package mymodule_test

import (
    _ "github.com/bool64/dev" // Include development helpers to the project. 
    _ "github.com/dohernandez/dev-grpc" // Include development grpc helpers to the project. 

dohernandez avatar Nov 28 '24 11:11 dohernandez

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 8 (+1) 163 (+6) 114 (+2) 21 (+2) 28 (+2) 22 3.6K (+122B)
Makefile 13 (+2) 312 (+70) 210 (+47) 41 (+11) 61 (+12) 47 (+2) 10.6K (+1.8K)
Markdown 4 209 (+79) 153 (+57) 0 56 (+22) 0 5.8K (+2.1K)
Shell 6 (+1) 169 (+62) 101 (+36) 28 (+13) 40 (+13) 86 (+5) 7.1K (+1.7K)
YAML 11 (+1) 804 (+41) 676 (+36) 54 (+5) 74 0 27.5K (+1K)

github-actions[bot] avatar Nov 28 '24 11:11 github-actions[bot]