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

@americanexpress/holocron-dev-server

v0.2.4

Published

A micro-frontend dev server for Holocron Modules

Downloads

45

Readme

@americanexpress/holocron-dev-server

@americanexpress/holocron-dev-server is an experimental development server made for One App Holocron modules designed for enabling fast refresh and reloading of assets while creating web experiences.

⚠️ holocron-dev-server is a client-side only development server and does not run Holocron modules as One App would normally. Holocron modules are not loaded into memory on the server, nor does it server side render (only client side). There are other key differences, and as such, holocron-dev-server does not behave the same as One App server. If you are looking for a production-like environment to run One App Holocron modules, @americanexpress/one-app-runner would be the right tool of choice. This is because holocron-dev-server only provides a faster developer experience on the client side only, without the actual One App server.

📖 Table of Contents

✨ Features

  • Runs One App Holocron modules on an experimental development server
  • Fast refresh for Holocron modules, React components and styles are all hot loaded in the browser
  • Zero-config start up with pre-existing "one-amex" configuration in the package.json
  • Hot reload parrot scenarios and watch for changes
  • Hot reload language packs and watch for changes from the local modules
  • Combines the remote module if provided with the local module map remote module map with the universal map
  • Local Holocron modules bundles/externals analyzed and reported using webpack bundle analyzer

Differences with One App

  • Only works client side
  • Does not server side render

Server Spec

🤹‍ Usage

Prerequisites

Installation

npm install -D @americanexpress/holocron-dev-server

# or

yarn add -D @americanexpress/holocron-dev-server

Start Up

add the script in the package.json of your Holocron module:

{
  "scripts": {
    "dev": "holocron-dev-server"
  }
}

then run to start the development server:

npm run dev

# or

yarn dev

Once the command runs, the sandbox Holocron module reload server will start up using the configuration found in the modules package.json.

Zero-Config

holocron-dev-server uses existing configurations from "one-amex" to source what modules, externals and other configuration like rootModuleName are used.

The config uses one-amex.runner (modules, rootModuleName, moduleMapUrl, dockerImage, envVars) and one-amex.bundler (providedExternals, requiredExternals) to set up the HMR environment for your Holocron module.

Default Values

In the case that certain configuration options are not present in the Holocron module config, there are default values that are used in its place.

  • the root module name (rootModuleName) will use the current module if it is not defined.
  • the docker image (dockerImage) will default to oneamex/one-app-dev:latest if not defined.

Parrot Scenarios

If a mock/scenarios.js exists in your module, the parrot scenarios will be watched for changes and updated, please note that the parrot browser extension will need to be changed to refer to the port used by the holocron development server.

Language Packs

The same applies if locale/* folder exists in your Holocron module. When a given locale gets modified, the holocron dev server will notify the client and will load the language pack into state. Please note that if default fallback for loading the language pack is en-US, if any issue occurs while trying to load it.

🎛️ API

The API is subject to change

holocron-dev-server

Command line tool usage.

Usage

npx -p @americanexpress/holocron-dev-server -- holocron-dev-server

Configuration

hmr Options

Use the one-amex.hmr config for more advanced configurations. The experimental hmr config is subject to change. The options supported are:

| name | type | required | default | value | | --------------- | ------------------- | -------- | -------------- | ------------------------------------------------------------------------------------------- | | logLevel | Number or String | false | 4 or "info" | "info" or 4, "log" or 3, "warn" or 2, "error" or 1, 0 for silent | | sourceMap | [Boolean, String] | false | "source-map" | value passed to webpack's devtool configuration (eg inline-cheap-source-map, false) | | clientConfig | Object | false | {} | the One App configuration in the store (store.get('config')) | | port | Number | false | 4000 | the port that holocron-dev-server binds to | | openWhenReady | Boolean | false | false | Set to true to enable opening your default browser when ready |

{
  "one-amex": {
    "hmr": {
      "logLevel": "info",
      "port": 4000,
      "openWhenReady": false,
      "sourceMap": "inline-cheap-source-map",
      "clientConfig": {
        "myClientSideConfig": "https://url"
      }
    }
  }
}

Troubleshooting

There may be instances where fast refresh may stop working for various reasons, check out the troubleshooting guide from @pmmmwh/react-refresh-webpack-plugin react-refresh for debugging tips.

If any issues persist, try removing the static directory generated and run the development server again.