0.18.2 • Published 5 days ago

@tinijs/cli v0.18.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 days ago

@tinijs/cli

The CLI for the TiniJS framework.

Install

  • Create a TiniJS app:

npx @tinijs/cli new my-app --latest

  • Or, install it globally:

npm i -g @tinijs/cli

For more, please visit: https://tinijs.dev

Development

  • Create a home for TiniJS: mkdir TiniJS && cd TiniJS
  • Fork the repo
  • Install dependencies: cd cli && npm i
  • Make changes & build locally: npm run build
  • Preview a command: tini <command> [options]
  • Push changes & create a PR 👌

The structure

This project uses a design pattern called seminjecto (it's a term which I invented some years ago).

The source of the package resides in the src folder:

  • public-api.ts: the public interface of the package
  • bin.ts: the entry of the CLI
  • lib/index.ts: the container for all shared features
  • lib/services/...: all the reusable services
  • cli/index.ts: the container of the CLI app
  • cli/commands/...: all the commands of the CLI app

The test specs are in the test folder:

  • No unit test has been written yet (please help if you can, thank you!)

Add new command

  • Install the @lamnhan/seminjecto CLI tool: npm i -g @lamnhan/seminjecto (the tool is quite outdated but it is still working :), I will update it when I have more time).
  • Run: semidi g command commands/<name>

A file will be create in src/cli/commands/<name>.command.ts.

Beside, the command definition code will be injected into src/cli/index.ts.

The CLI for the TiniJS framework.

Build the app.

Usage:

tini build --target [value]

Options:

  • -t, --target [value]: Target: production (default), qa1, any, ...

Clean Typescript output files.

Usage:

tini clean --includes [value] --excludes [value]
tini c --includes [value] --excludes [value]

Options:

  • -i, --includes [value]: Including files, separated by |.
  • -e, --excludes [value]: Excluding files, separated by |.

Start the dev server.

Usage:

tini dev --watch
tini serve --watch

Options:

  • -w, --watch: Watch mode only.

Open documentation.

Usage:

tini docs
tini home

Generate a resource.

Usage:

tini generate <type> <dest> --type-prefixed --nested
tini create <type> <dest> --type-prefixed --nested
tini g <type> <dest> --type-prefixed --nested

Parameters:

  • <type>: The resource type
  • <dest>: The resource destination

Options:

  • -t, --type-prefixed: Use the format name.type.ext.
  • -n, --nested: Nested under a folder.

Create a new project.

Usage:

tini new <projectName> --latest --tag [value] --skip-install --skip-ui --skip-git
tini start <projectName> --latest --tag [value] --skip-install --skip-ui --skip-git

Parameters:

  • <projectName>: The project name.

Options:

  • -l, --latest: Install the latest @tinijs/skeleton.
  • -t, --tag [value]: Use the custom version of the @tinijs/skeleton.
  • -i, --skip-install: Do not install dependency packages.
  • -u, --skip-ui: Do not run tini ui use.
  • -g, --skip-git: Do not initialize a git repository.

Preview the app.

Usage:

tini preview --port [value] --host [value] --i18n

Options:

  • -p, --port [value]: Custom port.
  • -h, --host [value]: Custom host.
  • -i, --i18n: Enable superstatic i18n.

Working with PWA apps.

Usage:

tini pwa <subCommand> --tag [value]

Parameters:

  • <subCommand>: The <subCommand> parameter.

Options:

  • -t, --tag [value]: Use the custom version of @tinijs/pwa.

Unit test the app.

Usage:

tini test

Tools for developing and using Tini.

Usage:

tini ui <subCommand> [params...] --build-only --skip-help

Parameters:

  • <subCommand>: The <subCommand> parameter.
  • [params...]: The [params...] parameter.

Options:

  • -b, --build-only: Build mode only of the use command.
  • -i, --skip-help: Skip instruction of the use command.

Display help.

Usage:

tini help

Any other command is not suppoted.

Usage:

tini <cmd>

License

@tinijs/cli is released under the MIT license.