Skip to content

Commit

Permalink
chore: improve script customisation
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas-Man committed Mar 29, 2024
1 parent df132b8 commit a01f128
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ DEST=$BASEDIR/dist

APPSCRIPT='appsscript.json'
HTMLHOME='home.html'
BACKUP_EXT='.backup'

# Make dir if it does not exist.
mkdir -p ${DEST}
Expand All @@ -28,19 +29,19 @@ for FULL_PATH_NAME in $(ls ${SOURCE}/*.js); do
cp ${SOURCE}/${FILE} ${DEST}

# Remove imports
sed -i .orig '/^import/d' ${DEST}/${FILE}
sed -i ${BACKUP_EXT} '/^import/d' ${DEST}/${FILE}

# remove eslint-disable statements
sed -i .orig '/^\/\* eslint-disable/d' ${DEST}/${FILE}
sed -i ${BACKUP_EXT} '/^\/\* eslint-disable/d' ${DEST}/${FILE}

# Remove exports
sed -i .orig '/export {/,/}/d' ${DEST}/${FILE}
sed -i ${BACKUP_EXT} '/export {/,/}/d' ${DEST}/${FILE}

# convert `console` to `Logger`
sed -i .orig 's/console\./Logger\./g' ${DEST}/${FILE}
sed -i ${BACKUP_EXT} 's/console\./Logger\./g' ${DEST}/${FILE}
done

# Fix code formatting after striping import, exports and eslint-disable statements
cd ${DEST}
#npx prettier . --write
rm *.js.orig
rm *.js${BACKUP_EXT}

0 comments on commit a01f128

Please sign in to comment.