Giter Club home page Giter Club logo

ace's Introduction

ace

Build Status

Ace is an attempt at providing convention over configuration to codice and connexta UI projects. The frontend ecosystem has many options when it comes to UI tooling. The main issue most face is choosing the right tools and configuring them properly to work with their technology stack. Ace tries to gather and configure the necessary tools to be productive when developing frontend UI for DDF based applications.

For the most part, ace acts as a wrapper to widely used frontend tooling.

Those technologies include:

Help

To get a full listing of the capabilities of ace, do:

ace --help

Bundling

All javascript bundling is done by webpack. The root of your application should be specified by the package.json "main" key. The bundle environment can be specified through NODE_ENV environment variable, the --env command line flag or it will default to the development environment.

  • production: For building a bundle which has more aggressive optimizations and minification.

    • Outputs to ./target/webapp
  • development: For use during development.

    • Outputs to ./target/webapp
  • test: For bundling all *.spec.js files into a test bundle. The test bundle can be evaluated in any browser environment.

    • Writes ./target/test/index.html
    • Writes ./target/test/test.js

Dev Server

To provide incremental building of javascript bundle, ace uses the webpack dev server.

To start a dev server, do:

ace start

To start a test server, do:

ace start --env=test

For help on more options, do:

ace start --help 

Testing

Once you've bundled your tests, you can run them in a variety of environments. You can load them in any browser, or run them in a headless browser for continuous integration.

Mocha API

Mocha's API consists of two global functions describe and it.

Example:

describe('a group of tests', () => {
  it('should pass', () => {
  })
  it('should pass callback' (done) => {
    setTimeout(done, 1000)
  })
  it('should pass promise', () => {
    return Promise.resolve(new Error('fail'))
  })
  it('should fail', () => {
    throw new Error('fail')
  })
  it('should fail callback', (done) => {
    done(new Error('fail'))
  })
  it('should fail promise', (done) => {
    return Promise.reject(new Error('fail'))
  })
})

NOTE: Ace uses the default timeout of 2 seconds for tests.

Testing in CI

To run your bundled tests in a headless chrome environment, do

ace test target/webapp/index.html

This will also write a coverage report to target/coverage.json.

Code Coverage

To enforce coverage constraints, you can use a tool like istanbul. Ace currently don't include this but might be added in the future.

First, create a .istanbul.yml with the following content:

reporting:
    dir: ./target/coverage
check:
    global:
        statements: 50
        branches: 50
        lines: 50
        functions: 50
        excludes: []

To check coverage, do:

istanbul check-coverage

To generate a report to visualize coverage, do:

istanbul report

which will write an html file to ./target/coverage/index.html.

Code Formatting

To check if your code conforms to ace's prettier config, do:

ace format

To update your code in place, do:

ace format -w

If using Visual Studio Code, consider installing the prettier extension so you can run the formatter in your editor and add a .prettierrc.js with the following content to the root of your project:

module.exports = require("@connexta/ace/prettierrc")

ace's People

Contributors

andrewkfiedler avatar djblue avatar rymach avatar mojogitoverhere avatar parret avatar ryeats avatar stustison avatar shaundmorris avatar brendan-hofmann avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.