summaryrefslogtreecommitdiffstats
path: root/nodejs
diff options
context:
space:
mode:
authorMichel Alexandre Salim <salimma@fedoraproject.org>2021-01-17 18:06:39 -0800
committerMichel Alexandre Salim <salimma@fedoraproject.org>2021-01-17 18:06:39 -0800
commit013a041379ce4cd5bd3f15ec18f4ffe336630a65 (patch)
tree6730a4258322f16e3ef0668bf3408bd5a2fa0280 /nodejs
parent4046ba39c9a0e35ee25c8c65f833344535c14240 (diff)
downloadspecs-013a041379ce4cd5bd3f15ec18f4ffe336630a65.tar.gz
specs-013a041379ce4cd5bd3f15ec18f4ffe336630a65.tar.xz
specs-013a041379ce4cd5bd3f15ec18f4ffe336630a65.zip
Draft bitwarden-cli spec and SRPM
Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
Diffstat (limited to 'nodejs')
-rw-r--r--nodejs/bitwarden-cli.spec74
1 files changed, 48 insertions, 26 deletions
diff --git a/nodejs/bitwarden-cli.spec b/nodejs/bitwarden-cli.spec
index 5c660fd..7d63c6d 100644
--- a/nodejs/bitwarden-cli.spec
+++ b/nodejs/bitwarden-cli.spec
@@ -1,24 +1,26 @@
%global npm_name @bitwarden/cli
+%bcond_with tests
%{?nodejs_default_filter}
-%{?nodejs_find_provides_and_requires}
+#{?nodejs_find_provides_and_requires}
Name: bitwarden-cli
-Version: 1.11.0
+Version: 1.13.3
Release: 1%{?dist}
Summary: Bitwarden vault CLI tool
License: GPLv3
URL: https://github.com/bitwarden/cli
Source0: https://registry.npmjs.org/%{npm_name}/-/cli-%{version}.tgz#/%{name}-%{version}.tgz
-# rename from @bitwarden/cli to bitwarden-cli
-Patch0: %{name}-1.11.0-fixname.diff
+Source1: %{name}-%{version}-nm-prod.tgz
+Source2: %{name}-%{version}-nm-dev.tgz
+Source3: %{name}-%{version}-bundled-licenses.txt
-BuildRequires: nodejs
-# BuildRequires: nodejs-packaging
-
-ExclusiveArch: %{nodejs_arches} noarch
BuildArch: noarch
+ExclusiveArch: %{nodejs_arches} noarch
+
+Requires: nodejs
+BuildRequires: nodejs-devel
%description
The Bitwarden CLI is a powerful, full-featured command-line interface (CLI) tool
@@ -28,39 +30,59 @@ Node.js
%prep
%autosetup -p1 -n package
+cp %{SOURCE3} .
%build
-#nothing to do
+# Setup bundled node modules
+tar xfz %{SOURCE1}
+# bad shebang - and we don't need this anyway
+# #!/usr/bin/env ./node_modules/.bin/coffee
+rm -rf ./node_modules_prod/performance-now/test/
+find . -name '*prod'
+mkdir -p node_modules
+pushd node_modules
+ln -s ../node_modules_prod/* .
+ln -s ../node_modules_prod/.bin .
+popd
%install
-# not using npm_name as it contains a / which confuses the packaging scripts
-mkdir -p %{buildroot}%{nodejs_sitelib}/%{name}
-cp -pr build package.json %{buildroot}%{nodejs_sitelib}/%{name}
-BIN=%{nodejs_sitelib}/%{name}/build/bw.js
-chmod +x %{buildroot}${BIN}
-pushd %{buildroot}
-mkdir -p ./%{_bindir}
-ln -s ${BIN} ./%{_bindir}/bw
-popd
+mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name}
+# Copy over bundled nodejs modules
+cp -pr node_modules node_modules_prod %{buildroot}%{nodejs_sitelib}/%{npm_name}
+
+cp -pr build package.json %{buildroot}%{nodejs_sitelib}/%{npm_name}
-%nodejs_symlink_deps
+mkdir -p %{buildroot}%{_bindir}
+cat <<EOF > %{buildroot}%{_bindir}/bw
+#!/bin/sh
+node %{nodejs_sitelib}/%{npm_name}/build/bw.js \$@
+EOF
+%if %{with tests}
%check
-#pushd build
-#{__nodejs} -e 'require("./")'
-#popd
+%nodejs_symlink_deps --check
+# Setup bundled dev node_modules for testing
+tar xfz %{SOURCE2}
+pushd node_modules
+ln -s ../node_modules_dev/* .
+popd
+pushd node_modules/.bin
+ln -s ../../node_modules_dev/.bin/* .
+popd
+%endif
%files
-%license LICENSE.txt
+%license LICENSE.txt %{name}-%{version}-bundled-licenses.txt
%doc README.md
-%{_bindir}/bw
-%{nodejs_sitelib}/%{name}
+%attr(0755,root,root) %{_bindir}/bw
+%dir %{nodejs_sitelib}/@bitwarden
+%{nodejs_sitelib}/%{npm_name}
%changelog
-* Wed Jul 29 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.11.0-1
+* Sun Jan 17 2021 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.13.3-1
- Initial package