82 lines
1.9 KiB
Bash
82 lines
1.9 KiB
Bash
#
|
|
#
|
|
#
|
|
|
|
EAPI=7
|
|
|
|
MY_P="${PN}-${PV/_beta/-beta.}"
|
|
|
|
HOMEPAGE="https://www.verdaccio.org/"
|
|
DESCRIPTION="A lightweight private npm proxy registry"
|
|
SRC_URI="https://registry.npmjs.org/${PN}/-/${MY_P}.tgz"
|
|
RESTRICT="network-sandbox"
|
|
|
|
SLOT="0"
|
|
KEYWORDS="~amd64 ~x86"
|
|
LICENSE="MIT"
|
|
|
|
S="${WORKDIR}/package"
|
|
RDEPEND="
|
|
>=net-libs/nodejs-16.0.0
|
|
acct-user/verdaccio
|
|
acct-group/verdaccio
|
|
"
|
|
DEPEND="${RDEPEND}
|
|
sys-apps/yarn"
|
|
|
|
DOCS=(
|
|
conf/default.yaml
|
|
conf/full.yaml
|
|
)
|
|
|
|
src_unpack() {
|
|
# Unpack top-level project
|
|
default_src_unpack
|
|
|
|
# Fetch dependencies
|
|
if [[ -d "${PORTAGE_ACTUAL_DISTDIR}/yarn-cache" ]]
|
|
then
|
|
addwrite "${PORTAGE_ACTUAL_DISTDIR}/yarn-cache"
|
|
else
|
|
addwrite "${PORTAGE_ACTUAL_DISTDIR}"
|
|
fi
|
|
|
|
yarn --cache-folder "${PORTAGE_ACTUAL_DISTDIR}/yarn-cache" --cwd "${S}" \
|
|
--prefer-offline --pure-lockfile --prod install \
|
|
|| die "Failed to install dependencies"
|
|
}
|
|
|
|
src_prepare() {
|
|
default_src_prepare
|
|
# Fix location of include files
|
|
sed -i -e "s:../build/:${EPREFIX}/usr/share/verdaccio/build/:" \
|
|
bin/verdaccio || die ""
|
|
|
|
# Locations in configuration files are relative to config file path, convert to absolute
|
|
sed -i -E -e "s|^(storage\|plugins):.+|\1: ${EPREFIX}/var/lib/verdaccio/\1|" \
|
|
conf/*.yaml || die ""
|
|
}
|
|
|
|
src_install() {
|
|
default_src_install
|
|
|
|
keepdir /etc/verdaccio
|
|
insinto /etc/verdaccio
|
|
newins conf/default.yaml config.yaml
|
|
|
|
insinto /usr/share/verdaccio
|
|
doins -r build index.js node_modules package.json
|
|
dosym /etc/verdaccio /usr/share/verdaccio/conf
|
|
dosbin bin/verdaccio
|
|
|
|
keepdir /var/{lib,log}/verdaccio
|
|
keepdir /var/lib/verdaccio/{plugins,storage}
|
|
fowners verdaccio:verdaccio /var/{lib,log}/verdaccio
|
|
fowners verdaccio:verdaccio /var/lib/verdaccio/{plugins,storage}
|
|
fperms 0750 /var/{lib,log}/verdaccio
|
|
fperms 0750 /var/lib/verdaccio/{plugins,storage}
|
|
|
|
newinitd "${FILESDIR}/verdaccio.initd" verdaccio
|
|
newconfd "${FILESDIR}/verdaccio.confd" verdaccio
|
|
}
|