forked from deanoemcke/spaces
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpackage.sh
More file actions
executable file
·44 lines (32 loc) · 1.04 KB
/
package.sh
File metadata and controls
executable file
·44 lines (32 loc) · 1.04 KB
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
41
42
43
44
#!/bin/bash
# This script packages the extension for distribution.
# It can be run from any directory.
# Save the current working directory
ORIGINAL_DIR=$(pwd)
# Get the directory of the script itself
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# The parent directory of the 'spaces' directory is where we want to run the zip command from.
PARENT_DIR="$(dirname "$SCRIPT_DIR")"
# Change to the parent directory
cd "$PARENT_DIR"
set -e
if [[ ! -d "spaces" || ! -f "spaces/manifest.json" ]]; then
echo "Error: 'spaces' directory not found."
# Restore the directory before exiting
cd "$ORIGINAL_DIR"
exit 1
fi
echo "Creating spaces.zip in $(pwd)..."
# Create the zip file, including the 'spaces' directory and specified files.
zip -r spaces.zip \
spaces/css \
spaces/img \
spaces/js \
spaces/LICENSE \
spaces/manifest.json \
spaces/README.md \
spaces/*.html
echo "Package created at spaces.zip"
# Restore the original working directory
cd "$ORIGINAL_DIR"
echo "Returned to $(pwd)"