2021-03-22 04:41:27 +00:00
|
|
|
#!/usr/bin/env bash
|
2021-03-18 06:31:29 +00:00
|
|
|
#
|
|
|
|
# Copyright (C) 2021 CismonX <admin@cismon.net>
|
|
|
|
#
|
|
|
|
# Copying and distribution of this file, with or without modification, are
|
|
|
|
# permitted in any medium without royalty, provided the copyright notice and
|
|
|
|
# this notice are preserved. This file is offered as-is, without any warranty.
|
|
|
|
#
|
|
|
|
|
2021-04-21 09:25:24 +00:00
|
|
|
VSIX_FILE_NAME=texinfo-$(json -f package.json version).vsix
|
|
|
|
PACKAGE_JSON_CLEANUP_JS=$(cat ./scripts/package-json-cleanup.js)
|
|
|
|
|
2021-04-12 12:06:11 +00:00
|
|
|
vsce package --baseContentUrl=$(json -f package.json repository.url)/tree
|
2021-04-21 09:25:24 +00:00
|
|
|
|
|
|
|
unzip -d $VSIX_FILE_NAME{.d,}
|
|
|
|
cd $VSIX_FILE_NAME.d
|
2021-05-04 20:44:30 +00:00
|
|
|
MINIFY_XML_OPTIONS='--no-shorten-namespaces --no-remove-unused-namespaces --no-remove-unused-default-namespace'
|
|
|
|
minify-xml $MINIFY_XML_OPTIONS --output \[Content_Types\].xml{,}
|
|
|
|
minify-xml $MINIFY_XML_OPTIONS --output extension.vsixmanifest{,}
|
2021-04-21 09:25:24 +00:00
|
|
|
cd extension
|
|
|
|
# Minify JSON files.
|
|
|
|
json -j0 -I -e "$PACKAGE_JSON_CLEANUP_JS" -f package.json
|
2021-04-24 17:39:48 +00:00
|
|
|
perl -pi -e 'chomp if eof' package.json
|
2021-04-21 09:25:24 +00:00
|
|
|
json5 -o language-configuration.json{,}
|
|
|
|
# Remove comments from Markdown files.
|
2021-04-24 17:39:48 +00:00
|
|
|
tail -n +9 README.md > _ && mv _ README.md
|
|
|
|
tail -n +9 CHANGELOG.md > _ && mv _ CHANGELOG.md
|
2021-04-23 12:38:07 +00:00
|
|
|
cd ext
|
|
|
|
# Minify Perl scripts.
|
|
|
|
if [ -x "$(command -v perltidy)" ]; then
|
|
|
|
perltidy --mangle -dac -b html-preview.pm
|
|
|
|
rm html-preview.pm.bak
|
|
|
|
fi
|
|
|
|
cd ../../..
|
2021-04-21 09:25:24 +00:00
|
|
|
|
|
|
|
# Re-package .vsix file.
|
|
|
|
node ./scripts/make-vsix.js $VSIX_FILE_NAME
|
|
|
|
rm -r $VSIX_FILE_NAME.d
|