vscode-texinfo/scripts/package.sh

46 lines
1.4 KiB
Bash
Raw Normal View History

2024-04-02 06:12:03 +00:00
#!/bin/sh
2021-03-18 06:31:29 +00:00
#
2024-04-02 06:12:03 +00:00
# Copyright (C) 2021,2024 CismonX <admin@cismon.net>
2021-03-18 06:31:29 +00:00
#
# 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.
#
2024-04-02 06:12:03 +00:00
set -e
2021-04-21 09:25:24 +00:00
2024-04-02 06:12:03 +00:00
version=$(json -f package.json version)
vsix_file_name=texinfo-$version.vsix
vsce package --baseContentUrl="$(json -f package.json repository.url)/tree"
unzip -d "$vsix_file_name.d" "$vsix_file_name"
cd "$vsix_file_name.d"
minify_xml() {
minify-xml --no-shorten-namespaces --no-remove-unused-namespaces \
--no-remove-unused-default-namespace -i "$1"
}
minify_xml '[Content_Types].xml'
minify_xml extension.vsixmanifest
2021-04-21 09:25:24 +00:00
cd extension
# Minify JSON files.
2024-04-02 06:12:03 +00:00
json -j0 -I -e "$(cat ../../scripts/package-json-cleanup.js)" -f package.json
2021-04-24 17:39:48 +00:00
perl -pi -e 'chomp if eof' package.json
2024-04-02 06:12:03 +00:00
json5 language-configuration.json > _ && mv _ language-configuration.json
2021-04-21 09:25:24 +00:00
# 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
2024-04-02 06:12:03 +00:00
cd ext
# Minify Perl scripts.
2021-10-01 17:30:37 +00:00
# You can install perltidy with `cpan Perl::Tidy`
2024-04-02 06:12:03 +00:00
if command -v perltidy; then
perltidy --mangle -dac -b html-preview.pm
rm html-preview.pm.bak
fi
2021-04-21 09:25:24 +00:00
2024-04-02 06:12:03 +00:00
cd ../../..
2021-04-21 09:25:24 +00:00
# Re-package .vsix file.
2024-04-02 06:12:03 +00:00
node ./scripts/make-vsix.js "$vsix_file_name"
rm -r "$vsix_file_name.d"