0.1.5 • Published 10 months ago

@cran/bin.squash v0.1.5

Weekly downloads
-
License
SEE LICENSE IN li...
Repository
-
Last release
10 months ago

Squash

Usage

npm install --global @cran/bin.squash
squash --help

Recommended Scripts

{
  "scripts": {
    "clean": "squash clean",
    "build": "squash build",
    "debug": "squash build --debug"
  }
}

Variables

Buildtime

All variables found on process.env at the time of initiating a build or debug process will be embeded at build time in your app

In addition, some variables are provided by Squash

process.env.SQUASH_BUILT_AT=Date.now();
process.env.SQUASH_ENTRYPOINT="pwa"|"cap";

Runtime

All runtime variables will be found in config.js which is automatically loaded, syncronously, to the project index (this implies it will always be executed before the page renders)

You may access these values at any time via the window object __config. It is recommended you add this variable to your linter to prevent issue.

Configuration

Existence

Some features are toggles automatically based on the existence of configuration files (they are searched for an used in order of their appearance in the list below)

  • will enable typescript support
    • tsconfig.squash.json
    • tsconfig.json
  • will enable capacitor support
    • capacitor.config.json
    • capacitor.config.js
    • capacitor.config.ts
  • will be used if icon not provided elsewhere
    • icon.png
    • icon.jpg
    • icon.jpeg

Package Configuration

PathDefaultUsage
.name""Fallback for title and description
.titlename<title> and <meta name="application-name" />
.description.name<meta name="description" />
.lang"en-US"<html lang>
.scripts.squash:configecho {}Will be merged with .squash.config (Must be valid json)
.scripts.squash:manifest|echo {}|Will be merged with.squash.manifest` (Must be valid json)
.squash.icon""Icon for PWA Manifest
.squash.config{}Will be put in __config variable
`.squash.manifest|{}|Object with Manifest shape
`.squash.stylus|{}|Stylus configuration overrides

Environment

Note: Environment variables will overwrite package configurations

# development | production
SQUASH_ENV=$NODE_ENV
# boolean
SQUASH_DEBUG=false
# directory location
SQUASH_SRC=src
# directory location
SQUASH_OUT=out
# file location
SQUASH_ICON=

Arguments

Note: All command line arguments overwrite environment variables

--version  Show version number                                       [boolean]
--help     Show help                                                 [boolean]
--cap      Should compile capacitor                  [boolean] [default: null]
--pwa      Should compile pwa                        [boolean] [default: true]
--env      Environment (SQUASH_ENV | NODE_ENV)
               [choices: "development", "production"] [default: "development"]
--debug    Launch dev-server and watch for changes
                                           [boolean, "write"] [default: false]