package init

This commit is contained in:
wangchong1995924 2020-08-21 14:41:44 +08:00
parent 6237fb1ab7
commit eccac940d1
5 changed files with 77 additions and 0 deletions

1
licenses.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,52 @@
%global npm_name spdx-license-ids
%{?nodejs_find_provides_and_requires}
%global enable_tests 0
Name: nodejs-spdx-license-ids
Version: 1.2.0
Release: 1
Summary: A list of SPDX license identifiers
Url: https://github.com/shinnn/spdx-license-ids
Source0: https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-%{version}.tgz
Source1: https://spdx.org/licenses/licenses.json
Source2: https://raw.githubusercontent.com/shinnn/spdx-license-ids/v1.2.0/test.js
License: Unlicense
BuildArch: noarch
ExclusiveArch: %{nodejs_arches} noarch
BuildRequires: jq nodejs-packaging
%if 0%{?enable_tests}
BuildRequires: npm(rimraf) npm(tape)
%endif
%description
A list of SPDX license identifiers
%prep
%setup -q -n package
cp -p %{SOURCE1} .
cp -p %{SOURCE2} .
chmod -x README.md
rm spdx-license-ids.json
%build
%{_bindir}/jq '[.licenses[].licenseId] | map(select(endswith("+")|not))' licenses.json > spdx-license-ids.json
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name}
cp -pr package.json spdx-license-ids.json %{buildroot}%{nodejs_sitelib}/%{npm_name}
%{nodejs_symlink_deps}
%check
%{nodejs_symlink_deps} --check
%{__nodejs} -e 'require("./")'
%if 0%{?enable_tests}
%{__nodejs} --harmony_arrow_functions test.js
%endif
%files
%{!?_licensedir:%global license %doc}
%{nodejs_sitelib}/spdx-license-ids
%doc README.md
%license LICENSE
%changelog
* Fri Aug 21 2020 wangchong <wangchong56@huawei.com> - 1.2.0-1
- package init

View File

@ -0,0 +1,4 @@
version-control: github
src_repo: shinnn/spdx-license-ids
tag_prefix: ^v
seperator: .

BIN
spdx-license-ids-1.2.0.tgz Normal file

Binary file not shown.

20
test.js Normal file
View File

@ -0,0 +1,20 @@
'use strict';
const test = require('tape');
const requireBowerFiles = require('require-bower-files');
let expected = require('./spdx-license-ids.json');
function runTest(description, main) {
test(description, t => {
t.plan(1);
t.deepEqual(main, expected, 'should return an array of SPDX license identifiers.');
});
}
runTest('require(\'spdx-license-ids\')', require('.'));
global.window = {};
requireBowerFiles({self: true});
runTest('window.spdxLicenseIds', window.spdxLicenseIds);