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

ember-local-resolver

v0.1.3

Published

Turn {{a-route/local-component}} into {{local-component}}

Downloads

26

Readme

ember-local-resolver

Put local components / helpers where they belong

Dependencies

Ember

Health

Travis Coveralls

Security

bitHound

Ember Observer score

EmberObserver

Installation

ember install ember-local-resolver

Purpose

Rather than clutter your global components and helpers directories with components/helpers that are only used in a specific case, wouldn't it be nice to locate them alongside the consuming template?

"That would great"

You've come to the right place!

Usage

This addon makes the most sense in a pods structure (although classic is supported).

The standard Ember resolver looks up components and helpers from root directories

app/components
app/helpers

This works fine most of the time, but for complex apps you'll often want to create a number of components / helpers that are really only relevant to a particular route.

Unfortunately with the current resolver those components / helpers either have to live in the root directories or you need to provide a nested path with / that both looks ugly and won't be supported when angle-bracket components land.

The module unification RFC solves this issue using the concept of private collections which allows -components / -helpers in a feature pod to provide locally scoped private modules.

This addon enables these capabilities today, so you can use a structure like:

app/user-account/route.js
app/user-account/controller.js
app/user-account/template.hbs
app/user-account/-components/user-avatar/component.js
app/user-account/-components/user-avatar/template.hbs
app/user-account/-helpers/generate-moniker/helper.js

And use them within your user-account template as

{{user-avatar}}
{{generate-moniker}}

That's it, now get out there and go have some fun!

Order of resolution

In the event that a local and global component / helper share a name, the local version wins when in the local template.

You can also reference the global component / helper from within the local component's template, but please...for the sake of everyone's sanity...just rename one of them.

Generators

Unfortunately, we don't have a fancy generator to make new local components / helpers (cough...PRs welcome...) so the easiest way to handle this is to just move a generated directory into your local -components / -helpers path.

Credits

Thanks to @rwjblue for the initial gist for this implementation.

Development

Setup

git clone [email protected]:ciena-frost/ember-local-resolver.git
cd ember-local-resolver
npm install && bower install

Development Server

A dummy application for development is available under ember-local-resolver/tests/dummy. To run the server run ember server (or npm start) from the root of the repository and visit the app at http://localhost:4200.

Testing

Run npm test from the root of the project to run linting checks as well as execute the test suite and output code coverage.