summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorzxp198210052024-10-22 18:14:23 +0800
committerzxp198210052024-10-22 18:14:23 +0800
commit13d16a5a47af6518d2f6f0e78b961df8c0ec2087 (patch)
tree1289b4e33c2a18d54a40746010f912d3b7f1e31d
parent88db8e1e681f9470fe0d04b5f61a9a97751aae7d (diff)
downloadaur-melt-mdeditor-git.tar.gz
update shellscripts
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD61
-rw-r--r--melt-mdeditor.sh2
3 files changed, 37 insertions, 30 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 2acc2a7d9d96..1b508265c36b 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,5 +1,5 @@
pkgbase = melt-mdeditor-git
- pkgdesc = A Markdown Editor.Based on the GitHub Flavored Markdown Spec.
+ pkgdesc = A Markdown Editor.Based on the GitHub Flavored Markdown Spec.Use system-wide electron.
pkgver = 2.12.1.r0.gec6da7b
pkgrel = 1
url = https://github.com/qazsato/melt
@@ -17,6 +17,6 @@ pkgbase = melt-mdeditor-git
source = melt-mdeditor.git::git+https://github.com/qazsato/melt.git
source = melt-mdeditor.sh
sha256sums = SKIP
- sha256sums = 2b2e8aeed33fd71c521e49fd54fb2fa81218d16aef8bccb88d77909055ab8051
+ sha256sums = 291f50480f5a61bc9c68db7d44cd0412071128706baa868a9cb854f8779a1980
pkgname = melt-mdeditor-git
diff --git a/PKGBUILD b/PKGBUILD
index 9d26210790e2..ad2678c8fb40 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,7 +6,7 @@ pkgver=2.12.1.r0.gec6da7b
_electronversion=27
_nodeversion=20
pkgrel=1
-pkgdesc="A Markdown Editor.Based on the GitHub Flavored Markdown Spec."
+pkgdesc="A Markdown Editor.Based on the GitHub Flavored Markdown Spec.Use system-wide electron."
arch=('x86_64')
url="https://github.com/qazsato/melt"
license=('MIT')
@@ -28,52 +28,59 @@ source=(
"${pkgname%-git}.sh"
)
sha256sums=('SKIP'
- '2b2e8aeed33fd71c521e49fd54fb2fa81218d16aef8bccb88d77909055ab8051')
+ '291f50480f5a61bc9c68db7d44cd0412071128706baa868a9cb854f8779a1980')
pkgver() {
cd "${srcdir}/${pkgname%-git}.git"
- git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/v//g'
+ set -o pipefail
+ git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/v//g' ||
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}
_ensure_local_nvm() {
- export NVM_DIR="${srcdir}/.nvm"
+ local NVM_DIR="${srcdir}/.nvm"
source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
nvm install "${_nodeversion}"
nvm use "${_nodeversion}"
}
build() {
- sed -e "s|@electronversion@|${_electronversion}|" \
- -e "s|@appname@|${pkgname%-git}|g" \
- -e "s|@runname@|app.asar|g" \
- -e "s|@cfgdirname@|${_pkgname}|g" \
- -e "s|@options@||g" \
- -i "${srcdir}/${pkgname%-git}.sh"
+ sed -e "
+ s/@electronversion@/${_electronversion}/g
+ s/@appname@/${pkgname%-git}/g
+ s/@runname@/app.asar/g
+ s/@cfgdirname@/${_pkgname}/g
+ s/@options@/env ELECTRON_OZONE_PLATFORM_HINT=auto/g
+ " -i "${srcdir}/${pkgname%-git}.sh"
_ensure_local_nvm
gendesk -q -f -n --pkgdesc="${pkgdesc}" --categories="Utility" --pkgname="${pkgname%-git}" --name="${_pkgname}" --exec="${pkgname%-git} %U"
cd "${srcdir}/${pkgname%-git}.git"
- export npm_config_build_from_source=true
+ electronDist="/usr/lib/electron${_electronversion}"
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
- #export SYSTEM_ELECTRON_VERSION="$(electron${_electronversion} -v | sed 's/v//g')"
- #export npm_config_target="${SYSTEM_ELECTRON_VERSION}"
- #export ELECTRONVERSION="${_electronversion}"
+ export SYSTEM_ELECTRON_VERSION="$(electron${_electronversion} -v | sed 's/v//g')"
HOME="${srcdir}/.electron-gyp"
- mkdir -p "${srcdir}/.electron-gyp"
- touch "${srcdir}/.electron-gyp/.yarnrc"
- if [ `curl -s ipinfo.io/country | grep CN | wc -l ` -ge 1 ];then
- export npm_config_registry=https://registry.npmmirror.com
- export npm_config_disturl=https://registry.npmmirror.com/-/binary/node/
- export npm_config_electron_mirror=https://registry.npmmirror.com/-/binary/electron/
- export npm_config_electron_builder_binaries_mirror=https://registry.npmmirror.com/-/binary/electron-builder-binaries/
- else
- echo "Your network is OK."
+ {
+ echo -e '\n'
+ #echo 'build_from_source=true'
+ echo "cache=${srcdir}/.npm_cache"
+ } >> .npmrc
+ if [[ "$(curl -s ipinfo.io/country)" == *"CN"* ]]; then
+ {
+ echo 'registry=https://registry.npmmirror.com'
+ echo 'disturl=https://registry.npmmirror.com/-/binary/node/'
+ echo 'electron_mirror=https://registry.npmmirror.com/-/binary/electron/'
+ echo 'electron_builder_binaries_mirror=https://registry.npmmirror.com/-/binary/electron-builder-binaries/'
+ } >> .npmrc
+ sed -i "s/registry.npmjs.org/registry.npmmirror.com/g" package-lock.json
fi
icns2png -x public/icon.icns -o public
- sed "s|release/\${version}|release|g;s|AppImage|dir|g" -i electron-builder.json5
- NODE_ENV=development yarn install --cache-folder "${srcdir}/.yarn_cache"
- NODE_ENV=production yarn run build
+ sed -i "s/\${version}//g" electron-builder.json5
+ NODE_ENV=development npm install --force
+ NODE_ENV=development npm add -D rollup
+ NODE_ENV=production npx vue-tsc --noEmit
+ NODE_ENV=production npx vite build
+ NODE_ENV=production npm exec -c "electron-builder --linux dir -c.electronDist=${electronDist}"
}
package() {
install -Dm755 "${srcdir}/${pkgname%-git}.sh" "${pkgdir}/usr/bin/${pkgname%-git}"
install -Dm644 "${srcdir}/${pkgname%-git}.git/release/linux-unpacked/resources/app.asar" -t "${pkgdir}/usr/lib/${pkgname%-git}"
install -Dm644 "${srcdir}/${pkgname%-git}.git/public/icon_512x512x32.png" "${pkgdir}/usr/share/pixmaps/${pkgname%-git}.png"
install -Dm644 "${srcdir}/${pkgname%-git}.desktop" -t "${pkgdir}/usr/share/applications"
- install -Dm644 "${srcdir}/${pkgname%-git}.git/release/linux-unpacked/LICENSE"* -t "${pkgdir}/usr/share/licenses/${pkgname}"
} \ No newline at end of file
diff --git a/melt-mdeditor.sh b/melt-mdeditor.sh
index 4cfe3ac09dd8..40e422ca2ee7 100644
--- a/melt-mdeditor.sh
+++ b/melt-mdeditor.sh
@@ -21,7 +21,7 @@ if [[ -f "${_FLAGS_FILE}" ]]; then
fi
done < "${_FLAGS_FILE}"
fi
-cd "${_APPDIR}"
+cd "${_APPDIR}" || { echo "Failed to change directory to ${_APPDIR}"; exit 1; }
if [[ "${EUID}" -ne 0 ]] || [[ "${ELECTRON_RUN_AS_NODE}" ]]; then
exec electron@electronversion@ "${_RUNNAME}" ${_OPTIONS} "${_USER_FLAGS[@]}" "$@"
else