@zairakai/js-dev-tools 1.1.0 → 1.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.
|
@@ -41,6 +41,7 @@ include:
|
|
|
41
41
|
workflow:
|
|
42
42
|
rules:
|
|
43
43
|
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
|
|
44
|
+
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
44
45
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_MERGE_REQUEST_ID
|
|
45
46
|
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "develop"
|
|
46
47
|
- if: $CI_COMMIT_REF_NAME =~ /^feature\// || $CI_COMMIT_REF_NAME =~ /^fix\// || $CI_COMMIT_REF_NAME =~ /^hotfix\//
|
|
@@ -240,6 +241,8 @@ js:quality:bats:
|
|
|
240
241
|
js:quality:outdated:
|
|
241
242
|
<<: *job_node
|
|
242
243
|
stage: quality
|
|
244
|
+
rules:
|
|
245
|
+
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
243
246
|
script:
|
|
244
247
|
- bash "$DEV_TOOLS_SCRIPTS/outdated.sh"
|
|
245
248
|
artifacts:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zairakai/js-dev-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.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",
|
package/scripts/setup-project.sh
CHANGED
|
@@ -633,6 +633,70 @@ do_publish() {
|
|
|
633
633
|
done
|
|
634
634
|
}
|
|
635
635
|
|
|
636
|
+
# ============================================================================
|
|
637
|
+
# GitLab CI — Ref Synchronizer
|
|
638
|
+
# Mirrors GitlabCiSynchronizer.php from laravel-dev-tools.
|
|
639
|
+
# Runs on every postinstall (npm install / npm update).
|
|
640
|
+
# Reads the installed version of @zairakai/js-dev-tools and updates the
|
|
641
|
+
# ref: in the project's .gitlab-ci.yml if it is out of sync.
|
|
642
|
+
# ============================================================================
|
|
643
|
+
|
|
644
|
+
sync_gitlab_ci_ref() {
|
|
645
|
+
local gitlab_ci="${PROJECT_ROOT}/.gitlab-ci.yml"
|
|
646
|
+
local gitlab_project="zairakai/npm-packages/js-dev-tools"
|
|
647
|
+
|
|
648
|
+
[[ -f "$gitlab_ci" ]] || return 0
|
|
649
|
+
grep -qF "$gitlab_project" "$gitlab_ci" || return 0
|
|
650
|
+
|
|
651
|
+
# Resolve installed version from the package's own package.json
|
|
652
|
+
local installed_version
|
|
653
|
+
installed_version="$(node -e "try{const p=require('${DEV_TOOLS_ROOT}/package.json');console.log('v'+(p.version||'').replace(/^v/,''))}catch(e){}" 2>/dev/null || echo "")"
|
|
654
|
+
|
|
655
|
+
[[ -n "$installed_version" ]] || return 0
|
|
656
|
+
|
|
657
|
+
# Extract the current ref: value inside the js-dev-tools include block
|
|
658
|
+
local in_block=false found_project=false current_ref=""
|
|
659
|
+
while IFS= read -r line; do
|
|
660
|
+
local trimmed="${line#"${line%%[![:space:]]*}"}" # ltrim
|
|
661
|
+
|
|
662
|
+
if [[ "$trimmed" == "include:" ]]; then
|
|
663
|
+
in_block=true
|
|
664
|
+
continue
|
|
665
|
+
fi
|
|
666
|
+
|
|
667
|
+
if [[ "$in_block" == true ]]; then
|
|
668
|
+
# Exit block on non-indented, non-list line
|
|
669
|
+
if [[ -n "$trimmed" ]] && [[ "$line" != " "* ]] && [[ "$line" != "-"* ]]; then
|
|
670
|
+
in_block=false
|
|
671
|
+
found_project=false
|
|
672
|
+
fi
|
|
673
|
+
|
|
674
|
+
if [[ "$found_project" == false ]] && [[ "$trimmed" == *"$gitlab_project"* ]]; then
|
|
675
|
+
found_project=true
|
|
676
|
+
continue
|
|
677
|
+
fi
|
|
678
|
+
|
|
679
|
+
if [[ "$found_project" == true ]] && [[ "$trimmed" == ref:* ]]; then
|
|
680
|
+
current_ref="${trimmed#ref:}"
|
|
681
|
+
current_ref="${current_ref#"${current_ref%%[![:space:]]*}"}" # ltrim
|
|
682
|
+
current_ref="${current_ref//\'/}"
|
|
683
|
+
current_ref="${current_ref//\"/}"
|
|
684
|
+
break
|
|
685
|
+
fi
|
|
686
|
+
fi
|
|
687
|
+
done < "$gitlab_ci"
|
|
688
|
+
|
|
689
|
+
[[ -n "$current_ref" ]] || return 0
|
|
690
|
+
[[ "$current_ref" != "$installed_version" ]] || return 0
|
|
691
|
+
|
|
692
|
+
# Auto-fix: replace the ref
|
|
693
|
+
if sed -i "s|ref: ${current_ref}|ref: ${installed_version}|" "$gitlab_ci"; then
|
|
694
|
+
echo " dev-tools: .gitlab-ci.yml ref ${current_ref} → ${installed_version}"
|
|
695
|
+
else
|
|
696
|
+
echo " dev-tools: WARNING — could not update .gitlab-ci.yml ref (manual fix needed)" >&2
|
|
697
|
+
fi
|
|
698
|
+
}
|
|
699
|
+
|
|
636
700
|
# ============================================================================
|
|
637
701
|
# Makefile Setup
|
|
638
702
|
# ============================================================================
|
|
@@ -789,6 +853,9 @@ setup_project() {
|
|
|
789
853
|
"config/dev-tools/eslint.config.js"
|
|
790
854
|
fi
|
|
791
855
|
|
|
856
|
+
# ─── GitLab CI ref sync ───────────────────────────────────────────────────
|
|
857
|
+
sync_gitlab_ci_ref
|
|
858
|
+
|
|
792
859
|
# ─── Summary ─────────────────────────────────────────────────────────────
|
|
793
860
|
if [[ "$SILENT_MODE" == "true" ]]; then
|
|
794
861
|
check_optional_deps
|