Meteor 0.9 package publish issue - meteor

As per this https://hackpad.com/Migrating-Packages-zN0we9sIjkH I created a new meteor package and currently facing a problem when trying to publish.
PackageName : 'UserId:packageName'
To add package : 'meteor add packageName' (mateor add UserId:packageName did not work).
Package runs locally without any issue.
When I tried to publish,
cd path/to/your:package
meteor publish
Message :
There is no package named 'packageName'. If you are creating a new package, use the --create flag.
Publish failed.
Then I tried "meteor publish --create"
Message :
To confirm that you wish to create a top-level package with no account
prefix, please run this command again with the --top-level option.
(Only administrators can create top-level packages without an account prefix)
I used "UserId: PackageName" when creating the package and already log in to meteor account. Any idea to fix this issue?
Thanks !

Make sure the name field is in package.js:
Package.describe({
name: "user:packagename",
// other fields
});
Then, there will be no need to make sure the package is in a directory with the same name.
See https://github.com/mizzao/meteor-user-status for an example.

Related

How create package in laravel 5.3

Please need explanation of creating package in laravel 5.3.
i want to create package that give me exact location when input longituate and latitude.
Proper way of creating package:
Steps:
1.We set up a folder structure for our package.
2.We created a composer file for our package and autoloaded it
3.We created a Service Provider for our package and added it to the existing list in config/app.php
4.We created a controller that contains the logic to get the Developer Status
5.We created a config file that contains our package configurations.
6.We created a routes file to point to our controller
7.We updated our Service Provider to resolve our Controller

Meteor: Could not resolve the specified constraints for this project: Unknown package

What are the constraints that Meteor is trying to resolve when it loads the packages at startup? Is it all related to versioning or is it actually looking at the code that you load with ap.use() in packages.js?
I am getting this error when I try to start up my project. I have a super-simple package file that I created with the meter create --package command. I put all of my files that make up the package into the directory that it created and moved that directory to .meteor/packages. I'm just trying to create a local package for now. Here's the contents of package.js in that directory:
Package.describe({
name: 'ammap-meteor',
summary: 'mapping library packaged for meteor ',
version: '1.0.0',
});
Package.onUse(function(api) {
api.versionsFrom('METEOR#0.9.0');
api.addFiles('ammap.js');
api.addFiles('ammap_amcharts_extension.js');
});
Package.onTest(function(api) {
api.use('tinytest');
api.use('ammap-meteor');
api.addFiles('ammap-meteor-tests.js');
});
My ammap-meteor-tests.js file is blank for the moment but it exists. Would that make a difference? And I assume you just omit the git: property from Package.onUse() for a local package, is that right?
OK, I was able to get past that error with the publish command:
meteor publish --create
So I did not succeed in making a local package (still not clear on that) but at least I can get the package to load now.

Local package asset with Meteor

I originally had an app using a private/settings.json asset. When attempting to make a package out of this app, I put that asset in packages/x:package/config/settings.json, and in the package.js's .onUse added
api.addFiles('config/settings.json', 'server', { isAsset: true });
I was using it successfully in the package as
settings = JSON.parse(Assets.getText('config/settings.json'));
until I removed private/settings.json. I now get
TypeError: Cannot read property 'token' of undefined
If I only keep private/settings.json, instead removing packages/x:package/config/settings.json (also changing from config/ to private/ in package.js, the package, etc) I get
error: File not found: private/settings.json
(How) can I have assets that are only local to the package? Alternatively, how can I include/use global assets in private/ in the package?
I think it makes sense that packages wouldn't be able to access assets in the app's private directory. Otherwise, a package could accidentally expose your app's private settings or assets.
It sounds like what you want is to share your settings.json file between the app and the package. There are several ways you could do this:
Put the settings into a second package and use it in your app and in your first package.
Have a method exported by your package called setSettings that allows the app to load its settings and then pass them into your package.
Use Meteor.settings, and launch your app with meteor --settings private/settings.json instead of getting the settings from an asset.

Meteor wants MONGO_URL on startup

After then I downgrade to 0.6.4.1 version on startup I have error:
Error: MONGO_URL must be set in environment
So I try set this variable
root#xxx:/home/xxx/Documents/exchange# echo $MONGO_URL
mongodb://localhost:27017/exchange
But it doesn't help.
I try to start developer server not bundle.
It appears you double-posted this in the Meteor google group as well:
https://groups.google.com/forum/#!topic/meteor-talk/lAReHjJZjl0
In any case, for your reference and others, you are probably not actually on 0.6.4.1 unless you run meteor --release 0.6.4.1. From your other post, you are still on 0.6.5 and you need to add standard-app-packages for it to work properly if you were previously on 0.6.4.1. See the following:
https://github.com/meteor/meteor/issues/1257

How to get the current directory within a meteor Smart Package

I am building a package for meteor to be published on Atmosphere and I need to get the current directory that the package is installed. I have tried process.cwd() in a file that's included in the package, but that gets the current directory of my app. The package is installed and working correctly, it just seems that the package is running in the same process as the app, hence process.cwd() is getting the current app dir. Does anyone know of a trick to get the current directory of the package?
This is what I have in the package files:
package.js
Package.on_use(function (api) {
api.use('sync-methods', 'server');
api.add_files(["lib/api_server.js"], "server");
api.add_files(["lib/api_client.js"], "client");
});
api_server.js
var cwd = process.cwd();
console.log(cwd);
This displays /home/dknell/meteor-apps/testApp
Why would you need current directory? To access a file inside the package? Then add a file as n package asset:
api.add_files(['file.txt'], 'server', {isAsset: true});
And then you can read it with Assets.getText('file.txt') in your package.
If you don't want the content, but an absolute path for another tool, you can try
var path = Npm.require('path');
var base = path.resolve('.');
var assetsBase = path.join(base, '/assets/packages/<author_smart-package-name>');
For the <author_smart-package-name> enter your package name, but if it has your meteor user name included, change the colon (:) to underscore (_)
That seems okay on OS X and Linux, probably works in windows as well.
oops, this is for files within the app, not a package. anyway maybe helpful to someone
I need to access a directory path for loading a list of files
// files in /private get built to:
// .meteorlocal/build/programs/server/assets/app/
// base path resolves to:
// .meteor/local/build/programs/server
so you need to manually add "/assets/app" to your paths.
until meteor change this at some point.
just getting to the content of a file isn't helpful if you have a directory of changing content...

Resources