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:
inspectOptions
: typhonjs-github-inspect-orgstransformOptions
: typhonjs-github-inspect-orgs-transform
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:
- github-transform-collaborators-all - Transforms all collaborators across all organizations.
- github-transform-collaborators-user - Transforms all collaborators across all organizations w/
userCredential
. - github-transform-contributors-all - Transforms all contributors across all organizations.
- github-transform-contributors-user - Transforms all contributors across all organizations w/
userCredential
. - github-transform-members-all - Transforms all organization members across all organizations.
- github-transform-members-user - Transforms all organization members across all organizations w/
userCredential
. - github-transform-org-members-all - Transforms all members by organization across all organizations.
- github-transform-org-members-user - Transforms all members by organization across all organizations w/
userCredential
. - github-transform-org-repo-collaborators-all - Transforms all collaborators by repo by organization across all organizations.
- github-transform-org-repo-collaborators-user - Transforms all collaborators by repo by organization across all organizations w/
userCredential
. - github-transform-org-repo-contributors-all - Transforms all contributors by repo by organization across all organizations.
- github-transform-org-repo-contributors-user - Transforms all contributors by repo by organization across all organizations w/
userCredential
. - github-transform-org-repo-stats-all - Transforms GitHub statistics by repo by organization across all organizations.
- github-transform-org-repo-stats-user - Transforms GitHub statistics by repo by organization across all organizations w/
userCredential
. - github-transform-org-repos-all - Transforms all repos by organization across all organizations.
- github-transform-org-repos-user - Transforms all repos by organization across all organizations w/
userCredential
. - github-transform-org-team-members-all - Transforms all members by team by organization across all organizations.
- github-transform-org-team-members-user - Transforms all members by team by organization across all organizations w/
userCredential
. - github-transform-org-teams-all - Transforms all teams by organization across all organizations.
- github-transform-org-teams-user - Transforms all teams by organization across all organizations w/
userCredential
. - github-transform-orgs-all - Transforms all organizations.
- github-transform-orgs-user - Transforms all organizations w/
userCredential
. - github-transform-owner-orgs - Transforms all organizations by organization owner.
- github-transform-owners - Transforms all organization owners.
- github-transform-owners-rate-limit - Transforms the current rate limits for all organization owners.
- github-transform-user-from-credential - Transforms the GitHub user who owns the provided
userCredential
.