@mrpelz/boilerplate-common 7.4.0 → 8.1.0
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/.vscode → .vscode}/settings.json +1 -1
- package/{config/Makefile → Makefile} +22 -8
- package/{config/eslint.config.js → eslint.config.js} +1 -1
- package/{config/jest.config.js → jest.config.js} +1 -1
- package/package.json +11 -3
- package/scripts/bootstrap.sh +70 -77
- package/{config → scripts}/dev.sh +1 -1
- package/{config → scripts}/watch.sh +1 -1
- package/{config/tsconfig.base.json → tsconfig.json} +1 -0
- package/tsconfig.meta.json +11 -0
- package/config/tsconfig.meta.json +0 -9
- /package/{config/.editorconfig → .editorconfig} +0 -0
- /package/{config/.husky → .husky}/commit-msg +0 -0
- /package/{config/.vscode → .vscode}/extensions.json +0 -0
- /package/{config/commitlint.config.mjs → commitlint.config.mjs} +0 -0
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
transform_clear \
|
|
17
17
|
transform_lint \
|
|
18
18
|
transform_package_json \
|
|
19
|
+
transform_package_json_fix \
|
|
19
20
|
transform_package_json_name \
|
|
20
21
|
transform_package_json_sort \
|
|
21
22
|
transform_package_json_version \
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
transform_typescript \
|
|
24
25
|
util_clear \
|
|
25
26
|
util_edit \
|
|
27
|
+
util_get_package_json \
|
|
26
28
|
util_get_version \
|
|
27
29
|
util_install_git_hooks \
|
|
28
30
|
watch \
|
|
@@ -64,15 +66,15 @@ SUB_RUN = \
|
|
|
64
66
|
\
|
|
65
67
|
echo "parent:$(@)";
|
|
66
68
|
|
|
67
|
-
PKG_NAME := $(shell npm pkg get name 2>/dev/null | sed -nr 's/^"@(.+)"$$/\1/p' 2>/dev/null)
|
|
69
|
+
PKG_NAME := $(shell npm pkg get --workspaces=false name 2>/dev/null | sed -nr 's/^"@(.+)"$$/\1/p' 2>/dev/null)
|
|
68
70
|
GIT_NAME := $(shell git remote get-url origin 2>/dev/null | sed -nr 's/^(https|git)(:\/\/|@)(.+@)?([^\/:]+)[\/:]([^\/:]+)\/(.+)\.git$$/\5\/\6/p' 2>/dev/null)
|
|
69
71
|
|
|
70
|
-
PKG_VERSION := $(shell npm pkg get version 2>/dev/null | sed -nr 's/^"(.+)"$$/\1/p' 2>/dev/null)
|
|
72
|
+
PKG_VERSION := $(shell npm pkg get --workspaces=false version 2>/dev/null | sed -nr 's/^"(.+)"$$/\1/p' 2>/dev/null)
|
|
71
73
|
GIT_VERSION := $(shell git describe --tag --abbrev=0 2>/dev/null | sed -nr 's/^v(.+)$$/\1/p' 2>/dev/null)
|
|
72
74
|
|
|
73
|
-
PKG_REPO_TYPE := $(shell npm pkg get repository.type 2>/dev/null | sed -nr 's/^"(.+)"$$/\1/p' 2>/dev/null)
|
|
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)
|
|
75
|
-
PKG_REPO_DIRECTORY := $(shell npm pkg get repository.directory 2>/dev/null | sed -nr 's/^"(.+)"$$/\1/p' 2>/dev/null)
|
|
75
|
+
PKG_REPO_TYPE := $(shell npm pkg get --workspaces=false repository.type 2>/dev/null | sed -nr 's/^"(.+)"$$/\1/p' 2>/dev/null)
|
|
76
|
+
PKG_REPO_NAME := $(shell npm pkg get --workspaces=false 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)
|
|
77
|
+
PKG_REPO_DIRECTORY := $(shell npm pkg get --workspaces=false repository.directory 2>/dev/null | sed -nr 's/^"(.+)"$$/\1/p' 2>/dev/null)
|
|
76
78
|
|
|
77
79
|
ESLINT_ARGS := --ignore-pattern "dist/**/*" --ignore-pattern "node_modules/**/*" --ignore-pattern "$(SUB_PACKAGE_DIR)/**/*"
|
|
78
80
|
|
|
@@ -101,6 +103,7 @@ check_lint:
|
|
|
101
103
|
eslint $(ESLINT_ARGS) .
|
|
102
104
|
|
|
103
105
|
check_package_json: \
|
|
106
|
+
util_get_package_json \
|
|
104
107
|
check_package_json_sort \
|
|
105
108
|
check_package_json_repository \
|
|
106
109
|
check_package_json_name \
|
|
@@ -196,7 +199,13 @@ transform_lint:
|
|
|
196
199
|
transform_package_json: \
|
|
197
200
|
transform_package_json_sort \
|
|
198
201
|
transform_package_json_name \
|
|
199
|
-
transform_package_json_version
|
|
202
|
+
transform_package_json_version \
|
|
203
|
+
transform_package_json_fix
|
|
204
|
+
|
|
205
|
+
transform_package_json_fix:
|
|
206
|
+
$(SUB_RUN)
|
|
207
|
+
|
|
208
|
+
npm pkg fix --workspaces=false
|
|
200
209
|
|
|
201
210
|
transform_package_json_name:
|
|
202
211
|
$(SUB_RUN)
|
|
@@ -204,7 +213,7 @@ transform_package_json_name:
|
|
|
204
213
|
if [[ -n "$(PKG_REPO_DIRECTORY)" ]]; then \
|
|
205
214
|
echo "is sub-package, not applying repository name"; \
|
|
206
215
|
else \
|
|
207
|
-
npm pkg set "name=@$(GIT_NAME)"; \
|
|
216
|
+
npm pkg set --workspaces=false "name=@$(GIT_NAME)"; \
|
|
208
217
|
fi
|
|
209
218
|
|
|
210
219
|
transform_package_json_sort:
|
|
@@ -215,7 +224,7 @@ transform_package_json_sort:
|
|
|
215
224
|
transform_package_json_version:
|
|
216
225
|
$(SUB_RUN)
|
|
217
226
|
|
|
218
|
-
npm pkg set "version=$(GIT_VERSION)"
|
|
227
|
+
npm pkg set --workspaces=false "version=$(GIT_VERSION)"
|
|
219
228
|
|
|
220
229
|
transform_prod: \
|
|
221
230
|
util_clear \
|
|
@@ -236,6 +245,11 @@ util_edit:
|
|
|
236
245
|
|
|
237
246
|
code .
|
|
238
247
|
|
|
248
|
+
util_get_package_json:
|
|
249
|
+
$(SUB_RUN)
|
|
250
|
+
|
|
251
|
+
npm pkg get --workspaces=false
|
|
252
|
+
|
|
239
253
|
util_get_version:
|
|
240
254
|
@echo $(PKG_VERSION)
|
|
241
255
|
|
|
@@ -461,7 +461,7 @@ export const plugins = {
|
|
|
461
461
|
|
|
462
462
|
/** @type {import('eslint').Linter.FlatConfig} */
|
|
463
463
|
export const configMeta = {
|
|
464
|
-
files: ['**/*.js'],
|
|
464
|
+
files: ['**/*.{js,mjs}'],
|
|
465
465
|
ignores: ['dist/**/*', 'node_modules/**/*', 'src/**/*', 'packages/**/*'],
|
|
466
466
|
languageOptions: {
|
|
467
467
|
parser: typescriptParser,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrpelz/boilerplate-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/mrpelz/boilerplate.git",
|
|
@@ -17,8 +17,16 @@
|
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist/**/*.{js,map,ts}",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
".editorconfig",
|
|
21
|
+
".husky/**/*",
|
|
22
|
+
".vscode/**/*.json",
|
|
23
|
+
"commitlint.config.mjs",
|
|
24
|
+
"eslint.config.js",
|
|
25
|
+
"jest.config.js",
|
|
26
|
+
"Makefile",
|
|
27
|
+
"scripts/**/*.sh",
|
|
28
|
+
"tsconfig.json",
|
|
29
|
+
"tsconfig.meta.json"
|
|
22
30
|
],
|
|
23
31
|
"dependencies": {
|
|
24
32
|
"@commitlint/cli": "latest",
|
package/scripts/bootstrap.sh
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
OVERRIDE=$1
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
BOILERPLATE_MODULE_NAME=$BOILERPLATE_MODULE_IDENTIFIER
|
|
10
|
-
BOILERPLATE_MODULE_PATH="$(realpath --relative-to=. "$(npm root)")/$BOILERPLATE_MODULE_IDENTIFIER/"
|
|
7
|
+
BOILERPLATE_MODULE_NAME="@mrpelz/boilerplate-common"
|
|
8
|
+
BOILERPLATE_MODULE_PATH="$(realpath --relative-to=. "$(npm ls --parseable --silent "$BOILERPLATE_MODULE_NAME" 2>/dev/null)")"
|
|
11
9
|
|
|
12
10
|
FORMAT_BOLD=$(tput bold)
|
|
13
11
|
FORMAT_NORMAL=$(tput sgr0)
|
|
@@ -135,102 +133,95 @@ make_config() {
|
|
|
135
133
|
|
|
136
134
|
## FLOW
|
|
137
135
|
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
for COMMAND in make head sed tmux xargs; do
|
|
137
|
+
if ! check_command "$COMMAND"; then
|
|
138
|
+
echo "❌ \"$COMMAND\" is not available, aborting"
|
|
139
|
+
exit 1
|
|
140
|
+
fi
|
|
141
|
+
done
|
|
140
142
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
+
if [[ "$(npm pkg get --workspaces=false name)" == "\"$BOILERPLATE_MODULE_NAME\"" ]]; then
|
|
144
|
+
echo "📍 running within \"$BOILERPLATE_MODULE_NAME\""
|
|
145
|
+
SKIP_FILES=1
|
|
143
146
|
else
|
|
144
|
-
echo "ℹ️ running with \"$
|
|
145
|
-
fi
|
|
146
|
-
|
|
147
|
-
if ! check_command make; then
|
|
148
|
-
echo "❌ \"make\" is not available, aborting"
|
|
149
|
-
exit 1
|
|
147
|
+
echo "ℹ️ running with \"$BOILERPLATE_MODULE_NAME\" as dependency"
|
|
150
148
|
fi
|
|
151
149
|
|
|
152
|
-
if
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
fi
|
|
156
|
-
|
|
157
|
-
if ! check_command tmux; then
|
|
158
|
-
echo "❌ \"tmux\" is not available, aborting"
|
|
159
|
-
exit 1
|
|
160
|
-
fi
|
|
150
|
+
if [[ $SKIP_FILES -ne 1 ]]; then
|
|
151
|
+
if check_response "🖇 install symbolic links referencing files in boilerplate?" y; then
|
|
152
|
+
make_ln "${BOILERPLATE_MODULE_PATH}/.editorconfig" .editorconfig
|
|
161
153
|
|
|
162
|
-
|
|
163
|
-
|
|
154
|
+
make_ln "${BOILERPLATE_MODULE_PATH}/.vscode/extensions.json" .vscode/extensions.json
|
|
155
|
+
make_ln "${BOILERPLATE_MODULE_PATH}/.vscode/settings.json" .vscode/settings.json
|
|
164
156
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
make_ln "${BOILERPLATE_MODULE_PATH}config/watch.sh" scripts/watch.sh
|
|
169
|
-
make_ln "${BOILERPLATE_MODULE_PATH}config/dev.sh" scripts/dev.sh
|
|
170
|
-
fi
|
|
157
|
+
make_ln "${BOILERPLATE_MODULE_PATH}/scripts/watch.sh" scripts/watch.sh
|
|
158
|
+
make_ln "${BOILERPLATE_MODULE_PATH}/scripts/dev.sh" scripts/dev.sh
|
|
159
|
+
fi
|
|
171
160
|
|
|
172
|
-
if check_response "📃 install bare config files extending base files in boilerplate?" y; then
|
|
161
|
+
if check_response "📃 install bare config files extending base files in boilerplate?" y; then
|
|
173
162
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
163
|
+
# no indent
|
|
164
|
+
make_config .gitignore "$(
|
|
165
|
+
cat <<EOF
|
|
177
166
|
.DS_Store
|
|
178
167
|
dist
|
|
179
168
|
node_modules
|
|
180
169
|
secrets.txt
|
|
181
170
|
EOF
|
|
182
|
-
|
|
171
|
+
)"
|
|
183
172
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
173
|
+
make_config Makefile "$(
|
|
174
|
+
cat <<EOF
|
|
175
|
+
BASE_FILE := \$(shell npm ls --parseable --silent "$BOILERPLATE_MODULE_NAME" 2>/dev/null)
|
|
176
|
+
|
|
177
|
+
include \$(BASE_FILE)/Makefile
|
|
187
178
|
EOF
|
|
188
|
-
|
|
179
|
+
)"
|
|
189
180
|
|
|
190
|
-
|
|
191
|
-
|
|
181
|
+
make_config commitlint.config.mjs "$(
|
|
182
|
+
cat <<EOF
|
|
192
183
|
// @ts-ignore
|
|
193
|
-
import config from '$BOILERPLATE_MODULE_NAME/
|
|
184
|
+
import config from '$BOILERPLATE_MODULE_NAME/commitlint.config.mjs';
|
|
194
185
|
|
|
195
186
|
/** @type {import('@commitlint/types').UserConfig} */
|
|
196
187
|
export default config;
|
|
197
188
|
EOF
|
|
198
|
-
|
|
189
|
+
)"
|
|
199
190
|
|
|
200
|
-
|
|
201
|
-
|
|
191
|
+
make_config eslint.config.js "$(
|
|
192
|
+
cat <<EOF
|
|
202
193
|
// @ts-ignore
|
|
203
|
-
import config from '$BOILERPLATE_MODULE_NAME/
|
|
194
|
+
import config from '$BOILERPLATE_MODULE_NAME/eslint.config.js';
|
|
204
195
|
|
|
205
196
|
/** @type {import('eslint').Linter.FlatConfig[]} */
|
|
206
197
|
export default config;
|
|
207
198
|
EOF
|
|
208
|
-
|
|
199
|
+
)"
|
|
209
200
|
|
|
210
|
-
|
|
211
|
-
|
|
201
|
+
make_config jest.config.js "$(
|
|
202
|
+
cat <<EOF
|
|
212
203
|
// @ts-ignore
|
|
213
|
-
import config from '$BOILERPLATE_MODULE_NAME/
|
|
204
|
+
import config from '$BOILERPLATE_MODULE_NAME/jest.config.js';
|
|
214
205
|
|
|
215
206
|
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
216
207
|
export default config;
|
|
217
208
|
EOF
|
|
218
|
-
|
|
209
|
+
)"
|
|
219
210
|
|
|
220
|
-
|
|
221
|
-
|
|
211
|
+
make_config tsconfig.json "$(
|
|
212
|
+
cat <<EOF
|
|
222
213
|
{
|
|
223
214
|
"compilerOptions": {
|
|
224
215
|
"outDir": "dist",
|
|
225
216
|
},
|
|
226
|
-
"extends": "$BOILERPLATE_MODULE_NAME/
|
|
217
|
+
"extends": "$BOILERPLATE_MODULE_NAME/tsconfig.json",
|
|
227
218
|
"include": ["src/**/*"]
|
|
228
219
|
}
|
|
229
220
|
EOF
|
|
230
|
-
|
|
221
|
+
)"
|
|
231
222
|
|
|
232
|
-
|
|
233
|
-
|
|
223
|
+
make_config tsconfig.build.json "$(
|
|
224
|
+
cat <<EOF
|
|
234
225
|
{
|
|
235
226
|
"compilerOptions": {
|
|
236
227
|
"noEmit": false
|
|
@@ -240,44 +231,44 @@ EOF
|
|
|
240
231
|
"include": ["src/**/*"]
|
|
241
232
|
}
|
|
242
233
|
EOF
|
|
243
|
-
|
|
234
|
+
)"
|
|
244
235
|
|
|
245
|
-
|
|
246
|
-
|
|
236
|
+
make_config tsconfig.meta.json "$(
|
|
237
|
+
cat <<EOF
|
|
247
238
|
{
|
|
248
239
|
"exclude": ["dist/**/*", "node_modules/**/*", "packages/**/*", "src/**/*"],
|
|
249
|
-
"extends": "$BOILERPLATE_MODULE_NAME/
|
|
250
|
-
"include": ["**/*.js"]
|
|
240
|
+
"extends": "$BOILERPLATE_MODULE_NAME/tsconfig.meta.json",
|
|
241
|
+
"include": ["**/*.js", "**/*.mjs"]
|
|
251
242
|
}
|
|
252
243
|
EOF
|
|
253
|
-
|
|
244
|
+
)"
|
|
254
245
|
|
|
255
|
-
|
|
256
|
-
|
|
246
|
+
make_config .gitlab-ci.yml "$(if [[ "$BOILERPLATE_MODULE_NAME" == "$BOILERPLATE_MODULE_NAME" ]]; then
|
|
247
|
+
cat <<EOF
|
|
257
248
|
include:
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
249
|
+
- project: "mrpelz/boilerplate"
|
|
250
|
+
ref: main
|
|
251
|
+
file: "/gitlab/.gitlab-ci.yml"
|
|
252
|
+
# file: "/gitlab/.monorepo.gitlab-ci.yml"
|
|
262
253
|
EOF
|
|
263
|
-
|
|
264
|
-
|
|
254
|
+
else
|
|
255
|
+
cat <<EOF
|
|
265
256
|
include: "/gitlab/.gitlab-ci.yml"
|
|
266
257
|
# include: "/gitlab/.monorepo.gitlab-ci.yml"
|
|
267
258
|
EOF
|
|
268
|
-
|
|
259
|
+
fi)"
|
|
260
|
+
fi
|
|
269
261
|
fi
|
|
270
262
|
|
|
271
263
|
if check_response "💱 apply changes to \"package.json\"?" y; then
|
|
272
|
-
npm pkg set \
|
|
264
|
+
npm pkg set --workspaces=false \
|
|
273
265
|
"license=UNLICENSED" \
|
|
274
266
|
"author=Lennart Pelz <mail@mrpelz.de>" \
|
|
275
267
|
"type=module" \
|
|
276
268
|
"main=dist/main.js" \
|
|
277
269
|
"module=dist/main.js" \
|
|
278
270
|
"types=dist/main.d.ts" \
|
|
279
|
-
"files[0]=dist/**/*.{js,map,ts}"
|
|
280
|
-
"devDependencies.@mrpelz/boilerplate-common=latest"
|
|
271
|
+
"files[0]=dist/**/*.{js,map,ts}"
|
|
281
272
|
fi
|
|
282
273
|
|
|
283
274
|
if check_response "🕳 run npm install?" y; then
|
|
@@ -295,7 +286,9 @@ fi
|
|
|
295
286
|
if check_command git; then
|
|
296
287
|
if [[ -d ".git" ]]; then
|
|
297
288
|
if check_response "🪝 install git hooks?" y; then
|
|
298
|
-
|
|
289
|
+
if [[ $SKIP_FILES -ne 1 ]]; then
|
|
290
|
+
make_ln "${BOILERPLATE_MODULE_PATH}/.husky/commit-msg" .husky/commit-msg
|
|
291
|
+
fi
|
|
299
292
|
make util_install_git_hooks
|
|
300
293
|
fi
|
|
301
294
|
else
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
tmux \
|
|
4
4
|
new-session "make -s watch_lint" \; \
|
|
5
|
-
bind-key -n C-d
|
|
5
|
+
bind-key -n C-d run-shell "tmux list-panes -s -F \"#{l:#{pane_pid}}\" -f \"#{l:#{pane_start_command}}\" | xargs kill; tmux kill-session" \; \
|
|
6
6
|
bind-key -n C-Down "select-pane -D" \; \
|
|
7
7
|
bind-key -n C-Left "select-pane -L" \; \
|
|
8
8
|
bind-key -n C-Right "select-pane -R" \; \
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
tmux \
|
|
4
4
|
new-session "make -s watch_lint" \; \
|
|
5
|
-
bind-key -n C-d
|
|
5
|
+
bind-key -n C-d run-shell "tmux list-panes -s -F \"#{l:#{pane_pid}}\" -f \"#{l:#{pane_start_command}}\" | xargs kill; tmux kill-session" \; \
|
|
6
6
|
bind-key -n C-Down "select-pane -D" \; \
|
|
7
7
|
bind-key -n C-Left "select-pane -L" \; \
|
|
8
8
|
bind-key -n C-Right "select-pane -R" \; \
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"incremental": false,
|
|
4
|
+
"moduleResolution": "Node",
|
|
5
|
+
"module": "None",
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
},
|
|
8
|
+
"exclude": ["dist/**/*", "node_modules/**/*", "packages/**/*", "src/**/*"],
|
|
9
|
+
"extends": "./tsconfig.json",
|
|
10
|
+
"include": ["**/*.js", "**/*.mjs"]
|
|
11
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|