[project] enrich the scripts of ci

This commit is contained in:
Revone 2023-10-19 09:21:00 +08:00
parent b73141089f
commit ba9cd51a6a
8 changed files with 230 additions and 33 deletions

View file

@ -10,8 +10,7 @@
/backup
/webpack.config.js
/rename_clear_files.sh
/scripts
/tsconfig.prod.json
/docs

View file

@ -8,10 +8,14 @@ All notable changes to this project will be documented in this file.
- [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
- [`auto-changelog`](https://github.com/CookPete/auto-changelog)
## [v1.36.4](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
## [v1.36.5](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
### Changes
- [trie] renamed ambiguous methods and add comments to all methods. [`#12`](https://github.com/zrwusa/data-structure-typed/pull/12)
- [binarytree] modified the getDepth method to adhere to the proper def… [`#11`](https://github.com/zrwusa/data-structure-typed/pull/11)
- Trie [`#10`](https://github.com/zrwusa/data-structure-typed/pull/10)
- [tree] getHeight returns faulty height bug fixed [`#9`](https://github.com/zrwusa/data-structure-typed/pull/9)
- [trie] support casesensitivity. getWords bug fixed [`#8`](https://github.com/zrwusa/data-structure-typed/pull/8)
- [binary-tree, graph] In order to optimize the design of Binary Trees,… [`#7`](https://github.com/zrwusa/data-structure-typed/pull/7)
- [BinaryTree, Heap] In abstract classes, only retain abstract methods.… [`#6`](https://github.com/zrwusa/data-structure-typed/pull/6)

View file

@ -907,3 +907,4 @@ optimal approach to data structure design.
</tr>
</tbody>
</table>

50
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "data-structure-typed",
"version": "1.36.4",
"version": "1.36.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "data-structure-typed",
"version": "1.36.4",
"version": "1.36.5",
"license": "MIT",
"devDependencies": {
"@types/benchmark": "^2.1.3",
@ -15,17 +15,17 @@
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"auto-changelog": "^2.4.0",
"avl-tree-typed": "^1.36.3",
"avl-tree-typed": "^1.36.4",
"benchmark": "^2.1.4",
"binary-tree-typed": "^1.36.3",
"bst-typed": "^1.36.3",
"binary-tree-typed": "^1.36.4",
"bst-typed": "^1.36.4",
"dependency-cruiser": "^14.1.0",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"heap-typed": "^1.36.3",
"heap-typed": "^1.36.4",
"istanbul-badges-readme": "^1.8.5",
"jest": "^29.7.0",
"prettier": "^3.0.3",
@ -2396,12 +2396,12 @@
}
},
"node_modules/avl-tree-typed": {
"version": "1.36.3",
"resolved": "https://registry.npmjs.org/avl-tree-typed/-/avl-tree-typed-1.36.3.tgz",
"integrity": "sha512-OaAJ84yaupkmJBWD0Dqi2jdz1sO57n7ZFATzkHnN1VuOFK5dyoTHgGufZ0xK3A2Jh1i3lMYR7TZldFOnzBW1AA==",
"version": "1.36.4",
"resolved": "https://registry.npmjs.org/avl-tree-typed/-/avl-tree-typed-1.36.4.tgz",
"integrity": "sha512-iUTsr9dfxTb4aGBxv93Teh77cCEZBsJpk7MgzvTfUwIgdO3qskj3H8xmgAxzkeRSJqIvfEGC4jil6BNP6NfSBA==",
"dev": true,
"dependencies": {
"data-structure-typed": "^1.36.3"
"data-structure-typed": "^1.36.4"
}
},
"node_modules/babel-jest": {
@ -2586,12 +2586,12 @@
}
},
"node_modules/binary-tree-typed": {
"version": "1.36.3",
"resolved": "https://registry.npmjs.org/binary-tree-typed/-/binary-tree-typed-1.36.3.tgz",
"integrity": "sha512-7Hi3Q6yPoBjuiy6c+Wq1fjL8rugriUqFq6p1mhLoYbLgkCe8uXFmCi1A6s1jD/cMCwKWy23wATUNBSpajCTfKQ==",
"version": "1.36.4",
"resolved": "https://registry.npmjs.org/binary-tree-typed/-/binary-tree-typed-1.36.4.tgz",
"integrity": "sha512-fDoK2eAm+rdur+oJMBJvyjjjiQ12GpnMmbT+Bgce3tz4wnrQca6sVSEXo1uuAKTIMgDEGeVtsJmD+J6xQLqH/A==",
"dev": true,
"dependencies": {
"data-structure-typed": "^1.36.3"
"data-structure-typed": "^1.36.4"
}
},
"node_modules/brace-expansion": {
@ -2670,12 +2670,12 @@
}
},
"node_modules/bst-typed": {
"version": "1.36.3",
"resolved": "https://registry.npmjs.org/bst-typed/-/bst-typed-1.36.3.tgz",
"integrity": "sha512-e1gdr7Dy3YRZ0xXf63Ev9tMjXnLY4DJ4EHKIB5WKIDhVS45ZkuZ+9NZ9oLLRcYhpegwwO5HDASPzbhMb969E0Q==",
"version": "1.36.4",
"resolved": "https://registry.npmjs.org/bst-typed/-/bst-typed-1.36.4.tgz",
"integrity": "sha512-3soCZc7lJV5ZhC4owO8PLx6VlHrbaFuwOWcpuiQtIDpeVh/mgAHH3M/r/YCiAxLVWXjewerG7TB4T8CBhpo1AA==",
"dev": true,
"dependencies": {
"data-structure-typed": "^1.36.3"
"data-structure-typed": "^1.36.4"
}
},
"node_modules/buffer-from": {
@ -3027,9 +3027,9 @@
}
},
"node_modules/data-structure-typed": {
"version": "1.36.3",
"resolved": "https://registry.npmjs.org/data-structure-typed/-/data-structure-typed-1.36.3.tgz",
"integrity": "sha512-DspbeEZaeFRtiVi3WMm+gDzrCHgjDYy5Am1K57iF9ZtTeoXJgNQ0th+PL7HImeFh14zmAnVUgBEsN8lr4n04Cw==",
"version": "1.36.4",
"resolved": "https://registry.npmjs.org/data-structure-typed/-/data-structure-typed-1.36.4.tgz",
"integrity": "sha512-mX+KiaCJ9apd+X7M1dJhtxvUZlV15S36QGawoQhsmhwkHdDsBT06/sGca4vE7I20pZdoX5b34GW+3z4fUJI+/g==",
"dev": true
},
"node_modules/debug": {
@ -4362,12 +4362,12 @@
}
},
"node_modules/heap-typed": {
"version": "1.36.3",
"resolved": "https://registry.npmjs.org/heap-typed/-/heap-typed-1.36.3.tgz",
"integrity": "sha512-6C3Jzk1Cl5c8P49SF+elEpAckZ4I/a5bd9T+N7kp7zSEPon20+Xn6+TLC0E1feK6yex/E7mmlxKtsyoTXBSLdg==",
"version": "1.36.4",
"resolved": "https://registry.npmjs.org/heap-typed/-/heap-typed-1.36.4.tgz",
"integrity": "sha512-A5gAttFYkaXXnAjNl7gIyulmoEYB4+usGhsb1QDD2LeHGfe1Pd0wNc/mX5iLFO2feIRcl3hbRw70SQoC+/V3Fg==",
"dev": true,
"dependencies": {
"data-structure-typed": "^1.36.3"
"data-structure-typed": "^1.36.4"
}
},
"node_modules/html-escaper": {

View file

@ -1,6 +1,6 @@
{
"name": "data-structure-typed",
"version": "1.36.4",
"version": "1.36.5",
"description": "Data Structures of Javascript & TypeScript. Binary Tree, BST, Graph, Heap, Priority Queue, Linked List, Queue, Deque, Stack, AVL Tree, Tree Multiset, Trie, Directed Graph, Undirected Graph, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue.",
"main": "dist/index.js",
"module": "lib/index.js",
@ -54,17 +54,17 @@
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"auto-changelog": "^2.4.0",
"avl-tree-typed": "^1.36.3",
"avl-tree-typed": "^1.36.4",
"benchmark": "^2.1.4",
"binary-tree-typed": "^1.36.3",
"bst-typed": "^1.36.3",
"binary-tree-typed": "^1.36.4",
"bst-typed": "^1.36.4",
"dependency-cruiser": "^14.1.0",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"heap-typed": "^1.36.3",
"heap-typed": "^1.36.4",
"istanbul-badges-readme": "^1.8.5",
"jest": "^29.7.0",
"prettier": "^3.0.3",

66
scripts/publish_all_subs.sh Executable file
View file

@ -0,0 +1,66 @@
#!/bin/bash
# Function to prompt for a directory path with a default value
prompt_for_directory() {
local message="$1"
local default_path="$2"
read -p "$message [$default_path]: " user_path
echo "${user_path:-$default_path}"
}
# Prompt for the source directory path
source_dir=$(prompt_for_directory "Enter the source directory" "/Users/revone/projects/data-structure-typed")
# Prompt for the destination directory path
individuals_dir=$(prompt_for_directory "Enter the destination directory" "/Users/revone/projects/data-structure-typed-individuals")
# Read the version variable from package.json
version_prompted=$(jq -r .version package.json)
cd "$individuals_dir"
# List of directories
directories=(
"avl-tree-typed"
"binary-tree-typed"
"bst-typed"
"deque-typed"
"directed-graph-typed"
"doubly-linked-list-typed"
"graph-typed"
"heap-typed"
"linked-list-typed"
"max-heap-typed"
"max-priority-queue-typed"
"min-heap-typed"
"min-priority-queue-typed"
"priority-queue-typed"
"singly-linked-list-typed"
"queue-typed"
"stack-typed"
"tree-multiset-typed"
"trie-typed"
"undirected-graph-typed"
)
# Loop through each directory
for dir in "${directories[@]}"; do
cd "$dir" || exit
# Update package.json version
npm version "$version_prompted"
# jq ".dependencies[\"data-structure-typed\"] = \"$version_prompted\"" package.json > temp.json
# mv temp.json package.json
# Install data-structure-typed package and build
npm i data-structure-typed@"$version_prompted"
npm run build:publish
cd ..
done
echo "All packages updated and built."
cd "$source_dir"

65
scripts/publish_docs.sh Executable file
View file

@ -0,0 +1,65 @@
#!/bin/bash
# Function to prompt for a directory path with a default value
prompt_for_directory() {
local message="$1"
local default_path="$2"
read -p "$message [$default_path]: " user_path
echo "${user_path:-$default_path}"
}
# Prompt for the source directory path
source_dir=$(prompt_for_directory "Enter the source directory" "/Users/revone/projects/data-structure-typed")
# Prompt for the destination directory path
docs_dir=$(prompt_for_directory "Enter the destination directory" "/Users/revone/projects/data-structure-typed-docs")
# Check if jq is installed and install it if needed
if ! command -v jq &> /dev/null; then
echo "jq is not installed. Installing..."
if [[ "$OSTYPE" == "linux-gnu" ]]; then
sudo apt-get update
sudo apt-get install jq
elif [[ "$OSTYPE" == "darwin"* ]]; then
if ! command -v brew &> /dev/null; then
echo "Homebrew is not installed. Please install Homebrew first."
exit 1
fi
brew install jq
else
echo "Unsupported operating system. Please install jq manually."
exit 1
fi
echo "jq has been installed."
else
echo "jq is already installed."
fi
# Change to the source directory
cd "$source_dir"
# Read the version variable from package.json
version=$(jq -r .version package.json)
# Execute the clear.sh script in the other directory
cd "$docs_dir"
shopt -s extglob
rm -r !(.gitignore|favicon.ico|.idea)
# Copy all files from source directory to destination directory
cp -r "$source_dir/docs/"* "$docs_dir"
# Change to the destination directory
cd "$docs_dir"
# Commit the changes to the Git repository
git add .
git commit -m "[pkg] $version published"
# Push the changes to the remote repository
git push
# Change back to the original directory
cd "$source_dir"

62
scripts/run_command_all_subs.sh Executable file
View file

@ -0,0 +1,62 @@
#!/bin/bash
# Function to prompt for a directory path with a default value
prompt_for_directory() {
local message="$1"
local default_path="$2"
read -p "$message [$default_path]: " user_path
echo "${user_path:-$default_path}"
}
# Prompt for the source directory path
source_dir=$(prompt_for_directory "Enter the source directory" "/Users/revone/projects/data-structure-typed")
# Prompt for the destination directory path
individuals_dir=$(prompt_for_directory "Enter the destination directory" "/Users/revone/projects/data-structure-typed-individuals")
# Read the version variable from package.json
version_prompted=$(jq -r .version package.json)
cd "$individuals_dir"
# Read the command from the user
read -p "Enter the command: " command
# List of directories
directories=(
"avl-tree-typed"
"binary-tree-typed"
"bst-typed"
"deque-typed"
"directed-graph-typed"
"doubly-linked-list-typed"
"graph-typed"
"heap-typed"
"linked-list-typed"
"max-heap-typed"
"max-priority-queue-typed"
"min-heap-typed"
"min-priority-queue-typed"
"priority-queue-typed"
"singly-linked-list-typed"
"queue-typed"
"stack-typed"
"tree-multiset-typed"
"trie-typed"
"undirected-graph-typed"
)
# Loop through each directory
for dir in "${directories[@]}"; do
cd "$dir" || exit
# execute the command
$command
cd ..
done
echo "$command in all libs executed success."
cd "$source_dir"