%{?nodejs_find_provides_and_requires} %global enable_tests 0 %global enable_grunt 0 Name: nodejs-hooker Version: 0.2.3 Release: 1 Summary: Monkey-patch (hook) functions for debugging License: MIT URL: https://github.com/cowboy/javascript-hooker Source0: http://registry.npmjs.org/hooker/-/hooker-%{version}.tgz Patch0: %{name}-0.2.3-Updating-gruntfile-to-grunt-0.3.0-format.patch Patch1: %{name}-0.2.3-Rename-grunt.js-to-Gruntfile.js.patch Patch2: %{name}-0.2.3-Update-Gruntfile.js-for-use-with-grunt-0.4.0.patch BuildArch: noarch ExclusiveArch: %{nodejs_arches} noarch BuildRequires: nodejs-packaging uglify-js %if 0%{?enable_tests} BuildRequires: npm(nodeunit) %endif %if 0%{?enable_grunt} BuildRequires: npm(grunt-cli) npm(grunt-contrib-nodeunit) npm(grunt-contrib-uglify) %endif %description %{summary}. %prep %setup -q -n package %patch0 -p1 %patch1 -p1 %patch2 -p1 %nodejs_symlink_deps --check %build %if 0%{?enable_grunt} grunt uglify %else head -n 8 lib/hooker.js > dist/ba-hooker.min.js.new /usr/bin/uglifyjs dist/ba-hooker.js -m -c >> dist/ba-hooker.min.js.new touch -r dist/ba-hooker.min.js dist/ba-hooker.min.js.new mv dist/ba-hooker.min.js{.new,} %endif %install mkdir -p %{buildroot}%{nodejs_sitelib}/hooker cp -pr package.json child.js dist/ lib/ parent.js \ %{buildroot}%{nodejs_sitelib}/hooker %nodejs_symlink_deps %if 0%{?enable_tests} %check %if 0%{?enable_grunt} grunt nodeunit %else %{nodejs_sitelib}/nodeunit/bin/nodeunit test/*.js %endif %endif %files %doc LICENSE-MIT README.md %{nodejs_sitelib}/hooker %changelog * Thu Aug 20 2020 wangxiao - 0.2.3-1 - Package init