@mrpelz/boilerplate-preact 9.0.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,8 @@
1
+ BASE_FILE := $(shell npm ls --parseable --silent "@mrpelz/boilerplate-dom" 2>/dev/null)
2
+
3
+ include $(BASE_FILE)/Makefile
4
+
5
+ watch_lint:
6
+ nodemon --quiet --watch "**/*" --watch "src/**/*" --ignore "dist/**/*" --ignore "node_modules/**/*" --ignore "*.d.ts" --ext "js,mjs,jsx,ts,tsx" \
7
+ --exec 'clear; eslint $(ESLINT_ARGS) .'; \
8
+ exit 0;
@@ -0,0 +1,5 @@
1
+ // @ts-ignore
2
+ import config from '@mrpelz/boilerplate-dom/commitlint.config.mjs';
3
+
4
+ /** @type {import('@commitlint/types').UserConfig} */
5
+ export default config;
@@ -0,0 +1,29 @@
1
+ import {
2
+ config as configUpstream,
3
+ configMeta,
4
+ // @ts-ignore
5
+ } from '@mrpelz/boilerplate-dom/eslint.config.js';
6
+ // @ts-ignore
7
+ import pluginReactHooks from 'eslint-plugin-react-hooks';
8
+
9
+ export { configMeta };
10
+
11
+ const reactHooksRecommendedRules =
12
+ /** @type {import('eslint').Linter.RulesRecord} */ (
13
+ pluginReactHooks.configs.recommended.rules
14
+ );
15
+
16
+ /** @type {import('eslint').Linter.FlatConfig} */
17
+ export const config = {
18
+ ...configUpstream,
19
+ files: ['src/**/*.{js,jsx,ts,tsx}'],
20
+ plugins: {
21
+ ...configUpstream.plugins,
22
+ // @ts-ignore
23
+ 'react-hooks': pluginReactHooks,
24
+ },
25
+ rules: { ...configUpstream.rules, ...reactHooksRecommendedRules },
26
+ };
27
+
28
+ /** @type {import('eslint').Linter.FlatConfig[]} */
29
+ export default [configMeta, config];
package/jest.config.js ADDED
@@ -0,0 +1,13 @@
1
+ // @ts-ignore
2
+ import configUpstream from '@mrpelz/boilerplate-dom/jest.config.js';
3
+
4
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
5
+ const config = {
6
+ ...configUpstream,
7
+ moduleNameMapper: {
8
+ '^(\\./.+)\\.m?jsx?$': '$1',
9
+ },
10
+ };
11
+
12
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
13
+ export default config;
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@mrpelz/boilerplate-preact",
3
+ "version": "9.0.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/mrpelz/boilerplate.git",
7
+ "directory": "packages/boilerplate-preact"
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-preact-bootstrap": "scripts/bootstrap.sh"
17
+ },
18
+ "files": [
19
+ "dist/**/*.{js,map,ts}",
20
+ "dist/**/*.tsx",
21
+ "commitlint.config.mjs",
22
+ "eslint.config.js",
23
+ "jest.config.js",
24
+ "Makefile",
25
+ "scripts/**/*.sh",
26
+ "stylelint.config.js",
27
+ "tsconfig.json",
28
+ "tsconfig.meta.json",
29
+ "webpack.config.js"
30
+ ],
31
+ "dependencies": {
32
+ "@mrpelz/boilerplate-dom": "*",
33
+ "eslint-plugin-react-hooks": "latest",
34
+ "preact": "latest"
35
+ }
36
+ }
@@ -0,0 +1,169 @@
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
+ BOILERPLATE_PREACT_MODULE_NAME="@mrpelz/boilerplate-preact"
12
+ BOILERPLATE_PREACT_MODULE_PATH="$(realpath --relative-to=. "$(npm ls --parseable --silent "$BOILERPLATE_PREACT_MODULE_NAME" 2>/dev/null)")"
13
+
14
+ SCRIPT_PATH="${BOILERPLATE_MODULE_PATH}/scripts"
15
+ # shellcheck disable=SC1091
16
+ source "${SCRIPT_PATH}/utils.sh"
17
+
18
+ ## FLOW
19
+
20
+ # shellcheck disable=SC1091
21
+ source "${SCRIPT_PATH}/common-pre.sh"
22
+
23
+ if [[ $SKIP_FILES -ne 1 ]]; then
24
+ if check_response "🖇 install symbolic links referencing files in \"$BOILERPLATE_MODULE_NAME\" and \"$BOILERPLATE_DOM_MODULE_NAME\"?" y; then
25
+ make_ln "${BOILERPLATE_MODULE_PATH}/.editorconfig" .editorconfig
26
+
27
+ make_ln "${BOILERPLATE_MODULE_PATH}/.shellcheckrc" .shellcheckrc
28
+
29
+ make_ln "${BOILERPLATE_MODULE_PATH}/.vscode/extensions.json" .vscode/extensions.json
30
+ make_ln "${BOILERPLATE_MODULE_PATH}/.vscode/settings.json" .vscode/settings.json
31
+
32
+ make_ln "${BOILERPLATE_DOM_MODULE_PATH}/scripts/watch.sh" scripts/watch.sh
33
+ make_ln "${BOILERPLATE_DOM_MODULE_PATH}/scripts/watch-dev.sh" scripts/watch-dev.sh
34
+ fi
35
+
36
+ if check_response "📃 install bare config files extending base files in \"$BOILERPLATE_MODULE_NAME\", \"$BOILERPLATE_DOM_MODULE_NAME\" and \"$BOILERPLATE_PREACT_MODULE_PATH\"?" y; then
37
+
38
+ # no indent
39
+ make_config .gitignore "$(
40
+ cat <<EOF
41
+ .DS_Store
42
+ dist
43
+ node_modules
44
+ secrets.txt
45
+ EOF
46
+ )"
47
+
48
+ make_config Makefile "$(
49
+ cat <<EOF
50
+ BASE_FILE := \$(shell npm ls --parseable --silent "$BOILERPLATE_PREACT_MODULE_PATH" 2>/dev/null)
51
+
52
+ include \$(BASE_FILE)/Makefile
53
+ EOF
54
+ )"
55
+
56
+ make_config commitlint.config.mjs "$(
57
+ cat <<EOF
58
+ // @ts-ignore
59
+ import config from '$BOILERPLATE_PREACT_MODULE_PATH/commitlint.config.mjs';
60
+
61
+ /** @type {import('@commitlint/types').UserConfig} */
62
+ export default config;
63
+ EOF
64
+ )"
65
+
66
+ make_config eslint.config.js "$(
67
+ cat <<EOF
68
+ // @ts-ignore
69
+ import config from '$BOILERPLATE_PREACT_MODULE_PATH/eslint.config.js';
70
+
71
+ /** @type {import('eslint').Linter.FlatConfig[]} */
72
+ export default config;
73
+ EOF
74
+ )"
75
+
76
+ make_config jest.config.js "$(
77
+ cat <<EOF
78
+ // @ts-ignore
79
+ import config from '$BOILERPLATE_PREACT_MODULE_PATH/jest.config.js';
80
+
81
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
82
+ export default config;
83
+ EOF
84
+ )"
85
+
86
+ make_config stylelint.config.js "$(
87
+ cat <<EOF
88
+ import { execSync } from 'node:child_process';
89
+ import { resolve } from 'node:path';
90
+
91
+ /** @type {import('stylelint').Config} */
92
+ export default {
93
+ extends: [
94
+ resolve(
95
+ execSync('npm ls --parseable "$BOILERPLATE_PREACT_MODULE_PATH"', {
96
+ encoding: 'utf8',
97
+ }).trim(),
98
+ 'stylelint.config.js',
99
+ ),
100
+ ],
101
+ };
102
+ EOF
103
+ )"
104
+
105
+ make_config webpack.config.js "$(
106
+ cat <<EOF
107
+ // @ts-ignore
108
+ import config from '$BOILERPLATE_PREACT_MODULE_PATH/webpack.config.js';
109
+
110
+ /** @type {import('webpack').Configuration | import('webpack').WebpackOptionsNormalized} */
111
+ export default config;
112
+ EOF
113
+ )"
114
+
115
+ make_config tsconfig.json "$(
116
+ cat <<EOF
117
+ {
118
+ "compilerOptions": {
119
+ "outDir": "dist",
120
+ },
121
+ "extends": "$BOILERPLATE_PREACT_MODULE_PATH/tsconfig.json",
122
+ "include": ["src/**/*"]
123
+ }
124
+ EOF
125
+ )"
126
+
127
+ make_config tsconfig.build.json "$(
128
+ cat <<EOF
129
+ {
130
+ "compilerOptions": {
131
+ "noEmit": false
132
+ },
133
+ "exclude": ["**/*.test.ts"],
134
+ "extends": "./tsconfig.json",
135
+ "include": ["src/**/*"]
136
+ }
137
+ EOF
138
+ )"
139
+
140
+ make_config tsconfig.meta.json "$(
141
+ cat <<EOF
142
+ {
143
+ "exclude": ["dist/**/*", "node_modules/**/*", "packages/**/*", "src/**/*"],
144
+ "extends": "$BOILERPLATE_PREACT_MODULE_PATH/tsconfig.meta.json",
145
+ "include": ["**/*.js", "**/*.mjs"]
146
+ }
147
+ EOF
148
+ )"
149
+
150
+ make_config .gitlab-ci.yml "$(
151
+ cat <<EOF
152
+ include:
153
+ - project: "mrpelz/boilerplate"
154
+ ref: main
155
+ file: "/gitlab/.gitlab-ci.yml"
156
+ # file: "/gitlab/.monorepo.gitlab-ci.yml"
157
+ EOF
158
+ )"
159
+ fi
160
+ fi
161
+
162
+ # shellcheck disable=SC1091
163
+ source "${SCRIPT_PATH}/common-post.sh"
164
+
165
+ if check_response "📂 create \"static\" directory (this will *not* overwrite/empty out existing directories)?" y; then
166
+ mkdir -p static
167
+ fi
168
+
169
+ echo "✅ done"
@@ -0,0 +1,14 @@
1
+ import { execSync } from 'node:child_process';
2
+ import { resolve } from 'node:path';
3
+
4
+ /** @type {import('stylelint').Config} */
5
+ export default {
6
+ extends: [
7
+ resolve(
8
+ execSync('npm ls --parseable "@mrpelz/boilerplate-dom"', {
9
+ encoding: 'utf8',
10
+ }).trim(),
11
+ 'stylelint.config.js',
12
+ ),
13
+ ],
14
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "compilerOptions": {
3
+ "jsx": "react-jsx",
4
+ "jsxImportSource": "preact"
5
+ },
6
+ "extends": "@mrpelz/boilerplate-dom/tsconfig.json",
7
+ "include": ["src/**/*"]
8
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "exclude": ["dist/**/*", "node_modules/**/*", "packages/**/*", "src/**/*"],
3
+ "extends": "@mrpelz/boilerplate-dom/tsconfig.meta.json",
4
+ "include": ["**/*.js", "**/*.mjs"]
5
+ }
@@ -0,0 +1,26 @@
1
+ import { resolve } from 'node:path';
2
+
3
+ import config, {
4
+ dirBase,
5
+ dirSrc,
6
+ // @ts-ignore
7
+ } from '@mrpelz/boilerplate-dom/webpack.config.js';
8
+
9
+ const { entry } = config;
10
+ if (entry) entry[0] = resolve(dirSrc, 'main.tsx');
11
+
12
+ config.module?.rules?.push({
13
+ exclude: /node_modules/,
14
+ test: /\.tsx$/i,
15
+ use: [
16
+ {
17
+ loader: 'ts-loader',
18
+ options: {
19
+ configFile: resolve(dirBase, 'tsconfig.build.json'),
20
+ },
21
+ },
22
+ ],
23
+ });
24
+
25
+ /** @type {import('webpack').Configuration | import('webpack').WebpackOptionsNormalized} */
26
+ export default config;