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

npm for the plugin? #38

Closed
franfrutos opened this issue Sep 26, 2022 · 7 comments
Closed

npm for the plugin? #38

franfrutos opened this issue Sep 26, 2022 · 7 comments

Comments

@franfrutos
Copy link

franfrutos commented Sep 26, 2022

I am using jspsych-builder, which I think makes the process of programming experiments with jspsych much more flexible and simple, and I would like to use this plugin in integration with jspsych-builder. The fundamental problem is that, as far as I know, plugins have to be installed via npm. Have you thought about converting this package into a package so that it is possible to use it via npm?

@kurokida
Copy link
Owner

Thanks for this post!

Unfortunately, I'm not familliar with the npm at all. But my friend @tpronk might be able to help us.
I hope you don't get your hopes up and wait too long.

@tpronk
Copy link

tpronk commented Sep 29, 2022

Hi @franfrutos and @kurokida!

I took a quick peek at jsPsych Builder. I see that besides NPM, it also supports "module-style imports of non-module plugins from @jspsych-contrib". However, the NPM and the contrib approach seem to require that the jspsych-psychophysics plugin is written in ES6, which it currently isn't. Converting the psychophysics plugin to ES6 could be quite project.

However, I'm not very sure of the above, since I'm not very experienced with jsPsych and only found out about that builder half an hour ago. Maybe reach out the builder devs to see what they think?

@franfrutos
Copy link
Author

Thank you both!

I have opened an issue in the jspsych-builder repository (bjoluc/jspsych-builder#40). Let's see if the jspsych-builder developers have a simple solution.

@tpronk
Copy link

tpronk commented Sep 29, 2022

Bueno! I liked it in the hope that I then get notifications when we get any replies :)

@bjoluc
Copy link
Contributor

bjoluc commented Sep 30, 2022

Hi all,

I just skimmed over the code and found that it's quite easy to turn into an ES module and publish to NPM. It doesn't require modernizing any of the internals, just changing some top-level code. However, it would add an extra "transpile" step that automatically creates the conventional jspsych-psychophysics.js file from the ES version of it so you don't have to maintain both. @kurokida You might continue committing a generated jspsych-psychophysics.js to Git or just let people download the package from NPM / unpkg.com instead of GitHub. And you would need to update the package version and run npm publish for every new release. Happy to send a PR and explain the setup if you're interested. Cheers!

@kurokida
Copy link
Owner

kurokida commented Oct 5, 2022

@bjoluc Thank you for the careful explanation. Since I'm not familiar with the ES module and NPM, I can't fully imagine what would be happned if I accept your suggestions. I'm little concerned about changing how to download my plugin. Since my plugin includes the jsPsych itself, the users can run my sample programs just by downloading the plugin from GitHub repository. Introducing the NPM stile might be confuse my plugin users.

But on the other hand, I interested in making my plugin compatible with NPM. So, if you can please make the PR and let me confirm how use of my plugin would be changed.

Best,
Daiichiro

@kurokida
Copy link
Owner

Thanks to @bjoluc , I can finally publish the psychophysics plugin on NPM. Sorry for the wait.

You can install it runningnpm install @kurokida/jspsych-psychophysics

You can also see the website:
https://www.npmjs.com/package/@kurokida/jspsych-psychophysics

Best,
Daiichiro

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

4 participants