@zairakai/js-dev-tools 1.4.4 → 2.1.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/package.json +4 -4
- package/scripts/config.sh +53 -0
- package/scripts/eslint-fix.sh +1 -0
- package/scripts/eslint.sh +1 -0
- package/scripts/knip.sh +1 -0
- package/scripts/outdated.sh +1 -0
- package/scripts/prettier-fix.sh +1 -0
- package/scripts/prettier.sh +1 -0
- package/scripts/stylelint-fix.sh +1 -0
- package/scripts/stylelint.sh +1 -0
- package/scripts/test.sh +1 -0
- package/scripts/typecheck.sh +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zairakai/js-dev-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "The unified and centralized development toolkit for JavaScript/TypeScript projects - ESLint, Prettier, Stylelint, Knip, Vitest, Git Hooks, and GitLab CI pipeline templates",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dev-tools",
|
|
@@ -102,8 +102,8 @@
|
|
|
102
102
|
"prettier-plugin-blade": "^2.1.0",
|
|
103
103
|
"prettier-plugin-organize-imports": "^4.0.0",
|
|
104
104
|
"stylelint": "^17.8.0",
|
|
105
|
-
"stylelint-config-html": "^
|
|
106
|
-
"stylelint-config-recommended-vue": "^
|
|
105
|
+
"stylelint-config-html": "^2.0.0",
|
|
106
|
+
"stylelint-config-recommended-vue": "^2.0.0",
|
|
107
107
|
"stylelint-config-standard": "^40.0.0",
|
|
108
108
|
"stylelint-config-standard-scss": "^17.0.0",
|
|
109
109
|
"stylelint-order": "^8.0.0",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@vitest/coverage-v8": "^4.1.4",
|
|
115
115
|
"knip": "^6.4.1",
|
|
116
|
-
"sort-package-json": "^
|
|
116
|
+
"sort-package-json": "^4.0.0",
|
|
117
117
|
"typescript": "^6.0.3",
|
|
118
118
|
"vitest": "^4.1.4",
|
|
119
119
|
"zod": "^4.0.0"
|
package/scripts/config.sh
CHANGED
|
@@ -43,6 +43,59 @@ detect_project_type() {
|
|
|
43
43
|
PROJECT_TYPE="$(detect_project_type)"
|
|
44
44
|
export PROJECT_TYPE
|
|
45
45
|
|
|
46
|
+
# ─── DOCKER AUTO-DISPATCH ──────────────────────────────────────────────────────
|
|
47
|
+
# Tool scripts that need a real Node runtime (eslint, prettier, stylelint, knip,
|
|
48
|
+
# tsc/vue-tsc, vitest, npm outdated) call maybe_dockerize right after sourcing
|
|
49
|
+
# this file. When a docker-compose stack is already running for this project,
|
|
50
|
+
# the script transparently re-execs itself inside the "node" service instead of
|
|
51
|
+
# depending on whatever Node happens to be on the host.
|
|
52
|
+
#
|
|
53
|
+
# Utility scripts (doctor.sh, install-hooks.sh, git-*.sh, setup-project.sh) never
|
|
54
|
+
# call this — they inspect or act on the host on purpose and must keep doing so.
|
|
55
|
+
#
|
|
56
|
+
# Opt out with DEV_TOOLS_NO_DOCKER=true. Override target service/mount with
|
|
57
|
+
# DEV_TOOLS_NODE_SERVICE / DEV_TOOLS_NODE_SERVICE_MOUNT if a project's compose
|
|
58
|
+
# file diverges from the "node" / "/app" convention.
|
|
59
|
+
DEV_TOOLS_DOCKER_ENV_VARS=(CI COVERAGE)
|
|
60
|
+
|
|
61
|
+
maybe_dockerize() {
|
|
62
|
+
local script_path="$1"
|
|
63
|
+
shift
|
|
64
|
+
|
|
65
|
+
# Already running inside a container — nothing to dispatch.
|
|
66
|
+
[[ -f /.dockerenv ]] && return 0
|
|
67
|
+
|
|
68
|
+
# Explicit opt-out.
|
|
69
|
+
[[ "${DEV_TOOLS_NO_DOCKER:-false}" == "true" ]] && return 0
|
|
70
|
+
|
|
71
|
+
# CI runners execute inside a single job image, not this dev compose stack.
|
|
72
|
+
[[ "${CI:-false}" == "true" || "${GITLAB_CI:-false}" == "true" ]] && return 0
|
|
73
|
+
|
|
74
|
+
command -v docker >/dev/null 2>&1 || return 0
|
|
75
|
+
[[ -f "${PROJECT_ROOT}/docker-compose.yml" ]] || return 0
|
|
76
|
+
|
|
77
|
+
local service="${DEV_TOOLS_NODE_SERVICE:-node}"
|
|
78
|
+
local mount="${DEV_TOOLS_NODE_SERVICE_MOUNT:-/app}"
|
|
79
|
+
|
|
80
|
+
# Only dispatch when the target service is already running — never start
|
|
81
|
+
# it as a side effect of running a quality check.
|
|
82
|
+
if ! (cd "$PROJECT_ROOT" && docker compose ps --status running --services 2>/dev/null | grep -qx "$service"); then
|
|
83
|
+
return 0
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
local rel_script="${script_path#"${PROJECT_ROOT}"/}"
|
|
87
|
+
local env_flags=()
|
|
88
|
+
local var
|
|
89
|
+
for var in "${DEV_TOOLS_DOCKER_ENV_VARS[@]}"; do
|
|
90
|
+
[[ -n "${!var:-}" ]] && env_flags+=(-e "$var")
|
|
91
|
+
done
|
|
92
|
+
|
|
93
|
+
log_step "Dispatching to '${service}' container..."
|
|
94
|
+
cd "$PROJECT_ROOT"
|
|
95
|
+
exec docker compose exec -T "${env_flags[@]}" "$service" bash "${mount}/${rel_script}" "$@"
|
|
96
|
+
}
|
|
97
|
+
export -f maybe_dockerize
|
|
98
|
+
|
|
46
99
|
# ─── BINARY PATHS ─────────────────────────────────────────────────────────────
|
|
47
100
|
BIN_DIR="${PROJECT_ROOT}/node_modules/.bin"
|
|
48
101
|
export ESLINT_BIN="${BIN_DIR}/eslint"
|
package/scripts/eslint-fix.sh
CHANGED
package/scripts/eslint.sh
CHANGED
package/scripts/knip.sh
CHANGED
package/scripts/outdated.sh
CHANGED
package/scripts/prettier-fix.sh
CHANGED
package/scripts/prettier.sh
CHANGED
package/scripts/stylelint-fix.sh
CHANGED
package/scripts/stylelint.sh
CHANGED
package/scripts/test.sh
CHANGED
package/scripts/typecheck.sh
CHANGED