@mrpelz/boilerplate-node 8.0.0 → 8.2.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/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.0.0",
3
+ "version": "8.2.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mrpelz/boilerplate.git",
@@ -13,10 +13,17 @@
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
- "@mrpelz/boilerplate-common": "latest",
26
+ "@mrpelz/boilerplate-common": "*",
20
27
  "@types/node": "latest"
21
28
  }
22
29
  }
@@ -0,0 +1,132 @@
1
+ #!/usr/bin/env bash
2
+
3
+
4
+ BOILERPLATE_MODULE_NAME="@mrpelz/boilerplate-common"
5
+ BOILERPLATE_MODULE_PATH="$(realpath --relative-to=. "$(npm ls --parseable --silent "$BOILERPLATE_MODULE_NAME" 2>/dev/null)")"
6
+
7
+ BOILERPLATE_NODE_MODULE_NAME="@mrpelz/boilerplate-node"
8
+ BOILERPLATE_NODE_MODULE_PATH="$(realpath --relative-to=. "$(npm ls --parseable --silent "$BOILERPLATE_NODE_MODULE_NAME" 2>/dev/null)")"
9
+
10
+ SCRIPT_PATH="${BOILERPLATE_MODULE_PATH}/scripts"
11
+ # shellcheck disable=SC1091
12
+ source "${SCRIPT_PATH}/utils.sh"
13
+
14
+ ## FLOW
15
+
16
+ # shellcheck disable=SC1091
17
+ source "${SCRIPT_PATH}/common-pre.sh"
18
+
19
+ if [[ $SKIP_FILES -ne 1 ]]; then
20
+ if check_response "🖇 install symbolic links referencing files in \"$BOILERPLATE_MODULE_NAME\" and \"$BOILERPLATE_NODE_MODULE_NAME\"?" y; then
21
+ make_ln "${BOILERPLATE_MODULE_PATH}/.editorconfig" .editorconfig
22
+
23
+ make_ln "${BOILERPLATE_MODULE_PATH}/.shellcheckrc" .shellcheckrc
24
+
25
+ make_ln "${BOILERPLATE_MODULE_PATH}/.vscode/extensions.json" .vscode/extensions.json
26
+ make_ln "${BOILERPLATE_MODULE_PATH}/.vscode/settings.json" .vscode/settings.json
27
+
28
+ make_ln "${BOILERPLATE_NODE_MODULE_PATH}/scripts/watch.sh" scripts/watch.sh
29
+ make_ln "${BOILERPLATE_NODE_MODULE_PATH}/scripts/watch-dev.sh" scripts/watch-dev.sh
30
+ fi
31
+
32
+ if check_response "📃 install bare config files extending base files in \"$BOILERPLATE_MODULE_NAME\" and \"$BOILERPLATE_NODE_MODULE_NAME\"?" y; then
33
+
34
+ # no indent
35
+ make_config .gitignore "$(
36
+ cat <<EOF
37
+ .DS_Store
38
+ dist
39
+ node_modules
40
+ secrets.txt
41
+ EOF
42
+ )"
43
+
44
+ make_config Makefile "$(
45
+ cat <<EOF
46
+ BASE_FILE := \$(shell npm ls --parseable --silent "$BOILERPLATE_NODE_MODULE_NAME" 2>/dev/null)
47
+
48
+ include \$(BASE_FILE)/Makefile
49
+ EOF
50
+ )"
51
+
52
+ make_config commitlint.config.mjs "$(
53
+ cat <<EOF
54
+ // @ts-ignore
55
+ import config from '$BOILERPLATE_NODE_MODULE_NAME/commitlint.config.mjs';
56
+
57
+ /** @type {import('@commitlint/types').UserConfig} */
58
+ export default config;
59
+ EOF
60
+ )"
61
+
62
+ make_config eslint.config.js "$(
63
+ cat <<EOF
64
+ // @ts-ignore
65
+ import config from '$BOILERPLATE_NODE_MODULE_NAME/eslint.config.js';
66
+
67
+ /** @type {import('eslint').Linter.FlatConfig[]} */
68
+ export default config;
69
+ EOF
70
+ )"
71
+
72
+ make_config jest.config.js "$(
73
+ cat <<EOF
74
+ // @ts-ignore
75
+ import config from '$BOILERPLATE_NODE_MODULE_NAME/jest.config.js';
76
+
77
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
78
+ export default config;
79
+ EOF
80
+ )"
81
+
82
+ make_config tsconfig.json "$(
83
+ cat <<EOF
84
+ {
85
+ "compilerOptions": {
86
+ "outDir": "dist",
87
+ },
88
+ "extends": "$BOILERPLATE_NODE_MODULE_NAME/tsconfig.json",
89
+ "include": ["src/**/*"]
90
+ }
91
+ EOF
92
+ )"
93
+
94
+ make_config tsconfig.build.json "$(
95
+ cat <<EOF
96
+ {
97
+ "compilerOptions": {
98
+ "noEmit": false
99
+ },
100
+ "exclude": ["**/*.test.ts"],
101
+ "extends": "./tsconfig.json",
102
+ "include": ["src/**/*"]
103
+ }
104
+ EOF
105
+ )"
106
+
107
+ make_config tsconfig.meta.json "$(
108
+ cat <<EOF
109
+ {
110
+ "exclude": ["dist/**/*", "node_modules/**/*", "packages/**/*", "src/**/*"],
111
+ "extends": "$BOILERPLATE_NODE_MODULE_NAME/tsconfig.meta.json",
112
+ "include": ["**/*.js", "**/*.mjs"]
113
+ }
114
+ EOF
115
+ )"
116
+
117
+ make_config .gitlab-ci.yml "$(
118
+ cat <<EOF
119
+ include:
120
+ - project: "mrpelz/boilerplate"
121
+ ref: main
122
+ file: "/gitlab/.gitlab-ci.yml"
123
+ # file: "/gitlab/.monorepo.gitlab-ci.yml"
124
+ EOF
125
+ )"
126
+ fi
127
+ fi
128
+
129
+ # shellcheck disable=SC1091
130
+ source "${SCRIPT_PATH}/common-post.sh"
131
+
132
+ 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
+ }