-
Notifications
You must be signed in to change notification settings - Fork 4
CLI
OGX.CLI
is a command line interpreter for OGX.JS. The CLI is the all around toolbox to work with files in OGX.JS without having to create/delete/link anything by hand, for both dev and prod builds.
Since version
1.7.2
, upon installation, uglifyjs-folder@3.0.0 is also installed globally. The compress command relies on this package.
The CLI requires NPM/Node.JS
//init npm package
npm init
//install CLI globally
npm install @globules-io/ogx.cli -g
//install or update OGX.JS for current project/folder
ogx update --force
//OR you can alternatively use the master dev version
ogx update --dev
//init default structure
ogx init
To display help and specific command help
ogx help
ogx help create
To create the default folder structure
ogx init
To check the installed vs latest version of OGX.JS and OGX.CLI
ogx version
To install or update to the latest version of OGX.JS (
--force
is optional)
ogx update --force
To create files and set them up in your OGX.JS project
ogx create view MyView
ogx create template MyTemplate
ogx create stage MyStage
ogx create controller MyController
To rename files and update them up in your OGX.JS project (OML files, JSON files, Views, Stages, Controllers and app.json)
ogx rename view MyView MyNewName
ogx rename template MyTemplate MyNewName
ogx rename stage MyStage MyNewName
ogx rename controller MyController MyNewName
To delete files and unset from in your OGX.JS project
ogx delete view MyView
ogx delete template MyTemplate
ogx delete stage MyStage
ogx delete controller MyController
The open command will lookup a
View
(js and css) and aTemplate
, given a name, and will attempt to open the files in the current instance of VSCODE.
ogx open invoices
The targeted files are
www/js/views/view.Invoices.js
,www/css/views/view.Invoices.css
,www/js/html/template.Invoices.html
andwww/oml/invoices.oml
You can also specify the type of file and lookup and open that specific file, considering the name of
View
ogx open js invoices
In this case, the file
www/js/views/view.Invoices.js
will open
To list all image files present in your
www/img
folder and all the images in each theme, and link them in thepreload
tag ofapp.json
ogx images
To list all sound files present in your
www/snd
folder, and link them in thepreload
tag ofapp.json
ogx sounds
To list all json files present in your
www/json
folder, and link them in thepreload
tag ofapp.json
ogx jsons
To list all folders and all fonts in each folder of the
www/fonts
folder, and all the fonts in each theme, then createwww/css/bin/fonts.css
with the font declarations in it then link it to theindex.html
ogx fonts
Then when
OGX.JS
is going to preload, it will create an invisible element with some text with a css set to a font variation, then later deleted to ensure all fonts are ready. Note that the expected font format is
fontname-variation.ext
such as
roboto-regular.ttf
Note that this command must be run again if the
link
orunlink
commands are used.
Recursively cycles through the template of a view, to prefill its
css
file with found classes and ids. The template must be linked to a view (have the same name).
ogx css MyView
To list all files of a type, and link them in to the head tag of
index.html
. Note that this is done automatically when using thecreate
command.
ogx link views
ogx link templates
ogx link stages
ogx link css
ogx link js
ogx link all
Note that
ogx link css
only links the extra css files located inwww/css/bin
and thatogx link js
only links the extra js files located inwww/js/bin
. The js and css files created with the CLI (controllers, views and stages) are linked withogx link controllers
,ogx link views
andogx link stages
.
To list all files of a type, and unlink them in to the head tag of
index.html
. Note that this is done automatically when using thedelete
command.
ogx unlink views
ogx unlink templates
ogx unlink stages
ogx unlink css
ogx unlink js
ogx unlink all
Note that
ogx unlink css
only unlinks the extra css files located inwww/css/bin
and thatogx unlink js
only unlinks the extra js files located inwww/js/bin
. The js and css files created with the CLI (controllers, views and stages) are unlinked withogx unlink controllers
,ogx unlink views
andogx unlink stages
.
Prepare is the all in one command to unlink then list and link all files.
ogx prepare
You can skip some elements
ogx prepare skip images fonts
You can save this preference, so every time you use ogx prepare, the same elements are skipped
ogx prepare skip images fonts --save
To remove the elements to skip
ogx prepare skip --reset
You can also clear your
preload
node fromapp.json
by doing
ogx prepare clear
Note that
clear
does notreset
any skip preference
Back up and compress files contained in the following folders, then links the compressed files in
index.html
www/css/bin
www/css/views
www/css/stages
www/js/bin
www/js/views
www/js/controllers
www/js/stages
Restore files contained in the following folders, then links the uncompressed files in
index.html
www/css/bin
www/css/views
www/css/stages
www/js/bin
www/js/views
www/js/controllers
www/js/stages
Looks up for unused files and prompts to remove them.
ogx purge [stages|views|controllers|templates|images|all]
To change an option of the CLI, such as the default index page from index.html to index.php, do
ogx set index index.php
To link in index file and use OGX.JS dev/debug version
ogx dev
To link in index file and use OGX.JS production version. Note that production builds stops working if inspected in the console. They are not meant to be used in a development environment.
ogx prod
To encrypt
app.json
ogx encrypt my_secret_key
To decrypt
app.json
ogx decrypt my_secret_key
To build a release build
ogx build release
To build an encrypted release build
ogx build release MYPASSWORD
To build an encrypted release build including js files (views, stages, controllers)
1.16.0+
ogx build release MYPASSWORD --js
To build via external tool
ogx build android debug
Packs multiple files into one. Once packed, all files are still available within the framework as if they were unpacked. Note that, this is automated with
ogx build release
ogx pack templates
ogx pack jsons
ogx pack omls
To pack all supported file types
ogx pack all
Note that if you are hosting on IIS, you should add
.pak
toMIME types
astext/plain
. You should also add.oml
asapplication/json
Starting at version
1.15.2
, files to be packed are automatically back-up into their respective folder into theogx
folder, in case packing or unpacking fails. To remove the backed-up files, you can run
ogx pack clean
Packed files can be restored if the unpacking command fails by running
ogx pack restore
Unpacks a pak file into multiple files. Note that, this is automated with
ogx build restore
ogx unpack templates
ogx unpack jsons
ogx unpack omls
To unpack all supported file types
ogx unpack all
To deploy a build to a device
ogx deploy android debug
To build a non encrypted release build
ogx build release
To build an encrypted release build
ogx build release MYPASSWORD
Alternatively, you can do all these steps, if you'd rather verify the build status after each step.
ogx prod /* tell the CLI to use production build of OGX */
ogx prepare /* prepare index */
ogx pack all /* pack all supported files into a single file */
ogx compress /* compress files and update index */
ogx encrypt [key] /* encrypts app.json */
To restore a non encrypted release build into workable files
ogx build restore
To restore an encrypted release build into workable files
ogx build restore MYPASSWORD
Alternatively, you can do all these steps, if you'd rather verify the build status after each step.
ogx decrypt [key] /* decrypt app.json */
ogx restore /* restore uncompressed files */
ogx unpack all /* unpack all supported files into multiple files */
ogx dev /* tell the CLI to use dev build of OGX */
ogx prepare /* rebuild index file */
Note that if you pack and encrypt, pak files will be encrypted too, starting at version
1.14.0
- Welcome
- Changelog
- Structure
- Configuration
- Getting started
- CLI
- Poly
- Core
- Templating
- Routing
- Controllers
- Components
- Extra Components
- Helpers
- Styling
- Debugging