3.1.1-beta.7 • Published 3 years ago

rah v3.1.1-beta.7

Weekly downloads
196
License
MIT
Repository
gitlab
Last release
3 years ago

rah

rah is the react application harness. It is a combination of project management tools, build system, and development server features derived from react-boilerplate. Internally at Racepoint, we use this to build static single page applications and unify deployment processes. The goal is simple -- making changes to any application built against react-boilerplate requires making manual changes to every project that uses it. That's slow, inefficient, tedious, and no fun at all.

To fix that, we've inverted the server and build components of react-boilerplate. Instead of forming the basis of your project's folder structure that functionality is now just another module dependency that can be installed like so:

Installation

npm install rah -D

Usage through NPM scripts

To use it, you will need to add the following to your package.json

  ...
  "scripts": {
    "start": "cross-env NODE_ENV=development node ./node_modules/rah/server",
    "build:dll": "node ./node_modules/rah/internals/scripts/dependencies.js"
    ...
  },
  ...

To make use of the CLI to generate containers and components, you will need to add the following to your package.json. For example, from the root directory of an application run npm run generate [option] Options are container, component, and language.

  ...
  "scripts": {
    "generate": "plop --plopfile node_modules/rah/internals/generators/index.js",
    ...
  },
  ...

RAH includes a script to validate manifest.json files. It accepts a single argument --index. The index document should contain a link element with a href pointing to your manifest.json file. Because RAH looks to your index file to get the name of your manifest, you can make use of the PWA plugin's fingerprinting feature.

package.json
"scripts": {
  "postbuild": "node ./node_modules/rah/internals/scripts/validate-wam.js --index build/index.html",
},
build/index.html
<html lang="en">
  <link
    href="/manifest.json"
  />
</head>

Other functionality is in progress!

Usage of the rah config

RAH will look to the root directory of your app for a file named rah-config.js. This file will be merged with the RAH defaults.

RAH uses the webpack-pwa-manifest plugin to generate a manifest.json file for your app. To configure your app's manifest, you can export an object of manifest settings in rah-config.js. RAH presets are:

const path = require('path');

module.exports = {
  manifest: {
    name: 'React Application Harness',
    short_name: 'RAH',
    description:
      'Maintainable and installable react application development infrastructure.',
    background_color: '#fafafa',
    theme_color: '#000000',
    icons: [
      {
        src: path.resolve('node_modules/rah/assets/icon-512x512.png'),
        sizes: [72, 96, 120, 128, 144, 152, 167, 180, 192, 384, 512],
      },
    ],
  },
  indexPath: 'app/index.html'
};

Read more about the webpack-pwa-manifest and its presets. Read more about manifest spec on the Mozilla Developer Network.

Known issues

Install time

These issues are not strictly harmless, in the sense that they represent a large amount of ongoing meaintenance work for our codebase, but they do not impact runtime code as of right this second.

npm WARN deprecated react-router-redux@5.0.0-alpha.9: This project is no longer maintained.
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated react-dom@16.4.1: This version of react-dom/server contains a minor vulnerability. Please update react-dom to 16.4.2+. Learn more: https://fb.me/cve-2018-6341
npm WARN deprecated babel@6.23.0: In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN rollback Rolling back readable-stream@2.3.6 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\nelso\src\rpe\serverless\test-app\node_modules\fsevents\node_modules'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN jest-styled-components@5.0.1 requires a peer of styled-components@^2.0.0 || ^3.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN test-app@0.0.1 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

DLL compilation

These are related to the filesize issues that have their own section below.

[BABEL] Note: The code generator has deoptimised the styling of "... /node_modules/lodash/lodash.js" as it exceeds the max of "500KB".
[BABEL] Note: The code generator has deoptimised the styling of "... /node_modules/brace/index.js" as it exceeds the max of "500KB".

Filesize

Currently, rahDeps.dll.js comes in around 2.14 MiB for a small project. That's massive by any stretch. We are actively working to get that down to a more reasonable size. The bundle is cached in several tiers, so it isn't usually an issue after first page load. Since our primary target user is a person we have an ongoing relationship with, we can generally assume that they will not regularly see the impact of this bundle size, but that's no reason to be this wasteful.

Application bundles will vary, but we've seen sizes as large as 12 MiB for moderate size projects with a default react-boilerplate installation. There is a lot of work to do on this front.

@babel/cli@babel/core@babel/plugin-proposal-class-properties@babel/plugin-proposal-export-default-from@babel/plugin-proposal-export-namespace-from@babel/plugin-proposal-function-bind@babel/plugin-proposal-logical-assignment-operators@babel/plugin-proposal-object-rest-spread@babel/plugin-proposal-optional-chaining@babel/plugin-proposal-throw-expressions@babel/plugin-syntax-dynamic-import@babel/plugin-transform-modules-commonjs@babel/plugin-transform-react-constant-elements@babel/plugin-transform-react-inline-elements@babel/plugin-transform-react-jsx-source@babel/preset-env@babel/preset-react@babel/register@babel/traverseadd-asset-html-webpack-pluginbabel-corebabel-eslintbabel-loaderbabel-plugin-dynamic-import-nodebabel-plugin-inline-react-svgbabel-plugin-module-resolverbabel-plugin-react-intlbabel-plugin-styled-componentsbabel-plugin-transform-react-remove-prop-typesbracechalkcircular-dependency-plugincompressionconnected-react-routercore-jscoverallscross-envcss-loaderenzymeenzyme-adapter-react-16enzyme-to-jsoneslinteslint-config-airbnbeslint-config-airbnb-baseeslint-config-prettiereslint-import-resolver-webpackeslint-plugin-importeslint-plugin-jsx-a11yeslint-plugin-prettiereslint-plugin-reacteslint-plugin-react-hookseslint-plugin-redux-sagaeventsource-polyfillexports-loaderexpressfile-loaderfontfaceobserverhistoryhoist-non-react-staticshtml-loaderhtml-webpack-pluginhtmlparser2image-webpack-loaderimmutableimports-loaderintlinvariantipjest-clijest-styled-componentslint-stagedlodashminimistngroknode-plopnpm-clinull-loaderplopprettierreactreact-domreact-reduxreact-routerreact-test-rendererreduxredux-sagaregenerator-runtimerimrafshelljsstyle-loaderstyled-componentsstylelintstylelint-config-recommendedstylelint-config-styled-componentsstylelint-processor-styled-componentssvg-url-loaderurl-loaderwamwebpackwebpack-cliwebpack-dev-middlewarewebpack-hot-middlewarewebpack-pwa-manifest
3.1.1-beta.7

3 years ago

3.1.1-beta.6

3 years ago

3.1.1-beta.5

3 years ago

3.1.1-beta.4

3 years ago

3.1.1-beta.3

3 years ago

3.1.1-beta.2

3 years ago

3.1.1-beta.1

3 years ago

3.1.1-beta.0

3 years ago

3.1.0

3 years ago

3.0.5

3 years ago

3.0.4

4 years ago

3.0.4-beta.2

4 years ago

3.0.4-beta.1

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.1-beta.5

4 years ago

3.0.1-beta.3

4 years ago

3.0.1-beta.4

4 years ago

3.0.1-beta.2

4 years ago

3.0.1-beta.1

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.0

9 years ago