summaryrefslogtreecommitdiffstats
path: root/nodejs
diff options
context:
space:
mode:
authorMichel Alexandre Salim <salimma@fedoraproject.org>2021-01-19 20:39:53 -0800
committerMichel Alexandre Salim <salimma@fedoraproject.org>2021-01-19 20:39:53 -0800
commit3b17a861c458d3b58f6175d1cb2aa5a8abd625b4 (patch)
tree3430c0b8ad488142173786b95bdb7b57660a7022 /nodejs
parent55186260f2238f62a9fe60785c1fb01060978618 (diff)
downloadspecs-3b17a861c458d3b58f6175d1cb2aa5a8abd625b4.tar.gz
specs-3b17a861c458d3b58f6175d1cb2aa5a8abd625b4.tar.xz
specs-3b17a861c458d3b58f6175d1cb2aa5a8abd625b4.zip
nodejs/bitwarden-cli:
- fix lints - symlink to binary, don't wrap with shell script Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
Diffstat (limited to 'nodejs')
-rw-r--r--nodejs/bitwarden-cli.spec42
1 files changed, 35 insertions, 7 deletions
diff --git a/nodejs/bitwarden-cli.spec b/nodejs/bitwarden-cli.spec
index f23b454..602a4a4 100644
--- a/nodejs/bitwarden-cli.spec
+++ b/nodejs/bitwarden-cli.spec
@@ -35,10 +35,40 @@ cp %{SOURCE3} .
%build
# Setup bundled node modules
tar xfz %{SOURCE1}
-# bad shebang - and we don't need this anyway
+# remove unnecessary files
+# #!/usr/bin/env node, sh, bash
+rm -rf node_modules_prod/ajv/scripts/
+# bash completion script
+rm -rf node_modules_prod/dashdash/etc
+# empty log
+rm -f node_modules_prod/nwsapi/dist/lint.log
# #!/usr/bin/env ./node_modules/.bin/coffee
-rm -rf ./node_modules_prod/performance-now/test/
-find . -name '*prod'
+rm -rf node_modules_prod/performance-now/test/
+# scripts
+rm -rf node_modules_prod/pn/scripts/
+
+# fix shebangs for node
+for f in $(grep -l '/usr/bin/env node' build/bw.js node_modules_prod/is-docker/cli.js node_modules_prod/*/bin/*);
+do
+ sed -i 's|#!/usr/bin/env node$|#!/usr/bin/node|' $f
+done
+# fix executable permissions
+chmod 755 build/bw.js node_modules_prod/tldjs/bin/update.js
+
+# js.map and json files should not be executable
+find node_modules_prod -type f -executable \( -name '*.js.map' -o -name '*.json' \) -exec chmod 644 '{}' +
+
+# compress bundled manpages
+for m in sshpk;
+do
+ gzip node_modules_prod/$m/man/man*/*.?
+done
+
+
+# remove hidden files and directories
+find node_modules_prod -type f -name '.*' -delete
+find node_modules_prod -type d -name .bin -prune -o -type d -name '.*' -exec rm -rf '{}' +
+
mkdir -p node_modules
pushd node_modules
ln -s ../node_modules_prod/* .
@@ -54,10 +84,8 @@ cp -pr node_modules node_modules_prod %{buildroot}%{nodejs_sitelib}/%{npm_name}
cp -pr build package.json %{buildroot}%{nodejs_sitelib}/%{npm_name}
mkdir -p %{buildroot}%{_bindir}
-cat <<EOF > %{buildroot}%{_bindir}/bw
-#!/bin/sh
-node %{nodejs_sitelib}/%{npm_name}/build/bw.js \$@
-EOF
+pushd %{buildroot}%{_bindir}
+ln -s ../../%{nodejs_sitelib}/%{npm_name}/build/bw.js bw
%files