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

typhonjs-github-orgs-gulptasks

v0.0.7

Published

Provides GitHub many organization / repos gulp tasks shared by TyphonJS and beyond.

Downloads

11

Readme

typhonjs-github-orgs-gulptasks

NPM Code Style License Gitter

Build Status Dependency Status

Provides GitHub many organization / repos gulp tasks shared by TyphonJS and beyond.

The transform Gulp tasks are optional and only load if the following NPM modules are installed:

The following are example entries in package.json:

  "dependencies": {
    "typhonjs-github-inspect-orgs": "^0.1.0"
    "typhonjs-github-inspect-orgs-transform": "^0.1.0"
  },
  "devDependencies": {
    "gulp": "^3.0.0",
    "typhonjs-github-orgs-gulptasks": "^0.1.0",
    "typhonjs-npm-build-test": "^0.1.0"
  },

An example gulpfile.babel.js initializing the transform tasks:

import fs            from 'fs';
import gulp          from 'gulp';

import gitGulpTasks  from 'typhonjs-github-orgs-gulptasks';

// Import all GitHub Orgs gulp tasks

// Loads owner / user public access tokens from environment variables or from `./token.owner` and `./token.user` in
// the root directory.
let ownerCredential = process.env.GITHUB_OWNER_TOKEN;
let userCredential = process.env.GITHUB_USER_TOKEN;

// If user ownerCredential is still undefined attempt to load from a local file `./owner.token`.
if (typeof ownerCredential === 'undefined')
{
   try { ownerCredential = fs.readFileSync('./token.owner', 'utf-8'); }
   catch(err) { /* ... */ }
}

// If user userCredential is still undefined attempt to load from a local file `./user.token`.
if (typeof userCredential === 'undefined')
{
   try { userCredential = fs.readFileSync('./token.user', 'utf-8'); }
   catch(err) { /* ... */ }
}

// Fail now if we don't have an owner token.
if (typeof ownerCredential !== 'string')
{
   throw new TypeError('No owner credentials found in `process.env.GITHUB_OWNER_TOKEN` or `./token.owner`.');
}

// Fail now if we don't have a user token.
if (typeof userCredential !== 'string')
{
   throw new TypeError('No user credentials found in `process.env.GITHUB_USER_TOKEN` or `./token.user`.');
}

// Defines TyphonJS organizations.
const organizations = [{ credential: ownerCredential, owner: 'typhonrt', regex: '^typhonjs' }];

// Import all tasks and set `rootPath` to the base project path and `srcGlob` to all JS sources in `./src`.
gitGulpTasks(gulp,
{
   rootPath: __dirname,
   importTasks: ['transform'],
   inspectOptions: { ctor: { organizations, verbose: true } },
   transformOptions: { ctor: { transformType: 'text' },  methods: { credential: userCredential } }
});

The above example Gulp file uses Babel / ES6 which is installed by typhonjs-npm-build-test. To configure the GitHub Orgs Gulp tasks a owner and user GitHub public access token containing public_repo and read:org permissions is either set as environment variables (useful for Travis CI testing) in process.env.GITHUB_OWNER_TOKEN and process.env.GITHUB_USER_TOKEN or in local files ./token.owner and ./token.user. It should be noted that if storing public access tokens in local files that the given project should include a .gitignore file that prevents checking them in as GitHub will invalidate those tokens if they are checked in as part of a commit.

In particular regarding configuration please review:

// Import all tasks and set `rootPath` to the base project path.
gitGulpTasks(gulp,
{
   rootPath: __dirname,
   importTasks: ['transform'],
   inspectOptions: { ctor: { organizations, verbose: true } },
   transformOptions: { ctor: { transformType: 'text' },  methods: { credential: userCredential } }
});

The second parameter to gitGulpTasks is an options hash that must contains:

@param {object} options - Optional parameters:

(object)          inspectOptions - Hash of options for GitHubInspectOrgs with following categories:

   (object)       ctor - Constructor options for GitHubInspectOrgs creation.

(object)          transformOptions - Hash of options for GitHubInspectOrgsTransform with following categories:

   (object)       ctor - Constructor options for GitHubInspectOrgsTransform creation.

   (object)       methods - Options passed into GitHubInspectOrgsTransform method invocation. The `all` category of gulp tasks
                            defined will remove `credentials` entries.

   (object)       tasks - Options specific to controlling task creation below:

      (boolean)   skipNonCredentialTasks - If true then skip all tasks that don't require credentials.

Please review the documentation for options available for:

The following is a description of all imported Gulp tasks for typhonjs-github-inspect-orgs-transform with links to related documentation from typhonjs-github-inspect-orgs-transform: