%global modulename libcipm

%global npmlib_dir %{npmlib_sitelib}
%global nodejs_dir %{nodejs_sitelib}

%define __requires_exclude_from ^%{npmlib_dir}/%{modulename}/%{version}/tests?/.*

Name:           npmlib-libcipm
Version:        2.0.2
Release:        1%{?dist}
Summary:        programmatic API for cipm: a ci-oriented package installer for npm

License:        MIT
URL:            https://github.com/zkat/cipm#readme
Source0:        https://registry.npmjs.org/libcipm/-/libcipm-2.0.2.tgz

Patch0: npm2srpm-dependencies.patch

BuildRequires:  npmlib-packaging

BuildArch:      noarch
ExclusiveArch:  %{nodejs_arches} noarch

BuildRequires:  ((npmlib(bin-links) >= 1.1.2 with npmlib(bin-links) < 2.0.0))
BuildRequires:  ((npmlib(bluebird) >= 3.5.1 with npmlib(bluebird) < 4.0.0))
BuildRequires:  ((npmlib(find-npm-prefix) >= 1.0.2 with npmlib(find-npm-prefix) < 2.0.0))
BuildRequires:  ((npmlib(graceful-fs) >= 4.1.11 with npmlib(graceful-fs) < 5.0.0))
BuildRequires:  ((npmlib(lock-verify) >= 2.0.2 with npmlib(lock-verify) < 3.0.0))
BuildRequires:  ((npmlib(mkdirp) >= 0.5.1 with npmlib(mkdirp) < 0.6.0))
BuildRequires:  ((npmlib(npm-lifecycle) >= 2.0.3 with npmlib(npm-lifecycle) < 3.0.0))
BuildRequires:  ((npmlib(npm-logical-tree) >= 1.2.1 with npmlib(npm-logical-tree) < 2.0.0))
BuildRequires:  ((npmlib(npm-package-arg) >= 6.1.0 with npmlib(npm-package-arg) < 7.0.0))
BuildRequires:  ((npmlib(pacote) >= 8.1.6 with npmlib(pacote) < 9.0.0))
BuildRequires:  ((npmlib(protoduck) >= 5.0.0 with npmlib(protoduck) < 6.0.0))
BuildRequires:  ((npmlib(read-package-json) >= 2.0.13 with npmlib(read-package-json) < 3.0.0))
BuildRequires:  ((npmlib(rimraf) >= 2.6.2 with npmlib(rimraf) < 3.0.0))
BuildRequires:  ((npmlib(worker-farm) >= 1.6.0 with npmlib(worker-farm) < 2.0.0))
BuildRequires:  ((npmlib(npmlog) >= 4.1.2 with npmlib(npmlog) < 5.0.0))
BuildRequires:  ((npmlib(safe-buffer) = 5.0.1))

Requires:       npmlib(%{modulename}) = %{version}

%description
programmatic API for cipm: a ci-oriented package installer for npm

%package 2.0.2
Summary:        programmatic API for cipm: a ci-oriented package installer for npm


%description 2.0.2
programmatic API for cipm: a ci-oriented package installer for npm

%prep
%autosetup -p0 -n package

%build
# Nothing to build

%install
mkdir -p %{buildroot}%{npmlib_dir}/%{modulename}/%{version}
cp -pr index.js %{buildroot}%{npmlib_dir}/%{modulename}/%{version}
cp -pr lib %{buildroot}%{npmlib_dir}/%{modulename}/%{version}
cp -pr package.json %{buildroot}%{npmlib_dir}/%{modulename}/%{version}



mkdir -p %{buildroot}%{nodejs_dir}
ln -s %{npmlib_dir}/%{modulename}/%{version} %{buildroot}/%{nodejs_dir}/%{modulename}

%{npmlib_symlink_deps}

%check
rm -rf node_modules && %{npmlib_symlink_deps} .
%{__nodejs} -e 'require("./")'

%files
%doc CHANGELOG.md
%doc LICENSE.md
%doc README.md
%{nodejs_dir}/%{modulename}

%files 2.0.2
%doc CHANGELOG.md
%doc LICENSE.md
%doc README.md
%{npmlib_dir}/%{modulename}/%{version}
%dir %{npmlib_dir}/%{modulename}/

%changelog
* Mon Nov 19 2018 npm2srpm <dshea@redhat.com> - 2.0.2-1
- Package automatically generated by npm2srpm