Open tomitrescak opened 8 years ago
What I do now is that I export the module definition "index.js" from the NPM package and I register this module with mantra app. The drawback of this is that:
I think you can simply wrap the module as it the way it is now. Only issue is you can't use CSS using the meteor way.
The way how you can load the module.
import coreModule from './modules/core';
import accounts-ui from 'mantra-accounts-ui';
// init context
const context = initContext();
// create app
const app = createApp(context);
app.loadModule(coreModule);
app.loadModule(accountsUI);
app.init();
The way you can use a container.
import LoginScreen from 'mantra-accounts-ui/containers/login_screen';
....
<LoginScreen />
When doing this, this module should expect the App Context has Meteor
field. Otherwise it's can throw an error when loading the module.
@tomitrescak could you share sample code if it's not a private thing? I am also interested in the case.
+1 El El jue, 10 mar 2016 a las 8:02, Aykut Yaman notifications@github.com escribió:
@tomitrescak https://github.com/tomitrescak could you share sample code if it's not a private thing? I am also interested in the case.
— Reply to this email directly or view it on GitHub https://github.com/kadirahq/mantra/issues/133#issuecomment-194722797.
The code can be found here: https://github.com/tomitrescak/meteor-accountsui-semanticui-react.git
Please note that it is a work in progress, so it can break at any given time, so consider it only as a matter to discuss. My biggest problem with the Mantra approach in packages is that I have to import the code at different places:
With Meteor packages you simply import the template and you are good to go.
Yet, I guess it is only matter of getting used to. Please leave your comments on the structure of this NPM package, and let me know what would you do differently.
And one off topic. How do you import "Session" ? which module is it part of? I tried to look in the meteor source but it is not clear to me.
Thank you.
Where I'm struggling here is when a module expects extra things in the client context. The only thing I can think of doing is adding a README detailing what is required, which is awful... unless context itself is made up of imported contexts?
Hi, I have created an account-ui modue based on semantic ui. I aam trying to transform it into the NPM module (yet still preserving Mantra structure and functionality) but I am running into little difficulties. Would you advise how can we solve following:
Is there any guideline on how should the process of transofrming module to NPM package be done?