npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

meteor-package-paths

v0.0.44

Published

Manages file paths for Meteor packages.

Downloads

65

Readme

Meteor Package Paths

Manages file paths for Meteor packages.

File inclusion is handled automatically by Meteor for apps. Unfortunately this is not so for packages which have explicit file inclusion references within the package.js file.

This package scans the folder strucutre of your package(s) automatically updating the file inclusion paths within your package.js file.

While this tool updates the package.js file, it is non-destructive and only changes the file path references, leaving all other lines within package.js intact.

Along with emulating the default Meteor file load order rules, this package provides sprockets style overriding of the load order of files within the package.js file. This can be particularly useful in the odd occasion where you really need one JS file to exist in the environment prior to another - and you don't wish to pervert your naming or folder structure to achieve that.

Installation

Install globally so you can use the command line from any folder.

npm install -g meteor-package-paths

Usage

This module assumes you are structuring your package folders like this:

/my-package
  /client
  /server
  /shared
  /images

To see the available commands, from within your package folder:

$ package --help

To create a fresh package.js file with all the correct api.addFiles entries:

$ cd my-package
$ package create 'My Package'

To update an existing package.js file:

$ cd my-package
$ package update

The resulting package.js file will contain the api.addFiles listing for your package taking into account any sprokets style comment directives you may have within any of the files.

And to update your app's entire set of packages:

$ cd my-app/packages
$ package update-all

Note, calling update-all will not effect any packages that have been sym-linked into your app.

Load Order

Path Directives

The default load order is deepest to shallowest. Use the comment directives to override this ordering:

require
require_directory (shallow)
require_tree      (deep)

For example:

#= require file.coffee
#= require_tree ../dir/foo
#= require_directory ../dir/foo

//= require file.js
//= require_tree ../dir/foo
//= require_directory ../dir/foo

Base directives

Files containing the base directive are ordered first, shallowest to deepest. This is a reversal of the above rules and is useful for the common pattern of having base classes declared in parent folders, under which folders contianing the files of deriving classes reside.

#= base
//= base

Exclusions

To exclude a file:

#= exclude

Exclusions

Images can be placed anywhere within the folder structure, and they are only added to the client. By convention, images are typically stored under:

/my-package
  /images

Testing from the Command Line

$ package --help

For example, from the command line:

$ package directory ./test/simple/client

$ package tree ./test/simple
$ package tree ./test/directives

$ package file ./test/simple/client/child/grand_child/grand_child.coffee
$ package file ./test/directives/client/child/grand_child/grand_child.coffee

Main

Files named main will be ordered last, deepest to shallowest.

'Where' Overrides

The execution domain (client / server / shared) is whatever the closest where name folder is. For example, you could override the shared folder, declaring some client-only files within it like this:

/shared
  foo.js
  /client
    css.styl
    template.html

Package tests

Use the same client / server / shared folder structure within a tests directory to have the test files output within the package's Package.on_test declaration block.

License

The MIT License (MIT)

Copyright © 2013 Phil Cockfield | Tim Haines

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.