package init
This commit is contained in:
parent
8cd756344e
commit
d9dae1353f
BIN
ansi-styles-2.1.0.tgz
Normal file
BIN
ansi-styles-2.1.0.tgz
Normal file
Binary file not shown.
50
nodejs-ansi-styles.spec
Normal file
50
nodejs-ansi-styles.spec
Normal file
@ -0,0 +1,50 @@
|
||||
%{?nodejs_find_provides_and_requires}
|
||||
%global enable_tests 1
|
||||
Name: nodejs-ansi-styles
|
||||
Version: 2.1.0
|
||||
Release: 1
|
||||
Summary: ANSI escape codes for colorizing strings in the terminal
|
||||
License: MIT
|
||||
URL: https://github.com/sindresorhus/ansi-styles
|
||||
Source0: http://registry.npmjs.org/ansi-styles/-/ansi-styles-%{version}.tgz
|
||||
Source1: https://raw.githubusercontent.com/chalk/ansi-styles/v%{version}/test.js
|
||||
BuildArch: noarch
|
||||
ExclusiveArch: %{nodejs_arches} noarch
|
||||
BuildRequires: nodejs-packaging
|
||||
%if 0%{?enable_tests}
|
||||
BuildRequires: npm(mocha) npm(chalk) npm(require-uncached)
|
||||
%endif
|
||||
%description
|
||||
%{summary}.
|
||||
|
||||
%prep
|
||||
%setup -q -n package
|
||||
cp -p %{SOURCE1} .
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}%{nodejs_sitelib}/ansi-styles
|
||||
cp -pr package.json index.js \
|
||||
%{buildroot}%{nodejs_sitelib}/ansi-styles
|
||||
%nodejs_symlink_deps
|
||||
|
||||
%check
|
||||
%nodejs_symlink_deps --check
|
||||
%{__nodejs} -e 'require("./")'
|
||||
%if 0%{?enable_tests}
|
||||
ln -s %{nodejs_sitelib}/chalk node_modules/chalk
|
||||
%{_bindir}/mocha -R spec
|
||||
%else
|
||||
%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m"
|
||||
%endif
|
||||
|
||||
%files
|
||||
%{!?_licensedir:%global license %doc}
|
||||
%doc readme.md
|
||||
%license license
|
||||
%{nodejs_sitelib}/ansi-styles
|
||||
|
||||
%changelog
|
||||
* Mon Aug 17 2020 Shaoqiang Kang <kangshaoqiang1@huawei.com> - 2.1.0-1
|
||||
- Package init
|
||||
4
nodejs-ansi-styles.yaml
Normal file
4
nodejs-ansi-styles.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
version_control: github
|
||||
src_repo: sindresorhus/ansi-styles
|
||||
tag_prefix: "v"
|
||||
seperator: "."
|
||||
42
test.js
Normal file
42
test.js
Normal file
@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
var assert = require('assert');
|
||||
var ansi = require('./');
|
||||
|
||||
// generates the screenshot
|
||||
Object.keys(ansi).forEach(function (el) {
|
||||
var style = ansi[el].open;
|
||||
|
||||
if (el === 'reset' || el === 'hidden') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (/^bg[^B]/.test(el)) {
|
||||
style = ansi.black.open + style;
|
||||
}
|
||||
|
||||
process.stdout.write(style + el + ansi.reset.open + ansi.reset.close + ' ');
|
||||
});
|
||||
|
||||
it('should return ANSI escape codes', function () {
|
||||
assert.equal(ansi.green.open, '\u001b[32m');
|
||||
assert.equal(ansi.bgGreen.open, '\u001b[42m');
|
||||
assert.equal(ansi.green.close, '\u001b[39m');
|
||||
assert.equal(ansi.gray.open, ansi.grey.open);
|
||||
});
|
||||
|
||||
it('should group related codes into categories', function () {
|
||||
assert.equal(ansi.colors.magenta, ansi.magenta);
|
||||
assert.equal(ansi.bgColors.bgYellow, ansi.bgYellow);
|
||||
assert.equal(ansi.modifiers.bold, ansi.bold);
|
||||
});
|
||||
|
||||
it('groups should not be enumerable', function () {
|
||||
assert.equal(Object.keys(ansi).indexOf('modifiers'), -1);
|
||||
});
|
||||
|
||||
it('should not pollute other objects', function () {
|
||||
var obj1 = require('./');
|
||||
var obj2 = require('./');
|
||||
obj1.foo = true;
|
||||
assert.notEqual(obj1.foo, obj2.foo);
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user