Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Refactor npm packages #5746

Merged
merged 1 commit into from
Jun 16, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
24 changes: 12 additions & 12 deletions .husky/post-commit
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
# #!/usr/bin/env sh
# . "$(dirname -- "$0")/_/husky.sh"

# Load config (variables)
. "$(dirname -- "$0")/config.sh"
# # Load config (variables)
# . "$(dirname -- "$0")/config.sh"

echo ""
echo "${RED}${CDR}${NC}: Commit completed."
echo "${GREEN}${CC}${NC}: Roger. We confirm commit completed."
# echo ""
# echo "${RED}${CDR}${NC}: Commit completed."
# echo "${GREEN}${CC}${NC}: Roger. We confirm commit completed."

echo ""
echo "${RED}${CDR}${NC}: Good deal."
echo "${RED}${CDR}${NC}: Shutdown."
echo "${GREEN}${CC}${NC}: Roger. Shutdown."
echo ""
# echo ""
# echo "${RED}${CDR}${NC}: Good deal."
# echo "${RED}${CDR}${NC}: Shutdown."
# echo "${GREEN}${CC}${NC}: Roger. Shutdown."
# echo ""
164 changes: 82 additions & 82 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,93 +1,93 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
# #!/usr/bin/env sh
# . "$(dirname -- "$0")/_/husky.sh"

# Load config (variables)
. "$(dirname -- "$0")/config.sh"
# # Load config (variables)
# . "$(dirname -- "$0")/config.sh"

echo ""
echo "${BLUE}INFO${NC}: Running ${YELLOW}pre-commit${NC} hook"
# echo ""
# echo "${BLUE}INFO${NC}: Running ${YELLOW}pre-commit${NC} hook"

echo ""
echo "${RED}${CDR}${NC}: Roger. Check."
echo "${GREEN}${CC}${NC}: Roger. We got a Pre-commit hook."
echo "${GREEN}${CC}${NC}: ${CDR}, this is ${CC}. You are GO for Pre-commit hook."
echo "${RED}${CDR}${NC}: Roger. I'm on it."
echo "${GREEN}${CC}${NC}: Roger. Pre-commit hook started."
# echo ""
# echo "${RED}${CDR}${NC}: Roger. Check."
# echo "${GREEN}${CC}${NC}: Roger. We got a Pre-commit hook."
# echo "${GREEN}${CC}${NC}: ${CDR}, this is ${CC}. You are GO for Pre-commit hook."
# echo "${RED}${CDR}${NC}: Roger. I'm on it."
# echo "${GREEN}${CC}${NC}: Roger. Pre-commit hook started."

# Only run if required files are changed
if git diff --cached --name-only | grep -q "^npm/" || git diff --cached --name-only | grep -q "^config/" || git diff --cached --name-only | grep -q "^action/"; then
# # Only run if required files are changed
# if git diff --cached --name-only | grep -q "^npm/" || git diff --cached --name-only | grep -q "^config/" || git diff --cached --name-only | grep -q "^action/"; then

echo ""
echo "${RED}${CDR}${NC}: Installing all dependencies"
pnpm install --no-frozen-lockfile 1>/dev/null
git add pnpm-lock.yaml
echo "${GREEN}${CC}${NC}: ${CDR}, ${CC}. Installation confirmed; You're looking good."
# echo ""
# echo "${RED}${CDR}${NC}: Installing all dependencies"
# pnpm install --no-frozen-lockfile 1>/dev/null
# git add pnpm-lock.yaml
# echo "${GREEN}${CC}${NC}: ${CDR}, ${CC}. Installation confirmed; You're looking good."

# Check if "npm" or "config" folder files are changed (any one of them)
if git diff --cached --name-only | grep -q "^npm/" || git diff --cached --name-only | grep -q "^config/"; then
echo ""
echo "${BLUE}INFO${NC}: Changes in ${YELLOW}packages${NC} detected."
echo "${BLUE}INFO${NC}: Executing ${GREEN}${PROTO_NPM}${NC} for ${YELLOW}pre-commit${NC} hook."
echo ""
echo "${RED}${CDR}${NC}: Linting code"
pnpm lint:packages 1>/dev/null
echo "${GREEN}${CC}${NC}: We confirm linting."
echo ""
echo "${RED}${CDR}${NC}: Roger."
echo "${RED}${CDR}${NC}: Testing code"
pnpm test:packages 1>/dev/null
echo "${GREEN}${CC}${NC}: Roger. We confirm testing."
echo ""
echo "${RED}${CDR}${NC}: Formatting code"
pnpm format:packages 1>/dev/null
echo "${GREEN}${CC}${NC}: Roger. We confirm formatting."
fi
# # Check if "npm" or "config" folder files are changed (any one of them)
# if git diff --cached --name-only | grep -q "^npm/" || git diff --cached --name-only | grep -q "^config/"; then
# echo ""
# echo "${BLUE}INFO${NC}: Changes in ${YELLOW}packages${NC} detected."
# echo "${BLUE}INFO${NC}: Executing ${GREEN}${PROTO_NPM}${NC} for ${YELLOW}pre-commit${NC} hook."
# echo ""
# echo "${RED}${CDR}${NC}: Linting code"
# pnpm lint:packages 1>/dev/null
# echo "${GREEN}${CC}${NC}: We confirm linting."
# echo ""
# echo "${RED}${CDR}${NC}: Roger."
# echo "${RED}${CDR}${NC}: Testing code"
# pnpm test:packages 1>/dev/null
# echo "${GREEN}${CC}${NC}: Roger. We confirm testing."
# echo ""
# echo "${RED}${CDR}${NC}: Formatting code"
# pnpm format:packages 1>/dev/null
# echo "${GREEN}${CC}${NC}: Roger. We confirm formatting."
# fi

# Check if "action" folder files are changed
if git diff --cached --name-only | grep -q "^action/"; then
echo ""
echo "${BLUE}INFO${NC}: Changes in ${YELLOW}action${NC} folder detected."
echo "${BLUE}INFO${NC}: Executing ${GREEN}${PROTO_ACTION}${NC} for ${YELLOW}pre-commit${NC} hook."
echo ""
echo "${RED}${CDR}${NC}: Building code"
pnpm build --filter action 1>/dev/null
echo "${GREEN}${CC}${NC}: We confirm dist/ building."
echo ""
echo "${RED}${CDR}${NC}: Formatting code"
pnpm format:action 1>/dev/null
echo "${GREEN}${CC}${NC}: Roger. We confirm formatting."
fi
fi
# # Check if "action" folder files are changed
# if git diff --cached --name-only | grep -q "^action/"; then
# echo ""
# echo "${BLUE}INFO${NC}: Changes in ${YELLOW}action${NC} folder detected."
# echo "${BLUE}INFO${NC}: Executing ${GREEN}${PROTO_ACTION}${NC} for ${YELLOW}pre-commit${NC} hook."
# echo ""
# echo "${RED}${CDR}${NC}: Building code"
# pnpm build --filter action 1>/dev/null
# echo "${GREEN}${CC}${NC}: We confirm dist/ building."
# echo ""
# echo "${RED}${CDR}${NC}: Formatting code"
# pnpm format:action 1>/dev/null
# echo "${GREEN}${CC}${NC}: Roger. We confirm formatting."
# fi
# fi

echo ""
echo "${RED}${CDR}${NC}: Checking for unstaged changes"
if ! git diff --quiet --exit-code; then
echo "${GREEN}${CC}${NC}: Roger. We confirm ${RED}there are unstaged changes${NC}."
echo "${GREEN}${CC}${NC}: Please stage your changes."
echo ""
echo "${BLUE}INFO${NC}: Commit aborted."
echo ""
exit 1
fi
echo "${GREEN}${CC}${NC}: Roger. We confirm no unstaged changes."
# echo ""
# echo "${RED}${CDR}${NC}: Checking for unstaged changes"
# if ! git diff --quiet --exit-code; then
# echo "${GREEN}${CC}${NC}: Roger. We confirm ${RED}there are unstaged changes${NC}."
# echo "${GREEN}${CC}${NC}: Please stage your changes."
# echo ""
# echo "${BLUE}INFO${NC}: Commit aborted."
# echo ""
# exit 1
# fi
# echo "${GREEN}${CC}${NC}: Roger. We confirm no unstaged changes."

echo ""
echo "${RED}${CDR}${NC}: Checking for branch"
if [ "$(git rev-parse --abbrev-ref HEAD)" = "master" ]; then
echo "${GREEN}${CC}${NC}: Roger. We confirm ${RED}you are on master${NC}."
echo "${GREEN}${CC}${NC}: Please checkout to another branch."
echo ""
echo "${BLUE}INFO${NC}: Commit aborted."
echo ""
exit 1
fi
echo "${GREEN}${CC}${NC}: Roger. We confirm you are not on master."
# echo ""
# echo "${RED}${CDR}${NC}: Checking for branch"
# if [ "$(git rev-parse --abbrev-ref HEAD)" = "master" ]; then
# echo "${GREEN}${CC}${NC}: Roger. We confirm ${RED}you are on master${NC}."
# echo "${GREEN}${CC}${NC}: Please checkout to another branch."
# echo ""
# echo "${BLUE}INFO${NC}: Commit aborted."
# echo ""
# exit 1
# fi
# echo "${GREEN}${CC}${NC}: Roger. We confirm you are not on master."

echo ""
echo "${RED}${CDR}${NC}: Pre-commit hook finished"
echo "${GREEN}${CC}${NC}: ${CDR}, this is ${CC}. Pre-commit hook finished."
echo "${GREEN}${CC}${NC}: You are GO for commit."
# echo ""
# echo "${RED}${CDR}${NC}: Pre-commit hook finished"
# echo "${GREEN}${CC}${NC}: ${CDR}, this is ${CC}. Pre-commit hook finished."
# echo "${GREEN}${CC}${NC}: You are GO for commit."

echo ""
echo "${RED}${CDR}${NC}: Roger. I'm on it."
echo "${GREEN}${CC}${NC}: Roger. Commit started."
# echo ""
# echo "${RED}${CDR}${NC}: Roger. I'm on it."
# echo "${GREEN}${CC}${NC}: Roger. Commit started."
1 change: 0 additions & 1 deletion action/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"twitter-api-v2": "^1.16.1"
},
"devDependencies": {
"@codinasion/language-data": "workspace:*",
"@types/node": "^20.12.10",
"@types/node-fetch": "^2.6.11",
"@typescript-eslint/eslint-plugin": "^7.8.0",
Expand Down
12 changes: 0 additions & 12 deletions npm/examples/dsa/dsa-examples/package.json

This file was deleted.

14 changes: 0 additions & 14 deletions npm/examples/dsa/dsa-examples/queue/Queue.js

This file was deleted.

6 changes: 0 additions & 6 deletions npm/examples/dsa/dsa-examples/search/BinarySearch.js

This file was deleted.

6 changes: 0 additions & 6 deletions npm/examples/dsa/dsa-examples/search/LinearSearch.js

This file was deleted.

6 changes: 0 additions & 6 deletions npm/examples/dsa/dsa-examples/sort/BubbleSort.js

This file was deleted.

6 changes: 0 additions & 6 deletions npm/examples/dsa/dsa-examples/sort/CountingSort.js

This file was deleted.

6 changes: 0 additions & 6 deletions npm/examples/dsa/dsa-examples/sort/HeapSort.js

This file was deleted.

6 changes: 0 additions & 6 deletions npm/examples/dsa/dsa-examples/sort/InsertionSort.js

This file was deleted.

6 changes: 0 additions & 6 deletions npm/examples/dsa/dsa-examples/sort/MergeSort.js

This file was deleted.

6 changes: 0 additions & 6 deletions npm/examples/dsa/dsa-examples/sort/QuickSort.js

This file was deleted.

6 changes: 0 additions & 6 deletions npm/examples/dsa/dsa-examples/sort/RadixSort.js

This file was deleted.

6 changes: 0 additions & 6 deletions npm/examples/dsa/dsa-examples/sort/SelectionSort.js

This file was deleted.

11 changes: 0 additions & 11 deletions npm/examples/dsa/dsa-examples/stack/Stack.js

This file was deleted.

14 changes: 0 additions & 14 deletions npm/examples/dsa/queue-example/Queue.js

This file was deleted.

12 changes: 0 additions & 12 deletions npm/examples/dsa/queue-example/package.json

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions npm/examples/dsa/search/binary-search-example/package.json

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions npm/examples/dsa/search/linear-search-example/package.json

This file was deleted.

6 changes: 0 additions & 6 deletions npm/examples/dsa/sort/bubble-sort-example/BubbleSort.js

This file was deleted.

Loading
Loading