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

sails-hook-federalist-ms

v1.0.0-alpha.6

Published

Sailsjs installable hook for Federalist to enable platform support for Windows and publishing support for Azure

Downloads

12

Readme

sails-hook-federalist-ms

npmbadge

This installable hook for Sails.js incorporates both Windows and Microsoft Azure extensibility in to Federalist, a static website management platform built and maintained by 18F. The hook is comprised of two components: build support for Windows (and Azure Web Apps) and static site publishing support for Azure.

New releases of this package will coincide with Federalist's current stage of development; based on 18F's Project Stage Definitions.

Detailed API documentation for this package can be found here: http://microsoft.github.io/sails-hook-federalist-ms/.

Running Federalist on Windows

In order to enable this hook, the FEDERALIST_BUILD_ENGINE environment variable must be set to 'federalist-ms'. By enabling this hook, the build engine will be configured to run tasks on Windows (or Web Apps), and the Azure site publishing feature will be activated.

If Federalist detects that the platform is running on Windows and the FEDERALIST_BUILD_ENGINE environment variable is not set, an error will be logged indicating that builds will fail until the variable is set correctly.

Windows Build Engine

Federalist works by executing a specific set of build tasks for each static site based on whether or not the site's content is built using a content generator (either Jekyll or Hugo). If the site isn't built with a generator, then the build engine simply stages the site's content for publishing as is.

When running Federalist on Windows (or on an Azure Web App as described below), this hook invokes the appropriate build tasks using CMD-based syntax. All task output is redirected to stdout and subsequently attached to the Federalist logging engine.

Jekyll

Jekyll must be installed in order to build sites that are created with it. Instructions for installing Jekyll on Windows can be found here. In addition, you'll want to install additional Ruby gem dependencies which can be done using the following commands:

gem install bundler
bundle install

Hugo

Hugo is required to build sites that depend on it and installation instructions can be found here.

Azure Static Site Publishing

Once a site has been built and staged, the hook will subsequently publish the content to an Azure Web App. In order to publish to Azure, a new Azure Active Directory native client application must be created. Instructions for doing so can be found here. The 'Redirect URI' value is arbitrary and can be set to anything.

In addition, the following environment variables need to be set:

| Environment Variable | Description | | :----------------------------------- | :------------------- | | FEDERALIST_BUILD_ENGINE | Should be set to 'federalist-ms' | | FEDERALIST_AZURE_SUBSCRIPTION_ID | Azure Subscription Id | | FEDERALIST_AZURE_TENANT_ID | Azure Active Directory tenant Id | | FEDERALIST_AZURE_CLIENT_ID | Azure Active Directory application client Id | | FEDERALIST_AZURE_USERNAME | Azure Active Directory organizational account username (cannot be a Microsoft Account (e.g. Outlook, Live, etc) | | FEDERALIST_AZURE_PASSWORD | Azure Active Directory organizational account password | | FEDERALIST_AZURE_REGION | Azure Region for deployment (for new Web Apps) |

The Azure publishing process is based on the following execution sequence:

  1. Retrieve Azure Active Directory authorization token
  2. Check for existence of Azure Web App
  3. If Web App exists, skip to Step 6
  4. Otherwise, provision new Azure Resource Group if one doesn't exist
  5. Deploy template to Resource Group
  6. Retrieve Web App site-level publishing credentials
  7. Publish content to Web App via FTPS

For the intial alpha release, FTPS is used to publish the site content. Future releases of this package will use Git for publishing.

Running Federalist on Azure

TODOs

  • Set environment variables (including RUBY_HOME)
  • Installer bundler gem
  • Execute bundle command at root to install Gem dependencies

Developing on Windows

This hook is developed following the Sails.js hook specification.

In order to install Sails and the required dependencies for contributing to the hook, the following prerequisites must be installed in the following order:

NOTE: In order to avoid Sails npm package name length limitations imposed by Windows, npm v3.x can be used to install the hook's dependencies. Instructions for upgrading npm to v3.x can be found here. Bear in mind that some packages might be incompatible with npm v3.x at the time of this writing. If issues arise during installation, reference the source repositories of the offending packages on GitHub for any open issues.

Execute the following command to install the dependencies for sails-hook-federalist-ms:

npm install

Gulp is used to execute all unit tests and compile the documentation from the code. The command below can be executed to initiate the build tasks.

gulp

NOTE: Only those with push priveleges on the GitHub remote can update the existing gh-pages branch. Any errors in the documentation should be denoted by a new Issue on GitHub.