From 7c94fd248c49795f1c42ae11bc7e1a85a722123360efcbe39c39c956d5582f84 Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Fri, 29 Jan 2021 10:42:25 +0000 Subject: [PATCH] Accepting request 867549 from home:adamm:nodejs localhost npm proxy so we can build programs that need npm in OBS OBS-URL: https://build.opensuse.org/request/show/867549 OBS-URL: https://build.opensuse.org/package/show/devel:languages:javascript/local-npm-registry?expand=0&rev=1 --- .gitattributes | 23 +++++++++++ .gitignore | 1 + catch_errors.patch | 17 +++++++++ local-npm-registry.changes | 12 ++++++ local-npm-registry.spec | 65 ++++++++++++++++++++++++++++++++ local_npm_registry-v0.0.2.tar.gz | 3 ++ 6 files changed, 121 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 catch_errors.patch create mode 100644 local-npm-registry.changes create mode 100644 local-npm-registry.spec create mode 100644 local_npm_registry-v0.0.2.tar.gz diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/catch_errors.patch b/catch_errors.patch new file mode 100644 index 0000000..d7953d5 --- /dev/null +++ b/catch_errors.patch @@ -0,0 +1,17 @@ +Index: local_npm_registry-v0.0.1/dist/index.js +=================================================================== +--- local_npm_registry-v0.0.1.orig/dist/index.js ++++ local_npm_registry-v0.0.1/dist/index.js +@@ -96,7 +96,11 @@ function mainEntryFunction() { + .then(port => configureNpmToSpecificLocalhostPort(service, port)) + .then(() => runNpmInstall()) + .then(() => { +- console.log("npm done. Shutting down proxy"); ++ console.log("npm done"); ++ }).catch(err => { ++ console.log("npm errors: %s", err); ++ }).finally(() => { ++ console.log("Shutting down proxy"); + return service.stop(); + }); + return 0; diff --git a/local-npm-registry.changes b/local-npm-registry.changes new file mode 100644 index 0000000..a0ac574 --- /dev/null +++ b/local-npm-registry.changes @@ -0,0 +1,12 @@ +------------------------------------------------------------------- +Tue Jan 26 14:43:10 UTC 2021 - Adam Majer + +- Update to 0.0.2: fixes uncaught exceptions +- work with quilt when unpacking archive + +------------------------------------------------------------------- +Mon Jan 18 16:16:21 UTC 2021 - Adam Majer + +- Initial version 0.0.1 + + diff --git a/local-npm-registry.spec b/local-npm-registry.spec new file mode 100644 index 0000000..8bfddf1 --- /dev/null +++ b/local-npm-registry.spec @@ -0,0 +1,65 @@ +# +# spec file for package local-npm-registry +# +# Copyright (c) 2021 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +Name: local-npm-registry +Version: 0.0.2 +Release: 0 +Summary: Localhost-only version of NPM registry +License: GPL-3.0-or-later +Url: https://github.com/openSUSE/npm-localhost-proxy +Source: https://github.com/openSUSE/npm-localhost-proxy/releases/download/v%{version}/local_npm_registry-v%{version}.tar.gz +Requires: npm-default +BuildArch: noarch + +%description +localhost-only npm registry serves NPM packages on localhost +address allowing running of "npm install" in a non-networked +environment + +%prep +%autosetup -p1 -n local_npm_registry-v%{version} + +%build +# nothing to build + +%install +mkdir -p %{buildroot}%{_datadir}/%{name} +mkdir -p %{buildroot}%{_bindir} +cp -r dist node_modules %{buildroot}%{_datadir}/%{name} +cat > %{buildroot}%{_bindir}/local-npm-registry << EOF +#!/bin/sh + +if [ "x$QUILT_COMMAND" = "xsetup" ] +then + echo "Run in setup mode. 'npm install' skipped. Run 'npm ci' manually." + cp "$RPM_SOURCE_DIR/package-lock.json" . + exit 0 +fi + +exec %{_bindir}/node %{_datadir}/%{name}/dist/ "\$@" +EOF + +%files +%defattr(-,root,root) +%license COPYING +%doc README.md +%attr(755,root,root) %{_bindir}/local-npm-registry +%{_datadir}/%{name} + +%changelog + diff --git a/local_npm_registry-v0.0.2.tar.gz b/local_npm_registry-v0.0.2.tar.gz new file mode 100644 index 0000000..87850c6 --- /dev/null +++ b/local_npm_registry-v0.0.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a1df1c99668f805a8ddb62a610d6611055086d3200716d423af0e0b11ef55d4 +size 145030