Socket
Book a DemoInstallSign in
Socket

@otr-app/web-builder

Package Overview
Dependencies
Maintainers
5
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@otr-app/web-builder

A shared build/task runner across front-end applications

latest
Source
npmnpm
Version
3.3.1
Version published
Maintainers
5
Created
Source

OTR Web Builder

A shared gulpfile to reduce build task duplication which will increase standardization, offer lower maintenance on updates across our applications

Usage

Install the web builder with npm

npm i --save-dev @otr-app/web-builder

Import it in gulpfile.js

let webBuilder = require('@otr-app/web-builder');

Configuration

Below is the default configuration that can be overwritten with the setOptions method.

let options = {
    tsConfig: null,
    port: 5555,
    rootDir: './',
    baseDir: 'app',
    buildDir: 'build/',
    buildCssDir: 'build/assets/css',
    bundleOpts: {
        basedir: "app",
        debug: (argv.domain || 'devo') !== 'prod',
        entries: ['index.ts'],
        cache: {},
        packageCache: {}
    }
}

Customize

Here's an example of overriding the options above.

webBuilder.setOptions({
    tsConfig: require('./tsconfig.json'), // override with local ts config
    port: 8889,
    baseDir: 'webapp',
    bundleOpts: {
        basedir: 'webapp',
        entries: ['index.ts'],
        debug: true 
    }
});

Example of using tasks from @otr-app/web-builder in side a consumer. List of all re-usable gulp tasks located here

// otr_admin_web_app - gulpfile.js
exports.clean = webBuilder.clean;
exports.build = gulp.series(
    copySrc,
    webBuilder.copyNodeModules,
    webBuilder.bundle,
    gulp.parallel(
        webBuilder.minifySass,
        minifyJs,
        replaceVars)
);

Tasks

  • bundle
    • compiles typescripts and bundles all dependencies and source code into one file
  • minifySass
  • copyNodeModules
    • copies package.json into build/ and installs all the production dependencies into build/
  • clean
    • deletes build/
  • connectServer
    • launches a local server at port defined in setOptions
  • More to be added

Testing

To test tasks locally

gulp -f index.js <task_name>

FAQs

Package last updated on 07 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.