Skip to content

Commit 0dd57da

Browse files
tinayuangaojelbourn
authored andcommitted
chore: add script to bulk copy generated docs files (#2337)
1 parent e66462e commit 0dd57da

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

scripts/release/copy-docs.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# Copy docs to material docs site
4+
5+
# Run this script after `gulp docs`
6+
# Need to specify destination folder
7+
# Use OVERVIEW.html when possible. If there's no OVERVIEW file exists, use README.html
8+
9+
usage='Usage: copy-docs.sh $destinationFolder'
10+
if [ $# -ne 1 ]; then
11+
echo "Missing destination folder. $usage"
12+
exit
13+
fi
14+
15+
originFolder=./dist/docs/
16+
destFolder=$1
17+
18+
if [ ! -w $destFolder ]; then
19+
echo "Invalid destination folder. $usage"
20+
exit
21+
fi
22+
23+
for file in $originFolder*
24+
do
25+
name=${file#$originFolder}
26+
overviewFile=$originFolder$name/OVERVIEW.html
27+
readmeFile=$originFolder$name/README.html
28+
destFile=$destFolder/$name.html
29+
if [ -f $overviewFile ]; then
30+
cp $overviewFile $destFile
31+
echo "Copied $overviewFile to $destFile"
32+
elif [ -f $readmeFile ]; then
33+
cp $readmeFile $destFile
34+
echo "Copied $readmeFile to $destFile"
35+
fi
36+
done

0 commit comments

Comments
 (0)