diff --git a/.husky/pre-commit b/.husky/pre-commit index 4f1fbbc3..ede0c885 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,11 +1,30 @@ #!/usr/bin/env sh -# Pre-commit hook to run Snyk and Talisman scans, completing both before deciding to commit +# Pre-commit hook to run lint, Snyk and Talisman scans, completing all before deciding to commit # Function to check if a command exists command_exists() { command -v "$1" >/dev/null 2>&1 } +# Allow bypassing the hook with an environment variable +if [ "$SKIP_HOOK" = "1" ]; then + echo "Skipping lint, Snyk and Talisman scans (SKIP_HOOK=1)." + exit 0 +fi + +# Run ESLint check first +echo "Running ESLint check..." +npm run lint +lint_exit_code=$? + +if [ $lint_exit_code -ne 0 ]; then + echo "ESLint check failed. Please fix the linting issues and try again." + echo "You can run 'npm run format' to auto-fix most issues." + exit 1 +fi + +echo "ESLint check passed." + # Check if Snyk is installed if ! command_exists snyk; then echo "Error: Snyk is not installed. Please install it and try again." @@ -18,12 +37,6 @@ if ! command_exists talisman; then exit 1 fi -# Allow bypassing the hook with an environment variable -if [ "$SKIP_HOOK" = "1" ]; then - echo "Skipping Snyk and Talisman scans (SKIP_HOOK=1)." - exit 0 -fi - # Initialize variables to track scan results snyk_failed=false talisman_failed=false @@ -63,7 +76,7 @@ if [ "$snyk_failed" = true ] || [ "$talisman_failed" = true ]; then exit 1 fi -# If both scans pass, allow the commit -echo "All scans passed. Proceeding with commit.cd ." +# If all checks pass, allow the commit +echo "All checks passed (ESLint, Snyk, Talisman). Proceeding with commit." rm -f snyk_output.log talisman_output.log exit 0 \ No newline at end of file diff --git a/.talismanrc b/.talismanrc index 61cb65f1..df7a3fac 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,27 +1,6 @@ fileignoreconfig: -- filename: .github/workflows/secrets-scan.yml - ignore_detectors: - - filecontent -- filename: package-lock.json - checksum: 9d0340f9359927d477fe8ab4650642c068c592be63fb817651d866849e0dbbc2 -- filename: .husky/pre-commit - checksum: 5baabd7d2c391648163f9371f0e5e9484f8fb90fa2284cfc378732ec3192c193 + - filename: .husky/pre-commit + checksum: 52a664f536cf5d1be0bea19cb6031ca6e8107b45b6314fe7d47b7fad7d800632 + - filename: test/sanity-check/api/user-test.js + checksum: 6bb8251aad584e09f4d963a913bd0007e5f6e089357a44c3fb1529e3fda5509d version: "" -fileignoreconfig: -- filename: test/unit/globalField-test.js - checksum: 25185e3400a12e10a043dc47502d8f30b7e1c4f2b6b4d3b8b55cdc19850c48bf -version: "1.0" -fileignoreconfig: -- filename: lib/stack/index.js - checksum: 6aab5edf85efb17951418b4dc4402889cd24c8d786c671185074aeb4d50f0242 -- filename: test/sanity-check/api/stack-test.js - checksum: 198d5cf7ead33b079249dc3ecdee61a9c57453e93f1073ed0341400983e5aa53 -version: "1.0" -fileignoreconfig: -- filename: test/sanity-check/api/previewToken-test.js - checksum: 9a42e079b7c71f76932896a0d2390d86ac626678ab20d36821dcf962820a886c -- filename: lib/stack/deliveryToken/index.js - checksum: 51ae00f07f4cc75c1cd832b311c2e2482f04a8467a0139da6013ceb88fbdda2f -- filename: lib/stack/deliveryToken/previewToken/index.js - checksum: b506f33bffdd20dfc701f964370707f5d7b28a2c05c70665f0edb7b3c53c165b -version: "1.0" diff --git a/CHANGELOG.md b/CHANGELOG.md index 8605e14f..5cfd4f98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog -## [v1.21.8](https://github.com/contentstack/contentstack-management-javascript/tree/v1.21.8) (2025-07-07) +## [v1.22.0](https://github.com/contentstack/contentstack-management-javascript/tree/v1.22.0) (2025-07-07) + - Enhancement + - AWS-AU Region support added - Fix - Fixed branch header conflits ## [v1.21.7](https://github.com/contentstack/contentstack-management-javascript/tree/v1.21.7) (2025-06-30) diff --git a/lib/contentstack.js b/lib/contentstack.js index 18ded7fd..02088318 100644 --- a/lib/contentstack.js +++ b/lib/contentstack.js @@ -10,6 +10,7 @@ import httpClient from './core/contentstackHTTPClient.js' const regionHostMap = { NA: 'api.contentstack.io', EU: 'eu-api.contentstack.com', + AU: 'au-api.contentstack.com', AZURE_NA: 'azure-na-api.contentstack.com', AZURE_EU: 'azure-eu-api.contentstack.com', GCP_NA: 'gcp-na-api.contentstack.com', diff --git a/package-lock.json b/package-lock.json index 67054cc1..76926083 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@contentstack/management", - "version": "1.21.8", + "version": "1.22.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@contentstack/management", - "version": "1.21.8", + "version": "1.22.0", "license": "MIT", "dependencies": { "assert": "^2.1.0", diff --git a/package.json b/package.json index e05e986a..106a4501 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@contentstack/management", - "version": "1.21.8", + "version": "1.22.0", "description": "The Content Management API is used to manage the content of your Contentstack account", "main": "./dist/node/contentstack-management.js", "browser": "./dist/web/contentstack-management.js", diff --git a/test/sanity-check/api/user-test.js b/test/sanity-check/api/user-test.js index 015307fa..8010834d 100644 --- a/test/sanity-check/api/user-test.js +++ b/test/sanity-check/api/user-test.js @@ -111,6 +111,13 @@ describe('Contentstack User Session api Test', () => { done() }) + it('should get host for AU region', done => { + const client = contentstack.client({ region: 'AU' }) + const baseUrl = client.axiosInstance.defaults.baseURL + expect(baseUrl).to.include('au-api.contentstack.com', 'region AU set correctly') + done() + }) + it('should get host for AZURE_NA region', done => { const client = contentstack.client({ region: 'AZURE_NA' }) const baseUrl = client.axiosInstance.defaults.baseURL diff --git a/test/unit/Util-test.js b/test/unit/Util-test.js index 0e125976..b7845fff 100644 --- a/test/unit/Util-test.js +++ b/test/unit/Util-test.js @@ -123,6 +123,7 @@ describe('Get User Agent', () => { expect(isHost('contentstack.io:2Sdrd')).to.be.equal(true, 'contentstack.io:2Sdrd should be host') expect(isHost('contentstack.io:wedsfa2')).to.be.equal(true, 'contentstack.io:wedsfa2 should be host') expect(isHost('eu-api.contentstack.com')).to.be.equal(true, 'eu-api.contentstack.com should be host') + expect(isHost('au-api.contentstack.com')).to.be.equal(true, 'au-api.contentstack.com should be host') expect(isHost('contentstack.io/path')).to.be.equal(false, 'contentstack.io/path should not host') done() })