@mrpelz/boilerplate-dom 8.4.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 +49 -0
- package/commitlint.config.mjs +5 -0
- package/eslint.config.js +5 -0
- package/jest.config.js +5 -0
- package/package.json +45 -0
- package/scripts/bootstrap.sh +166 -0
- package/scripts/watch-dev.sh +27 -0
- package/scripts/watch.sh +25 -0
- package/stylelint.config.js +4 -0
- package/tsconfig.json +8 -0
- package/tsconfig.meta.json +9 -0
- package/webpack.config.js +71 -0
package/Makefile
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
BASE_FILE := $(shell npm ls --parseable --silent "@mrpelz/boilerplate-common" 2>/dev/null)
|
|
2
|
+
|
|
3
|
+
include $(BASE_FILE)/Makefile
|
|
4
|
+
|
|
5
|
+
WEBPACK := WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG=true webpack
|
|
6
|
+
STYLELINT := stylelint "src/**/*.css"
|
|
7
|
+
|
|
8
|
+
.PHONY: .PHONY \
|
|
9
|
+
check_stylelint \
|
|
10
|
+
transform_stylelint \
|
|
11
|
+
watch_stylelint
|
|
12
|
+
|
|
13
|
+
check: \
|
|
14
|
+
check_commit \
|
|
15
|
+
check_package_json \
|
|
16
|
+
check_lint \
|
|
17
|
+
check_stylelint \
|
|
18
|
+
check_config \
|
|
19
|
+
check_typescript \
|
|
20
|
+
check_test
|
|
21
|
+
|
|
22
|
+
check_stylelint:
|
|
23
|
+
$(SUB_RUN)
|
|
24
|
+
|
|
25
|
+
$(STYLELINT)
|
|
26
|
+
|
|
27
|
+
transform: \
|
|
28
|
+
transform_package_json \
|
|
29
|
+
transform_lint \
|
|
30
|
+
transform_stylelint \
|
|
31
|
+
transform_build
|
|
32
|
+
|
|
33
|
+
transform_build:
|
|
34
|
+
$(SUB_RUN)
|
|
35
|
+
|
|
36
|
+
$(WEBPACK)
|
|
37
|
+
|
|
38
|
+
transform_stylelint:
|
|
39
|
+
$(SUB_RUN)
|
|
40
|
+
|
|
41
|
+
$(STYLELINT) --fix
|
|
42
|
+
|
|
43
|
+
watch_build: util_clear
|
|
44
|
+
$(WEBPACK) serve
|
|
45
|
+
|
|
46
|
+
watch_stylelint:
|
|
47
|
+
nodemon --quiet --watch "src/**/*" --ext "css" \
|
|
48
|
+
--exec 'clear; $(STYLELINT); exit 0'; \
|
|
49
|
+
exit 0;
|
package/eslint.config.js
ADDED
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mrpelz/boilerplate-dom",
|
|
3
|
+
"version": "8.4.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/mrpelz/boilerplate.git",
|
|
7
|
+
"directory": "packages/boilerplate-dom"
|
|
8
|
+
},
|
|
9
|
+
"license": "UNLICENSED",
|
|
10
|
+
"author": "Lennart Pelz <mail@mrpelz.de>",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "dist/main.js",
|
|
13
|
+
"module": "dist/main.js",
|
|
14
|
+
"types": "dist/main.d.ts",
|
|
15
|
+
"bin": {
|
|
16
|
+
"boilerplate-dom-bootstrap": "scripts/bootstrap.sh"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/**/*.{js,map,ts}",
|
|
20
|
+
"commitlint.config.mjs",
|
|
21
|
+
"eslint.config.js",
|
|
22
|
+
"jest.config.js",
|
|
23
|
+
"Makefile",
|
|
24
|
+
"scripts/**/*.sh",
|
|
25
|
+
"stylelint.config.js",
|
|
26
|
+
"tsconfig.json",
|
|
27
|
+
"tsconfig.meta.json",
|
|
28
|
+
"webpack.config.js"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@mrpelz/boilerplate-common": "*",
|
|
32
|
+
"@types/webpack": "latest",
|
|
33
|
+
"css-loader": "latest",
|
|
34
|
+
"css-minimizer-webpack-plugin": "latest",
|
|
35
|
+
"html-webpack-plugin": "latest",
|
|
36
|
+
"mini-css-extract-plugin": "latest",
|
|
37
|
+
"stylelint": "latest",
|
|
38
|
+
"stylelint-config-idiomatic-order": "latest",
|
|
39
|
+
"stylelint-config-standard": "latest",
|
|
40
|
+
"ts-loader": "latest",
|
|
41
|
+
"webpack": "latest",
|
|
42
|
+
"webpack-cli": "latest",
|
|
43
|
+
"webpack-dev-server": "latest"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
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_DOM_MODULE_NAME="@mrpelz/boilerplate-dom"
|
|
9
|
+
BOILERPLATE_DOM_MODULE_PATH="$(realpath --relative-to=. "$(npm ls --parseable --silent "$BOILERPLATE_DOM_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_DOM_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_DOM_MODULE_PATH}/scripts/watch.sh" scripts/watch.sh
|
|
30
|
+
make_ln "${BOILERPLATE_DOM_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_DOM_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_DOM_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_DOM_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_DOM_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_DOM_MODULE_NAME/jest.config.js';
|
|
77
|
+
|
|
78
|
+
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
79
|
+
export default config;
|
|
80
|
+
EOF
|
|
81
|
+
)"
|
|
82
|
+
|
|
83
|
+
make_config stylelint.config.js "$(
|
|
84
|
+
cat <<EOF
|
|
85
|
+
import { execSync } from 'node:child_process';
|
|
86
|
+
import { resolve } from 'node:path';
|
|
87
|
+
|
|
88
|
+
/** @type {import('stylelint').Config} */
|
|
89
|
+
export default {
|
|
90
|
+
extends: [
|
|
91
|
+
resolve(
|
|
92
|
+
execSync('npm ls --parseable "$BOILERPLATE_DOM_MODULE_NAME"', {
|
|
93
|
+
encoding: 'utf8',
|
|
94
|
+
}).trim(),
|
|
95
|
+
'stylelint.config.js',
|
|
96
|
+
),
|
|
97
|
+
],
|
|
98
|
+
};
|
|
99
|
+
EOF
|
|
100
|
+
)"
|
|
101
|
+
|
|
102
|
+
make_config webpack.config.js "$(
|
|
103
|
+
cat <<EOF
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
import config from '$BOILERPLATE_DOM_MODULE_NAME/webpack.config.js';
|
|
106
|
+
|
|
107
|
+
/** @type {import('webpack').Configuration | import('webpack').WebpackOptionsNormalized} */
|
|
108
|
+
export default config;
|
|
109
|
+
EOF
|
|
110
|
+
)"
|
|
111
|
+
|
|
112
|
+
make_config tsconfig.json "$(
|
|
113
|
+
cat <<EOF
|
|
114
|
+
{
|
|
115
|
+
"compilerOptions": {
|
|
116
|
+
"outDir": "dist",
|
|
117
|
+
},
|
|
118
|
+
"extends": "$BOILERPLATE_DOM_MODULE_NAME/tsconfig.json",
|
|
119
|
+
"include": ["src/**/*"]
|
|
120
|
+
}
|
|
121
|
+
EOF
|
|
122
|
+
)"
|
|
123
|
+
|
|
124
|
+
make_config tsconfig.build.json "$(
|
|
125
|
+
cat <<EOF
|
|
126
|
+
{
|
|
127
|
+
"compilerOptions": {
|
|
128
|
+
"noEmit": false
|
|
129
|
+
},
|
|
130
|
+
"exclude": ["**/*.test.ts"],
|
|
131
|
+
"extends": "./tsconfig.json",
|
|
132
|
+
"include": ["src/**/*"]
|
|
133
|
+
}
|
|
134
|
+
EOF
|
|
135
|
+
)"
|
|
136
|
+
|
|
137
|
+
make_config tsconfig.meta.json "$(
|
|
138
|
+
cat <<EOF
|
|
139
|
+
{
|
|
140
|
+
"exclude": ["dist/**/*", "node_modules/**/*", "packages/**/*", "src/**/*"],
|
|
141
|
+
"extends": "$BOILERPLATE_DOM_MODULE_NAME/tsconfig.meta.json",
|
|
142
|
+
"include": ["**/*.js", "**/*.mjs"]
|
|
143
|
+
}
|
|
144
|
+
EOF
|
|
145
|
+
)"
|
|
146
|
+
|
|
147
|
+
make_config .gitlab-ci.yml "$(
|
|
148
|
+
cat <<EOF
|
|
149
|
+
include:
|
|
150
|
+
- project: "mrpelz/boilerplate"
|
|
151
|
+
ref: main
|
|
152
|
+
file: "/gitlab/.gitlab-ci.yml"
|
|
153
|
+
# file: "/gitlab/.monorepo.gitlab-ci.yml"
|
|
154
|
+
EOF
|
|
155
|
+
)"
|
|
156
|
+
fi
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
# shellcheck disable=SC1091
|
|
160
|
+
source "${SCRIPT_PATH}/common-post.sh"
|
|
161
|
+
|
|
162
|
+
if check_response "📂 create \"static\" directory (this will *not* overwrite/empty out existing directories)?" y; then
|
|
163
|
+
mkdir -p static
|
|
164
|
+
fi
|
|
165
|
+
|
|
166
|
+
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 \; \
|
|
13
|
+
set-option -w pane-border-status top \; \
|
|
14
|
+
set-option -w pane-border-style fg=default \; \
|
|
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_stylelint" \; \
|
|
21
|
+
set-option -p pane-border-format "stylelint (stylelint.config.js)" \; \
|
|
22
|
+
split-window -h -l 66% "make -s watch_build" \; \
|
|
23
|
+
set-option -p pane-border-format "webpack (ts-loader with tsconfig.build.json, excludes test-files)" \; \
|
|
24
|
+
split-window -h -l 50% "make -s watch_config" \; \
|
|
25
|
+
set-option -p pane-border-format "tsc (tsconfig.meta.json, checks files outside \"src\")" \; \
|
|
26
|
+
split-window -f -v -l 5 \; \
|
|
27
|
+
set-option -p pane-border-format "input" \; \
|
package/scripts/watch.sh
ADDED
|
@@ -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 \; \
|
|
13
|
+
set-option -w pane-border-status top \; \
|
|
14
|
+
set-option -w pane-border-style fg=default \; \
|
|
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_stylelint" \; \
|
|
21
|
+
set-option -p pane-border-format "stylelint (stylelint.config.js)" \; \
|
|
22
|
+
split-window -h -l 66% "make -s watch_build" \; \
|
|
23
|
+
set-option -p pane-border-format "webpack (ts-loader with tsconfig.build.json, excludes test-files)" \; \
|
|
24
|
+
split-window -h -l 50% "make -s watch_config" \; \
|
|
25
|
+
set-option -p pane-border-format "node (\"dist/main.js\")" \; \
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"moduleResolution": "NodeNext",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
},
|
|
6
|
+
"exclude": ["dist/**/*", "node_modules/**/*", "packages/**/*", "src/**/*"],
|
|
7
|
+
"extends": "@mrpelz/boilerplate-common/tsconfig.meta.json",
|
|
8
|
+
"include": ["**/*.js", "**/*.mjs"]
|
|
9
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
|
|
3
|
+
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
|
|
4
|
+
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
5
|
+
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
6
|
+
|
|
7
|
+
export const dirBase = process.cwd();
|
|
8
|
+
|
|
9
|
+
export const dirDist = resolve(dirBase, 'dist');
|
|
10
|
+
export const dirSrc = resolve(dirBase, 'src');
|
|
11
|
+
export const dirStatic = resolve(dirBase, 'static');
|
|
12
|
+
|
|
13
|
+
/** @type {import('webpack').Configuration | import('webpack').WebpackOptionsNormalized} */
|
|
14
|
+
export default {
|
|
15
|
+
devServer: {
|
|
16
|
+
compress: true,
|
|
17
|
+
magicHtml: false,
|
|
18
|
+
port: 3000,
|
|
19
|
+
static: [
|
|
20
|
+
{
|
|
21
|
+
directory: dirSrc,
|
|
22
|
+
publicPath: '/src',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
directory: dirStatic,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
devtool: 'nosources-source-map',
|
|
30
|
+
entry: [resolve(dirSrc, 'main.ts'), resolve(dirSrc, 'main.css')],
|
|
31
|
+
mode: 'production',
|
|
32
|
+
module: {
|
|
33
|
+
rules: [
|
|
34
|
+
{
|
|
35
|
+
exclude: /node_modules/,
|
|
36
|
+
test: /\.ts$/i,
|
|
37
|
+
use: [
|
|
38
|
+
{
|
|
39
|
+
loader: 'ts-loader',
|
|
40
|
+
options: {
|
|
41
|
+
configFile: resolve(dirBase, 'tsconfig.build.json'),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
test: /\.css$/i,
|
|
48
|
+
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
optimization: {
|
|
53
|
+
minimize: true,
|
|
54
|
+
minimizer: ['...', new CssMinimizerPlugin()],
|
|
55
|
+
},
|
|
56
|
+
output: {
|
|
57
|
+
clean: true,
|
|
58
|
+
devtoolModuleFilenameTemplate: '[resource-path]',
|
|
59
|
+
path: dirDist,
|
|
60
|
+
},
|
|
61
|
+
plugins: [
|
|
62
|
+
new MiniCssExtractPlugin(),
|
|
63
|
+
new HtmlWebpackPlugin({
|
|
64
|
+
// template: resolve(dirSrc, 'index.html'),
|
|
65
|
+
title: '@mrpelz/boilerplate-dom',
|
|
66
|
+
}),
|
|
67
|
+
],
|
|
68
|
+
resolve: {
|
|
69
|
+
extensions: ['.ts', '.js'],
|
|
70
|
+
},
|
|
71
|
+
};
|