-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·75 lines (57 loc) · 1.92 KB
/
build.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
71
72
73
74
75
#! /bin/bash
# This bash script creates a distribution-ready version of the plugin
# Parameters
all=besogo.all.js
min=besogo.min.js
distPath=dist
library=besogo
homeDir=$PWD
echo "Distribution path is: "
echo distPath
echo ""
echo "Combining all" ./$library " library files..."
# Combine all library files
cd files/$library/
cat js/* > $all
# Inject the commonJS call at the end of the combined file
echo "Injecting commonJS code into " $library " library..."
echo "exports.besogo=besogo;" >> $all
# Minify library
echo "Minifying library..."
curl -s \
-d compilation_level=SIMPLE_OPTIMIZATIONS \
-d output_format=text \
-d output_info=compiled_code \
--data-urlencode "js_code@${all}" \
http://closure-compiler.appspot.com/compile \
> $min
cd $homeDir
# Clear destination directory and copy all needed files to it
echo "Clearing distribution directory " ./$distPath "..."
rm -rf ./$distPath/
echo "Creating distribution subtree..."
mkdir -p ./$distPath/files
mkdir -p ./$distPath/files/doc
mkdir -p ./$distPath/files/jdoc
mkdir -p ./$distPath/files/$library
mkdir -p ./$distPath/files/$library/css
mkdir -p ./$distPath/files/$library/img
echo "Copying " $library "combined + minified js files..."
cp files/$library/$min ./$distPath/files/$library/
cp files/$library/$all ./$distPath/files/$library/
echo "Copying " $library "CSS files and images..."
cp files/$library/css/* ./$distPath/files/$library/css
cp files/$library/img/* ./$distPath/files/$library/img
echo "Copying plugin javascript files and plugin.info..."
cp ./*.js ./$distPath/
cp plugin.info ./$distPath/
echo "Copying tiddlywiki.info, documentation, and .json settings..."
cp files/doc/* ./$distPath/files/doc/
cp files/tiddlywiki.files ./$distPath/files
cp files/config.json ./$distPath/files
echo "Uploading test wiki..."
# TO DO
echo "Test wiki upload still to do!"
echo "Generating JDOC API docs..."
jsdoc files/$library/js/*.js --destination jsdoc
echo "Done"