-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_dirs.sh
41 lines (33 loc) · 1.45 KB
/
generate_dirs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# Define modules and their directory structures
declare -A MODULES=(
["inventory-monitoring"]="src/controllers src/services src/models src/routes src/utils src/middlewares src/config tests/unit tests/integration"
["supplier-integration"]="src/controllers src/services src/models src/routes src/utils src/middlewares src/config tests/unit tests/integration"
["viral-product-alerts"]="src/controllers src/services src/models src/routes src/utils src/middlewares src/config tests/unit tests/integration"
)
# Function to create directories and root files
create_structure() {
MODULE_NAME=$1
DIRS=$2
echo "Creating module: $MODULE_NAME"
# Create directories
for DIR in $DIRS; do
FULL_PATH="./$MODULE_NAME/$DIR"
mkdir -p "$FULL_PATH"
echo " Created: $FULL_PATH"
done
# Create root files
ROOT_FILES=("package.json" "tsconfig.json" "README.md")
for FILE in "${ROOT_FILES[@]}"; do
FILE_PATH="./$MODULE_NAME/$FILE"
if [ ! -f "$FILE_PATH" ]; then
touch "$FILE_PATH"
echo " Created file: $FILE_PATH"
fi
done
}
# Iterate over each module and create the structure
for MODULE in "${!MODULES[@]}"; do
create_structure "$MODULE" "${MODULES[$MODULE]}"
done
echo "Directory generation completed!"