@zairakai/js-dev-tools 3.20.0 → 3.21.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.
Files changed (48) hide show
  1. package/.editorconfig +6 -72
  2. package/.gitlab/ci/parts/base.yml +95 -0
  3. package/.gitlab/ci/parts/publish.yml +156 -0
  4. package/.gitlab/ci/parts/quality.yml +161 -0
  5. package/.gitlab/ci/parts/security.yml +40 -0
  6. package/.gitlab/ci/parts/updates.yml +60 -0
  7. package/.gitlab/ci/pipeline-js-app.yml +19 -38
  8. package/.gitlab/ci/pipeline-js-package.yml +23 -528
  9. package/README.md +51 -6
  10. package/config/.markdownlintignore +9 -1
  11. package/config/.prettierignore +8 -0
  12. package/config/.stylelintignore +7 -0
  13. package/config/eslint.config.js +7 -1
  14. package/config/knip.config.js +2 -2
  15. package/package.json +28 -25
  16. package/scripts/build.sh +28 -28
  17. package/scripts/ci-quality.sh +6 -6
  18. package/scripts/config.sh +164 -148
  19. package/scripts/doctor.sh +12 -12
  20. package/scripts/eslint-fix.sh +8 -8
  21. package/scripts/eslint.sh +15 -15
  22. package/scripts/install-bats.sh +143 -146
  23. package/scripts/install-hooks.sh +108 -111
  24. package/scripts/install-markdownlint.sh +4 -4
  25. package/scripts/install-shellcheck.sh +135 -138
  26. package/scripts/knip.sh +7 -7
  27. package/scripts/markdownlint.sh +38 -38
  28. package/scripts/outdated.sh +30 -29
  29. package/scripts/prettier-fix.sh +13 -13
  30. package/scripts/prettier.sh +13 -13
  31. package/scripts/setup-project.sh +691 -629
  32. package/scripts/stylelint-fix.sh +17 -17
  33. package/scripts/stylelint.sh +18 -18
  34. package/scripts/test.sh +13 -11
  35. package/scripts/typecheck.sh +11 -11
  36. package/scripts/update-dependencies.mjs +68 -68
  37. package/scripts/validate-shellcheck.sh +18 -18
  38. package/stubs/githooks/commit-msg +18 -18
  39. package/stubs/githooks/pre-commit +19 -19
  40. package/stubs/githooks/pre-push +18 -18
  41. package/stubs/githooks/prepare-commit-msg +6 -6
  42. package/stubs/gitlab-ci/gitlab-ci.yml.stub +1 -1
  43. package/stubs/governance/CONTRIBUTING.md.stub +5 -3
  44. package/stubs/quality/eslint.config.js.stub +1 -1
  45. package/stubs/quality/knip.config.js.stub +1 -1
  46. package/stubs/style/prettier.config.js.stub +3 -3
  47. package/stubs/style/stylelint.config.js.stub +1 -1
  48. package/stubs/testing/vitest.config.js.stub +1 -1
@@ -28,9 +28,9 @@ cd "$PROJECT_ROOT"
28
28
 
29
29
  # Check if make is available
30
30
  if ! command -v make &>/dev/null; then
31
- echo -e "${RED}❌ make not found - skipping quality checks${NC}"
32
- echo ""
33
- exit 0
31
+ echo -e "${RED}❌ make not found - skipping quality checks${NC}"
32
+ echo ""
33
+ exit 0
34
34
  fi
35
35
 
36
36
  # Run full quality gate (quality + tests)
@@ -38,20 +38,20 @@ echo -e "${BLUE}→${NC} Running: ${CYAN}make ci${NC}"
38
38
  echo ""
39
39
 
40
40
  if make ci; then
41
- echo ""
42
- echo -e "${GREEN}✅ All quality gates passed - push allowed${NC}"
43
- echo ""
44
- exit 0
41
+ echo ""
42
+ echo -e "${GREEN}✅ All quality gates passed - push allowed${NC}"
43
+ echo ""
44
+ exit 0
45
45
  else
46
- echo ""
47
- echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
48
- echo -e "${RED} ❌ Quality gate failed!${NC}"
49
- echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
50
- echo ""
51
- echo -e "${YELLOW}Fix issues or run local tests before pushing.${NC}"
52
- echo ""
53
- echo -e "${YELLOW}Or bypass (NOT recommended):${NC}"
54
- echo -e " ${CYAN}git push --no-verify${NC}"
55
- echo ""
56
- exit 1
46
+ echo ""
47
+ echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
48
+ echo -e "${RED} ❌ Quality gate failed!${NC}"
49
+ echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
50
+ echo ""
51
+ echo -e "${YELLOW}Fix issues or run local tests before pushing.${NC}"
52
+ echo ""
53
+ echo -e "${YELLOW}Or bypass (NOT recommended):${NC}"
54
+ echo -e " ${CYAN}git push --no-verify${NC}"
55
+ echo ""
56
+ exit 1
57
57
  fi
@@ -15,19 +15,19 @@ commit_msg_file="$1"
15
15
  commit_source="$2"
16
16
 
17
17
  case "$commit_source" in
18
- merge | squash | commit) exit 0 ;;
18
+ merge | squash | commit) exit 0 ;;
19
19
  esac
20
20
 
21
21
  branch=$(git symbolic-ref --short HEAD 2>/dev/null)
22
22
 
23
23
  # Extract the ticket from a branch named type/#NUMBER-description
24
24
  if [[ $branch =~ (feature|fix|hotfix)/#([0-9]+) ]]; then
25
- ticket="#${BASH_REMATCH[2]}"
25
+ ticket="#${BASH_REMATCH[2]}"
26
26
 
27
- if ! grep -qE "${ticket}([^0-9]|$)" "$commit_msg_file"; then
28
- sed -i.bak -E "1s/^([a-z]+(\([^)]*\))?: )/\1${ticket} /" "$commit_msg_file"
29
- rm -f "$commit_msg_file.bak"
30
- fi
27
+ if ! grep -qE "${ticket}([^0-9]|$)" "$commit_msg_file"; then
28
+ sed -i.bak -E "1s/^([a-z]+(\([^)]*\))?: )/\1${ticket} /" "$commit_msg_file"
29
+ rm -f "$commit_msg_file.bak"
30
+ fi
31
31
  fi
32
32
 
33
33
  exit 0
@@ -1,6 +1,6 @@
1
1
  # .gitlab-ci.yml
2
2
  # Generated by @zairakai/js-dev-tools setup-project.sh
3
- # Inherits the full shared template — only project-specific variables are defined here.
3
+ # Inherits the full shared template - only project-specific variables are defined here.
4
4
  #
5
5
  # To regenerate:
6
6
  # bash node_modules/@zairakai/js-dev-tools/scripts/setup-project.sh --publish=gitlab-ci --force
@@ -10,12 +10,12 @@
10
10
  | Step | Command / Action | Description |
11
11
  | :--- | :--- | :--- |
12
12
  | **1. Install** | `npm install && bash scripts/install-hooks.sh` | Install dependencies and set up git hooks. |
13
- | **2. Branch** | `git checkout -b feature/#TICKET-name` | Create a feature branch from `main`. |
13
+ | **2. Branch** | `git checkout -b feature/#TICKET-name` | Create a feature branch from `develop`. |
14
14
  | **3. Code** | *(your IDE)* | Implement your changes following quality standards. |
15
15
  | **4. Quality** | `make quality` | Run the full quality gate. |
16
16
  | **5. Test** | `make test-all` | Ensure all tests (Vitest + BATS) are passing. |
17
17
  | **6. Commit** | `git commit -m "type(scope): #TICKET subject"` | Use [Conventional Commits][git-rules] format. |
18
- | **7. Push** | `git push origin feature/#TICKET-name` | Push and open a Merge Request to `main`. |
18
+ | **7. Push** | `git push origin feature/#TICKET-name` | Push and open a Merge Request to `develop`. |
19
19
 
20
20
  ---
21
21
 
@@ -24,12 +24,14 @@
24
24
  | Command | Tool | Description |
25
25
  | :--- | :--- | :--- |
26
26
  | `make quality` | All | Full static analysis and formatting gate. |
27
+ | `make quality-fix` | All | Apply the fixes that the tools can make. |
27
28
  | `make eslint` | ESLint | Run JS/TS static analysis. |
28
29
  | `make prettier` | Prettier | Check code formatting. |
29
30
  | `make stylelint` | Stylelint | Run SCSS/CSS static analysis. |
30
31
  | `make typecheck` | TSC | Run TypeScript type checking. |
31
32
  | `make markdownlint` | Markdownlint | Validate Markdown documentation. |
32
- | `make test` | Vitest | Run unit tests with coverage. |
33
+ | `make test` | Vitest | Run the unit tests. |
34
+ | `make test-coverage` | Vitest | Run the unit tests with the coverage report (`coverage/`): 75 % at least, as the base requires. |
33
35
  | `make bats` | BATS | Run shell script integration tests. |
34
36
 
35
37
  ---
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Project ESLint configuration.
3
- * Extends the @zairakai/js-dev-tools base config — customize as needed.
3
+ * Extends the @zairakai/js-dev-tools base config - customize as needed.
4
4
  *
5
5
  * Example of adding project-specific rules:
6
6
  * export default [
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Knip configuration — extends the @zairakai/js-dev-tools base config.
2
+ * Knip configuration - extends the @zairakai/js-dev-tools base config.
3
3
  * @see https://knip.dev/reference/configuration
4
4
  */
5
5
 
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Project Prettier configuration.
3
- * Extends the @zairakai/js-dev-tools base config — customize as needed.
3
+ * Extends the @zairakai/js-dev-tools base config - customize as needed.
4
4
  *
5
- * Example of adding project-specific overrides:
5
+ * Example of adding a project-specific plugin (the formatting options stay the ones of the base):
6
6
  * import baseConfig from '@zairakai/js-dev-tools/config/prettier.config.js'
7
7
  * export default {
8
8
  * ...baseConfig,
9
- * printWidth: 100,
9
+ * plugins: [...baseConfig.plugins, 'prettier-plugin-tailwindcss'],
10
10
  * }
11
11
  */
12
12
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Project Stylelint configuration.
3
- * Extends the @zairakai/js-dev-tools base config — customize as needed.
3
+ * Extends the @zairakai/js-dev-tools base config - customize as needed.
4
4
  *
5
5
  * Example of adding project-specific rules:
6
6
  * export default {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Project Vitest configuration.
3
- * Extends the @zairakai/js-dev-tools base config — customize as needed.
3
+ * Extends the @zairakai/js-dev-tools base config - customize as needed.
4
4
  *
5
5
  * Example of adding project-specific settings (e.g. Vue plugin, jsdom):
6
6
  * import vue from '@vitejs/plugin-vue'