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

@foundry-ai/foundry-service-loader

v1.0.0

Published

A lazy service loader for Foundry.ai projects

Downloads

10

Readme

Foundry Service Loader

| Doc Sections | |--------------| | Getting Started | | Included Services | | Making Changes |

Get the Code

  • https://bitbucket.org/foundrydc/foundry-service-loader

Usage

1. Require

const FoundryServiceLoader = require('foundry-service-loader');
// Easy enough

2. Init

const serviceLoader = FoundryServiceLoader(config);
 // see README.md in config folder

3. Usage

const myService = new MyService();
serviceLoader.setService('myService', myService);

// later on in another file
const serviceLoader = require('foundry-service-loader')(); // no need to pass config in again after init
const myService = serviceLoader.getService('myService');

Included Services

ElasticSearch Client

const Config = require('config');
const FoundryServiceLoader = require('foundry-service-loader');
const serviceLoader = FoundryServiceLoader(Config.get('services'))
const elasticSearchClient = serviceLoader.getElasticSearchClient();

// use the service
return new Promise((resolve, reject) => {
  elasticSearchClient.indices.create({
    index: 'myIndexName'
  }, (err, result) => {
    if (err) reject(err);
    else resolve(result);
  })
})

Email

const Config = require('config');
const FoundryServiceLoader = require('foundry-service-loader');
const serviceLoader = FoundryServiceLoader(Config.get('services'))
const emailService = serviceLoader.getEmailService();

// use the service
emailService.send(emailData)
.then(authorization => { /** do something */ })
.catch(err => { /** handle error */ });

Foundry Kue Scheduler

Logger

const Config = require('config');
const FoundryServiceLoader = require('foundry-service-loader');
const serviceLoader = FoundryServiceLoader(Config.get('services'))
const logger = serviceLoader.getLogger();

// use the service
logger.info('My info log', { data })

Making Changes

If you have never used Git, search around online to get a grounding. But here are the basic commands you will need to use to actually push code to our repository, with a little bit of Git theory to explain what's going on.

  1. First make sure you have the most current version of the codebase. In your terminal window, navigate to the project root. Type git checkout master to checkout the master branch.
  2. git pull origin master will update master with any new changes.
  3. git checkout -b feature/[NEW_FEATURE_NAME] this will create a new branch (called feature/NEW_FEATURE_NAME, or whatever you want). Your branch names should be descriptive, but short. For example, if I want to create a cart on my branch, I might call it "feature/cart" (after the object) or "feature/checkout" (after the functionality).
  4. You can run git branch at any time to see which branch you're on and what branches you have locally.
  5. Write some code. If you ever want to see which files you've changed, added, or deleted you can run git status
  6. When you are satisfied with your changes, make a commit by executing git commit -am [YOUR_COMMIT_MESSAGE]. The -a attribute tells Git to commit all changed files. If you don't want to commit all of them, you'll have to type the names of the files. The -m is required; Git needs commit messages. Try to be descriptive, maybe your first commit message will be "store skeleton", the next will be "product page", etc. NOTE git commit -a will not commit any new files since they are not part of Git yet. If you have new files you will need to run git add . before the above commands ("." means "all").
  7. Once the code is committed to your branch, your branch is ready to go. Now we just need to release it into the internet and tell everyone else that we want to combine this branch with the master branch. Execute git push origin [BRANCH_NAME]. Here, origin represents our Bitbucket repository. Run git remote -v to see your repository aliases.
  8. Now we create a pull request on github - in other words, a request to the other developers that we want our code to be merged into the application. In the left sidebar, click Pull Requests > Create Pull Request. The branch on the left should be the branch you were just working on i.e. the one we want to merge into the app. The branch on the right should be master. Make a descriptive title so we know what the pull request is for, and add the necessary reviewers.
  9. Click "Create Pull Request" and wait for us to review your code.

We follow the git branching model outlined in this blog post.