### Start Hexo Server Source: https://github.com/meteor/docs/blob/master/README.md Installs project dependencies using npm and starts the local Hexo development server. This command is used to serve the documentation site locally and watch for file changes. ```bash npm install npm start ``` -------------------------------- ### Android SDK Installation Guide Source: https://github.com/meteor/docs/blob/master/long-form/breaking-changes-1.2.md Information on installing the Android SDK for Meteor mobile development. Links to guides for Mac and Linux are provided. ```html Mac Linux ``` -------------------------------- ### Manual Meteor Installation Steps for Windows Source: https://github.com/meteor/docs/blob/master/long-form/alternate-windows-installation.md This section outlines the manual installation process for Meteor on Windows. It requires installing 7-Zip, downloading the appropriate Meteor archive, extracting it to a specific directory, and updating the system's PATH environment variable. ```bash echo %LocalAppData%\.meteor ``` ```bash Add the full directory path from step 3 to your PATH environment variable. ``` ```bash meteor ``` -------------------------------- ### Install Fetch Package Source: https://github.com/meteor/docs/blob/master/source/packages/fetch.md Installs the fetch package for a Meteor app. This command should be run from the app directory. ```bash meteor add ecmascript ``` -------------------------------- ### Install Logging Package Source: https://github.com/meteor/docs/blob/master/source/packages/logging.md Installs the Meteor logging package using the Meteor command-line tool. ```shell meteor add logging ``` -------------------------------- ### Install Meteor using npm Source: https://github.com/meteor/docs/blob/master/source/install.md Installs the latest official Meteor release globally using npm. This is the recommended installation method. Ensure Node.js 8 or newer is installed. ```bash npm install -g meteor ``` -------------------------------- ### Troubleshooting MongoDB Startup Errors on Windows Source: https://github.com/meteor/docs/blob/master/source/windows.md This snippet addresses common errors when the embedded MongoDB server fails to start on Windows, indicated by specific exit codes. It suggests installing the Visual C++ Redistributable for Visual Studio as a solution, providing links to relevant versions based on MongoDB versions. ```shell C:\Users\user\app> meteor => Started proxy. Unexpected mongo exit code 3221225781. Restarting. Unexpected mongo exit code 3221225781. Restarting. Unexpected mongo exit code 3221225781. Restarting. Can't start Mongo server. ``` -------------------------------- ### Install ReactiveDict Source: https://github.com/meteor/docs/blob/master/source/api/reactive-dict.md Installs the reactive-dict package into your Meteor project. ```bash meteor add reactive-dict ``` -------------------------------- ### Install Meteor with sudo permissions Source: https://github.com/meteor/docs/blob/master/source/install.md Installs Meteor globally using npm when user permissions require sudo. The `--unsafe-perm` flag is necessary in such cases. Use with caution and understand the implications. ```bash sudo npm install -g meteor --unsafe-perm ``` -------------------------------- ### Install ReactiveVar Source: https://github.com/meteor/docs/blob/master/source/api/reactive-var.md Adds the reactive-var package to your Meteor project. This is the first step to using ReactiveVar. ```bash meteor add reactive-var ``` -------------------------------- ### Meteor Mobile Configuration Example Source: https://github.com/meteor/docs/blob/master/source/api/mobile-config.md An example of a `mobile-config.js` file used to configure Meteor applications for mobile platforms. It demonstrates setting app information, icons, launch screens, preferences, and plugin configurations. ```js // This section sets up some basic app metadata, the entire section is optional. App.info({ id: 'com.example.matt.uber', name: 'über', description: 'Get über power in one button click', author: 'Matt Development Group', email: 'contact@example.com', website: 'http://example.com' }); // Set up resources such as icons and launch screens. App.icons({ 'iphone_2x': 'icons/icon-60@2x.png', 'iphone_3x': 'icons/icon-60@3x.png', // More screen sizes and platforms... }); App.launchScreens({ 'iphone_2x': 'splash/Default@2x~iphone.png', 'iphone5': 'splash/Default~iphone5.png', // More screen sizes and platforms... }); // Set PhoneGap/Cordova preferences. App.setPreference('BackgroundColor', '0xff0000ff'); App.setPreference('HideKeyboardFormAccessoryBar', true); App.setPreference('Orientation', 'default'); App.setPreference('Orientation', 'all', 'ios'); // Pass preferences for a particular PhoneGap/Cordova plugin. App.configurePlugin('com.phonegap.plugins.facebookconnect', { APP_ID: '1234567890', API_KEY: 'supersecretapikey' }); // Add custom tags for a particular PhoneGap/Cordova plugin to the end of the // generated config.xml. 'Universal Links' is shown as an example here. App.appendToConfig(' '); ``` -------------------------------- ### Legacy Meteor Installation (Not Recommended) Source: https://github.com/meteor/docs/blob/master/source/install.md Installs Meteor using a bash script via curl. This method is not maintained and is not recommended for new installations. It does not depend on Node.js. ```bash curl https://install.meteor.com/ | sh ``` -------------------------------- ### Install Service Configuration Package Source: https://github.com/meteor/docs/blob/master/source/api/accounts.md Installs the `service-configuration` package, which is necessary for configuring external login services. ```bash meteor add service-configuration ``` -------------------------------- ### Install HTTP Package Source: https://github.com/meteor/docs/blob/master/source/api/http.md Instructions to add the HTTP package to a Meteor project using the command line. ```bash meteor add http ``` -------------------------------- ### Install DDPRateLimiter Source: https://github.com/meteor/docs/blob/master/source/api/methods.md Command to add the ddp-rate-limiter package to a Meteor project for customizing rate limiting. ```bash meteor add ddp-rate-limiter ``` -------------------------------- ### Install url Package Source: https://github.com/meteor/docs/blob/master/source/packages/url.md Installs the 'url' package into an existing Meteor application. This command should be run from the root directory of your Meteor app. ```bash meteor add url ``` -------------------------------- ### Meteor GitHub Login Example Source: https://github.com/meteor/docs/blob/master/source/api/accounts.md Demonstrates how to initiate a login with GitHub, requesting specific permissions and handling potential errors. ```js Meteor.loginWithGithub({ requestPermissions: ['user', 'public_repo'] }, (error) => { if (error) { Session.set('errorMessage', error.reason || 'Unknown error'); } }); ``` -------------------------------- ### Install GitHub Login Package Source: https://github.com/meteor/docs/blob/master/source/api/accounts.md Installs the necessary package to enable GitHub login functionality in your Meteor application. ```bash meteor add accounts-github ``` -------------------------------- ### Install Meteor markdown Package Source: https://github.com/meteor/docs/blob/master/source/packages/markdown.md Command to install the markdown package in a Meteor project. ```bash meteor add markdown ``` -------------------------------- ### ReactiveDict and Autorun Example Source: https://github.com/meteor/docs/blob/master/long-form/tracker-manual.md Illustrates the use of ReactiveDict to store reactive data and Tracker.autorun to log changes. This example shows how reactive updates are batched for consistency. ```javascript var balances = new ReactiveDict; balances.set("alice", "2"); balances.set("bob", "1"); Tracker.autorun(function() { console.log("Alice:", balances.get("alice"), "Bob:", balances.get("bob"), "Total:", balances.get("alice") + balances.get("bob")); }); ``` -------------------------------- ### Example Log Output Source: https://github.com/meteor/docs/blob/master/source/packages/logging.md Illustrates the console output format for a log message containing 'message' and 'app' keys. ```shell E20200519-17:57:41.655(9) [DESKTOP] (main.js:36) warning {"error":{"property1":"foo","property2":"bar","property3":{"foo":"bar"}}} ``` -------------------------------- ### Install Meteor on Apple M1 with Rosetta Source: https://github.com/meteor/docs/blob/master/source/install.md Installs Meteor globally using npm on Apple M1 machines by explicitly using the Rosetta x86_64 architecture. This is a workaround until native M1 support is available. ```bash arch -x86_64 npm install -g meteor ``` -------------------------------- ### Meteor Startup Initialization Source: https://github.com/meteor/docs/blob/master/source/api/core.md Executes code when the Meteor application has finished starting up. On the server, this runs after the process starts. On the client, it runs when the DOM is ready. Code runs in the order it was defined. ```js if (Meteor.isServer) { Meteor.startup(() => { if (Rooms.find().count() === 0) { Rooms.insert({ name: 'Initial room' }); } }); } ``` -------------------------------- ### New User Validation Example Source: https://github.com/meteor/docs/blob/master/source/api/accounts-multi.md Example of how to validate a new user's username on the server, ensuring it meets a minimum length requirement and throwing a specific error message on failure. ```javascript Accounts.validateNewUser((user) => { if (user.username && user.username.length >= 3) { return true; } else { throw new Meteor.Error(403, 'Username must have at least 3 characters'); } }); // Validate username, without a specific error message. Accounts.validateNewUser((user) => { return user.username !== 'root'; }); ``` -------------------------------- ### Meteor Tracker Flush Cycle Example Source: https://github.com/meteor/docs/blob/master/long-form/tracker-manual.md Demonstrates the Meteor Tracker flush cycle, autorun execution, and the behavior of afterFlush handlers with a banking example. It shows how reactive dependencies trigger reruns and how afterFlush callbacks ensure checks are performed after all autoruns have completed. ```javascript var bank = new ReactiveDict; bank.set("checking", 10); bank.set("savings", 50); bank.set("checkWritingAllowed", true); Tracker.autorun(function () { console.log("There is $" + bank.get("checking") + " in your checking account."); Tracker.afterFlush(function () { // Since this is inside afterFlush, it only runs after every autorun affected // by the most recent update has finished rerunning. So the overdraft protection // code below will run before this check happens. if (bank.get("checking") < 0) { console.log("Insufficient funds! No more checks for you!"); bank.set("checkWritingAllowed", false); } }); }); Tracker.autorun(function () { if (bank.get("checking") < 0 && bank.get("savings") >= 25) { bank.set("checking", bank.get("checking") + 25); bank.set("savings", bank.get("savings") - 25); console.log("Automatically transferred $25 from savings to checking."); } }); Tracker.autorun(function () { if (bank.get("checkWritingAllowed")) console.log("Go ahead, write some checks!"); else console.log("Your check writing privileges have been suspended!"); }); var writeACheck = function (amount) { if (bank.get("checkWritingAllowed")) bank.set("checking", bank.get("checking") - amount); }; // "There is $10 in your checking account." // "Go ahead, write some checks!" writeACheck(5); // "There is $5 in your checking account." writeACheck(20); // "There is $-15 in your checking account." // "Automatically transferred $25 from savings to checking." // "There is $10 in your checking account." writeACheck(30); // "There is $-20 in your checking account." // "Automatically transferred $25 from savings to checking." // "There is $5 in your checking account." writeACheck(15); // "There is $-10 in your checking account." // "Insufficient funds! No more checks for you!" // "Your check writing privileges have been suspended!" ``` -------------------------------- ### Client Subscription Example Source: https://github.com/meteor/docs/blob/master/source/api/pubsub.md Shows how a client subscribes to data published by the server using `Meteor.subscribe` and how to access the data using a collection. ```js // Declare a collection to hold the count object. const Counts = new Mongo.Collection('counts'); // Subscribe to the count for the current room. Tracker.autorun(() => { Meteor.subscribe('countsByRoom', Session.get('roomId')); }); // Use the new collection. const roomCount = Counts.findOne(Session.get('roomId')).count; console.log(`Current room has ${roomCount} messages.`); ``` -------------------------------- ### Blaze Template Example Source: https://github.com/meteor/docs/blob/master/source/api/reactive-dict.md Provides the HTML structure for a Blaze template that displays dynamic enemy information and includes a button to change it. ```html ``` -------------------------------- ### Basic ReactiveDict Usage Source: https://github.com/meteor/docs/blob/master/source/api/reactive-dict.md Demonstrates setting and getting a value, and how changes trigger reactive updates via Tracker.autorun. ```javascript const state = new ReactiveDict(); state.set('currentRoomId', 'random'); Tracker.autorun(() => { Meteor.subscribe('chatHistory', { room: state.get('currentRoomId') }); }); // Causes the function passed to `Tracker.autorun` to be rerun, so that the // 'chatHistory' subscription is moved to the room 'general'. state.set('currentRoomId', 'general'); ``` -------------------------------- ### Basic Server-Side Rendering with React Source: https://github.com/meteor/docs/blob/master/source/packages/server-render.md Example of using `onPageLoad` on the server to render a React component into an element with id 'app' using `renderToString`. ```javascript import React from "react"; import { renderToString } from "react-dom/server"; import { onPageLoad } from "meteor/server-render"; import App from "/imports/Server.js"; onPageLoad(sink => { sink.renderIntoElementById("app", renderToString( )); }); ``` -------------------------------- ### Meteor.call - Asynchronous Example Source: https://github.com/meteor/docs/blob/master/source/api/methods.md Demonstrates how to call a Meteor method asynchronously on the server, with a callback to handle the result or error. ```js Meteor.call('foo', 1, 2, (error, result) => { ... }); ``` -------------------------------- ### Connecting to MongoDB Primary Source: https://github.com/meteor/docs/blob/master/long-form/oplog-observe-driver.md Example of connecting to the primary server in a MongoDB replica set using the mongo shell, specifying admin database and authentication credentials. ```bash $ mongo -u YourExistingAdminUserName -p YourExistingAdminPassword mongo-server-1.example.com/admin ``` -------------------------------- ### Meteor Deployment Options Source: https://github.com/meteor/docs/blob/master/source/commandline.md Explains the `--free` and `--mongo` command-line options for deploying Meteor applications. `--free` enables a free tier with limitations, while `--mongo` integrates a free MongoDB instance. These options are useful for testing and development but not recommended for production. ```bash meteor deploy --free meteor deploy --mongo meteor deploy --free --mongo ``` -------------------------------- ### Automatic Cleanup Convention Example Source: https://github.com/meteor/docs/blob/master/long-form/tracker-manual.md Shows how to use the automatic cleanup convention with Meteor.subscribe. The subscription is automatically managed (started or stopped) based on the reactive dependencies within the autorun. ```js Tracker.autorun(function () { if (Session.get("subscribeToNewsFeed")) { Meteor.subscribe("newsFeed", Meteor.userId()); } }); ``` -------------------------------- ### Package Configuration Example Source: https://github.com/meteor/docs/blob/master/source/api/packagejs.md Demonstrates how to configure package options using the Meteor settings file. This approach allows for declarative configuration, making options available at runtime without specific function calls. ```json { "packages": { "quave:collections": { "isServerOnly": true } } } ``` -------------------------------- ### Meteor Package Use Statistics Source: https://github.com/meteor/docs/blob/master/long-form/package-server-api.md Fetches daily package installation statistics from the Meteor Package Server via an HTTP GET request. The data is returned as a newline-delimited JSON array, detailing package names, versions, direct adds, and total adds for a specific day. ```HTTP GET /stats/v1/ Example Response: {\"name\": \"tracker\", \"version\": \"1.0.1\", \"directAdds\": 250, \"totalAdds\": 1000 } {\"name\": \"iron:router\", \"version\": \"1.0.0\", \"directAdds\": 200, \"totalAdds\": 800 } ``` -------------------------------- ### Meteor Create Command Source: https://github.com/meteor/docs/blob/master/source/commandline.md Initializes a new Meteor project. By default, it sets up a React project. It can create a package if used within an existing app. Various flags control the project's structure and included packages. ```bash # Create a new project named 'my-app' meteor create my-app # Create a bare project (Blaze) meteor create --bare my-bare-app # Create a full, imports-based project meteor create --full my-full-app # Create a minimal project meteor create --minimal my-minimal-app # Create a new package in the current app's packages directory meteor create --package my-new-package # Create a project with TypeScript support meteor create --typescript my-ts-app ``` -------------------------------- ### Meteor Settings Management Source: https://github.com/meteor/docs/blob/master/source/commandline.md Demonstrates how to manage application settings during deployment. Settings are provided via a JSON file and are accessible on the server via `Meteor.settings`. ```json { "public": { "api_key": "your_public_api_key" }, "private": { "database_url": "your_private_database_url" } } ``` -------------------------------- ### Meteor CLI Overview Source: https://github.com/meteor/docs/blob/master/source/commandline.md General information about the Meteor command-line tool. It highlights that `meteor help` provides comprehensive details and that `meteor run` is the default command. ```APIDOC Project: /meteor/docs CLI Commands: meteor help [command] Description: Get help on meteor command line usage. Lists common commands or detailed help for a specific command. meteor run [--port PORT] [SERVER_NODE_OPTIONS=value] Description: Run a meteor development server. Automatically detects project root and hot-reloads. Default port is 3000. Can specify port and pass Node.js options. Default Behavior: Equivalent to running `meteor`. Environment Variable: SERVER_NODE_OPTIONS for Node.js flags. Example: `meteor run --port 4000` meteor debug [--debug-port PORT] Description: Run the project with debugging enabled. Superseded by `--inspect` and `--inspect-brk` flags for `run`, `test`, `test-packages`. Note: Affects the server process. Pauses execution before the first statement. Default Debug Port: 5858. Example: `meteor run --inspect-brk --debug-port 9229` meteor create [--bare|--full|--minimal|--package|--typescript] Description: Create a new Meteor project or package. Flags control project structure (React, Blaze, imports-based, minimal) and language support (TypeScript). Example: `meteor create --react my-app` ``` -------------------------------- ### Install accounts-password Package Source: https://github.com/meteor/docs/blob/master/source/api/passwords.md Installs the `accounts-password` package into your Meteor application. This package provides the core functionality for password-based authentication. ```bash meteor add accounts-password ``` -------------------------------- ### Enable bundle-visualizer Source: https://github.com/meteor/docs/blob/master/source/packages/bundle-visualizer.md Enables the bundle-visualizer package for Meteor by running the meteor tool with the `--extra-packages` and `--production` flags. This simulates production bundling and enables minification, which is required for accurate analysis. ```sh cd app/ meteor --extra-packages bundle-visualizer --production ``` -------------------------------- ### Tracker.afterFlush Execution Example Source: https://github.com/meteor/docs/blob/master/long-form/tracker-manual.md Illustrates the behavior of Tracker.afterFlush with a practical example. It shows how the callback is executed after a reactive update and that it's a one-shot operation. ```js set("favoriteFood", "candy"); // "My favorite food is candy!" setUnpopularFood("lizards"); // "My favorite food is lizards!" // "Sounds gross to you, but from where I'm from it's considered a delicacy!" set("favoriteFood", "ice cream"); // "My favorite food is ice cream!" ``` -------------------------------- ### Meteor Help Command Source: https://github.com/meteor/docs/blob/master/source/commandline.md Provides assistance for Meteor command-line usage. Running `meteor help` lists common commands, while `meteor help ` offers detailed information about a specific command. ```bash meteor help meteor help ``` -------------------------------- ### Tracker.Dependency Implementation Example Source: https://github.com/meteor/docs/blob/master/long-form/tracker-manual.md A JavaScript implementation of the Tracker.Dependency class, demonstrating how to manage a set of Tracker.Computation objects and trigger their invalidation. This example shows the core logic for tracking dependencies and notifying them of changes. ```javascript Dependency = function () { this._nextId = 0; this._dependents = {}; }; Dependency.prototype.depend = function () { var self = this; if (Tracker.currentComputation) { var id = self._nextId++; self._dependents[id] = Tracker.currentComputation; Tracker.currentComputation.onInvalidate(function () { delete self._dependents[id]; }); } }; Dependency.prototype.changed = function () { for (var id in this._dependents) { this._dependents[id].invalidate(); } }; ``` -------------------------------- ### Serve Static HTML Landing Page Source: https://github.com/meteor/docs/blob/master/source/packages/webapp.md This example shows how to serve a static HTML file ('index.html') from the application's private assets on the root path ('/'). It utilizes `Assets.getText` to read the file content, generates an ETag for caching, and handles conditional requests (304 Not Modified). It also includes error handling if the file is not found. This approach is beneficial for optimizing Time To First Byte (TTFB). ```js /* global WebApp Assets */ import crypto from 'crypto' import connectRoute from 'connect-route' WebApp.connectHandlers.use(connectRoute(function (router) { router.get('/', function (req, res, next) { const buf = Assets.getText('index.html') if (buf.length > 0) { const eTag = crypto.createHash('md5').update(buf).digest('hex') if (req.headers['if-none-match'] === eTag) { res.writeHead(304, 'Not Modified') return res.end() } res.writeHead(200, { ETag: eTag, 'Content-Type': 'text/html' }) return res.end(buf); } return res.end('Index page not found!') }) })) ``` -------------------------------- ### Advanced Field Projection with Nested Fields Source: https://github.com/meteor/docs/blob/master/source/api/collections.md Shows an advanced example of field projection in Meteor, including selecting specific fields within nested arrays. This example excludes the '_id' field and selects only the 'name' from 'alterEgos'. ```javascript Users.insert({ alterEgos: [ { name: 'Kira', alliance: 'murderer' }, { name: 'L', alliance: 'police' } ], name: 'Yagami Light' }); Users.findOne({}, { fields: { 'alterEgos.name': 1, '_id': 0 } }); // Returns { alterEgos: [{ name: 'Kira' }, { name: 'L' }] } ``` -------------------------------- ### ReactiveVar API Source: https://github.com/meteor/docs/blob/master/source/api/reactive-var.md ReactiveVar holds a single value that can be get and set. Setting a value invalidates Computations that called get. Unlike Session variables, ReactiveVars do not have global names, are not automatically migrated across hot code pushes, and can hold any value. ```APIDOC ReactiveVar: A reactive data source that holds a single value. - Does not have global names, allowing for local usage (e.g., attached to template instances). - State is not automatically migrated across hot code pushes. - Can hold any value, unlike Session variables limited to JSON/EJSON. - Setting the value to the same value has no effect (no invalidations triggered) for primitive values. For objects, calling `set` always counts as a change unless `equalsFunc` is configured. ReactiveVar#get(): Retrieves the current value of the ReactiveVar. ReactiveVar#set(newValue): Sets a new value for the ReactiveVar. This invalidates dependent computations. ``` -------------------------------- ### Meteor Package Publishing Source: https://github.com/meteor/docs/blob/master/source/commandline.md Commands for publishing Meteor packages, including initial publication, updates, and architecture-specific builds. Covers the process of logging in, naming conventions, and handling binary code. ```bash meteor publish # To publish for the first time: meteor publish --create # To update metadata or README: meteor publish --update ``` ```bash # Publish a build for a different architecture (e.g., Linux from a Mac): meteor publish-for-arch @ ``` -------------------------------- ### WebApp API Documentation Source: https://github.com/meteor/docs/blob/master/source/packages/webapp.md Provides core functions for managing runtime configuration. `addRuntimeConfigHook` registers a callback for dynamic configuration. `decodeRuntimeConfig` parses the configuration string, and `encodeRuntimeConfig` serializes an object back into a string. ```APIDOC WebApp.addRuntimeConfigHook(callback: function({arch: string, request: object, encodedCurrentConfig: string, updated: boolean}): string | undefined) Registers a hook to dynamically modify runtime configuration. The callback receives architecture, request details, the current config string, and an update flag. It should return the modified config string or undefined. WebApp.decodeRuntimeConfig(encodedConfig: string): object Decodes a runtime configuration string into a JavaScript object. WebApp.encodeRuntimeConfig(configObject: object): string Encodes a JavaScript object into a runtime configuration string. ``` -------------------------------- ### Meteor Project Creation Flags Source: https://github.com/meteor/docs/blob/master/source/commandline.md Flags to create new Meteor projects with different UI frameworks or configurations. These flags determine the default UI library and associated packages included in the project. ```bash meteor create --react meteor create --apollo meteor create --vue meteor create --svelte meteor create --blaze meteor create --bare meteor create --full meteor create --minimal ``` -------------------------------- ### Meteor Project Management and Deployment Source: https://github.com/meteor/docs/blob/master/source/commandline.md Commands for managing the local development environment and building the project for deployment. ```APIDOC meteor ensure-cordova-dependencies - Checks if Cordova dependencies are installed and installs them if not. meteor mongo - Opens a MongoDB shell for your local development database. - Requires the application to be running locally with 'meteor run'. meteor reset - Resets the current project to a fresh state by removing the local MongoDB database. - Warning: This deletes all local data. Ensure no important data is present before running. - Cannot be run while a development server is active; quit all running Meteor applications first. meteor build - Packages the project for deployment. - Output includes: - A tarball (.tar.gz) for the application server (or a 'bundle' directory with --directory). - An unsigned Android APK and source if Android is targeted. - An Xcode project source if iOS is targeted. - The server bundle can be used for self-hosting. - APK and Xcode projects are for deploying to respective app stores. - Bundles for the current architecture by default. ``` -------------------------------- ### Install Email Package Source: https://github.com/meteor/docs/blob/master/source/api/email.md Command to add the email package to a Meteor project. ```bash meteor add email ``` -------------------------------- ### Meteor Free Tier Limitations Source: https://github.com/meteor/docs/blob/master/source/commandline.md Details the restrictions associated with the Meteor free tier, including custom domain usage, cold start behavior, and the use of single Tiny containers. These limitations are important for understanding the capabilities and constraints of free deployments. ```bash # Custom domain restrictions: Must use .meteorapp.com domains # Cold Start: App stops after 10 minutes of inactivity # Container: Runs on a single Tiny container, not suitable for production ``` -------------------------------- ### Install Check Package Source: https://github.com/meteor/docs/blob/master/source/api/check.md Command to add the 'check' package to your Meteor application. ```bash meteor add check ``` -------------------------------- ### Referencing Uncached Large Image Source: https://github.com/meteor/docs/blob/master/source/packages/appcache.md Example of referencing a large image file that has been configured to not be cached by the `appcache` package. ```html ``` -------------------------------- ### Example: Cleanup on Invalidation Source: https://github.com/meteor/docs/blob/master/source/api/tracker.md Demonstrates how to perform cleanup actions when a computation is invalidated or stopped using Tracker.onInvalidate. ```js if (Tracker.active) { Tracker.onInvalidate(() => { x.destroy(); y.finalize(); }); } ``` -------------------------------- ### Meteor Build Plugins API Overview Source: https://github.com/meteor/docs/blob/master/source/api/packagejs.md Provides an overview of the Meteor Build Plugins API, which integrates with the Isobuild tool for application compilation and bundling. It outlines the three phases: linting, compilation, and minification. ```APIDOC Build Plugins API: Phases: - Linting: Checks code for undeclared variables or style guidelines. - Compilation: Transforms source files (e.g., CoffeeScript, ES2015) into plain JavaScript and CSS. - Minification: Optimizes JavaScript and CSS files, potentially including concatenation. File Processing Methods: - getContentsAsBuffer(): Returns file contents as a buffer. - getContentsAsString(): Returns file contents as a string. - getPackageName(): Returns the name of the package or null. - getPathInPackage(): Returns the relative path of the file within the package or app root. - getSourceHash(): Returns a hash string for caching. - getArch(): Returns the targeted architecture. - getBasename(): Returns the filename. - getDirname(): Returns the directory path relative to the package or app root. - error(message): Raises a compilation or linting error for the file. ``` -------------------------------- ### Meteor Package and App Management Source: https://github.com/meteor/docs/blob/master/source/commandline.md Commands for linting, searching, showing information about packages, and testing local packages. Also includes commands for administrative tasks and interactive shells. ```bash # Run linters and view build errors: meteor lint # Search for Meteor packages: meteor search # Show detailed information about a package: meteor show # Test local packages (all if no argument): meteor test-packages [package-name | path] # Specify port for test app: meteor test-packages --port 3001 # Administrative commands (e.g., manage maintainers): meteor admin # Connect to a running server for interactive evaluation: meteor shell ``` -------------------------------- ### Use ecmascript Package in Package.js Source: https://github.com/meteor/docs/blob/master/source/packages/ecmascript.md Example of how to include the `ecmascript` package in a Meteor package's `package.js` file. ```javascript Package.onUse((api) => { api.use('ecmascript'); }); ``` -------------------------------- ### Accounts UI Configuration Example Source: https://github.com/meteor/docs/blob/master/source/api/accounts.md Configures the Accounts UI package with specific settings for requesting permissions from external services, requesting offline tokens, and defining password signup fields. ```js Accounts.ui.config({ requestPermissions: { facebook: ['user_likes'], github: ['user', 'repo'] }, requestOfflineToken: { google: true }, passwordSignupFields: 'USERNAME_AND_OPTIONAL_EMAIL' }); ``` -------------------------------- ### File System Path Handling with Plugin.fs and Plugin.path Source: https://github.com/meteor/docs/blob/master/source/api/packagejs.md Shows how to use Meteor's provided fs and path modules (Plugin.fs, Plugin.path) for correct file system path manipulation, especially on Windows, ensuring compatibility with Unix-style paths. ```js // On Windows const fs = Plugin.fs; const path = Plugin.path; const filePath = path.join('/C/Program Files', 'Program/file.txt'); console.log(filePath); // Prints '/C/Program Files/Program/file.txt' ``` -------------------------------- ### Meteor Release Management Source: https://github.com/meteor/docs/blob/master/source/commandline.md Commands related to publishing Meteor releases and managing release tracks. Includes details on the configuration file format and creating new release tracks. ```bash # Publish a Meteor release using a JSON configuration file: meteor publish-release # To create a new release track: meteor publish-release --create-track ``` -------------------------------- ### Match.Maybe Pattern Example Source: https://github.com/meteor/docs/blob/master/source/api/check.md Illustrates the usage of Match.Maybe for optional fields within objects or for values that can be null or undefined. ```javascript // In an object const pattern = { name: Match.Maybe(String) }; check({ name: 'something' }, pattern); // OK check({}, pattern); // OK check({ name: undefined }, pattern); // Throws an exception check({ name: null }, pattern); // Throws an exception // Outside an object check(null, Match.Maybe(String)); // OK check(undefined, Match.Maybe(String)); // OK ``` -------------------------------- ### Meteor Run Command Source: https://github.com/meteor/docs/blob/master/source/commandline.md Starts a Meteor development server. It automatically detects the project root and hot-reloads the application upon file changes. The default port is 3000. Options include specifying a port and passing Node.js server options via environment variables. ```bash # Run on default port 3000 meteor run # Run on a specific port meteor run --port 4000 # Set Node.js server options (Windows PowerShell) $env:SERVER_NODE_OPTIONS = '--inspect' | meteor run # Set Node.js server options (Linux) SERVER_NODE_OPTIONS=--inspect-brk meteor run ``` -------------------------------- ### Client-Side Rendering with React Source: https://github.com/meteor/docs/blob/master/source/packages/server-render.md Example of client-side rendering using `onPageLoad` with `ReactDOM.hydrate`. The callback can be an async function to handle dynamic imports. ```javascript import React from "react"; import ReactDOM from "react-dom"; import { onPageLoad } from "meteor/server-render"; onPageLoad(async sink => { const App = (await import("/imports/Client.js")).default; ReactDOM.hydrate( , document.getElementById("app") ); }); ``` -------------------------------- ### Registering a Minifier Plugin Source: https://github.com/meteor/docs/blob/master/source/api/packagejs.md Registers a new minifier plugin with Meteor. This example shows how to register a JavaScript minifier using UglifyJsMinifier. ```js Plugin.registerMinifier({ extensions: ['js'] }, () => new UglifyJsMinifier); ```