Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using a new datasource (but not through NPM) #114

Open
ratacat opened this issue Apr 3, 2020 · 0 comments
Open

using a new datasource (but not through NPM) #114

ratacat opened this issue Apr 3, 2020 · 0 comments

Comments

@ratacat
Copy link
Contributor

ratacat commented Apr 3, 2020

I'm having trouble using this sqlite datasource through npm...it isn't exactly clear to me why
https://github.com/coderintherye/ranvier-datasource-sqlite

So I thought I would try and and just direct link it in the config..this is lines 27-37 of
DataSourceRegistry#load

      // relative path to require
      if (settings.require[0] === '.') {
        loader = require(rootPath + '/' + settings.require);
      } else if (!settings.require.includes('.')) {
        loader = require(settings.require);
      } else {
        const [moduleName, exportName] = settings.require.split('.');
        loader = requireFn(moduleName)[exportName];
      }

      const instance = new loader(sourceConfig, rootPath);

So the first option checks to see if the require starts with a ., and then if it does, it prepends the rootpath + /. So if you input .bundles/mybundle/datasource, it would output /rootpath/.bundles/mybundle/datasource, which in my system wouldn't work. Maybe the . is supposed to be removed?

The second option seems promising though, if there are no dots anywhere...then require. Which if you're giving a filepath would seem likely...except that filepath probably has an extension...like ~/bundles/mybundle/datasource/sqlite-datasource.js. So that doesn't work. And the last one is the NPM. I'm just wondering how this is supposed to work? Am I not understanding it correctly?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant