diff --git a/license b/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/nodejs-require-uncached.spec b/nodejs-require-uncached.spec new file mode 100644 index 0000000..268ae97 --- /dev/null +++ b/nodejs-require-uncached.spec @@ -0,0 +1,51 @@ +%global enable_tests 0 +%global module_name require-uncached +Name: nodejs-%{module_name} +Version: 1.0.3 +Release: 1 +Summary: Require a module bypassing the cache +License: MIT +URL: https://github.com/sindresorhus/require-uncached +Source0: http://registry.npmjs.org/require-uncached/-/require-uncached-%{version}.tgz +Source1: https://raw.githubusercontent.com/sindresorhus/import-fresh/v%{version}/license +Source2: https://raw.githubusercontent.com/sindresorhus/import-fresh/v%{version}/test.js +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch +BuildRequires: nodejs-packaging npm(caller-path) npm(resolve-from) +%if 0%{?enable_tests} +BuildRequires: npm(ava) +%endif +%description +Useful for testing purposes when you need to freshly require a module. + +%prep +%autosetup -n package +rm -rf node_modules +cp -p %{SOURCE1} %{SOURCE2} . +%nodejs_fixdep caller-path +%nodejs_fixdep resolve-from + +%build + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{module_name} +cp -pr package.json *.js %{buildroot}%{nodejs_sitelib}/%{module_name} +%nodejs_symlink_deps + +%check +%nodejs_symlink_deps --check +%{__nodejs} -e 'require("./")' +%if 0%{?enable_tests} +node test.js +%else +%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" +%endif + +%files +%doc readme.md +%license license +%{nodejs_sitelib}/%{module_name} + +%changelog +* Fri Aug 14 2020 wangyue - 1.0.3-1 +- Package init diff --git a/nodejs-require-uncached.yaml b/nodejs-require-uncached.yaml new file mode 100644 index 0000000..9ebfd50 --- /dev/null +++ b/nodejs-require-uncached.yaml @@ -0,0 +1,5 @@ +git_url: https://github.com/sindresorhus/require-uncached +version_control: github +src_repo: sindresorhus/require-uncached +tag_prefix: "^v" +seperator: "." diff --git a/require-uncached-1.0.3.tgz b/require-uncached-1.0.3.tgz new file mode 100644 index 0000000..d8fef8f Binary files /dev/null and b/require-uncached-1.0.3.tgz differ diff --git a/test.js b/test.js new file mode 100644 index 0000000..f3dd21a --- /dev/null +++ b/test.js @@ -0,0 +1,12 @@ +import test from 'ava'; +import m from './'; + +test(t => { + const id = './fixture'; + t.is(require(id)(), 1); + t.is(require(id)(), 2); + t.is(require(id)(), 3); + t.is(m(id)(), 1); + t.is(m(id)(), 1); + t.is(m(id)(), 1); +});