@aofl/aofljs-cli

is a command line tool for running aofljs/0.6.0 local server and automate the build process of aofljs apps.

Usage no npm install needed!

<script type="module">
  import aoflAofljsCli from 'https://cdn.skypack.dev/@aofl/aofljs-cli';
</script>

README

@aofl/aofljs-cli

aofljs-cli is a command line tool for running aofljs/0.6.0 local server and automate the build process of aofljs apps.

Installation

  1. Make sure you have the latest stable versions of git, node and npm installed
  2. Install as global package:
$ npm install -g @aofl/aofljs-cli

Usage

$ aofljs-cli [options]
$ aofljs-cli [command] [options]

Options:

-h, --help     output usage information
-V, --version  output the version number
Examples:
$ aofljs-cli --help
$ aofljs-cli --version

Commands:

build       runs r.js in a directory containing __build.js file.
server      start http server
help [cmd]  display help for [cmd]
Examples:
$ aofljs-cli build -r
$ aofljs-cli server -dl
$ aofljs-cli help build

help

Usage:
aofljs-cli help [options]
Options:
build     output usage information for the build command. Equivalent to aofljs-cli build -h.
server    output usage information for the server command. Equivalent to aofljs-cli server -h.

server

aofljs-cli comes with a web server based on express. It supports development mode and live reload functionality.

Install livereload extensions in your browser to use this functionality.

Usage:
aofljs-cli server [options]
Options:
-d, --dev              dev mode, *.js instead of *.min.js
-H, --host [host]      set hostname
--cors                 allow CORS
--https                enable https
--force-https          force redirect to https
-l, --livereload       livereload
-m, --market [market]  specify market
-p, --port [port]      set port. defaults to 3000
-c, --config <path>    path to config file. Apps configuration will be used to add redirect rules when dev mode is enabeled. Server will redirect requsts, to build director, to source directory.
-h, --help             output usage information
Examples:
$ aofljs-cli server
$ aofljs-cli server -dl -H example.localhost.com -p 3000
$ aofljs-cli server --https

build-app

aofljs-cli build-app will rebuild desired directories into the output directory. The following files/directories will be filtered out:

  • .git
  • .spec.js
  • node_modules
  • bower_components
  • karma.conf.js
  • main.karma.js
  • .md

If market is specified next files/directories will overwrite original(without market prefix) files:

  • index-{market}.html
  • __build-{market}.js
  • js/main-{market}.js
  • js/config/local-api-config-{market}.json
  • js/config/stage-api-config-{market}.json
  • js/config/state-routes-{market}.js

Names may be provided as additional arguments with a config file to filter desired apps within the config file.

Usage:
aofljs-cli build-app [options]
Options:
-h, --help  output usage information
-c, --config <path> path to config file
-o, --output <path> path to output directory
-m, --market [market] specify market
-e, --regexp [pattern]  Use pattern to include or exclude files
Examples:
$ aofljs-cli build-app
$ aofljs-cli build-app myDir -o path/to/output/dir 
$ aofljs-cli build-app -c path/to/config.json
$ aofljs-cli build-app -c path/to/config.json name_one name_two
$ aofljs-cli build-app myDir -o path/to/output/dir -m jp
$ aofljs-cli build-app myDir -o path/to/output/dir -m jp -e '!**/home_page/**' -e '!**/otherpattern*/**' -e '**/node_modules/**'

default regexp list

[
  '**/*',
  '!**/.git/**',
  '!**/.git*',
  '!**/*.spec.js',
  '!**/node_modules/**',
  '!**/bower_components/**',
  '!**/karma.conf.js',
  '!**/main.karma.js',
  '!**/*.md'
]

Config format:

{
  "apps": [
    {
      "name": "app_name",
      "src": "dir_to_copy",
      "output": "output_dir",
      "market": "jp"
    }, 
    {...}
  ]
}

build

aofljs-cli build command runs requirejs optimizer on __build.js file. The recursive option can be used to traverse the subdirectories of the working directory to optimize all __build.js scripts.

Usage:
aofljs-cli build [options]
Options:
-r                     recursive build. 
-m, --market [market]  specify market
-h, --help             output usage information
Examples:
$ aofljs-cli build
$ aofljs-cli build -r
$ aofljs-cli build -r path/to/dir1
$ aofljs-cli build -r path/to/dir1 path/to/dir2 ptah/to/dir3
note:*

main.js builds fail in some cases with Error: /abs/path/to/main.js does not exist. To fix this issue update mainConfigFile path.

mainConfigFile: './main.js',

to

mainConfigFile: '../../app-directory/js/main.js',

translate

aofljs-cli pot translates marked text within html elements that have a translate attribute.

Usage:
aofljs-cli pot
Examples:
$ aofljs-cli pot dir/to/translate

License

The MIT License (MIT) Copyright (c) 2017 Age of Learning

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.