mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
feat: replaced lunr by lunr-mutable (#915)
This commit is contained in:
parent
43bd622e29
commit
1602840ed1
11 changed files with 114 additions and 447 deletions
74
flow-typed/npm/lunr-mutable-indexes_vx.x.x.js
vendored
Normal file
74
flow-typed/npm/lunr-mutable-indexes_vx.x.x.js
vendored
Normal file
|
@ -0,0 +1,74 @@
|
|||
// flow-typed signature: f588bf5982dc1140e97108be62b860db
|
||||
// flow-typed version: <<STUB>>/lunr-mutable-indexes_v2.3.1/flow_v0.77.0
|
||||
|
||||
/**
|
||||
* This is an autogenerated libdef stub for:
|
||||
*
|
||||
* 'lunr-mutable-indexes'
|
||||
*
|
||||
* Fill this stub out by replacing all the `any` types.
|
||||
*
|
||||
* Once filled out, we encourage you to share your work with the
|
||||
* community by sending a pull request to:
|
||||
* https://github.com/flowtype/flow-typed
|
||||
*/
|
||||
|
||||
declare module 'lunr-mutable-indexes' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* We include stubs for each file inside this npm package in case you need to
|
||||
* require those files directly. Feel free to delete any files that aren't
|
||||
* needed.
|
||||
*/
|
||||
declare module 'lunr-mutable-indexes/lib/lunr_mutable' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr-mutable-indexes/lib/mutable_builder' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr-mutable-indexes/lib/mutable_index' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr-mutable-indexes/lunr-mutable' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr-mutable-indexes/test/mutable_serialization_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr-mutable-indexes/test/mutable_sugar_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr-mutable-indexes/test/mutable_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
// Filename aliases
|
||||
declare module 'lunr-mutable-indexes/lib/lunr_mutable.js' {
|
||||
declare module.exports: $Exports<'lunr-mutable-indexes/lib/lunr_mutable'>;
|
||||
}
|
||||
declare module 'lunr-mutable-indexes/lib/mutable_builder.js' {
|
||||
declare module.exports: $Exports<'lunr-mutable-indexes/lib/mutable_builder'>;
|
||||
}
|
||||
declare module 'lunr-mutable-indexes/lib/mutable_index.js' {
|
||||
declare module.exports: $Exports<'lunr-mutable-indexes/lib/mutable_index'>;
|
||||
}
|
||||
declare module 'lunr-mutable-indexes/lunr-mutable.js' {
|
||||
declare module.exports: $Exports<'lunr-mutable-indexes/lunr-mutable'>;
|
||||
}
|
||||
declare module 'lunr-mutable-indexes/test/mutable_serialization_test.js' {
|
||||
declare module.exports: $Exports<'lunr-mutable-indexes/test/mutable_serialization_test'>;
|
||||
}
|
||||
declare module 'lunr-mutable-indexes/test/mutable_sugar_test.js' {
|
||||
declare module.exports: $Exports<'lunr-mutable-indexes/test/mutable_sugar_test'>;
|
||||
}
|
||||
declare module 'lunr-mutable-indexes/test/mutable_test.js' {
|
||||
declare module.exports: $Exports<'lunr-mutable-indexes/test/mutable_test'>;
|
||||
}
|
431
flow-typed/npm/lunr_vx.x.x.js
vendored
431
flow-typed/npm/lunr_vx.x.x.js
vendored
|
@ -1,431 +0,0 @@
|
|||
// flow-typed signature: e0027883db9b96a34c42414495ddfa2b
|
||||
// flow-typed version: <<STUB>>/lunr_v0.7.2/flow_v0.64.0
|
||||
|
||||
/**
|
||||
* This is an autogenerated libdef stub for:
|
||||
*
|
||||
* 'lunr'
|
||||
*
|
||||
* Fill this stub out by replacing all the `any` types.
|
||||
*
|
||||
* Once filled out, we encourage you to share your work with the
|
||||
* community by sending a pull request to:
|
||||
* https://github.com/flowtype/flow-typed
|
||||
*/
|
||||
|
||||
declare module 'lunr' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* We include stubs for each file inside this npm package in case you need to
|
||||
* require those files directly. Feel free to delete any files that aren't
|
||||
* needed.
|
||||
*/
|
||||
declare module 'lunr/app' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/example/app' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/example/index_builder' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/example/jquery' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/example/mustache' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/example/require' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/example/text' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lib/document_store' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lib/event_emitter' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lib/index' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lib/lunr' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lib/pipeline' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lib/sorted_set' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lib/stemmer' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lib/stop_word_filter' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lib/token_store' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lib/tokenizer' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lib/trimmer' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lib/utils' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lib/vector' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lunr' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/lunr.min' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/document_store_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/env/bench' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/env/benchmark' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/env/jquery' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/env/mustache' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/fixtures/questions' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/foo_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/index_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/pipeline_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/set_index_of_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/sorted_set_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/stemmer_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/token_store_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/tokenizer_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/perf/vector_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/server' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/env/augment.min' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/env/jquery' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/env/qunit' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/env/runner' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/event_emitter_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/index_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/lunr_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/pipeline_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/search_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/serialisation_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/sorted_set_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/stemmer_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/stop_word_filter_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/store_node_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/store_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/test_helper' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/token_store_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/tokenizer_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/trimmer_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'lunr/test/vector_test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
// Filename aliases
|
||||
declare module 'lunr/app.js' {
|
||||
declare module.exports: $Exports<'lunr/app'>;
|
||||
}
|
||||
declare module 'lunr/example/app.js' {
|
||||
declare module.exports: $Exports<'lunr/example/app'>;
|
||||
}
|
||||
declare module 'lunr/example/index_builder.js' {
|
||||
declare module.exports: $Exports<'lunr/example/index_builder'>;
|
||||
}
|
||||
declare module 'lunr/example/jquery.js' {
|
||||
declare module.exports: $Exports<'lunr/example/jquery'>;
|
||||
}
|
||||
declare module 'lunr/example/mustache.js' {
|
||||
declare module.exports: $Exports<'lunr/example/mustache'>;
|
||||
}
|
||||
declare module 'lunr/example/require.js' {
|
||||
declare module.exports: $Exports<'lunr/example/require'>;
|
||||
}
|
||||
declare module 'lunr/example/text.js' {
|
||||
declare module.exports: $Exports<'lunr/example/text'>;
|
||||
}
|
||||
declare module 'lunr/lib/document_store.js' {
|
||||
declare module.exports: $Exports<'lunr/lib/document_store'>;
|
||||
}
|
||||
declare module 'lunr/lib/event_emitter.js' {
|
||||
declare module.exports: $Exports<'lunr/lib/event_emitter'>;
|
||||
}
|
||||
declare module 'lunr/lib/index.js' {
|
||||
declare module.exports: $Exports<'lunr/lib/index'>;
|
||||
}
|
||||
declare module 'lunr/lib/lunr.js' {
|
||||
declare module.exports: $Exports<'lunr/lib/lunr'>;
|
||||
}
|
||||
declare module 'lunr/lib/pipeline.js' {
|
||||
declare module.exports: $Exports<'lunr/lib/pipeline'>;
|
||||
}
|
||||
declare module 'lunr/lib/sorted_set.js' {
|
||||
declare module.exports: $Exports<'lunr/lib/sorted_set'>;
|
||||
}
|
||||
declare module 'lunr/lib/stemmer.js' {
|
||||
declare module.exports: $Exports<'lunr/lib/stemmer'>;
|
||||
}
|
||||
declare module 'lunr/lib/stop_word_filter.js' {
|
||||
declare module.exports: $Exports<'lunr/lib/stop_word_filter'>;
|
||||
}
|
||||
declare module 'lunr/lib/token_store.js' {
|
||||
declare module.exports: $Exports<'lunr/lib/token_store'>;
|
||||
}
|
||||
declare module 'lunr/lib/tokenizer.js' {
|
||||
declare module.exports: $Exports<'lunr/lib/tokenizer'>;
|
||||
}
|
||||
declare module 'lunr/lib/trimmer.js' {
|
||||
declare module.exports: $Exports<'lunr/lib/trimmer'>;
|
||||
}
|
||||
declare module 'lunr/lib/utils.js' {
|
||||
declare module.exports: $Exports<'lunr/lib/utils'>;
|
||||
}
|
||||
declare module 'lunr/lib/vector.js' {
|
||||
declare module.exports: $Exports<'lunr/lib/vector'>;
|
||||
}
|
||||
declare module 'lunr/lunr.js' {
|
||||
declare module.exports: $Exports<'lunr/lunr'>;
|
||||
}
|
||||
declare module 'lunr/lunr.min.js' {
|
||||
declare module.exports: $Exports<'lunr/lunr.min'>;
|
||||
}
|
||||
declare module 'lunr/perf/document_store_test.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/document_store_test'>;
|
||||
}
|
||||
declare module 'lunr/perf/env/bench.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/env/bench'>;
|
||||
}
|
||||
declare module 'lunr/perf/env/benchmark.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/env/benchmark'>;
|
||||
}
|
||||
declare module 'lunr/perf/env/jquery.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/env/jquery'>;
|
||||
}
|
||||
declare module 'lunr/perf/env/mustache.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/env/mustache'>;
|
||||
}
|
||||
declare module 'lunr/perf/fixtures/questions.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/fixtures/questions'>;
|
||||
}
|
||||
declare module 'lunr/perf/foo_test.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/foo_test'>;
|
||||
}
|
||||
declare module 'lunr/perf/index_test.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/index_test'>;
|
||||
}
|
||||
declare module 'lunr/perf/pipeline_test.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/pipeline_test'>;
|
||||
}
|
||||
declare module 'lunr/perf/set_index_of_test.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/set_index_of_test'>;
|
||||
}
|
||||
declare module 'lunr/perf/sorted_set_test.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/sorted_set_test'>;
|
||||
}
|
||||
declare module 'lunr/perf/stemmer_test.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/stemmer_test'>;
|
||||
}
|
||||
declare module 'lunr/perf/token_store_test.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/token_store_test'>;
|
||||
}
|
||||
declare module 'lunr/perf/tokenizer_test.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/tokenizer_test'>;
|
||||
}
|
||||
declare module 'lunr/perf/vector_test.js' {
|
||||
declare module.exports: $Exports<'lunr/perf/vector_test'>;
|
||||
}
|
||||
declare module 'lunr/server.js' {
|
||||
declare module.exports: $Exports<'lunr/server'>;
|
||||
}
|
||||
declare module 'lunr/test/env/augment.min.js' {
|
||||
declare module.exports: $Exports<'lunr/test/env/augment.min'>;
|
||||
}
|
||||
declare module 'lunr/test/env/jquery.js' {
|
||||
declare module.exports: $Exports<'lunr/test/env/jquery'>;
|
||||
}
|
||||
declare module 'lunr/test/env/qunit.js' {
|
||||
declare module.exports: $Exports<'lunr/test/env/qunit'>;
|
||||
}
|
||||
declare module 'lunr/test/env/runner.js' {
|
||||
declare module.exports: $Exports<'lunr/test/env/runner'>;
|
||||
}
|
||||
declare module 'lunr/test/event_emitter_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/event_emitter_test'>;
|
||||
}
|
||||
declare module 'lunr/test/index_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/index_test'>;
|
||||
}
|
||||
declare module 'lunr/test/lunr_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/lunr_test'>;
|
||||
}
|
||||
declare module 'lunr/test/pipeline_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/pipeline_test'>;
|
||||
}
|
||||
declare module 'lunr/test/search_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/search_test'>;
|
||||
}
|
||||
declare module 'lunr/test/serialisation_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/serialisation_test'>;
|
||||
}
|
||||
declare module 'lunr/test/sorted_set_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/sorted_set_test'>;
|
||||
}
|
||||
declare module 'lunr/test/stemmer_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/stemmer_test'>;
|
||||
}
|
||||
declare module 'lunr/test/stop_word_filter_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/stop_word_filter_test'>;
|
||||
}
|
||||
declare module 'lunr/test/store_node_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/store_node_test'>;
|
||||
}
|
||||
declare module 'lunr/test/store_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/store_test'>;
|
||||
}
|
||||
declare module 'lunr/test/test_helper.js' {
|
||||
declare module.exports: $Exports<'lunr/test/test_helper'>;
|
||||
}
|
||||
declare module 'lunr/test/token_store_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/token_store_test'>;
|
||||
}
|
||||
declare module 'lunr/test/tokenizer_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/tokenizer_test'>;
|
||||
}
|
||||
declare module 'lunr/test/trimmer_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/trimmer_test'>;
|
||||
}
|
||||
declare module 'lunr/test/vector_test.js' {
|
||||
declare module.exports: $Exports<'lunr/test/vector_test'>;
|
||||
}
|
|
@ -40,7 +40,7 @@
|
|||
"lint-staged": "7.2.0",
|
||||
"lockfile": "1.0.4",
|
||||
"lodash": "4.17.10",
|
||||
"lunr": "0.7.0",
|
||||
"lunr-mutable-indexes": "2.3.1",
|
||||
"marked": "0.4.0",
|
||||
"mime": "2.3.1",
|
||||
"minimatch": "3.0.4",
|
||||
|
|
|
@ -1,29 +1,31 @@
|
|||
// @flow
|
||||
|
||||
import lunr from 'lunr';
|
||||
import lunrMutable from 'lunr-mutable-indexes';
|
||||
import type {Version} from '@verdaccio/types';
|
||||
import type {IStorageHandler, IWebSearch} from '../../types';
|
||||
/**
|
||||
* Handle the search Indexer.
|
||||
*/
|
||||
class Search implements IWebSearch {
|
||||
index: any;
|
||||
index: lunrMutable.index;
|
||||
storage: IStorageHandler;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
constructor() {
|
||||
/* eslint no-invalid-this: "off" */
|
||||
this.index = lunr(function() {
|
||||
/* eslint no-invalid-this: "off" */
|
||||
this.index = lunrMutable(function() {
|
||||
this.field('name', {boost: 10});
|
||||
this.field('description', {boost: 4});
|
||||
this.field('author', {boost: 6});
|
||||
this.field('keywords', {boost: 7});
|
||||
this.field('version');
|
||||
this.field('readme');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Performs a query to the indexer.
|
||||
* If the keyword is a * it returns all local elements
|
||||
* otherwise performs a search
|
||||
|
@ -36,10 +38,10 @@ class Search implements IWebSearch {
|
|||
items.map( function( pkg ) {
|
||||
return {ref: pkg, score: 1};
|
||||
});
|
||||
}) : this.index.search(query);
|
||||
}
|
||||
}) : this.index.search(`*${query}*`);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Add a new element to index
|
||||
* @param {*} pkg the package
|
||||
*/
|
||||
|
@ -48,6 +50,8 @@ class Search implements IWebSearch {
|
|||
id: pkg.name,
|
||||
name: pkg.name,
|
||||
description: pkg.description,
|
||||
version: `v${pkg.version}`,
|
||||
keywords: pkg.keywords,
|
||||
author: pkg._npmUser ? pkg._npmUser.name : '???',
|
||||
});
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import {formatDateDistance} from '../../utils/package';
|
|||
|
||||
import classes from './package.scss';
|
||||
|
||||
const Package = ({name, version, author, description, license, time}) => {
|
||||
const Package = ({name, version, author, description, license, time, keywords}) => {
|
||||
return (<section className={classes.package}>
|
||||
<Link to={`detail/${name}`}>
|
||||
<div className={classes.header}>
|
||||
|
@ -25,6 +25,13 @@ const Package = ({name, version, author, description, license, time}) => {
|
|||
{description}
|
||||
</p>
|
||||
</div>
|
||||
<div className={classes.tags}>
|
||||
{keywords && keywords.map((keyword, index) => (
|
||||
<Tag key={index} type="gray">
|
||||
{keyword}
|
||||
</Tag>
|
||||
))}
|
||||
</div>
|
||||
<div className={classes.details}>
|
||||
<div className={classes.homepage}>
|
||||
{time ? `Published ${formatDateDistance(time)} ago` : ''}
|
||||
|
@ -42,6 +49,7 @@ Package.propTypes = {
|
|||
version: PropTypes.string,
|
||||
author: PropTypes.string,
|
||||
description: PropTypes.string,
|
||||
keywords: PropTypes.array,
|
||||
license: PropTypes.string,
|
||||
time: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
|
|
|
@ -18,6 +18,17 @@ .package {
|
|||
}
|
||||
}
|
||||
|
||||
.tags {
|
||||
margin: 0 0.5em 0.5em 0;
|
||||
white-space: nowrap;
|
||||
font-size: $font-size-sm;
|
||||
:global {
|
||||
.el-tag {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.details {
|
||||
display: flex;
|
||||
font-size: 80%;
|
||||
|
|
|
@ -36,12 +36,12 @@ export default class PackageList extends React.Component {
|
|||
|
||||
renderList() {
|
||||
return this.props.packages.map((pkg, i) => {
|
||||
const {name, version, description, time} = pkg;
|
||||
const {name, version, description, time, keywords} = pkg;
|
||||
const author = formatAuthor(pkg.author);
|
||||
const license = formatLicense(pkg.license);
|
||||
return (
|
||||
<li key={i}>
|
||||
<Package {...{name, version, author, description, license, time}} />
|
||||
<Package {...{name, version, author, description, license, time, keywords}} />
|
||||
</li>
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<Package /> component should load the component 1`] = `"<section class=\\"package\\"><a href=\\"detail/verdaccio\\"><div class=\\"header\\"><div class=\\"title\\"><h1>verdaccio <span class=\\"el-tag el-tag--gray\\">v1.0.0</span></h1></div><div role=\\"author\\" class=\\"author\\">By: Sam</div></div><div class=\\"footer\\"><p class=\\"description\\">Private NPM repository</p></div><div class=\\"details\\"><div class=\\"homepage\\">Published about 1 month ago</div><div class=\\"license\\">MIT</div></div></a></section>"`;
|
||||
exports[`<Package /> component should load the component 1`] = `"<section class=\\"package\\"><a href=\\"detail/verdaccio\\"><div class=\\"header\\"><div class=\\"title\\"><h1>verdaccio <span class=\\"el-tag el-tag--gray\\">v1.0.0</span></h1></div><div role=\\"author\\" class=\\"author\\">By: Sam</div></div><div class=\\"footer\\"><p class=\\"description\\">Private NPM repository</p></div><div class=\\"tags\\"></div><div class=\\"details\\"><div class=\\"homepage\\">Published about 1 month ago</div><div class=\\"license\\">MIT</div></div></a></section>"`;
|
||||
|
||||
exports[`<Package /> component should load the component without author 1`] = `"<section class=\\"package\\"><a href=\\"detail/verdaccio\\"><div class=\\"header\\"><div class=\\"title\\"><h1>verdaccio <span class=\\"el-tag el-tag--gray\\">v1.0.0</span></h1></div><div role=\\"author\\" class=\\"author\\"></div></div><div class=\\"footer\\"><p class=\\"description\\">Private NPM repository</p></div><div class=\\"details\\"><div class=\\"homepage\\">Published about 1 month ago</div><div class=\\"license\\">MIT</div></div></a></section>"`;
|
||||
exports[`<Package /> component should load the component without author 1`] = `"<section class=\\"package\\"><a href=\\"detail/verdaccio\\"><div class=\\"header\\"><div class=\\"title\\"><h1>verdaccio <span class=\\"el-tag el-tag--gray\\">v1.0.0</span></h1></div><div role=\\"author\\" class=\\"author\\"></div></div><div class=\\"footer\\"><p class=\\"description\\">Private NPM repository</p></div><div class=\\"tags\\"></div><div class=\\"details\\"><div class=\\"homepage\\">Published about 1 month ago</div><div class=\\"license\\">MIT</div></div></a></section>"`;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<PackageList /> component should load the component with packages 1`] = `"<div class=\\"package-list-items\\"><div class=\\"pkgContainer\\"><h1 class=\\"listTitle\\">Available Packages</h1><li><section class=\\"package\\"><a href=\\"detail/verdaccio\\"><div class=\\"header\\"><div class=\\"title\\"><h1>verdaccio <span class=\\"el-tag el-tag--gray\\">v1.0.0</span></h1></div><div role=\\"author\\" class=\\"author\\">By: Sam</div></div><div class=\\"footer\\"><p class=\\"description\\">Private NPM repository</p></div><div class=\\"details\\"><div class=\\"homepage\\">Published less than a minute ago</div><div class=\\"license\\"></div></div></a></section></li><li><section class=\\"package\\"><a href=\\"detail/abc\\"><div class=\\"header\\"><div class=\\"title\\"><h1>abc <span class=\\"el-tag el-tag--gray\\">v1.0.1</span></h1></div><div role=\\"author\\" class=\\"author\\">By: Rose</div></div><div class=\\"footer\\"><p class=\\"description\\">abc description</p></div><div class=\\"details\\"><div class=\\"homepage\\">Published less than a minute ago</div><div class=\\"license\\"></div></div></a></section></li><li><section class=\\"package\\"><a href=\\"detail/xyz\\"><div class=\\"header\\"><div class=\\"title\\"><h1>xyz <span class=\\"el-tag el-tag--gray\\">v1.1.0</span></h1></div><div role=\\"author\\" class=\\"author\\">By: Martin</div></div><div class=\\"footer\\"><p class=\\"description\\">xyz description</p></div><div class=\\"details\\"><div class=\\"homepage\\"></div><div class=\\"license\\"></div></div></a></section></li></div></div>"`;
|
||||
exports[`<PackageList /> component should load the component with packages 1`] = `"<div class=\\"package-list-items\\"><div class=\\"pkgContainer\\"><h1 class=\\"listTitle\\">Available Packages</h1><li><section class=\\"package\\"><a href=\\"detail/verdaccio\\"><div class=\\"header\\"><div class=\\"title\\"><h1>verdaccio <span class=\\"el-tag el-tag--gray\\">v1.0.0</span></h1></div><div role=\\"author\\" class=\\"author\\">By: Sam</div></div><div class=\\"footer\\"><p class=\\"description\\">Private NPM repository</p></div><div class=\\"tags\\"></div><div class=\\"details\\"><div class=\\"homepage\\">Published less than a minute ago</div><div class=\\"license\\"></div></div></a></section></li><li><section class=\\"package\\"><a href=\\"detail/abc\\"><div class=\\"header\\"><div class=\\"title\\"><h1>abc <span class=\\"el-tag el-tag--gray\\">v1.0.1</span></h1></div><div role=\\"author\\" class=\\"author\\">By: Rose</div></div><div class=\\"footer\\"><p class=\\"description\\">abc description</p></div><div class=\\"tags\\"></div><div class=\\"details\\"><div class=\\"homepage\\">Published less than a minute ago</div><div class=\\"license\\"></div></div></a></section></li><li><section class=\\"package\\"><a href=\\"detail/xyz\\"><div class=\\"header\\"><div class=\\"title\\"><h1>xyz <span class=\\"el-tag el-tag--gray\\">v1.1.0</span></h1></div><div role=\\"author\\" class=\\"author\\">By: Martin</div></div><div class=\\"footer\\"><p class=\\"description\\">xyz description</p></div><div class=\\"tags\\"></div><div class=\\"details\\"><div class=\\"homepage\\"></div><div class=\\"license\\"></div></div></a></section></li></div></div>"`;
|
||||
|
|
|
@ -17,6 +17,7 @@ import type {
|
|||
IReadTarball,
|
||||
} from '@verdaccio/streams';
|
||||
import type {ILocalData} from '@verdaccio/local-storage';
|
||||
import lunrMutable from 'lunr-mutable-indexes';
|
||||
import type {NextFunction, $Request, $Response} from 'request';
|
||||
|
||||
export type StringValue = verdaccio$StringValue;
|
||||
|
@ -75,7 +76,7 @@ export interface IAuth extends IBasicAuth, IAuthMiddleware, IAuthWebUI {
|
|||
}
|
||||
|
||||
export interface IWebSearch {
|
||||
index: any;
|
||||
index: lunrMutable.index;
|
||||
storage: IStorageHandler;
|
||||
query(query: string): any;
|
||||
add(pkg: Version): void;
|
||||
|
|
BIN
yarn.lock
BIN
yarn.lock
Binary file not shown.
Loading…
Reference in a new issue