Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
meteor-build-client
Advanced tools
Builder and bundler for the client part of a Meteor application. As a result it would generate simple index.html
, so it can be hosted on any server or even loaded via the file://
protocol.
npm install -g meteor-build-client
frozeman:build-client
is just a placeholder package, there's no need to install it;meteor-build-client /home
!import('/eager/file');
;The content of the output folder could look as follows:
index.html
a28817fe16898311635fa73b959979157e830a31.css
aeca2a21c383327235a08d55994243a9f478ed57.js
...
(other files from project's /public
directory)Things you need to know before exporting your project
meteor-build-client
looks for the <meteor-bundled-css />
tag in your <head>
section and the <meteor-bundled-js />
tag in the <body>
section.
Example:
<head>
<!-- your header stuff... -->
<!-- then typically add the css link at the bottom of the head -->
<meteor-bundled-css />
</head>
<body>
<!-- typically want to load all the js code at the top -->
<meteor-bundled-js />
<!-- The rest of your body stuff... -->
</body>
Note: this does not work for blaze projects. For blaze projects you can only set <meteor-bundled-css />
in your header. It is invalid to set <meteor-bundled-js />
in your body, simply leave it out and the right thing will happen.
List all available options and show docs:
meteor-build-client --help
Usage examples:
# cd to meteor app
cd /my/app
# run meteor-build-client
meteor-build-client ../output/directory
# build meteor app as usual
meteor build ../build-directory --directory
# bundle client-only assets with meteor-build-client
meteor-build-client ../build-directory-client --url https://example.com --usebuild ../build-directory
Pass Meteor's settings.json
settings file via --settings
or -s
option:
meteor-build-client ../output/directory -s ../settings.json
Note: Only the public
property of that JSON file will be add to the Meteor.settings
property.
Set the ROOT_URL
of the application via --url
or -u
option:
meteor-build-client ../output/directory -u https://myserver.com
By passing "default"
, application will try to connect to the server from where the application was served. If this option was not set, it will set the server to ""
(empty string) and will add a Meteor.disconnect()
after Meteor was loaded.
To serve application via file://
protocol (by opening the index.html
) set --path
or -p
option to ""
(empty string). This would generate relative paths for assets across the application:
meteor-build-client ../output/directory -p ""
The default path value is "/"
.
Note: "path" value will replace paths in generated CSS file. Use it to link fonts and other assets correctly.
To use pre-build Meteor application, built using meteor build
command manually, specify the --usebuild <path-to-build>
flag and meteor-build-client
will not run the meteor build
command.
Tips'n tricks using client bundle
When building server-less standalone web application we recommend to replace meteor-base
with meteor
and webapp
packages.
@@ .meteor/packages
- meteor-base
+ meteor
+ webapp
In order to connect to a Meteor servers, create DDP connection by using DDP.connect()
, as seen in the following example:
// This Should be in both server and client in a lib folder
DDPConnection = (Meteor.isClient) ? DDP.connect('http://localhost:3000/') : {};
// When creating a new collection on the client use:
if(Meteor.isClient) {
posts = new Mongo.Collection('posts', DDPConnection);
// set the new DDP connection to all internal packages, which require one
Meteor.connection = DDPConnection;
Accounts.connection = Meteor.connection;
Meteor.users = new Mongo.Collection('users');
Meteor.connection.subscribe('users');
// Subscribe like this:
DDPConnection.subscribe('mySubscription');
}
To enforce JavaScript routing, all requests should point to index.html
. See below "rewrite" instructions for various http/proxy servers.
Create .htaccess
for Apache with mod_rewrite
rules:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Always pass through requests for files that exist
# Per http://stackoverflow.com/a/7090026/223225
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
# Send all other requests to index.html where the JavaScript router can take over
# and render the requested route
RewriteRule ^.*$ index.html [L]
</IfModule>
Use try_files
and error_page
to redirect all requests to non-existent files to index.html
. Static files will be served by nginx itself.
server {
listen 80;
listen [::]:80;
server_name myapp.com;
index index.html;
root /var/www/myapp;
error_page 404 =200 /index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
FAQs
Meteor bundler for the client part of an app.
The npm package meteor-build-client receives a total of 55 weekly downloads. As such, meteor-build-client popularity was classified as not popular.
We found that meteor-build-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.