diff --git a/caller-path-2.0.0.tgz b/caller-path-2.0.0.tgz new file mode 100644 index 0000000..0bec58a Binary files /dev/null and b/caller-path-2.0.0.tgz differ diff --git a/nodejs-caller-path.spec b/nodejs-caller-path.spec new file mode 100644 index 0000000..18a25f4 --- /dev/null +++ b/nodejs-caller-path.spec @@ -0,0 +1,48 @@ +%global enable_tests 0 +%global module_name caller-path +Name: nodejs-%{module_name} +Version: 2.0.0 +Release: 1 +Summary: Get the path of the caller module +License: MIT +URL: https://github.com/sindresorhus/caller-path +Source0: http://registry.npmjs.org/caller-path/-/caller-path-%{version}.tgz +Source1: https://raw.githubusercontent.com/sindresorhus/caller-path/master/test.js +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch +BuildRequires: nodejs-packaging +%if 0%{?enable_tests} +BuildRequires: npm(fixture) npm(mocha) +%endif +%description +Get the path of the caller module. You can't use module.parent as modules are +cached and it will return the first caller module, not necessarily the current +one. + +%prep +%setup -q -n package +rm -rf node_modules +cp -p %{SOURCE1} . + +%build + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{module_name} +cp -pr package.json *.js %{buildroot}%{nodejs_sitelib}/%{module_name} +%nodejs_symlink_deps +%if 0%{?enable_tests} + +%check +%nodejs_symlink_deps --check +%{__nodejs} -e 'require("./")' +mocha +%endif + +%files +%doc readme.md +%license license +%{nodejs_sitelib}/%{module_name} + +%changelog +* Mon Aug 17 2020 Shaoqiang Kang - 2.0.0-1 +- Package init diff --git a/nodejs-caller-path.yaml b/nodejs-caller-path.yaml new file mode 100644 index 0000000..79b6fd7 --- /dev/null +++ b/nodejs-caller-path.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: sindresorhus/caller-path +tag_prefix: "v" +seperator: "." diff --git a/test.js b/test.js new file mode 100644 index 0000000..9cba378 --- /dev/null +++ b/test.js @@ -0,0 +1,11 @@ +import path from 'path'; +import test from 'ava'; +import fixture from './fixture'; +import fixture2 from './fixture2'; +import fixture3 from './fixture3'; + +test(t => { + t.is(path.basename(fixture()), 'test.js'); + t.is(path.basename(fixture2()), 'test.js'); + t.is(path.basename(fixture3()), 'test.js'); +});