forked from dauphine-dev/drop-feeds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakeExt.sh
executable file
·70 lines (70 loc) · 1.89 KB
/
makeExt.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
#
#install jq before run this script (apt install jq or https://stedolan.github.io/jq/download/)
#
NAME=drop_feeds
BRANCH=${PWD##*/}
INITIAL_DIR=${PWD}
#update files list
for d in $INITIAL_DIR/themes/*/ ; do
cd $d
find . ! -name '*.list' -type f >files.list
done
for d in $INITIAL_DIR/themes/_renderTab/*/ ; do
cd $d
find . ! -name '*.list' -type f >files.list
done
for d in $INITIAL_DIR/themes/_renderTab/_templates/*/ ; do
cd $d
find . ! -name '*.list' -type f >files.list
done
for d in $INITIAL_DIR/themes/_editor/*/ ; do
cd $d
find . ! -name '*.list' -type f >files.list
done
cd $INITIAL_DIR
rm -rf themes/_renderTab/files.list
rm -rf themes/_renderTab/_templates/_any/files.list
rm -rf themes/_renderTab/_templates/_error/files.list
rm -rf themes/_templates/files.list
rm -rf themes/_editor/files.list
rm -rf themes/_export/files.list
#create a working folder in parent directory named '_ext'
mkdir ../_ext/ > /dev/null 2>&1
#copy all files in the working folder
cd $INITIAL_DIR
cd ../_ext/
rm -rf $BRANCH/
cp -fr $INITIAL_DIR $BRANCH/
#cleanup unnecessary files
cd $INITIAL_DIR
cd ../_ext/$BRANCH
rm -rf themes-src/
rm -rf dropfeeds.code-workspace
rm -rf README.md
rm -rf *.sh
rm -rf .git/
rm -rf .vscode/
rm -rf .eslintrc.json
rm -rf .gitignore
#Creating for zip manifest v3 version
cd $INITIAL_DIR
cp -p manifestv3.json manifest.json
cp -p manifestv3.json ../_ext/$BRANCH/manifest.json
sleep 1
cd ../_ext/$BRANCH
VERSION=$(jq -r '.version' manifest.json)
rm -rf ../$NAME-$VERSION-mv3.zip
zip -r ../$NAME-$VERSION-mv3.zip * >/dev/null
#Creating for zip manifest v2 version
cd $INITIAL_DIR
cp -p manifestv2.json manifest.json
cp -p manifestv2.json ../_ext/$BRANCH/manifest.json
sleep 1
cd ../_ext/$BRANCH
VERSION=$(jq -r '.version' manifest.json)
rm -rf ../$NAME-$VERSION-mv2.zip
zip -r ../$NAME-$VERSION-mv2.zip * >/dev/null
#finishing...
cd $INITIAL_DIR
echo "Extension created"