@mrpelz/boilerplate-common 7.0.0 → 7.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/config/Makefile CHANGED
@@ -22,6 +22,7 @@
22
22
  transform_prod \
23
23
  transform_typescript \
24
24
  util_clear \
25
+ util_edit \
25
26
  util_get_version \
26
27
  util_install_git_hooks \
27
28
  watch \
@@ -37,6 +38,32 @@ ARGS := $(filter-out $(firstword $(MAKECMDGOALS)),$(MAKECMDGOALS))
37
38
 
38
39
  export PATH := $(shell npm root)/.bin:$(PATH)
39
40
 
41
+ SUB_PACKAGE_DIR := packages
42
+
43
+ SUB_RUN = \
44
+ if [[ "$(include_sub_packages)" = "false" ]]; then \
45
+ exit 0; \
46
+ fi; \
47
+ \
48
+ if [[ -n "$(sub_package)" ]]; then \
49
+ exit 0; \
50
+ fi; \
51
+ \
52
+ if [ ! -d "$(SUB_PACKAGE_DIR)" ]; then \
53
+ exit 0; \
54
+ fi; \
55
+ \
56
+ echo; \
57
+ \
58
+ for SUB_PACKAGE in $(SUB_PACKAGE_DIR)/*; do \
59
+ echo "$$SUB_PACKAGE:$(@)"; \
60
+ \
61
+ $(MAKE) "$(@)" sub_package="$$SUB_PACKAGE" -C "$$SUB_PACKAGE" || exit "$$?"; \
62
+ echo; \
63
+ done; \
64
+ \
65
+ echo "parent:$(@)";
66
+
40
67
  PKG_NAME := $(shell npm pkg get name 2>/dev/null | sed -nr 's/^"@(.+)"$$/\1/p' 2>/dev/null)
41
68
  GIT_NAME := $(shell git remote get-url origin 2>/dev/null | sed -nr 's/^(https|git)(:\/\/|@)(.+@)?([^\/:]+)[\/:]([^\/:]+)\/(.+)\.git$$/\5\/\6/p' 2>/dev/null)
42
69
 
@@ -47,7 +74,7 @@ PKG_REPO_TYPE := $(shell npm pkg get repository.type 2>/dev/null | sed -nr 's/^"
47
74
  PKG_REPO_NAME := $(shell npm pkg get repository.url 2>/dev/null | sed -nr 's/^"(.+)"$$/\1/p' 2>/dev/null | sed -nr 's/^(https|git)(:\/\/|@)(.+@)?([^\/:]+)[\/:]([^\/:]+)\/(.+)\.git$$/\5\/\6/p' 2>/dev/null)
48
75
  PKG_REPO_DIRECTORY := $(shell npm pkg get repository.directory 2>/dev/null | sed -nr 's/^"(.+)"$$/\1/p' 2>/dev/null)
49
76
 
50
- ESLINT_ARGS := --ignore-pattern "dist/**/*" --ignore-pattern "node_modules/**/*" --ignore-pattern "packages/**/*"
77
+ ESLINT_ARGS := --ignore-pattern "dist/**/*" --ignore-pattern "node_modules/**/*" --ignore-pattern "$(SUB_PACKAGE_DIR)/**/*"
51
78
 
52
79
  %:
53
80
  @:
@@ -76,66 +103,74 @@ check_package_json: \
76
103
  check_package_json_version
77
104
 
78
105
  check_package_json_name:
106
+ $(SUB_RUN)
107
+
79
108
  if [[ -z "$(GIT_NAME)" ]]; then \
80
109
  echo "cannot determine git repository name, skipping"; \
81
- fi
82
-
110
+ exit 0; \
111
+ fi; \
112
+ \
83
113
  if [[ -n "$(PKG_REPO_DIRECTORY)" ]]; then \
84
114
  echo "is sub-package, not comparing to repository name"; \
85
- fi
86
-
87
- if [[ -z "$(GIT_NAME)" || -n "$(PKG_REPO_DIRECTORY)" || "$(PKG_NAME)" = "$(GIT_NAME)" ]]; then \
88
115
  exit 0; \
89
- else \
116
+ fi; \
117
+ \
118
+ if [[ "$(PKG_NAME)" != "$(GIT_NAME)" ]]; then \
90
119
  echo "name in package.json ($(PKG_NAME)) does not match git repository name ($(GIT_NAME))"; \
91
120
  exit 1; \
92
- fi
121
+ fi;
93
122
 
94
123
  check_package_json_repository:
124
+ $(SUB_RUN)
125
+
95
126
  if [[ -z "$(GIT_NAME)" ]]; then \
96
127
  echo "cannot determine git repository name, skipping"; \
97
- fi
98
-
99
- if [[ -z "$(GIT_NAME)" || "$(PKG_REPO_TYPE)" = "git" ]]; then \
100
128
  exit 0; \
101
- else \
129
+ fi;
130
+ \
131
+ if [[ "$(PKG_REPO_TYPE)" != "git" ]]; then \
102
132
  echo "repository.type in package.json ($(PKG_REPO_TYPE)) does not match \"git\""; \
103
133
  exit 1; \
104
- fi
105
-
106
- if [[ -z "$(GIT_NAME)" || "$(PKG_REPO_NAME)" = "$(GIT_NAME)" ]]; then \
107
- exit 0; \
108
- else \
134
+ fi; \
135
+ \
136
+ if [[ "$(PKG_REPO_NAME)" != "$(GIT_NAME)" ]]; then \
109
137
  echo "package name derived from repository.url in package.json ($(PKG_REPO_NAME)) does not match git repository name ($(GIT_NAME))"; \
110
138
  exit 1; \
111
- fi
112
-
113
- if [[ -z "$(ARGS)" || "$(PKG_REPO_DIRECTORY)" = "$(ARGS)" ]]; then \
139
+ fi; \
140
+ \
141
+ if [[ -z "$(sub_package)" ]]; then \
114
142
  exit 0; \
115
- else \
116
- echo "sub-package directory derived from repository.directory in package.json ($(PKG_REPO_DIRECTORY)) does not match required directory ($(ARGS))"; \
143
+ fi; \
144
+ \
145
+ if [[ "$(PKG_REPO_DIRECTORY)" != "$(sub_package)" ]]; then \
146
+ echo "sub-package directory derived from repository.directory in package.json ($(PKG_REPO_DIRECTORY)) does not match required directory ($(sub_package))"; \
117
147
  exit 1; \
118
- fi
148
+ fi;
119
149
 
120
150
  check_package_json_sort:
151
+ $(SUB_RUN)
152
+
121
153
  sort-package-json --check
122
154
 
123
155
  check_package_json_version:
124
156
  if [[ -z "$(GIT_VERSION)" ]]; then \
125
157
  echo "cannot determine git repository version, skipping"; \
126
- fi
127
-
128
- if [[ -z "$(GIT_VERSION)" || "$(PKG_VERSION)" = "$(GIT_VERSION)" ]]; then \
129
158
  exit 0; \
130
- else \
159
+ fi; \
160
+ \
161
+ if [[ "$(PKG_VERSION)" != "$(GIT_VERSION)" ]]; then \
131
162
  echo "version in package.json ($(PKG_VERSION)) does not match git repository version ($(GIT_VERSION))"; \
132
163
  exit 1; \
133
- fi
164
+ fi;
134
165
 
135
166
  check_test:
167
+ $(SUB_RUN)
168
+
136
169
  jest .
137
170
 
138
171
  check_typescript:
172
+ $(SUB_RUN)
173
+
139
174
  tsc
140
175
 
141
176
  transform: \
@@ -148,6 +183,8 @@ transform_clear: \
148
183
  transform
149
184
 
150
185
  transform_lint:
186
+ $(SUB_RUN)
187
+
151
188
  eslint --fix $(ESLINT_ARGS) .
152
189
 
153
190
  transform_package_json: \
@@ -156,6 +193,8 @@ transform_package_json: \
156
193
  transform_package_json_version
157
194
 
158
195
  transform_package_json_name:
196
+ $(SUB_RUN)
197
+
159
198
  if [[ -n "$(PKG_REPO_DIRECTORY)" ]]; then \
160
199
  echo "is sub-package, not applying repository name"; \
161
200
  else \
@@ -163,9 +202,13 @@ transform_package_json_name:
163
202
  fi
164
203
 
165
204
  transform_package_json_sort:
205
+ $(SUB_RUN)
206
+
166
207
  sort-package-json
167
208
 
168
209
  transform_package_json_version:
210
+ $(SUB_RUN)
211
+
169
212
  npm pkg set "version=$(GIT_VERSION)"
170
213
 
171
214
  transform_prod: \
@@ -173,11 +216,20 @@ transform_prod: \
173
216
  transform_typescript
174
217
 
175
218
  transform_typescript:
219
+ $(SUB_RUN)
220
+
176
221
  tsc --project tsconfig.build.json
177
222
 
178
223
  util_clear:
224
+ $(SUB_RUN)
225
+
179
226
  rm -rf dist/{*,.*}
180
227
 
228
+ util_edit:
229
+ $(SUB_RUN)
230
+
231
+ code .
232
+
181
233
  util_get_version:
182
234
  @echo $(PKG_VERSION)
183
235
 
@@ -195,7 +247,7 @@ watch_dev:
195
247
 
196
248
  watch_lint:
197
249
  chokidar --initial "**/*.js" "src/**/*.{js,ts}" --ignore "dist/**/*" --ignore "node_modules/**/*" --ignore "*.d.ts" \
198
- --command "clear; eslint --ignore-pattern \"dist/**/*\" --ignore-pattern \"node_modules/**/*\" --ignore-pattern \"packages/**/*\" .; echo \"[waiting for changes…]\""
250
+ --command "clear; eslint --ignore-pattern \"dist/**/*\" --ignore-pattern \"node_modules/**/*\" --ignore-pattern \"$(SUB_PACKAGE_DIR)/**/*\" .; echo \"[waiting for changes…]\""
199
251
 
200
252
  watch_test:
201
253
  jest --watch .
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@mrpelz/boilerplate-common",
3
- "version": "7.0.0",
3
+ "version": "7.1.1",
4
4
  "repository": {
5
5
  "type": "git",
6
- "url": "https://git.i.wurstsalat.cloud/mrpelz/boilerplate.git",
6
+ "url": "https://github.com/mrpelz/boilerplate.git",
7
7
  "directory": "packages/boilerplate-common"
8
8
  },
9
9
  "license": "UNLICENSED",
@@ -258,10 +258,12 @@ include:
258
258
  - project: "mrpelz/boilerplate"
259
259
  ref: main
260
260
  file: "/gitlab/.gitlab-ci.yml"
261
+ # file: "/gitlab/.monorepo.gitlab-ci.yml"
261
262
  EOF
262
263
  else
263
264
  cat <<EOF
264
265
  include: "/gitlab/.gitlab-ci.yml"
266
+ # include: "/gitlab/.monorepo.gitlab-ci.yml"
265
267
  EOF
266
268
  fi)"
267
269
  fi