diff --git a/nodejs-path-exists.spec b/nodejs-path-exists.spec new file mode 100644 index 0000000..a2e6fd7 --- /dev/null +++ b/nodejs-path-exists.spec @@ -0,0 +1,47 @@ +%global enable_tests 0 +%global srcname path-exists +Epoch: 1 +Name: nodejs-%{srcname} +Version: 3.0.0 +Release: 1 +Summary: Promisify a callback-style function +License: MIT +URL: https://github.com/sindresorhus/path-exists +Source0: https://registry.npmjs.com/%{srcname}/-/%{srcname}-%{version}.tgz +Source1: https://raw.githubusercontent.com/sindresorhus/%{srcname}/v%{version}/test.js +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch +BuildRequires: nodejs-packaging +%if 0%{?enable_tests} +BuildRequires: npm(ava) +%endif +%description +%{summary}. + +%prep +%autosetup -n package +cp -p %{SOURCE1} . + +%build + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{srcname} +cp -pr index.js package.json \ + %{buildroot}%{nodejs_sitelib}/%{srcname} +%nodejs_symlink_deps + +%check +%nodejs_symlink_deps --check +%{__nodejs} -e 'require("./")' +%if 0%{?enable_tests} +ava +%endif + +%files +%doc readme.md +%license license +%{nodejs_sitelib}/%{srcname} + +%changelog +* Mon Aug 31 2020 wutao - 3.0.0-1 +- Package init diff --git a/nodejs-path-exists.yaml b/nodejs-path-exists.yaml new file mode 100644 index 0000000..462bbb1 --- /dev/null +++ b/nodejs-path-exists.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: sindresorhus/path-exists +tag_prefix: "^v" +seperator: "." diff --git a/path-exists-3.0.0.tgz b/path-exists-3.0.0.tgz new file mode 100644 index 0000000..4c5ff16 Binary files /dev/null and b/path-exists-3.0.0.tgz differ diff --git a/test.js b/test.js new file mode 100644 index 0000000..e726a11 --- /dev/null +++ b/test.js @@ -0,0 +1,12 @@ +import test from 'ava'; +import m from './'; + +test('async', async t => { + t.true(await m('test.js')); + t.false(await m('fail')); +}); + +test('sync', t => { + t.true(m.sync('test.js')); + t.false(m.sync('fail')); +});