package init

This commit is contained in:
wangxiao65 2020-09-01 13:54:39 +08:00
parent 4d2cb5f268
commit 65a8942dce
4 changed files with 79 additions and 0 deletions

BIN
has-ansi-2.0.0.tgz Normal file

Binary file not shown.

65
nodejs-has-ansi.spec Normal file
View File

@ -0,0 +1,65 @@
%{?nodejs_find_provides_and_requires}
%global packagename has-ansi
%global enable_tests 0
# Tests disabled due to missing nodejs-ava package dependency
Name: nodejs-has-ansi
Version: 2.0.0
Release: 1
Summary: Check if a string has ANSI escape codes
License: MIT
URL: https://github.com/sindresorhus/has-ansi
Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz
# The test files are not included in the npm tarball.
Source1: https://raw.githubusercontent.com/chalk/has-ansi/0722275e1bef139fcd09137da6e5550c3cd368b9/test.js
ExclusiveArch: %{nodejs_arches} noarch
BuildArch: noarch
BuildRequires: nodejs-packaging
%if 0%{?enable_tests}
BuildRequires: npm(ava)
%endif
%description
Check if a string has ANSI escape codes
%prep
%setup -q -n package
# setup the tests
cp -p %{SOURCE1} .
%build
# nothing to do!
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename}
cp -pr package.json *.js \
%{buildroot}%{nodejs_sitelib}/%{packagename}
%nodejs_symlink_deps
%if 0%{?enable_tests}
%check
%nodejs_symlink_deps --check
%{__nodejs} -e 'require("./")'
%{__nodejs} test.js
%endif
%files
%{!?_licensedir:%global license %doc}
%doc *.md
%license license
%{nodejs_sitelib}/%{packagename}
%changelog
* Thu Aug 20 2020 wangxiao <wangxiao65@huawei.com> - 2.0.0-1
- package init

5
nodejs-has-ansi.yaml Normal file
View File

@ -0,0 +1,5 @@
git_url: https://github.com/sindresorhus/has-ansi
version_control: github
src_repo: sindresorhus/has-ansi
tag_prefix: "^v"
seperator: "."

9
test.js Normal file
View File

@ -0,0 +1,9 @@
'use strict';
var test = require('ava');
var hasAnsi = require('./');
test(function (t) {
t.assert(hasAnsi('foo\u001b[4mcake\u001b[0m'));
t.assert(!hasAnsi('cake'));
t.end();
});