@blundergoat/gruff-ts 0.3.0 → 0.3.2

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.
@@ -608,6 +608,10 @@ ${"test"}("magic assertion", () => {
608
608
  expect(total).toBe(42);
609
609
  });
610
610
 
611
+ ${"test"}("static shape assertion", () => {
612
+ assert.equal(typeof renderCatalogue, "function");
613
+ });
614
+
611
615
  ${"test"}("unused mock", () => {
612
616
  const unusedMock = jest.fn();
613
617
  assert.ok(true);
@@ -658,7 +662,6 @@ function catalogueCoverageOptions(): AnalyseProjectOptions {
658
662
  "size.file-length": { threshold: 8, severity: "warning" },
659
663
  "size.function-length": { threshold: 8, severity: "warning" },
660
664
  "size.parameter-count": { threshold: 3, severity: "warning" },
661
- "test-quality.setup-bloat": { threshold: 2, severity: "advisory" },
662
665
  },
663
666
  },
664
667
  };
package/src/types.ts CHANGED
@@ -25,7 +25,7 @@ export type OutputFormat = "text" | "json" | "html" | "markdown" | "github" | "h
25
25
  export type FailThreshold = "none" | "advisory" | "warning" | "error";
26
26
 
27
27
  /** Changed-region filter precision for diff-aware analysis. */
28
- export type ChangedScopeMode = "symbol" | "hunk";
28
+ export type ChangedScopeMode = "symbol" | "hunk" | "file";
29
29
 
30
30
  /** Public options contract consumed by the analyzer core and CLI. */
31
31
  export interface AnalysisOptions {
@@ -143,6 +143,7 @@ export interface Finding {
143
143
  remediation?: string;
144
144
  metadata: Record<string, unknown>;
145
145
  fingerprint: string;
146
+ stableIdentity: string;
146
147
  }
147
148
 
148
149
  /** Non-finding runtime diagnostic emitted while preparing or reading inputs. */
package/docs/releasing.md DELETED
@@ -1,106 +0,0 @@
1
- # Releasing
2
-
3
- This checklist prepares public `@blundergoat/gruff-ts@0.3.x` patch releases.
4
- Current release line: `0.3.0`.
5
-
6
- ## Bump The Version
7
-
8
- `scripts/bump-version.sh <semver>` updates `package.json`,
9
- `package-lock.json`, and `src/constants.ts` together so the CLI `--version`
10
- output and the published `@blundergoat/gruff-ts` package version cannot drift
11
- apart. For a no-op release (e.g. fixes folded into the current dated version),
12
- the version should already match; use `--check` instead of bumping unless the
13
- release version changes.
14
-
15
- ```bash
16
- scripts/bump-version.sh --check
17
- scripts/bump-version.sh 0.3.1
18
- scripts/bump-version.sh --check
19
- ```
20
-
21
- The script edits files in place and does not commit or tag. After running it,
22
- update `CHANGELOG.md` and run `npm run check`.
23
-
24
- ## Before Publishing
25
-
26
- - [ ] `scripts/bump-version.sh --check` reports the intended version.
27
- - [ ] `CHANGELOG.md` has an entry for the new version with today's date.
28
- - [ ] `README.md`, `CONTRIBUTING.md`, `SECURITY.md`, and docs under `docs/`
29
- reflect any user-visible changes.
30
- - [ ] `.goat-flow/tasks/0.3.0/` has no unresolved release blockers beyond
31
- explicitly accepted `human-verification-pending` milestones.
32
- - [ ] `LICENSE` is present and `package.json` `license` field matches.
33
- - [ ] `npm run check` passes.
34
- - [ ] `scripts/preflight-checks.sh` passes (checks version lockstep, runs
35
- `npm audit --audit-level=moderate`, `npm run check`, a full `gruff-ts`
36
- self-scan, and `shellcheck` on `scripts/*.sh` when `shellcheck` is
37
- installed).
38
- - [ ] `npm pack --dry-run` shows only publishable runtime, docs, scripts, and
39
- metadata files.
40
- - [ ] Local smoke scan succeeds:
41
-
42
- ```bash
43
- ./bin/gruff-ts
44
- ./bin/gruff-ts analyse fixtures/sample.ts --fail-on=none
45
- ./bin/gruff-ts summary fixtures/sample.ts --fail-on=none
46
- ./bin/gruff-ts report fixtures/sample.ts --output /tmp/gruff-ts-report.html
47
- ./bin/gruff-ts list-rules
48
- ```
49
-
50
- ## Package Review
51
-
52
- Preview `@blundergoat/gruff-ts` package contents:
53
-
54
- ```bash
55
- npm pack --dry-run
56
- ```
57
-
58
- The package should include:
59
-
60
- - `bin/gruff-ts`
61
- - `src/` (all runtime `.ts` files; `src/**/*.test.ts` files are excluded by
62
- `.npmignore`)
63
- - `scripts/` (`bump-version.sh`, `check.sh`, `dependency-install.sh`,
64
- `dependency-update.sh`, `preflight-checks.sh`, `npm-publish.sh`,
65
- `start-dev.sh`, `test-performance.sh`)
66
- - `fixtures/sample.ts`
67
- - `README.md`
68
- - `CHANGELOG.md`
69
- - `CONTRIBUTING.md`
70
- - `SECURITY.md`
71
- - `LICENSE`
72
- - `docs/`
73
- - `package.json`
74
- - `tsconfig.json`
75
-
76
- The package must exclude:
77
-
78
- - `node_modules/`
79
- - `coverage/`
80
- - `.agents/`, `.claude/`, `.codex/`, `.github/`, and `.goat-flow/`
81
- - `AGENTS.md` and `CLAUDE.md`
82
- - `.gruff-ts.yaml` (this repo's local config)
83
- - env and secret files (`.env`, `.env.*` except `.env.example`)
84
- - local scratchpad or log artifacts
85
- - `src/**/*.test.ts`
86
-
87
- ## Publish
88
-
89
- ```bash
90
- bash scripts/npm-publish.sh
91
- ```
92
-
93
- The script verifies npm auth, checks version lockstep, runs
94
- `scripts/preflight-checks.sh`, prints an `npm publish --dry-run` summary, and
95
- prompts before publishing.
96
-
97
- ## After Publishing
98
-
99
- - [ ] Install `@blundergoat/gruff-ts` in a temporary project.
100
- - [ ] Run `gruff-ts --help`.
101
- - [ ] Run `gruff-ts analyse . --fail-on=none`.
102
- - [ ] Run `gruff-ts summary . --fail-on=none`.
103
- - [ ] Run `gruff-ts list-rules`.
104
- - [ ] Verify `README.md` install instructions from a clean checkout.
105
- - [ ] Tag the release in git (`git tag v0.3.0 && git push --tags`) and create
106
- or update public release notes from `CHANGELOG.md`.
@@ -1,21 +0,0 @@
1
- export class SampleAnalyzer {
2
- public name = "demo";
3
- private secretUrl = "mysql://demo:password123@example.test/app";
4
-
5
- public process(a: boolean, b: string[], c: string, d: string, e: string, f: string): void {
6
- if (a) {
7
- for (const item of b) {
8
- if (item === c) {
9
- eval(item);
10
- }
11
- }
12
- }
13
-
14
- const apiKey = "AKIA1111111111111111";
15
- console.log(apiKey, this.secretUrl, d, e, f);
16
- }
17
- }
18
-
19
- test("sleeps without assertion", async () => {
20
- await new Promise((resolve) => setTimeout(resolve, 1));
21
- });
@@ -1,210 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- # Bump gruff-ts to a new semver in package.json, package-lock.json, and src/constants.ts.
5
- # The CLI surfaces VERSION from src/constants.ts; package metadata drives `npm publish`.
6
- # Keeping all release version surfaces in lockstep is a release invariant.
7
-
8
- usage() {
9
- cat <<'USAGE'
10
- Usage:
11
- scripts/bump-version.sh <new-version>
12
- scripts/bump-version.sh --check
13
-
14
- Arguments:
15
- <new-version> Target semver, e.g. 0.1.1, 0.2.0, 0.3.0-rc.1.
16
-
17
- Options:
18
- --check Verify package.json, package-lock.json, src/constants.ts, and CHANGELOG.md
19
- already agree on the same version.
20
- --help, -h Show this help.
21
-
22
- Notes:
23
- Edits files in place. Does not commit or tag. Run `npm run check` afterwards.
24
- USAGE
25
- }
26
-
27
- die() {
28
- printf 'bump-version: %s\n' "$*" >&2
29
- exit 1
30
- }
31
-
32
- repo_root() {
33
- local script_dir
34
- script_dir="$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
35
- CDPATH='' cd -- "$script_dir/.." && pwd
36
- }
37
-
38
- read_package_version() {
39
- awk -F'"' '/^[[:space:]]*"version"[[:space:]]*:/ { print $4; exit }' package.json
40
- }
41
-
42
- read_constants_version() {
43
- awk -F'"' '/^const VERSION = "/ { print $2; exit }' src/constants.ts
44
- }
45
-
46
- read_package_lock_version() {
47
- node -e 'const fs = require("node:fs"); const data = JSON.parse(fs.readFileSync("package-lock.json", "utf8")); process.stdout.write(String(data.version ?? ""));'
48
- }
49
-
50
- read_package_lock_package_version() {
51
- node -e 'const fs = require("node:fs"); const data = JSON.parse(fs.readFileSync("package-lock.json", "utf8")); process.stdout.write(String(data.packages?.[""]?.version ?? ""));'
52
- }
53
-
54
- read_changelog_latest_version() {
55
- # POSIX awk: avoid gawk's 3-argument match() so this still parses under mawk/BSD awk.
56
- # Matches the themed-narrative heading style `## v<semver> - YYYY-MM-DD`. The leading `v` and
57
- # the digit lookahead filter out any non-version headings (e.g. a hypothetical `## Unreleased`
58
- # block above the latest release).
59
- awk '/^##[[:space:]]+v[0-9]/ { sub(/^##[[:space:]]+v/, ""); sub(/[[:space:]].*$/, ""); print; exit }' CHANGELOG.md
60
- }
61
-
62
- write_package_version() {
63
- local next_version="$1"
64
- awk -v target="$next_version" '
65
- BEGIN { done = 0 }
66
- /^[[:space:]]*"version"[[:space:]]*:/ && !done {
67
- sub(/"version"[[:space:]]*:[[:space:]]*"[^"]+"/, "\"version\": \"" target "\"")
68
- done = 1
69
- }
70
- { print }
71
- ' package.json > package.json.tmp
72
- mv package.json.tmp package.json
73
- }
74
-
75
- write_constants_version() {
76
- local next_version="$1"
77
- awk -v target="$next_version" '
78
- BEGIN { done = 0 }
79
- /^const VERSION = "/ && !done {
80
- print "const VERSION = \"" target "\";"
81
- done = 1
82
- next
83
- }
84
- { print }
85
- ' src/constants.ts > src/constants.ts.tmp
86
- mv src/constants.ts.tmp src/constants.ts
87
- }
88
-
89
- write_package_lock_version() {
90
- local next_version="$1"
91
- node - "$next_version" <<'NODE'
92
- const fs = require("node:fs");
93
-
94
- const target = process.argv[2];
95
- const lockPath = "package-lock.json";
96
- const lock = JSON.parse(fs.readFileSync(lockPath, "utf8"));
97
-
98
- lock.version = target;
99
- if (!lock.packages || typeof lock.packages !== "object" || !lock.packages[""]) {
100
- throw new Error('package-lock.json missing packages[""] root package entry');
101
- }
102
- lock.packages[""].version = target;
103
-
104
- fs.writeFileSync(`${lockPath}.tmp`, `${JSON.stringify(lock, null, 2)}\n`);
105
- NODE
106
- mv package-lock.json.tmp package-lock.json
107
- }
108
-
109
- validate_semver() {
110
- local value="$1"
111
- # Standard semver: MAJOR.MINOR.PATCH with optional prerelease/build metadata.
112
- local pattern='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)(\.(0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*))?(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$'
113
- [[ "$value" =~ $pattern ]] || die "not a valid semver: $value"
114
- }
115
-
116
- check_version_lockstep() {
117
- local pkg const_ lock lock_package changelog
118
- pkg="$(read_package_version)" || die "failed to read package.json version"
119
- const_="$(read_constants_version)" || die "failed to read src/constants.ts VERSION"
120
- lock="$(read_package_lock_version)" || die "failed to read package-lock.json root version"
121
- lock_package="$(read_package_lock_package_version)" || die "failed to read package-lock.json package version"
122
- [[ -n "$pkg" ]] || die "package.json has no \"version\" field"
123
- [[ -n "$const_" ]] || die "src/constants.ts has no VERSION constant"
124
- [[ -n "$lock" ]] || die "package-lock.json has no root \"version\" field"
125
- [[ -n "$lock_package" ]] || die 'package-lock.json has no packages[""].version field'
126
- if ! [[ "$pkg" == "$const_" && "$pkg" == "$lock" && "$pkg" == "$lock_package" ]]; then
127
- printf 'version surfaces disagree: package.json=%s src/constants.ts=%s package-lock.json=%s package-lock.json packages[""]=%s\n' "$pkg" "$const_" "$lock" "$lock_package" >&2
128
- exit 1
129
- fi
130
- [[ -f CHANGELOG.md ]] || die "CHANGELOG.md not found"
131
- changelog="$(read_changelog_latest_version)" || die "failed to read CHANGELOG.md latest version"
132
- [[ -n "$changelog" ]] || die "CHANGELOG.md has no '## [version]' heading"
133
- if [[ "$pkg" != "$changelog" ]]; then
134
- printf 'CHANGELOG.md latest version %s does not match package.json %s; run scripts/bump-version.sh %s or add a CHANGELOG.md entry for %s\n' "$changelog" "$pkg" "$changelog" "$pkg" >&2
135
- exit 1
136
- fi
137
- printf 'package.json, package-lock.json, src/constants.ts, and CHANGELOG.md agree on %s\n' "$pkg"
138
- }
139
-
140
- main() {
141
- if [[ "$#" -eq 0 ]]; then
142
- usage >&2
143
- exit 2
144
- fi
145
-
146
- cd "$(repo_root)"
147
- [[ -f package.json ]] || die "package.json not found"
148
- [[ -f package-lock.json ]] || die "package-lock.json not found"
149
- [[ -f src/constants.ts ]] || die "src/constants.ts not found"
150
-
151
- case "$1" in
152
- -h|--help)
153
- usage
154
- exit 0
155
- ;;
156
- --check)
157
- check_version_lockstep
158
- exit 0
159
- ;;
160
- esac
161
-
162
- local next="$1"
163
- validate_semver "$next"
164
-
165
- local current
166
- current="$(read_package_version)" || die "failed to read package.json version"
167
- [[ -n "$current" ]] || die "package.json has no \"version\" field"
168
-
169
- local current_const
170
- current_const="$(read_constants_version)" || die "failed to read src/constants.ts VERSION"
171
- [[ -n "$current_const" ]] || die "src/constants.ts has no VERSION constant"
172
-
173
- local current_lock current_lock_package
174
- current_lock="$(read_package_lock_version)" || die "failed to read package-lock.json root version"
175
- current_lock_package="$(read_package_lock_package_version)" || die "failed to read package-lock.json package version"
176
- [[ -n "$current_lock" ]] || die "package-lock.json has no root \"version\" field"
177
- [[ -n "$current_lock_package" ]] || die 'package-lock.json has no packages[""].version field'
178
-
179
- if ! [[ "$current" == "$current_const" && "$current" == "$current_lock" && "$current" == "$current_lock_package" ]]; then
180
- die "current versions diverge: package.json=$current src/constants.ts=$current_const package-lock.json=$current_lock package-lock.json packages[\"\"]=$current_lock_package (resolve manually first)"
181
- fi
182
-
183
- if [[ "$current" == "$next" ]]; then
184
- printf 'already at %s; nothing to do\n' "$next"
185
- exit 0
186
- fi
187
-
188
- write_package_version "$next"
189
- write_constants_version "$next"
190
- write_package_lock_version "$next"
191
-
192
- local check_pkg check_const check_lock check_lock_package
193
- check_pkg="$(read_package_version)"
194
- check_const="$(read_constants_version)"
195
- check_lock="$(read_package_lock_version)"
196
- check_lock_package="$(read_package_lock_package_version)"
197
- [[ "$check_pkg" == "$next" ]] || die "package.json did not update cleanly (read back: ${check_pkg:-empty})"
198
- [[ "$check_const" == "$next" ]] || die "src/constants.ts did not update cleanly (read back: ${check_const:-empty})"
199
- [[ "$check_lock" == "$next" ]] || die "package-lock.json did not update cleanly (read back: ${check_lock:-empty})"
200
- [[ "$check_lock_package" == "$next" ]] || die "package-lock.json packages[\"\"] did not update cleanly (read back: ${check_lock_package:-empty})"
201
-
202
- printf 'bumped %s -> %s\n' "$current" "$next"
203
- printf ' package.json\n'
204
- printf ' package-lock.json\n'
205
- printf ' src/constants.ts\n'
206
- # shellcheck disable=SC2016
207
- printf 'next: update CHANGELOG.md and run `npm run check`\n'
208
- }
209
-
210
- main "$@"
package/scripts/check.sh DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- npm run check
@@ -1,96 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- NPM_AUDIT_LEVEL="${NPM_AUDIT_LEVEL:-moderate}"
5
- RUN_AUDIT=1
6
- RUN_CHECK=0
7
-
8
- usage() {
9
- cat <<'USAGE'
10
- Usage:
11
- scripts/dependency-install.sh [options]
12
-
13
- Installs dependencies from package-lock.json using npm ci.
14
-
15
- Options:
16
- --audit-level LEVEL npm audit threshold (default: moderate)
17
- --no-audit Skip npm audit after install
18
- --check Run npm run check after install and audit
19
- --help, -h Show this help
20
-
21
- Environment:
22
- NPM_AUDIT_LEVEL Default audit threshold when --audit-level is omitted
23
- USAGE
24
- }
25
-
26
- die() {
27
- printf 'dependency-install: %s\n' "$*" >&2
28
- exit 1
29
- }
30
-
31
- repo_root() {
32
- local script_dir
33
- script_dir="$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
34
- CDPATH='' cd -- "$script_dir/.." && pwd
35
- }
36
-
37
- parse_args() {
38
- while [[ "$#" -gt 0 ]]; do
39
- case "$1" in
40
- --audit-level)
41
- [[ "$#" -ge 2 ]] || die "--audit-level requires a value"
42
- NPM_AUDIT_LEVEL="$2"
43
- shift
44
- ;;
45
- --audit-level=*)
46
- NPM_AUDIT_LEVEL="${1#*=}"
47
- ;;
48
- --no-audit)
49
- RUN_AUDIT=0
50
- ;;
51
- --check)
52
- RUN_CHECK=1
53
- ;;
54
- --help|-h)
55
- usage
56
- exit 0
57
- ;;
58
- *)
59
- usage >&2
60
- die "unknown option: $1"
61
- ;;
62
- esac
63
- shift
64
- done
65
- }
66
-
67
- require_tool() {
68
- command -v "$1" >/dev/null 2>&1 || die "$1 is required"
69
- }
70
-
71
- main() {
72
- parse_args "$@"
73
- cd "$(repo_root)"
74
-
75
- require_tool node
76
- require_tool npm
77
- [[ -f package.json ]] || die "package.json not found"
78
- [[ -f package-lock.json ]] || die "package-lock.json not found"
79
-
80
- echo "--- Install dependencies ---"
81
- npm ci
82
-
83
- if [[ "$RUN_AUDIT" -eq 1 ]]; then
84
- echo ""
85
- echo "--- Dependency audit ---"
86
- npm audit --audit-level="$NPM_AUDIT_LEVEL"
87
- fi
88
-
89
- if [[ "$RUN_CHECK" -eq 1 ]]; then
90
- echo ""
91
- echo "--- TypeScript + tests ---"
92
- npm run check
93
- fi
94
- }
95
-
96
- main "$@"
@@ -1,177 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- NPM_AUDIT_LEVEL="${NPM_AUDIT_LEVEL:-moderate}"
5
- DRY_RUN=0
6
- LATEST=0
7
- RUN_AUDIT=1
8
- RUN_CHECK=1
9
-
10
- usage() {
11
- cat <<'USAGE'
12
- Usage:
13
- scripts/dependency-update.sh [options]
14
-
15
- Updates npm dependencies, then verifies the result.
16
-
17
- Default behavior:
18
- - npm update
19
- - npm audit --audit-level=moderate
20
- - npm run check
21
-
22
- Options:
23
- --dry-run Show npm outdated output without changing files
24
- --latest Update direct dependencies/devDependencies to @latest
25
- --audit-level LEVEL npm audit threshold (default: moderate)
26
- --no-audit Skip npm audit after update
27
- --no-check Skip npm run check after update
28
- --help, -h Show this help
29
-
30
- Environment:
31
- NPM_AUDIT_LEVEL Default audit threshold when --audit-level is omitted
32
- USAGE
33
- }
34
-
35
- die() {
36
- printf 'dependency-update: %s\n' "$*" >&2
37
- exit 1
38
- }
39
-
40
- repo_root() {
41
- local script_dir
42
- script_dir="$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
43
- CDPATH='' cd -- "$script_dir/.." && pwd
44
- }
45
-
46
- parse_args() {
47
- while [[ "$#" -gt 0 ]]; do
48
- case "$1" in
49
- --dry-run)
50
- DRY_RUN=1
51
- ;;
52
- --latest)
53
- LATEST=1
54
- ;;
55
- --audit-level)
56
- [[ "$#" -ge 2 ]] || die "--audit-level requires a value"
57
- NPM_AUDIT_LEVEL="$2"
58
- shift
59
- ;;
60
- --audit-level=*)
61
- NPM_AUDIT_LEVEL="${1#*=}"
62
- ;;
63
- --no-audit)
64
- RUN_AUDIT=0
65
- ;;
66
- --no-check)
67
- RUN_CHECK=0
68
- ;;
69
- --help|-h)
70
- usage
71
- exit 0
72
- ;;
73
- *)
74
- usage >&2
75
- die "unknown option: $1"
76
- ;;
77
- esac
78
- shift
79
- done
80
- }
81
-
82
- require_tool() {
83
- command -v "$1" >/dev/null 2>&1 || die "$1 is required"
84
- }
85
-
86
- print_outdated() {
87
- local output
88
- local status
89
-
90
- if output=$(npm outdated --long 2>&1); then
91
- printf '%s\n' "$output"
92
- echo "All dependencies are current within the configured ranges."
93
- return 0
94
- else
95
- status=$?
96
- fi
97
-
98
- # npm outdated exits non-zero when it finds outdated dependencies.
99
- if [[ -n "$output" ]]; then
100
- printf '%s\n' "$output"
101
- fi
102
- if ((status == 1)); then
103
- return 0
104
- fi
105
-
106
- return "$status"
107
- }
108
-
109
- read_direct_dependencies() {
110
- local field="$1"
111
- # Print one key per line, nothing for an empty section. `console.log(keys.join("\n"))` would
112
- # emit a lone newline when the section is empty, and `mapfile -t` would then read a single
113
- # empty element, causing the install loop below to run `npm install --save-prod @latest`.
114
- node -e "const pkg = require('./package.json'); for (const key of Object.keys(pkg['$field'] || {})) console.log(key);"
115
- }
116
-
117
- install_latest_dependencies() {
118
- local -a dependencies=()
119
- local -a dev_dependencies=()
120
- local dependency
121
-
122
- mapfile -t dependencies < <(read_direct_dependencies dependencies)
123
- mapfile -t dev_dependencies < <(read_direct_dependencies devDependencies)
124
-
125
- if [[ "${#dependencies[@]}" -gt 0 ]]; then
126
- for dependency in "${dependencies[@]}"; do
127
- dependency="${dependency}@latest"
128
- echo "Updating production dependency: $dependency"
129
- npm install --save-prod "$dependency"
130
- done
131
- fi
132
-
133
- if [[ "${#dev_dependencies[@]}" -gt 0 ]]; then
134
- for dependency in "${dev_dependencies[@]}"; do
135
- dependency="${dependency}@latest"
136
- echo "Updating development dependency: $dependency"
137
- npm install --save-dev "$dependency"
138
- done
139
- fi
140
- }
141
-
142
- main() {
143
- parse_args "$@"
144
- cd "$(repo_root)"
145
-
146
- require_tool node
147
- require_tool npm
148
- [[ -f package.json ]] || die "package.json not found"
149
- [[ -f package-lock.json ]] || die "package-lock.json not found"
150
-
151
- if [[ "$DRY_RUN" -eq 1 ]]; then
152
- echo "--- Outdated dependencies ---"
153
- print_outdated
154
- exit 0
155
- fi
156
-
157
- echo "--- Update dependencies ---"
158
- if [[ "$LATEST" -eq 1 ]]; then
159
- install_latest_dependencies
160
- else
161
- npm update
162
- fi
163
-
164
- if [[ "$RUN_AUDIT" -eq 1 ]]; then
165
- echo ""
166
- echo "--- Dependency audit ---"
167
- npm audit --audit-level="$NPM_AUDIT_LEVEL"
168
- fi
169
-
170
- if [[ "$RUN_CHECK" -eq 1 ]]; then
171
- echo ""
172
- echo "--- TypeScript + tests ---"
173
- npm run check
174
- fi
175
- }
176
-
177
- main "$@"