This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
forked from rantav/go-archetype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
transformations.yml
46 lines (46 loc) · 1.65 KB
/
transformations.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
ignore: [".git/", "transformations.yml", ".DS_Store", ".idea/", ".tmp/", "dist/", "go-archetype"]
inputs:
- id: ProjectName # Must be a unique ID. Can be used also as CLI arg
text: What is the project name?
type: text
- id: IncludeReadme
text: Would you like to include the readme file?
type: yesno
- id: ProjectDescription
text: Please provide a long project description
type: text
before:
operations:
- sh:
- ls {{ .destination }}
transformations:
- name: include the readme file
type: include
region_marker: # When there's no marker, the entire file(s) is included
condition: IncludeReadme
files: ["README.md"]
- name: include a reference to the readme file
type: include
region_marker: __INCLUDE_README__
condition: IncludeReadme
files: ["main.go"]
- name: project long description
type: replace
pattern: Use go-archetype to transform project archetypes into existing live projects
replacement: "{{ wrap 80 .ProjectDescription }}" # Wrap input by 80 columns
files: ["cmd/root.go"]
- name: project package
type: replace
pattern: github.com/rantav/go-archetype
replacement: github.com/xxx/yyy # A simple replacement that does not require user input. Useful? Not really...
files: ["*.go", "go.mod", "**/*.go"]
- name: project name
type: replace
pattern: go-archetype
replacement: "{{ .ProjectName }}" # Reference to an input ID; go templates syntax
files: ["*.go", "**/*.go"]
after:
operations:
- sh:
- cd {{.destination}} && gofmt -s -w .
- echo Done archetyping from {{ .source }} to {{ .destination }} of project {{ .ProjectName }}