I have a meteor application which deals with fetching API from third party. I need to create a package out of my meteor application or maybe convert the meteor application into a package so that meteor developers can use it by just adding the package into their application.
I looked online and found that you needed to create a meteor developer account but when I clicked on the link, it seems to be outdated.
Is there a way I can do this ?
That link above looks like having user session ids
a) Install directly from GitHub
You can install npm packages directly from GitHub. It is not required to publish at atmospherejs.com or npmjs.com . Also, npm packages can be used with any Javascript web framework, not only Meteor.
For example, this installs package from GitHub:
npm install github:wekan/dragscroll --save
It can be used it like this at client:
import dragscroll from 'dragscroll';
Or moved to run at server:
Repo for that is here:
https://github.com/wekan/dragscroll
package.json looks like this:
{
"dependencies": {
"@wekanteam/dragscroll": "github:wekan/dragscroll"
}
}
b) Publish at npmjs.com
- Register here:
- At command line, login to npm:
npm login
More info about that is at:
- At your package directory, publish your public package:
npm publish --access public
Settings
For settings, you can use serverside environment variables, like this:
const someSetting=process.env.SOME_SETTING;
You can copy serverside variable to clientside, if needed:
and use it at clientside, for example like this:
onRendered() {
if (Meteor.settings.public.SOME_SETTING) {
Here is example, how I added that environment variable to many platforms:
@abroa01 you need a Meteor account in order to publish the package to the public.
However you also create the package and share e.g. via GitHub repo without a Meteor account.