Skip to content

Commit 5bb0870

Browse files
authored
Merge pull request #1 from contentstack/feat/base-setup
export query command base code
2 parents a819b0e + ba0c63b commit 5bb0870

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+22123
-5
lines changed

.eslintignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
node_modules
2+
.todo
3+
.env
4+
.dccache
5+
logs
6+
contents
7+
lerna-debug.log
8+
.DS_Store
9+
contentTest
10+
build
11+
_backup*
12+
oclif.manifest.json
13+
.vscode
14+
.nyc_output
15+
contentstack-cli-logs
16+
packages/**/package-lock.json
17+
.dccache
18+
yarn.lock
19+
contents-*
20+
*.http
21+
*.todo
22+
talisman_output.log
23+
snyk_output.log

.eslintrc

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"env": {
3+
"node": true
4+
},
5+
"parser": "@typescript-eslint/parser",
6+
"parserOptions": {
7+
"project": "tsconfig.json",
8+
"sourceType": "module"
9+
},
10+
"extends": [
11+
// "oclif",
12+
"oclif-typescript",
13+
"plugin:@typescript-eslint/recommended"
14+
],
15+
"rules": {
16+
"@typescript-eslint/no-unused-vars": [
17+
"error",
18+
{
19+
"args": "none"
20+
}
21+
],
22+
"@typescript-eslint/prefer-namespace-keyword": "error",
23+
"@typescript-eslint/quotes": [
24+
"error",
25+
"single",
26+
{
27+
"avoidEscape": true,
28+
"allowTemplateLiterals": true
29+
}
30+
],
31+
"semi": "off",
32+
"@typescript-eslint/type-annotation-spacing": "error",
33+
"@typescript-eslint/no-redeclare": "off",
34+
"eqeqeq": [
35+
"error",
36+
"smart"
37+
],
38+
"id-match": "error",
39+
"no-eval": "error",
40+
"no-var": "error",
41+
"quotes": "off",
42+
"indent": "off",
43+
"camelcase": "off",
44+
"comma-dangle": "off",
45+
"arrow-parens": "off",
46+
"operator-linebreak": "off",
47+
"object-curly-spacing": "off",
48+
"node/no-missing-import": "off",
49+
"padding-line-between-statements": "off",
50+
"@typescript-eslint/ban-ts-ignore": "off",
51+
"unicorn/no-abusive-eslint-disable": "off",
52+
"unicorn/consistent-function-scoping": "off",
53+
"@typescript-eslint/no-use-before-define": "off"
54+
}
55+
}

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
*-debug.log
2+
*-error.log
3+
/.nyc_output
4+
/dist
5+
/lib
6+
/tmp
7+
/yarn.lock
8+
node_modules
9+
.DS_Store
10+
coverage
11+
./contents
12+
.vscode/
13+
/lib
14+
.env
15+
_backup_*
16+
contents/
17+
logs/
18+
oclif.manifest.json

.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

.mocharc.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"require": [
3+
"test/helpers/init.js",
4+
"ts-node/register",
5+
"source-map-support/register"
6+
],
7+
"watch-extensions": [
8+
"ts"
9+
],
10+
"recursive": true,
11+
"timeout": 5000
12+
}

.nycrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"inlcude": [
3+
"lib/**/*.js"
4+
]
5+
}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/README.md

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "all",
4+
"singleQuote": true,
5+
"printWidth": 120,
6+
"tabWidth": 2
7+
}

.talismanrc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
fileignoreconfig:
2-
- filename: .github/workflows/secrets-scan.yml
3-
ignore_detectors:
4-
- filecontent
5-
version: "1.0"
2+
- filename: snyk_output.log
3+
checksum: dfa9dc093345f006cc3fb107b8495fcbe79c524db51f44c08d959c656bedf2f7
4+
- filename: talisman_output.log
5+
checksum: 50a8928e551f9092dafcf50f531c926ac00e2846c564aafaaab70c1ecaa19490
6+
version: '1.0'

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Contentstack
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)