@mrpelz/boilerplate-node 8.1.0 → 8.2.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/Makefile ADDED
@@ -0,0 +1,17 @@
1
+ BASE_FILE := $(shell npm ls --parseable --silent "@mrpelz/boilerplate-common" 2>/dev/null)
2
+
3
+ include $(BASE_FILE)/Makefile
4
+
5
+ .PHONY: .PHONY \
6
+ run \
7
+ watch_run
8
+
9
+ NODE := node --use_strict --enable-source-maps --stack-trace-limit=100 "dist/main.js"
10
+
11
+ run:
12
+ $(NODE)
13
+
14
+ watch_run:
15
+ nodemon --watch "dist/**/*" --watch "node_modules/**/*" --ext "js,mjs" \
16
+ --exec '$(NODE)'; \
17
+ exit 0;
@@ -0,0 +1,5 @@
1
+ // @ts-ignore
2
+ import config from '@mrpelz/boilerplate-common/commitlint.config.mjs';
3
+
4
+ /** @type {import('@commitlint/types').UserConfig} */
5
+ export default config;
@@ -0,0 +1,5 @@
1
+ // @ts-ignore
2
+ import config from '@mrpelz/boilerplate-common/eslint.config.js';
3
+
4
+ /** @type {import('eslint').Linter.FlatConfig[]} */
5
+ export default config;
package/jest.config.js ADDED
@@ -0,0 +1,5 @@
1
+ // @ts-ignore
2
+ import config from '@mrpelz/boilerplate-common/jest.config.js';
3
+
4
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
5
+ export default config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrpelz/boilerplate-node",
3
- "version": "8.1.0",
3
+ "version": "8.2.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mrpelz/boilerplate.git",
@@ -13,7 +13,14 @@
13
13
  "module": "dist/main.js",
14
14
  "types": "dist/main.d.ts",
15
15
  "files": [
16
- "dist/**/*.{js,map,ts}"
16
+ "dist/**/*.{js,map,ts}",
17
+ "commitlint.config.mjs",
18
+ "eslint.config.js",
19
+ "jest.config.js",
20
+ "Makefile",
21
+ "scripts/**/*.sh",
22
+ "tsconfig.json",
23
+ "tsconfig.meta.json"
17
24
  ],
18
25
  "dependencies": {
19
26
  "@mrpelz/boilerplate-common": "*",
@@ -0,0 +1,133 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ## ENVIRONMENT
4
+
5
+ BOILERPLATE_MODULE_NAME="@mrpelz/boilerplate-common"
6
+ BOILERPLATE_MODULE_PATH="$(realpath --relative-to=. "$(npm ls --parseable --silent "$BOILERPLATE_MODULE_NAME" 2>/dev/null)")"
7
+
8
+ BOILERPLATE_NODE_MODULE_NAME="@mrpelz/boilerplate-node"
9
+ BOILERPLATE_NODE_MODULE_PATH="$(realpath --relative-to=. "$(npm ls --parseable --silent "$BOILERPLATE_NODE_MODULE_NAME" 2>/dev/null)")"
10
+
11
+ SCRIPT_PATH="${BOILERPLATE_MODULE_PATH}/scripts"
12
+ # shellcheck disable=SC1091
13
+ source "${SCRIPT_PATH}/utils.sh"
14
+
15
+ ## FLOW
16
+
17
+ # shellcheck disable=SC1091
18
+ source "${SCRIPT_PATH}/common-pre.sh"
19
+
20
+ if [[ $SKIP_FILES -ne 1 ]]; then
21
+ if check_response "🖇 install symbolic links referencing files in \"$BOILERPLATE_MODULE_NAME\" and \"$BOILERPLATE_NODE_MODULE_NAME\"?" y; then
22
+ make_ln "${BOILERPLATE_MODULE_PATH}/.editorconfig" .editorconfig
23
+
24
+ make_ln "${BOILERPLATE_MODULE_PATH}/.shellcheckrc" .shellcheckrc
25
+
26
+ make_ln "${BOILERPLATE_MODULE_PATH}/.vscode/extensions.json" .vscode/extensions.json
27
+ make_ln "${BOILERPLATE_MODULE_PATH}/.vscode/settings.json" .vscode/settings.json
28
+
29
+ make_ln "${BOILERPLATE_NODE_MODULE_PATH}/scripts/watch.sh" scripts/watch.sh
30
+ make_ln "${BOILERPLATE_NODE_MODULE_PATH}/scripts/watch-dev.sh" scripts/watch-dev.sh
31
+ fi
32
+
33
+ if check_response "📃 install bare config files extending base files in \"$BOILERPLATE_MODULE_NAME\" and \"$BOILERPLATE_NODE_MODULE_NAME\"?" y; then
34
+
35
+ # no indent
36
+ make_config .gitignore "$(
37
+ cat <<EOF
38
+ .DS_Store
39
+ dist
40
+ node_modules
41
+ secrets.txt
42
+ EOF
43
+ )"
44
+
45
+ make_config Makefile "$(
46
+ cat <<EOF
47
+ BASE_FILE := \$(shell npm ls --parseable --silent "$BOILERPLATE_NODE_MODULE_NAME" 2>/dev/null)
48
+
49
+ include \$(BASE_FILE)/Makefile
50
+ EOF
51
+ )"
52
+
53
+ make_config commitlint.config.mjs "$(
54
+ cat <<EOF
55
+ // @ts-ignore
56
+ import config from '$BOILERPLATE_NODE_MODULE_NAME/commitlint.config.mjs';
57
+
58
+ /** @type {import('@commitlint/types').UserConfig} */
59
+ export default config;
60
+ EOF
61
+ )"
62
+
63
+ make_config eslint.config.js "$(
64
+ cat <<EOF
65
+ // @ts-ignore
66
+ import config from '$BOILERPLATE_NODE_MODULE_NAME/eslint.config.js';
67
+
68
+ /** @type {import('eslint').Linter.FlatConfig[]} */
69
+ export default config;
70
+ EOF
71
+ )"
72
+
73
+ make_config jest.config.js "$(
74
+ cat <<EOF
75
+ // @ts-ignore
76
+ import config from '$BOILERPLATE_NODE_MODULE_NAME/jest.config.js';
77
+
78
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
79
+ export default config;
80
+ EOF
81
+ )"
82
+
83
+ make_config tsconfig.json "$(
84
+ cat <<EOF
85
+ {
86
+ "compilerOptions": {
87
+ "outDir": "dist",
88
+ },
89
+ "extends": "$BOILERPLATE_NODE_MODULE_NAME/tsconfig.json",
90
+ "include": ["src/**/*"]
91
+ }
92
+ EOF
93
+ )"
94
+
95
+ make_config tsconfig.build.json "$(
96
+ cat <<EOF
97
+ {
98
+ "compilerOptions": {
99
+ "noEmit": false
100
+ },
101
+ "exclude": ["**/*.test.ts"],
102
+ "extends": "./tsconfig.json",
103
+ "include": ["src/**/*"]
104
+ }
105
+ EOF
106
+ )"
107
+
108
+ make_config tsconfig.meta.json "$(
109
+ cat <<EOF
110
+ {
111
+ "exclude": ["dist/**/*", "node_modules/**/*", "packages/**/*", "src/**/*"],
112
+ "extends": "$BOILERPLATE_NODE_MODULE_NAME/tsconfig.meta.json",
113
+ "include": ["**/*.js", "**/*.mjs"]
114
+ }
115
+ EOF
116
+ )"
117
+
118
+ make_config .gitlab-ci.yml "$(
119
+ cat <<EOF
120
+ include:
121
+ - project: "mrpelz/boilerplate"
122
+ ref: main
123
+ file: "/gitlab/.gitlab-ci.yml"
124
+ # file: "/gitlab/.monorepo.gitlab-ci.yml"
125
+ EOF
126
+ )"
127
+ fi
128
+ fi
129
+
130
+ # shellcheck disable=SC1091
131
+ source "${SCRIPT_PATH}/common-post.sh"
132
+
133
+ echo "✅ done"
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env bash
2
+
3
+ tmux \
4
+ new-session "make -s watch_lint" \; \
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
+ bind-key -n C-Down "select-pane -D" \; \
7
+ bind-key -n C-Left "select-pane -L" \; \
8
+ bind-key -n C-Right "select-pane -R" \; \
9
+ bind-key -n C-Space "resize-pane -Z" \; \
10
+ bind-key -n C-Up "select-pane -U" \; \
11
+ set-option -w mouse on \; \
12
+ set-option -w pane-active-border-style bold,fg=black,bg=white \; \
13
+ set-option -w pane-border-status top \; \
14
+ set-option -w pane-border-style bold,fg=white \; \
15
+ set-option -w remain-on-exit on \; \
16
+ set-option -w status off \; \
17
+ set-option -p pane-border-format "eslint (eslint.config.json, includes files outside \"src\")" \; \
18
+ split-window -h -l 50% "make -s watch_test" \; \
19
+ set-option -p pane-border-format "jest (jest.config.json)" \; \
20
+ split-window -f -v -l 50% "make -s watch_typescript" \; \
21
+ set-option -p pane-border-format "tsc (tsconfig.build.json, excludes test-files)" \; \
22
+ split-window -h -l 50% "make -s watch_config" \; \
23
+ set-option -p pane-border-format "tsc (tsconfig.meta.json, checks files outside \"src\")" \; \
24
+ split-window -f -v -l 33% "make -s watch_run" \; \
25
+ set-option -p pane-border-format "node (\"dist/main.js\")" \; \
26
+ split-window -f -v -l 5 \; \
27
+ set-option -p pane-border-format "input" \; \
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+
3
+ tmux \
4
+ new-session "make -s watch_lint" \; \
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
+ bind-key -n C-Down "select-pane -D" \; \
7
+ bind-key -n C-Left "select-pane -L" \; \
8
+ bind-key -n C-Right "select-pane -R" \; \
9
+ bind-key -n C-Space "resize-pane -Z" \; \
10
+ bind-key -n C-Up "select-pane -U" \; \
11
+ set-option -w mouse on \; \
12
+ set-option -w pane-active-border-style bold,fg=black,bg=white \; \
13
+ set-option -w pane-border-status top \; \
14
+ set-option -w pane-border-style bold,fg=white \; \
15
+ set-option -w remain-on-exit on \; \
16
+ set-option -w status off \; \
17
+ set-option -p pane-border-format "eslint (eslint.config.json, includes files outside \"src\")" \; \
18
+ split-window -h -l 50% "make -s watch_test" \; \
19
+ set-option -p pane-border-format "jest (jest.config.json)" \; \
20
+ split-window -f -v -l 50% "make -s watch_typescript" \; \
21
+ set-option -p pane-border-format "tsc (tsconfig.build.json, excludes test-files)" \; \
22
+ split-window -h -l 50% "make -s watch_config" \; \
23
+ set-option -p pane-border-format "tsc (tsconfig.meta.json, checks files outside \"src\")" \; \
24
+ split-window -f -v -l 33% "make -s watch_run" \; \
25
+ set-option -p pane-border-format "node (\"dist/main.js\")" \; \
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "dist",
4
+ },
5
+ "extends": "@mrpelz/boilerplate-common/tsconfig.json",
6
+ "include": ["src/**/*"]
7
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "exclude": ["dist/**/*", "node_modules/**/*", "packages/**/*", "src/**/*"],
3
+ "extends": "@mrpelz/boilerplate-common/tsconfig.meta.json",
4
+ "include": ["**/*.js", "**/*.mjs"]
5
+ }