Skip to content

Commit 82891c6

Browse files
committed
setup the repo
1 parent 70d1461 commit 82891c6

6 files changed

Lines changed: 9999 additions & 12669 deletions

File tree

.husky/pre-commit

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env sh
2+
# Pre-commit hook to run Talisman and Snyk scans, completing both before deciding to commit
3+
4+
# Function to check if a command exists
5+
command_exists() {
6+
command -v "$1" >/dev/null 2>&1
7+
}
8+
9+
# Check if Talisman is installed
10+
if ! command_exists talisman; then
11+
echo "Error: Talisman is not installed. Please install it and try again."
12+
exit 1
13+
fi
14+
15+
# Check if Snyk is installed
16+
if ! command_exists snyk; then
17+
echo "Error: Snyk is not installed. Please install it and try again."
18+
exit 1
19+
fi
20+
21+
# Allow bypassing the hook with an environment variable
22+
if [ "$SKIP_HOOK" = "1" ]; then
23+
echo "Skipping Talisman and Snyk scans (SKIP_HOOK=1)."
24+
exit 0
25+
fi
26+
27+
# Initialize variables to track scan results
28+
talisman_failed=false
29+
snyk_failed=false
30+
31+
# Run Talisman secret scan
32+
echo "Running Talisman secret scan..."
33+
talisman --githook pre-commit > talisman_output.log 2>&1
34+
talisman_exit_code=$?
35+
36+
if [ $talisman_exit_code -eq 0 ]; then
37+
echo "Talisman scan passed: No secrets found."
38+
else
39+
echo "Talisman scan failed (exit code $talisman_exit_code). See talisman_output.log for details."
40+
talisman_failed=true
41+
fi
42+
43+
# Run Snyk vulnerability scan (continues even if Talisman failed)
44+
echo "Running Snyk vulnerability scan..."
45+
snyk test --all-projects --fail-on=all > snyk_output.log 2>&1
46+
snyk_exit_code=$?
47+
48+
if [ $snyk_exit_code -eq 0 ]; then
49+
echo "Snyk scan passed: No vulnerabilities found."
50+
elif [ $snyk_exit_code -eq 1 ]; then
51+
echo "Snyk found vulnerabilities. See snyk_output.log for details."
52+
snyk_failed=true
53+
else
54+
echo "Snyk scan failed with error (exit code $snyk_exit_code). See snyk_output.log for details."
55+
snyk_failed=true
56+
fi
57+
58+
# Evaluate results after both scans
59+
if [ "$talisman_failed" = true ] || [ "$snyk_failed" = true ]; then
60+
echo "Commit aborted due to issues found in one or both scans."
61+
[ "$talisman_failed" = true ] && echo "- Talisman issues: Check talisman_output.log"
62+
[ "$snyk_failed" = true ] && echo "- Snyk issues: Check snyk_output.log"
63+
exit 1
64+
fi
65+
66+
# If both scans pass, allow the commit
67+
echo "All scans passed. Proceeding with commit."
68+
rm -f talisman_output.log snyk_output.log
69+
exit 0

.npmrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Use workspace protocol for local development
2+
link-workspace-packages=true
3+
prefer-workspace-packages=true
4+
5+
# Hoist dependencies to root node_modules
6+
shamefully-hoist=true
7+
8+
# Use strict peer dependencies
9+
strict-peer-dependencies=false

.talismanrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,4 +359,8 @@ fileignoreconfig:
359359
checksum: 533043fcc944d91d1bfa084a6ba6e87409986c2931197d145237862f55143374
360360
- filename: packages/contentstack-export/test/unit/utils/export-config-handler.test.ts
361361
checksum: 64411834509e7e80211348aa8ea81da922a8e07bb0f87b9ae2a19c0bd167c82a
362+
- filename: pnpm-lock.yaml
363+
checksum: 4a6ed0dd31e71c81b02c3933ad4ee6fc3f3907cade5f3032095ec34563628154
364+
- filename: .husky/pre-commit
365+
checksum: 7a12030ddfea18d6f85edc25f1721fb2009df00fdd42bab66b05de25ab3e32b2
362366
version: "1.0"

package.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,18 @@
99
"node": ">=18.0.0"
1010
},
1111
"private": true,
12+
"packageManager": "pnpm@10.28.0",
1213
"scripts": {
13-
"cache:clear": "pnpm store prune",
14-
"clean": "pnpm --filter './packages/*' -w clean",
15-
"build": "pnpm --filter './packages/*' -w build",
16-
"bootstrap": "pnpm install --no-frozen-lockfile",
17-
"prepack": "pnpm --filter \"./packages/*\" -w prepack",
18-
"package-lock-only": "npm i --package-lock-only --workspaces",
19-
"setup-repo-old": "npm i && pnpm package-lock-only && pnpm clean && pnpm install --no-frozen-lockfile && pnpm prepack",
20-
"clean-repo": "rm -rf ./package-lock.json ./node_modules ./packages/**/node_modules ./packages/**/.nyc_output ./packages/**/package-lock.json",
21-
"preinstall-clean": "npm run clean-repo && npm cache clean --force && npx pnpm store prune",
22-
"setup-repo": "npm run preinstall-clean && npm i && npm run package-lock-only && npm run clean && pnpm install --no-frozen-lockfile && npm run prepack",
14+
"clean": "pnpm -r --filter './packages/*' run clean",
15+
"build": "pnpm -r --filter './packages/*' run build",
16+
"test": "pnpm -r --filter './packages/*' run test",
17+
"prepack": "pnpm -r --filter './packages/*' run prepack",
18+
"bootstrap": "pnpm install",
19+
"clean:modules": "rm -rf node_modules packages/**/node_modules",
20+
"clean:lock": "rm -f pnpm-lock.yaml",
21+
"clean:all": "pnpm store prune && pnpm run clean:modules && pnpm run clean:lock",
22+
"setup": "pnpm run clean:all && pnpm install",
2323
"prepare": "npx husky && chmod +x .husky/pre-commit",
24-
"test": "pnpm --filter './packages/*' -w test",
2524
"prepare-publish": "node scripts/prepare-publish.js",
2625
"publish:packages": "pnpm prepare-publish && pnpm publish -r --access public",
2726
"changeset": "changeset",

0 commit comments

Comments
 (0)