frau-appconfig-webpack-plugin

Webpack plugin for frau-appconfig-builder


Keywords
d2l, frau, free-range
License
Apache-2.0
Install
npm install frau-appconfig-webpack-plugin@0.0.3

Documentation

frau-appconfig-webpack-plugin

Webpack plugin that builds app config using frau-appconfig-builder

NPM version Build status Coverage Status Dependency Status

Installation

Install from npm:

npm install frau-appconfig-webpack-plugin

                or

yarn install frau-appconfig-webpack-plugin

Usage

import FrauAppConfigPlugin from 'frau-appconfig-webpack-plugin';

//Webpack config
const config =  {
  ...,
  plugins: [

      new FrauAppConfigPlugin(options)

  ]

Options

There are two ways to specifiy options:

  1. Pass in an object with the follow properties defined. appId, description, version, appClass and appFile must be defined
{
    appId: 'urn:d2l:fra:id:sample',
    description: 'test-config',
    version: '1.0.0',
    frauAppConfigBuilder: {
        appFile: 'index.html',
        dist: './test',
        envVar: 'TRAVIS',
        loader: 'iframe'
    } ,
    frauLocalAppResolver: {
         appClass: 'urn:d2l:fra:class:sample'
    },
    frauPublisher: {
        files: './dist/**',
        moduleType: 'app',
        targetDirectory: 'sample',
        creds: {
            key: 'key',
            secret: 'S3_SECRET'
        },
        devTagVar: 'TRAVIS_COMMIT', or devTag: 'Custom dev Tag'
        versionVar: 'TRAVIS_TAG' or version: 'SEMVAR VERSION: Ex. 1.0.0'
    }
}
  1. Pass in path to package.json and define the options in the file. Example shown below.
{
  packageFile: 'PATH_TO_PACKAGE_JSON'
}
{
    "name": "sample-package-json",
    "appId": "urn:d2l:fra:id:sample",
    "version": "0.0.1",
    "description": "Sample package json",
    "config": {
        "frauAppConfigBuilder": {
            "appFile": "index.html",
            "dist": "./dist",
            "envVar": "TRAVIS",
            "loader": "iframe"
        },
        "frauLocalAppResolver": {
            "appClass": "urn:d2l:fra:class:sample"
        },
        "frauPublisher": {
            "files": "./dist/**",
            "moduleType": "app",
            "targetDirectory": "sample",
            "creds": {
                "key": "key",
                "secret": "S3_SECRET"
            },
            "devTag": "TRAVIS_COMMIT",
            "version": "TRAVIS_TAG"
        }
    }
}

Contributing

  1. Fork the repository. Committing directly against this repository is highly discouraged.

    1. Make your modifications in a branch, updating and writing new unit tests as necessary in the spec directory.

      1. Ensure that all tests pass with yarn test

      2. Submit a pull request to this repository. Wait for tests to run and someone to chime in.

Code Style

This repository is configured with EditorConfig rules.