Skip to content

Commit

Permalink
Merge 20bca94 into a3004ad
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaong committed Sep 18, 2020
2 parents a3004ad + 20bca94 commit 9d11a42
Show file tree
Hide file tree
Showing 31 changed files with 2,012 additions and 2,524 deletions.
23 changes: 17 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
{
"env": {
"browser": true,
"es6": true
"browser": true,
"es6": true
},
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"standard"
"eslint:recommended",
"standard",
"plugin:@typescript-eslint/eslint-recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"rules": {
"quotes": ["error", "single", { "avoidEscape": true }],
"no-prototype-builtins": 0
"no-prototype-builtins": 0,
"no-use-before-define": 0,
"@typescript-eslint/no-use-before-define": [
"error",
{ "functions": false, "classes": false, "variables": false }
]
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
/dist
/examples/dist
/examples/node_modules
/benchmarks/dist
/coverage
yarn-error.log
55 changes: 0 additions & 55 deletions babel.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion benchmarks/autoSuggestion.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import { miniSearch as ms } from './divinaCommedia.js'

const suite = new Benchmark.Suite('Auto suggestion')
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/combinedSearch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import { miniSearch as ms } from './divinaCommedia.js'

const suite = new Benchmark.Suite('Combined search')
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/exactSearch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import { index } from './divinaCommedia.js'

const suite = new Benchmark.Suite('Exact search')
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/fuzzySearch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import { index } from './divinaCommedia.js'

const suite = new Benchmark.Suite('Fuzzy search')
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/indexing.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import MiniSearch from '../src/MiniSearch.js'
import { lines } from './divinaCommedia.js'

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/loadIndex.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import MiniSearch from '../src/MiniSearch.js'
import { miniSearch as ms } from './divinaCommedia.js'

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/prefixSearch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import { index } from './divinaCommedia.js'

const suite = new Benchmark.Suite('Prefix search')
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/searchFiltering.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Benchmark from 'benchmark'
const Benchmark = require('benchmark')
import { miniSearch } from './divinaCommedia.js'

const suite = new Benchmark.Suite('Search filtering')
Expand Down
3 changes: 2 additions & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"webpack-dev-server": "^3.1.9"
},
"dependencies": {
"core-js": "3"
"core-js": "3",
"minisearch": "file:../"
}
}
2 changes: 1 addition & 1 deletion examples/src/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import fetch from 'unfetch'
import MiniSearch from '../../src/MiniSearch.js'
import MiniSearch from 'minisearch'

class App extends React.PureComponent {
constructor (props) {
Expand Down
3 changes: 3 additions & 0 deletions examples/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3347,6 +3347,9 @@ minimist@^1.2.0, minimist@^1.2.5:
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==

"minisearch@file:..":
version "2.6.2"

mississippi@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022"
Expand Down
32 changes: 19 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@
"license": "MIT",
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.1",
"@babel/node": "^7.5.5",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-core": "^7.0.0-0",
"babel-jest": "^26.3.0",
"@rollup/plugin-typescript": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^4.1.1",
"@typescript-eslint/parser": "^4.1.1",
"benchmark": "^2.1.4",
"core-js": "^3.1.4",
"coveralls": "^3.0.2",
Expand All @@ -46,9 +42,10 @@
"jsdoc": "^3.6.4",
"regenerator-runtime": "^0.13.1",
"rollup": "^2.2.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-terser": "^7.0.0",
"snazzy": "^8.0.0",
"ts-jest": "^26.3.0",
"tslib": "^2.0.1",
"typescript": "^4.0.2"
},
"files": [
Expand All @@ -59,6 +56,14 @@
],
"jest": {
"testURL": "http://localhost:3000/",
"transform": {
"\\.(js|ts)$": "ts-jest"
},
"moduleFileExtensions": [
"ts",
"js"
],
"testRegex": "\\.test\\.(ts|js)$",
"setupFilesAfterEnv": [
"<rootDir>/src/testSetup/jest.js"
]
Expand All @@ -67,14 +72,15 @@
"test": "jest",
"test-watch": "jest --watch",
"coverage": "jest --coverage",
"benchmark": "NODE_ENV=production BABEL_OUTPUT=commonjs babel-node --expose-gc benchmarks/index.js",
"build": "NODE_ENV=production rollup -c",
"benchmark": "BENCHMARKS=true yarn build && NODE_ENV=production node --expose-gc benchmarks/dist/index.js",
"build": "yarn build-typedef && NODE_ENV=production rollup -c",
"build-minified": "MINIFY=true yarn build",
"build-docs": "jsdoc --configure jsdoc.json",
"lint": "eslint 'src/**/*.js'",
"lintfix": "eslint --fix 'src/**/*.js'",
"build-typedef": "tsc --outDir dist --declaration --emitDeclarationOnly",
"lint": "eslint 'src/**/*.{js,ts}'",
"lintfix": "eslint --fix 'src/**/*.{js,ts}'",
"prepublishOnly": "yarn test && yarn build"
},
"sideEffects": false,
"types": "./src/index.d.ts"
"types": "./dist/index.d.ts"
}
29 changes: 17 additions & 12 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import babel from 'rollup-plugin-babel'
import typescript from '@rollup/plugin-typescript'
import { terser } from 'rollup-plugin-terser'

const config = ({ format, output, name, dir }) => ({
input: 'src/index.js',
input: 'src/index.ts',
output: {
sourcemap: true,
dir: `dist/${dir || format}`,
Expand All @@ -19,18 +19,23 @@ const config = ({ format, output, name, dir }) => ({
})]
: []
},
plugins: [
babel({
rootMode: 'upward',
caller: {
output
}
})
]
plugins: [typescript()]
})

export default [
const benchmarks = {
input: 'benchmarks/index.js',
output: {
sourcemap: false,
dir: 'benchmarks/dist',
format: 'commonjs',
entryFileNames: '[name].js',
plugins: []
},
plugins: [typescript()]
}

export default process.env.BENCHMARKS === 'true' ? [benchmarks] : [
config({ format: 'es', output: 'es6' }),
config({ format: 'es', output: 'es5m', dir: 'es5m' }),
config({ format: 'umd', output: 'es5m', name: 'MiniSearch' })
config({ format: 'umd', output: 'es5m', name: 'MiniSearch' }),
]
Loading

0 comments on commit 9d11a42

Please sign in to comment.