-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
202 lines (178 loc) · 5.03 KB
/
Taskfile.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
version: '3'
output: prefixed
vars:
COMPOSE_PREFIX: dapple
CMS_COMPOSE_PROJECT_NAME: "{{.COMPOSE_PREFIX}}-cms"
REACT_COMPOSE_PROJECT_NAME: "{{.COMPOSE_PREFIX}}-react"
# Defaults
DEFAULT_GIT_REPO_URL_DESIGN_SYSTEM: [email protected]:danskernesdigitalebibliotek/dpl-design-system
DEFAULT_GIT_BRANCH_DESIGN_SYSTEM: develop
DEFAULT_GIT_REPO_URL_REACT: [email protected]:danskernesdigitalebibliotek/dpl-react
DEFAULT_GIT_BRANCH_REACT: develop
DEFAULT_GIT_REPO_URL_CMS: [email protected]:danskernesdigitalebibliotek/dpl-cms
DEFAULT_GIT_BRANCH_CMS: develop
# Actual values
GIT_REPO_URL_DESIGN_SYSTEM: '{{.GIT_REPO_URL_DESIGN_SYSTEM | default .DEFAULT_GIT_REPO_URL_DESIGN_SYSTEM}}'
GIT_BRANCH_DESIGN_SYSTEM: '{{.GIT_BRANCH_DESIGN_SYSTEM | default .DEFAULT_GIT_BRANCH_DESIGN_SYSTEM}}'
GIT_REPO_URL_REACT: '{{.GIT_REPO_URL_REACT | default .DEFAULT_GIT_REPO_URL_REACT}}'
GIT_BRANCH_REACT: '{{.GIT_BRANCH_REACT | default .DEFAULT_GIT_BRANCH_REACT}}'
GIT_REPO_URL_CMS: '{{.GIT_REPO_URL_CMS | default .DEFAULT_GIT_REPO_URL_CMS}}'
GIT_BRANCH_CMS: '{{.GIT_BRANCH_CMS | default .DEFAULT_GIT_BRANCH_CMS}}'
# If vars are specified here they will override the defaults above.
dotenv: ['.env']
tasks:
init:
summary: Setup this directory for development
deps:
- design-system:clone
- react:clone
- cms:clone
cmds:
- task: install
cleanup:
cmds:
- cmd: rm -rf design-system react cms
# This may fail due to permission problems. Continue regardless to see
# if Dapple works in a partial envinronment.
ignore_error: true
reinit:
cmds:
- task: cleanup
- task: init
install:
summary: (Re)install all dependencies.
deps:
- design-system:install
- react:install
- cms:install
design-system:clone:
cmds:
- git clone {{ .GIT_REPO_URL_DESIGN_SYSTEM }} -b {{ .GIT_BRANCH_DESIGN_SYSTEM }} design-system
design-system:install:
dir: design-system
sources:
- package.json
- yarn.lock
generates:
- node_modules/*
cmds:
- yarn install
design-system:link:
deps:
- design-system:build
dir: design-system
generates:
- package.json
cmds:
- cmd: yarn unlink
ignore_error: true
- yarn link
design-system:build:
dir: design-system
sources:
- src/**/*.scss
- src/**/*.js
- public/icons/**/*.svg
generates:
- build/**/*.*
- dist.zip
cmds:
- yarn css:build
- ./bundle.sh
design-system:dev:
dir: design-system
run: once
cmds:
- yarn dev
react:clone:
cmds:
- git clone {{ .GIT_REPO_URL_REACT}} -b {{ .GIT_BRANCH_REACT }} react
# Set project name to avoid conflicts with single checkouts.
- cp react/.env.example react/.env
- echo "COMPOSE_PROJECT_NAME={{.REACT_COMPOSE_PROJECT_NAME}}" >> react/.env
react:install:
dir: react
sources:
- package.json
- yarn.lock
generates:
- node_modules/*
cmds:
- yarn install
react:link:
dir: react
deps:
- design-system:link
cmds:
- yarn link @danskernesdigitalebibliotek/dpl-design-system
react:build:
dir: react
sources:
- src/**/*.ts
- src/**/*.tsx
- src/**/*.js
- src/**/*.jsx
- src/**/*.scss
cmds:
- yarn build
env:
# Create an updated version.json file for our build.
# This file is parsed by Drupal and the version added as query parameter
# for JavaScript assets. An updated value will help bust caches.
VERSION_FILE_NAME: "dapple"
VERSION_FILE_VERSION:
sh: 'echo "0.0.0-$(date +%s)"'
react:dev:
dir: react
deps:
- react:link
run: once
interactive: true
cmds:
- yarn dev
cms:clone:
cmds:
- git clone {{ .GIT_REPO_URL_CMS }} -b {{ .GIT_BRANCH_CMS }} cms
# Set project name to avoid conflicts with single checkouts.
- sed "s|COMPOSE_PROJECT_NAME=dpl-cms|COMPOSE_PROJECT_NAME={{.CMS_COMPOSE_PROJECT_NAME}}|g" <cms/.env.example >cms/.env
cms:install:
dir: cms
sources:
- composer.lock
generates:
- vendor/*
cmds:
- task dev:cli -- composer install
cms:link:
dir: cms
deps:
- design-system:build
- react:build
cmds:
- docker compose up -d
- docker compose cp ../design-system/build/. php:/app/web/themes/custom/novel/assets/dpl-design-system
- docker compose cp ../react/dist/. php:app/web/libraries/dpl-react
- task dev:cache:clear:all
cms:dev:
dir: cms
run: once
cmds:
- task dev:reset
dev:react:
deps:
- design-system:build
cmds:
- task: react:dev
dev:cms:
cmds:
- task: cms:dev
- task: cms:link
dev:cms-react:
deps:
- cms:dev
cmds:
# react:dev has an interactive prompt about port assignment as we try to
# run it on port 80 by default. To allow the user to reply we have to run
# it as a separate task instead of a dependency.
- task: react:dev
- task: cms:link