Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Meteor's package.js work?

Tags:

meteor

This Meteor.com blog post talks about package.js. Is this similar or even the same as a package.json file?

like image 702
kqw Avatar asked Apr 07 '13 15:04

kqw


People also ask

How does meteor JS work?

Meteor allows you to develop in one language, JavaScript, in all environments: application server, web browser, and mobile device. Meteor uses data on the wire, meaning the server sends data, not HTML, and the client renders it.

How do I use Meteor packages?

To use an Atmosphere Package in your app you can import it with the meteor/ prefix: import { Mongo } from "meteor/mongo"; Typically a package will export one or more symbols, which you'll need to reference with the destructuring syntax. You can find these exported symbols by either looking in that package's package.

How do I use NPM on Meteor JS?

To use an npm package from a file in your application you import the name of the package: import moment from 'moment'; // this is equivalent to the standard node require: const moment = require('moment'); This imports the default export from the package into the symbol moment .

Should I use Meteor JS?

If you are an experienced JavaScript developer, you should give Meteor a chance — you will certainly enjoy how fast and convenient the development process is. If you are a developer experienced in any language other than JavaScript but would like to master this language as well, Meteor.


1 Answers

The package.js file is used specifically with Meteor. If you browse through the repo at https://github.com/meteor/meteor/tree/master/packages you could see what a few look like. Each package has its own package.js.

package.json is slightly different, it's used to store node's npm dependencies so that one can run npm install to get the project's dependencies in order. It's more specific to npm/node than meteor. It wouldn't be used with meteor because meteor's run looks for dependencies defined with Npm.depends in the package's package.js for a particular package and gets the npm modules installed instead. So with meteor projects (apart from a bundled tarball in which they are automatically generated) don't need package.json files

like image 200
Tarang Avatar answered Oct 05 '22 14:10

Tarang