Skip to content

Commit

Permalink
Changed google compile method from java to npx.
Browse files Browse the repository at this point in the history
  • Loading branch information
zboris12 committed Mar 24, 2024
1 parent d6d6d23 commit f4cbbcd
Show file tree
Hide file tree
Showing 7 changed files with 600 additions and 187 deletions.
2 changes: 0 additions & 2 deletions .env.sample

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build
run-name: Build for browser and GAS
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['lts/*']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div align="center"><img src="logo.png" title="zgapdfsigner"></div>

![build status](https://github.com/zboris12/zgapdfsigner/actions/workflows/build.yml/badge.svg)

# ZgaPdfSigner
A javascript tool to sign a pdf or set protection of a pdf in web browser.
And it is more powerful when used in [Google Apps Script](https://developers.google.com/apps-script) or [nodejs](https://nodejs.org/).
Expand Down
47 changes: 47 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# !/bin/bash
# set -x

OUTFLDR=dist
if [ -d ${OUTFLDR} ]
then
rm -f ${OUTFLDR}/*
else
mkdir ${OUTFLDR}
fi

GCCOPT="--charset UTF-8 --compilation_level SIMPLE_OPTIMIZATIONS --warning_level VERBOSE"
GCCEXT="--externs closure/google-ext.js --externs closure/forge-ext.js --externs closure/pdflib-ext.js --externs closure/zb-externs.js"
jss=""
while read js
do
if [ -n "${js}" ]
then
c=$(echo "${js}" | cut -b1)
if [ "$c" != "#" ]
then
outf="${OUTFLDR}/_${js}"
sed -e "s/\/\/Only for nodejs Start\/\//\/*/g" -e "s/\/\/Only for nodejs End\/\//*\//g" "lib/${js}" > "${outf}"
if [ $? -eq 0 ]
then
echo "Created js file: ${outf}"
jss="${jss} --js ${outf}"
else
echo "Failed create js file: ${outf}"
exit 10
fi
fi
fi
done <<< "
zgacertsutil.js
zgapdfcryptor.js
zgapdfsigner.js
zgaindex.js
"
npx google-closure-compiler ${GCCOPT} ${GCCEXT} ${jss} --js_output_file ${OUTFLDR}/zgapdfsigner.min.js
if [ $? -ne 0 ]
then
echo "google-closure-compiler failed."
exit 20
fi

exit 0
180 changes: 0 additions & 180 deletions closure.js

This file was deleted.

Loading

0 comments on commit f4cbbcd

Please sign in to comment.