Skip to content

Initial Setup #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .cz-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
module.exports = {
types: [
{value: 'feat', name: 'feat: A new feature'},
{value: 'fix', name: 'fix: A bug fix'},
{value: 'docs', name: 'docs: Documentation only changes'},
{
value: 'style',
name: 'style: Changes that do not affect the meaning of the code\n (white-space, formatting, missing semi-colons, etc)',
},
{
value: 'refactor',
name: 'refactor: A code change that neither fixes a bug nor adds a feature',
},
{
value: 'perf',
name: 'perf: A code change that improves performance',
},
{value: 'test', name: 'test: Adding missing tests'},
{
value: 'chore',
name: 'chore: Changes to the build process or auxiliary tools\n and libraries such as documentation generation',
},
{value: 'revert', name: 'revert: Revert to a commit'},
{value: 'wip', name: 'wip: Work in progress'},
],

scopes: [
{name: 'loopback4-langchain'},
{name: 'ci-cd'},
{name: 'deps'},
{name: 'migrations'},
],

appendBranchNameToCommitMessage: false,
allowTicketNumber: false,
isTicketNumberRequired: false,
ticketNumberPrefix: 'Fixes - ',

// override the messages, defaults are as follows
messages: {
type: "Select the type of change that you're committing:",
scope: 'Denote the SCOPE of this change:',
// used if allowCustomScopes is true
customScope: 'Denote the SCOPE of this change:',
subject: 'Write a SHORT, IMPERATIVE tense description of the change:\n',
body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
breaking: 'List any BREAKING CHANGES (optional):\n',
footer:
'List any ISSUES CLOSED by this change (optional). E.g.: ABC-31, ABC-34:\n',
confirmCommit: 'Are you sure you want to proceed with the commit above?',
},

allowCustomScopes: false,
allowBreakingChanges: ['feat', 'fix'],

// limit subject length
subjectLimit: 100,
breaklineChar: '|', // It is supported for fields body and footer.
footerPrefix: '',
askForBreakingChangeFirst: true, // default is false
};
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/
coverage/
.eslintrc.js
commitlint.config.js
13 changes: 13 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
extends: '@loopback/eslint-config',
rules: {
'no-extra-boolean-cast': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'no-prototype-builtins': 'off',
'no-unused-vars': 'warn',
},
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
};
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
dist/
.DS_Store
npm-debug.log
.env
.nyc_output
coverage
23 changes: 23 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
# . "$(dirname "$0")/_/husky.sh"

if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then
npx --no-install commitlint --edit $1
else
echo "dev/tty no available skipping it"
fi

# Section for git-secrets
command -v git-secrets;
retval=$?;
if [ $retval -ne 0 ]; then
echo "git-secrets is not installed. Please run 'brew install git-secrets' or visit https://github.com/awslabs/git-secrets#installing-git-secrets"
exit 1
fi

# Initialise git-secrets configuration
git-secrets --register-aws > /dev/null

echo "Running git-secrets..."
# Scans the commit message.
git-secrets --commit_msg_hook -- "$@"
32 changes: 32 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# !/bin/sh
# . "$(dirname "$0")/_/husky.sh"

# print current NPM and Node version
npm --version;
node --version;

arch="$(uname -m)" # -i is only linux, -m is linux and apple
if test "$arch" = x86_64; then
npm test
elif test "$arch" = arm64; then
echo "Running command for the MacM1"
arch -x86_64 npm test
else
echo "unknown arch $arch"
exit 1
fi

# Section for git-secrets
command -v git-secrets;
retval=$?;
if [ $retval -ne 0 ]; then
echo "git-secrets is not installed. Please run 'brew install git-secrets' or visit https://github.com/awslabs/git-secrets#installing-git-secrets"
exit 1
fi

# Initialise git-secrets configuration
git-secrets --register-aws > /dev/null

echo "Running git-secrets..."
# Scans all files that are about to be committed.
git-secrets --pre_commit_hook -- "$@"
25 changes: 25 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh
# . "$(dirname "$0")/_/husky.sh"

if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then
exec < /dev/tty && npx cz --hook || true
else
echo "dev/tty no available skipping it"
fi

#exec < /dev/tty && npx cz --hook || true

# Section for git-secrets
command -v git-secrets;
retval=$?;
if [ $retval -ne 0 ]; then
echo "git-secrets is not installed. Please run 'brew install git-secrets' or visit https://github.com/awslabs/git-secrets#installing-git-secrets"
exit 1
fi

# Initialise git-secrets configuration
git-secrets --register-aws > /dev/null

echo "Running git-secrets..."
# Determines if merging in a commit will introduce tainted history.
git-secrets --prepare_commit_msg_hook -- "$@"
12 changes: 12 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "@istanbuljs/nyc-config-typescript",
"all": true,
"check-coverage": true,
"reporter": ["html", "text", "text-summary"],
"include": ["src/**/*.ts"],
"exclude": ["src/__tests__/**", "**/*.d.ts", "src/models/**"],
"branches": 0,
"lines": 0,
"functions": 0,
"statements": 0
}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
*.json
coverage
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"bracketSpacing": false,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "all",
"arrowParens": "avoid"
}
14 changes: 14 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'header-max-length': [2, 'always', 100],
'body-leading-blank': [2, 'always'],
'footer-leading-blank': [0, 'always'],
// 'references-empty': [2, 'never'],
},
parserPreset: {
parserOpts: {
issuePrefixes: ['ABC-'],
},
},
};
Loading