meteor update from 0.6.4.1 to 0.6.5 - meteor

in ~/.meteor/package/ folder all package.js files has only this:
// This file is included for compatibility with the Meteor 0.6.4 package downloader.
and nothing more.
Where is the package.js code?
Thanks!

The package system has changed.
You will find the auto-generated file you're refering to under:
/packages/name_of_your_package/.build/
As for where the actual 'package.js' file is, it's under
/packages/name_of_your_package/
As per the source code that's building these files for you:
// Pre-linker versions of Meteor expect all packages in the warehouse to
// contain a file called "package.js"; they use this as part of deciding
// whether or not they need to download a new package. Because packages
// are downloaded by the *existing* version of the tools, we need to
// include this file until we're comfortable breaking "meteor update" from
// 0.6.4. (Specifically, warehouse.packageExistsInWarehouse used to check
// to see if package.js exists instead of just looking for the package
// directory.)
// XXX Remove this once we can.
builder.write("package.js", {
data: new Buffer(
("// This file is included for compatibility with the Meteor " +
"0.6.4 package downloader.\n"),
"utf8")
});
I hope this helps!

Related

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.

CoffeeScript Packages Not Working with Meteor 0.9.0.1

After upgrading to 0.9.0.1 it would seem that CoffeeScript packages have two problems:
The exports from package.js don't seem to be exported.
The source files don't seem to be compiled.
package.js:
Package.describe({
summary: "sunburn"
});
Package.on_use(function (api, where) {
api.add_files(['lib/sunburn.coffee'], 'server');
api.export && api.export('Stinger', 'server');
});
Package.on_test(function (api) {
});
sunburn.coffee:
Stinger = -> "stinger here"
This is a local package. Both 'meteor add sunburn' and 'meteor remove sunburn' work fine. If sunburn.coffee is modified the server restarts. However, 'Stinger' is undefined when used from the server-side code. Somewhat more interestingly, if sunburn.coffee is modified to include syntax errors, the server will happily restart and no error will be reported. This is what leads me to believe that the CoffeeScript files aren't even being compiled. Or, at least, not being fully "wired up".
Code similar to this worked in the pre 0.9 version.
One last note: if the sunburn.coffee is changed to be a normal js file, 'Stinger' rewritten as normal javascript, and the file path updated in package.js, the above works fine.
Thanks :-)
You need to specify that your package actually depends on coffeescript to make the compilation happen :
api.use("coffeescript","client");
Previously, only having your app depending on build plugins (less, coffeescript, etc...) was OK but apparently now you have to specify that you use them inside packages as well.
Unrelated, but you should also specify a version in your Package.describe, and testing for the existence of api.export is unrelevant because I hope nobody is using Meteor < 0.6.5 anymore.

Meteor 0.9 package publish issue

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.

meteorite local packages, having trouble setting the global namespace?

My current project is at https://github.com/jimmack1963/localPackages.git.
I am trying to get this code to work:
console.log("You pressed the button, " + MyName);
where MyName comes from a package called simple, that is JUST LOCAL. Per 6.5, am exporting via
Package.on_use(function (api, where) {
api.add_files(['constant.js'], 'client');
//below added per possible suggestion from Nathan, had no effect.
api.use('constant.js', 'client');
if (api.export)
api.export('MyName');
});
Am trying to factor my code out to local packages. This is not about publishing packages, but about using local ones, which is referred to in many places. My package is simply trying to publish a string, MyName. But the project wants none of it. "MyName is not defined."
I copy the technique in 'Discover Meteor,' but it doesn't work for me, and I try other things. Have had a lot of success in Meteor in general.
This spec seems to be changing. I get the 6.5 export requirement, but easily find contradictory advise about the base project's need to add that project in smart.json (not the one in the package). Most references don't list that as a requirement at all.
I've tried
{
"packages": {
"simple" : {
"path": "packages/simple"
}
}
}
and putting it into git and trying from a different project:
{
"packages": {
"simple" : {
"git": "https://github.com/jimmack1963/localPackages.git"
}
}
}
For the latter, pleasingly, the installer was smart enough to burrow down and extract the package itself, ignoring the project wrapping it in the git project. Nice! So, I have the same problem when I install the package directly from git, still not published to the world.
Ubuntu 13.04
Meteorite version 0.6.11
Meteor Release 0.6.5.1
I had the same issue after migrating to 0.6.5 -
You only get 'exported' variables from packages you explicitly "use"; Packages "use" other packages by calling .use inside Package.on_use, projects "use" packages by adding them to .meteor/packages
Additionally, it seems to be quite picky about exporting variables, and wont currently export ones preceded with this.

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