# x4cli

> x4js client command line, server and hmr, cli command line

Latest version **1.6.0** (published 2023-10-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install x4cli
pnpm add x4cli
yarn add x4cli
bun add x4cli
```

Provides the command `x4cli`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.0 |
| Published | 2023-10-25 |
| First published | 2023-10-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 24.9 KB |
| Known vulnerabilities | 0 (+13 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ecochard@r-libre.fr |
| Maintainers | eco747 |
| Keywords | x4js, x4cli |

## Links

- npm: https://www.npmjs.com/package/x4cli
- Repository: https://github.com/rlibre/x4cli
- Homepage: https://github.com/rlibre/x4cli#readme
- Issues: https://github.com/rlibre/x4cli/issues
- npm.io page: https://npm.io/package/x4cli

## Dependencies (9)

- [tar](https://npm.io/package/tar.md) ^6.1.13
- [esbuild](https://npm.io/package/esbuild.md) ^0.17.10
- [chokidar](https://npm.io/package/chokidar.md) ^3.5.3
- [fs-extra](https://npm.io/package/fs-extra.md) ^11.1.1
- [commander](https://npm.io/package/commander.md) ^10.0.0
- [ansi-colors](https://npm.io/package/ansi-colors.md) ^4.1.3
- [faye-websocket](https://npm.io/package/faye-websocket.md) ^0.11.4
- [esbuild-plugin-less](https://npm.io/package/esbuild-plugin-less.md) ^1.1.12
- [@chialab/esbuild-plugin-html](https://npm.io/package/@chialab/esbuild-plugin-html.md) ^0.17.2

## Recent versions

- 1.6.0 (latest) — 2023-10-25

## README

# x4cli
x4 solution builder

installation:

```bash
npm install -g x4cli@latest
```

as an alternative, you can use npx ; use `npx x4cli` instead of `x4cli`.


## CREATE a new project

```bash
	# create an empty electron project
	# this will create a new folder named test with all files to start a new electron project
	x4cli create test --type=html
```

- `--type=<type>` where `<type>` is one of
  - `node`:		node project (client and server)
  - `electron`:	electron project (desktop application)
  - `html`:		html project (standard html project)
  - `server`:   simple server (work in progress)

- `--overwrite`: to overwrite existing project


## BUILD an existing project

```bash
	# build an electron project and monitor the main.js file
	# kill & reload main.js when changing
	x4cli build --serve --watch --hmr
```

- `--release`: 	build the release 
- `--debug`:	build in debug mode (default)
- `--serve`: 	(html) serve files
- `--watch`: 	watch for source modifications (automatic rebuild)
- `--hmr`: 		(electron/html) Hot Module Reloading: reload the browser when build is done 
- `--monitor=`<file>: (node) monitor for file modification kill and reload the node application

	
## package.json

a new entry is recognized: `x4cli`

- `postBuild`: commands to start after compilation; some string parts are replaced:
	- `${srcdir}`: source dir
	- `${outdir}`: destination dir
	- `@copy`: simple copy command line(windows/linux compat)

- `external`:  don't bundle these elements (you must use npm install for them in the dist folder)
- `override`: all options that will be sent to esbuild 

example:

```json
"x4cli": {
	"postBuild": [ "@copy ${srcdir}/src/assets ${outdir}/assets" ],
	"external": [ "better-sqlite3" ],					
	"override": {
		"legalComments": true
	}
}
```

---
_Source: https://npm.io/package/x4cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
