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

@edx/frontend-config

v1.0.1

Published

Frontend configuration template for Open edX micro-frontend applications.

Downloads

15

Readme

frontend-config (THIS REPO IS A WORK IN PROGRESS - IT IS NOT IN USE YET)

Getting Started

This repo is a template for frontend configuration libraries.

A frontend configuration library is intended to be used with an NPM alias during the build process to replace references to frontend-config (this repository). The application then imports config and plugins from this repo and uses it to configure itself.

Because of this, having a standardized interface for loading config information is important. We could provide a utility to validate it, perhaps, if it becomes painful.

NODE_ENV and APP_ENV

A Frontend Config may assume that two environment variables will be set via process.env.

NODE_ENV

This is a standard NODE_ENV variable. It will generally be production, development, or test.

DEPLOY_ENV

This is more granular than NODE_ENV, and represents the deploy environment. This is generally staging or production. Note that we do not set a staging NODE_ENV because many JavaScript libraries use a production NODE_ENV to indicate that they should enable optimizations and disable debugging code - setting NODE_ENV to staging would circumvent this.

Application-specific subdirectories

A Frontend Config must contain a directory called apps with subdirectories for the supported applications. At a minimum this must include profile and payment subdirectories. As more applications are converted to use frontend-config, they must be added as subdirectories.

apps/<APP_NAME>/index.js

An application-specific subdirectory must include an index.js file. Because application subdirectories are imported directly by the app, the other subdirectories will be tree-shaken out of the build, along with any dependencies (i.e., plugins like a header or footer) they may depend on.

This file must provide two exports.

config

A JSON configuration document. It must contain values for the following keys:

  • CREDENTIALS_BASE_URL
  • ECOMMERCE_BASE_URL
  • LMS_BASE_URL
  • LOGIN_URL
  • LOGOUT_URL
  • MARKETING_SITE_BASE_URL
  • ORDER_HISTORY_URL
  • SUPPORT_URL
  • REFRESH_ACCESS_TOKEN_ENDPOINT
  • SITE_NAME
  • CSRF_TOKEN_API_PATH
  • ACCESS_TOKEN_COOKIE_NAME
  • LANGUAGE_PREFERENCE_COOKIE_NAME
  • USER_INFO_COOKIE_NAME

It may optionally include any other keys that the application needs.

plugins

An Object representing the application's plugin configuration. Each key in the Object represents a known plugin slot identifier.

Currently the only two valid plugin slots are:

{
  header: <Plugin Configuration>,
  footer: <Plugin Configuration>,
}

Plugin Configuration

The plugin configuration must be an Object of the following shape:

{
  Component: <React Component for plugin>,
  messages: <i18n messages object>,
  config: <configuration JSON object for custom config>
}

apps/<APP_NAME>/index.scss

An application-specific subdirectory must include an index.scss file, representing CSS overrides (a CSS theme). The file may be empty, but it must exist.

Important Notes

This method of configuration does not fully replace our environment variable configuration that's currently in use.

There are some env vars that are used specifically by the build process, and in theory there could be some that are private. There are also two environment variables needed by this method.

Some examples:

  • APPLE_DEVELOPER_MERCHANT_ID_DOMAIN_ASSOCIATION - used in build process for payment
  • BASE_URL - used by webpack (duplicated here)
  • NEW_RELIC_APP_ID - used by webpack
  • NEW_RELIC_LICENSE_KEY - used by webpack
  • NEW_RELIC_ADMIN_KEY - used by webpack... weirdly I don't see it set anywhere.
  • NODE_ENV
  • DEPLOY_ENV - new and informs this repo what deploy environment the code is for - staging or production.

There are also many environment variables not covered by this repo that are used by other micro-frontends. Presumably they'd need to be added here as those MFEs are configured via this method.

  • CURRENCY_COOKIE_NAME - used by payment... not set anywhere?