eklem / designing-with-search-data

Plugin for Adobe XD - A search engine running inside XD to easily populate your search application design.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make search-index work with memdown

eklem opened this issue · comments

Todo:

  • Get help from @fergiemcdowall to get search-index be webpack'able and run with memdown
  • new search-index v1.0.1 in the browser
  • in the browser w/ memdown
  • Webpack w/ --devtool false. Make it run in the browser

It may be as simple as referencing both scripts since search-index refer to indexeddb, but not sure if I need to browserify fake-indexeddb.

Hmm, seems indexedDBShim is already browserified, so I'll start with that.

Need to be webpack or rollup. I'll start with webpack. If search-index could be a dependency and then altered so that indexedDBShim is a sub dep it would only take one webpack-step to get it working.

So, search-index with the indexedDBShim dependency, webpack'ed and running inside the XD plugin with one

const si = require('./search-index.js')

Here's how make it build automatically from package.json, and an example on how it can work from the xd-template-project.

Search-index test with working memdown example.

Try to webpack something like this:

import encode from 'encoding-down'
import fii from 'fergies-inverted-index'
import levelup from 'levelup'
import memdown from 'memdown'
import si from '../../dist/search-index.esm.js'


levelup(encode(memdown('myDB'), {
  valueEncoding: 'json'
}), (err, store) => {
  t.error(err)
  db = si({
    fii: fii({ store: store })
  })
})

Error in XD because of eval. Try the configuration file from one of the boilerplate projects.

Need to use sval to skip evaluse. Check out @kerrishotts pointers at Adobe XD Platform forums

Skip sval and see if webpack with --devtool false works. If so, I think it's a matter of setting up the Adobe XD plugin correctly.

Now, this needs to happen in XD plugin environment =)