Skip to content

Commit 03be46a

Browse files
committed
Switched to modern tools
1 parent ed8b9c9 commit 03be46a

4 files changed

Lines changed: 194 additions & 80 deletions

File tree

.husky/_/pre-commit

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/sh
2+
3+
if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
4+
set -x
5+
fi
6+
7+
if [ "$LEFTHOOK" = "0" ]; then
8+
exit 0
9+
fi
10+
11+
call_lefthook()
12+
{
13+
if test -n "$LEFTHOOK_BIN"
14+
then
15+
"$LEFTHOOK_BIN" "$@"
16+
elif lefthook.exe -h >/dev/null 2>&1
17+
then
18+
lefthook.exe "$@"
19+
elif lefthook.bat -h >/dev/null 2>&1
20+
then
21+
lefthook.bat "$@"
22+
else
23+
dir="$(git rev-parse --show-toplevel)"
24+
osArch=$(uname | tr '[:upper:]' '[:lower:]')
25+
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
26+
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe"
27+
then
28+
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" "$@"
29+
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe"
30+
then
31+
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" "$@"
32+
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe"
33+
then
34+
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" "$@"
35+
elif test -f "$dir/node_modules/lefthook/bin/index.js"
36+
then
37+
"$dir/node_modules/lefthook/bin/index.js" "$@"
38+
39+
elif bundle exec lefthook -h >/dev/null 2>&1
40+
then
41+
bundle exec lefthook "$@"
42+
elif yarn lefthook -h >/dev/null 2>&1
43+
then
44+
yarn lefthook "$@"
45+
elif pnpm lefthook -h >/dev/null 2>&1
46+
then
47+
pnpm lefthook "$@"
48+
elif swift package plugin lefthook >/dev/null 2>&1
49+
then
50+
swift package --disable-sandbox plugin lefthook "$@"
51+
elif command -v mint >/dev/null 2>&1
52+
then
53+
mint run csjones/lefthook-plugin "$@"
54+
elif command -v npx >/dev/null 2>&1
55+
then
56+
npx lefthook "$@"
57+
else
58+
echo "Can't find lefthook in PATH"
59+
fi
60+
fi
61+
}
62+
63+
call_lefthook run "pre-commit" "$@"

.husky/_/prepare-commit-msg

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/sh
2+
3+
if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
4+
set -x
5+
fi
6+
7+
if [ "$LEFTHOOK" = "0" ]; then
8+
exit 0
9+
fi
10+
11+
call_lefthook()
12+
{
13+
if test -n "$LEFTHOOK_BIN"
14+
then
15+
"$LEFTHOOK_BIN" "$@"
16+
elif lefthook.exe -h >/dev/null 2>&1
17+
then
18+
lefthook.exe "$@"
19+
elif lefthook.bat -h >/dev/null 2>&1
20+
then
21+
lefthook.bat "$@"
22+
else
23+
dir="$(git rev-parse --show-toplevel)"
24+
osArch=$(uname | tr '[:upper:]' '[:lower:]')
25+
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
26+
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe"
27+
then
28+
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" "$@"
29+
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe"
30+
then
31+
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" "$@"
32+
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe"
33+
then
34+
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" "$@"
35+
elif test -f "$dir/node_modules/lefthook/bin/index.js"
36+
then
37+
"$dir/node_modules/lefthook/bin/index.js" "$@"
38+
39+
elif bundle exec lefthook -h >/dev/null 2>&1
40+
then
41+
bundle exec lefthook "$@"
42+
elif yarn lefthook -h >/dev/null 2>&1
43+
then
44+
yarn lefthook "$@"
45+
elif pnpm lefthook -h >/dev/null 2>&1
46+
then
47+
pnpm lefthook "$@"
48+
elif swift package plugin lefthook >/dev/null 2>&1
49+
then
50+
swift package --disable-sandbox plugin lefthook "$@"
51+
elif command -v mint >/dev/null 2>&1
52+
then
53+
mint run csjones/lefthook-plugin "$@"
54+
elif command -v npx >/dev/null 2>&1
55+
then
56+
npx lefthook "$@"
57+
else
58+
echo "Can't find lefthook in PATH"
59+
fi
60+
fi
61+
}
62+
63+
call_lefthook run "prepare-commit-msg" "$@"

package-lock.json

Lines changed: 3 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 65 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,66 @@
11
{
2-
"name": "open-source-stack",
3-
"version": "1.0.0",
4-
"description": "Minimal open-source stack to help you ship an open-source package in TS",
5-
"main": "./dist/index.js",
6-
"module": "./dist/index.mjs",
7-
"types": "./dist/index.d.mts",
8-
"exports": {
9-
".": {
10-
"import": {
11-
"import": "./dist/index.mjs",
12-
"default": "./dist/index.mjs",
13-
"types": "./dist/index.d.mts"
14-
},
15-
"require": {
16-
"import": "./dist/index.js",
17-
"require": "./dist/index.js",
18-
"default": "./dist/index.js",
19-
"types": "./dist/index.d.ts"
20-
}
21-
}
22-
},
23-
"scripts": {
24-
"test": "vitest run",
25-
"test:cov": "vitest run --coverage",
26-
"build": "tsup src/index.ts --dts --format esm,cjs --outDir dist --minify --clean",
27-
"remix:dev": "npm run dev -w test-apps/remix-vite",
28-
"remix:cjs:dev": "npm run dev -w test-apps/remix-vite-cjs",
29-
"build:dev": "tsup src/index.ts --dts --format cjs,esm --outDir dist",
30-
"build:dev:watch": "npm run build:dev -- --watch",
31-
"build:dev:cjs:watch": "npm run build:dev -- --watch",
32-
"dev": "npm-run-all -s build:dev -p remix:dev build:dev:watch",
33-
"dev:cjs": "npm-run-all -s build:dev -p remix:cjs:dev build:dev:cjs:watch",
34-
"prepublishOnly": "npm run build",
35-
"check": "biome check .",
36-
"check:fix": "biome check --fix .",
37-
"tsc": "tsc",
38-
"validate": "npm run check && npm run tsc && npm run test"
39-
},
40-
"author": "",
41-
"license": "ISC",
42-
"repository": {
43-
"type": "git",
44-
"url": "git+https://github.com/forge42dev/open-source-stack.git"
45-
},
46-
"bugs": {
47-
"url": "https://github.com/forge42dev/open-source-stack/issues"
48-
},
49-
"files": [
50-
"dist"
51-
],
52-
"workspaces": [
53-
".",
54-
"test-apps/*"
55-
],
56-
"homepage": "https://github.com/forge42dev/open-source-stack#readme",
57-
"devDependencies": {
58-
"@biomejs/biome": "^1.8.3",
59-
"@types/node": "^20.12.7",
60-
"@vitest/coverage-v8": "^1.5.2",
61-
"happy-dom": "^14.7.1",
62-
"lefthook": "^1.7.2",
63-
"npm-run-all": "^4.1.5",
64-
"tsup": "^8.0.2",
65-
"typescript": "^5.4.5",
66-
"vitest": "^1.5.2"
67-
}
68-
}
2+
"name": "open-source-stack",
3+
"version": "1.0.0",
4+
"description": "Minimal open-source stack to help you ship an open-source package in TS",
5+
"main": "./dist/index.js",
6+
"module": "./dist/index.mjs",
7+
"types": "./dist/index.d.mts",
8+
"exports": {
9+
".": {
10+
"import": {
11+
"import": "./dist/index.mjs",
12+
"default": "./dist/index.mjs",
13+
"types": "./dist/index.d.mts"
14+
},
15+
"require": {
16+
"import": "./dist/index.js",
17+
"require": "./dist/index.js",
18+
"default": "./dist/index.js",
19+
"types": "./dist/index.d.ts"
20+
}
21+
}
22+
},
23+
"scripts": {
24+
"test": "vitest run",
25+
"test:cov": "vitest run --coverage",
26+
"build": "tsup src/index.ts --dts --format esm,cjs --outDir dist --minify --clean",
27+
"remix:dev": "npm run dev -w test-apps/remix-vite",
28+
"remix:cjs:dev": "npm run dev -w test-apps/remix-vite-cjs",
29+
"build:dev": "tsup src/index.ts --dts --format cjs,esm --outDir dist",
30+
"build:dev:watch": "npm run build:dev -- --watch",
31+
"build:dev:cjs:watch": "npm run build:dev -- --watch",
32+
"dev": "npm-run-all -s build:dev -p remix:dev build:dev:watch",
33+
"dev:cjs": "npm-run-all -s build:dev -p remix:cjs:dev build:dev:cjs:watch",
34+
"prepublishOnly": "npm run build",
35+
"check": "biome check .",
36+
"check:fix": "biome check --fix .",
37+
"typecheck": "tsc",
38+
"validate": "npm run check && npm run tsc && npm run test"
39+
},
40+
"author": "",
41+
"license": "ISC",
42+
"repository": {
43+
"type": "git",
44+
"url": "git+https://github.com/forge42dev/open-source-stack.git"
45+
},
46+
"bugs": {
47+
"url": "https://github.com/forge42dev/open-source-stack/issues"
48+
},
49+
"files": ["dist"],
50+
"workspaces": [".", "test-apps/*"],
51+
"homepage": "https://github.com/forge42dev/open-source-stack#readme",
52+
"devDependencies": {
53+
"@biomejs/biome": "^1.8.3",
54+
"@types/node": "^20.12.7",
55+
"@vitest/coverage-v8": "^1.5.2",
56+
"happy-dom": "^14.7.1",
57+
"lefthook": "^1.7.2",
58+
"npm-run-all": "^4.1.5",
59+
"tsup": "^8.0.2",
60+
"typescript": "^5.4.5",
61+
"vitest": "^1.5.2"
62+
},
63+
"optionalDependencies": {
64+
"@rollup/rollup-linux-x64-gnu": "^4.18.1"
65+
}
66+
}

0 commit comments

Comments
 (0)