UNPKG

7.3 kBMarkdownView Raw
1# fusion-cli
2
3[![Build status](https://badge.buildkite.com/4c8b6bc04b61175d66d26b54b1d88d52e24fecb1b537c54551.svg?branch=master)](https://buildkite.com/uberopensource/fusionjs)
4
5The CLI interface for Fusion.js
6
7The `fusion-cli` package is responsible for orchestrating compile-time configuration for server and browser bundles, as well as development, test and production variations. It provides a standardized Babel configuration that includes async/await support as well as stage 3+ Ecmascript features.
8
9Due to the complexity involved in configuring many permutations of configurations, Fusion.js does not support custom `webpack.config`. This design decision allows Fusion.js to eventually move away from Webpack if faster and better bundlers become available. Additionally, it allows Fusion.js to make changes to the internal webpack configuration without the concern of breaking users customizations. If you run into a situation where you feel you need to make a webpack customization, please reach out to us on [slack](https://join.slack.com/t/fusionjs/shared_invite/enQtMzk3NjM0MTg0MTI4LWJhNzVjYjk5ZDVlYWIxZWViMjA3YzE5OTc4YWZkNzBkZmNkYmJkMDYyOGEzODEwMzRmMWExMzc1NDIzMmY2NDQ) or create an issue describing your use case.
10
11The CLI is also responsible for hot module reloading in development mode, and for running the web server.
12
13### Installation
14
15```sh
16yarn add fusion-cli
17```
18
19---
20
21### CLI API
22
23The CLI API can be most easily run through the Yarn or NPX CLI, e.g. `yarn fusion build` or `npx fusion build`.
24
25- `fusion build [dir] [--production] [--log-level]`
26 Builds your application assets
27
28 This command generates transpiled javascript/source map files (aka assets, artifacts) for browser and server. By default it builds development assets, but can also build test and production assets, given the respective flags.
29
30 Build artifacts are stored in the `.fusion` directory.
31
32 - `--production`: Build production assets
33 - `--log-level`: Log level to output to console `[default: "info"]`
34
35- `fusion dev [dir] [--port] [--no-hmr] [--test] [--log-level] [--forceLegacyBuild]`
36 Builds development assets and runs the application in development mode
37
38 Note that this command only builds browser artifacts in memory, and it doesn't save them to the filesystem. This allows hot module reloading to occur faster since there's no performance cost due to I/O access.
39
40 - `--port`: The port on which the application runs `[default: 3000]`
41 - `--no-hmr`: Run without hot modules replacement
42 - `--test`: Run tests as well as application
43 - `--log-level`: Log level to output to console `[default: "info"]`
44 - `--forceLegacyBuild`: Force enable legacy build. By default not compiled in dev.
45 - `--perserve-names`: Disable name mangling during script minification
46
47<!--
48* `fusion profile [--environment] [--watch] [--file-count]`: Profile your application
49 * `--environment`: Either `production` or `development` `[default: "production"]`
50 * `--watch`: After profiling, launch source-map-explorer with file watch
51 * `--file-count`: The number of file sizes to output, sorted largest to smallest (-1 for all files) `[default: 20]`
52-->
53
54- `fusion start [--environment]`
55 Runs your application, assuming you have previously built them via `fusion build`. Note that build artifacts must be saved to disk (i.e. this command will fail if you use `fusion dev` to build artifacts instead of `fusion build`.
56
57 - `--environment`: Which environment/assets to run - defaults to first available assets among `["development", "production"]`
58
59- `fusion test [options]`
60 Builds test assets and runs tests
61
62 Tests are run with Jest
63
64 - `--dir`: Root path for the application relative to CLI CWD. (default .)
65 - `--debug`: Debug tests using --inspect-brk and --runInBand. (default false)
66 - `--match`: Runs test files that match a given string
67 - `--env`: Comma-separated list of environments to run tests in. Defaults to running both node and browser tests. (default jsdom,node)
68 - `--testFolder`: Which folder to look for tests in. Deprecated, use testMatch or testRegex instead.
69 - `--testMatch`: Which folder to look for tests in. A comma-separated list of glob patterns.
70 - `--testRegex`: Which folder to look for tests in. A comma-separated list of regexp strings.
71 - `--configPath`: Path to the jest configuration, used for testing. (default [path-to-fusion-cli]/build/jest/jest-config.js)
72 - `--updateSnapshot`, `-u`: Updates snapshots
73
74 Jest pass-through options
75
76 - `--collectCoverageFrom`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#collectcoveragefrom
77 - `--changedFilesWithAncestor`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#changedfileswithancestor
78 - `--changedSince`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#changedsince
79 - `--ci`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#ci
80 - `--clearCache`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#clearcache
81 - `--colors`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#colors
82 - `--coverage`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#coverage
83 - `--detectOpenHandles`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#detectopenhandles
84 - `--errorOnDeprecated`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#errorondeprecated
85 - `--expand`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#expand
86 - `--findRelatedTests`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#findrelatedtests
87 - `--json`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#json
88 - `--lastCommit`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#lastcommit
89 - `--listTests`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#listtests
90 - `--logHeapUsage`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#logheapusage
91 - `--noStackTrace`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#nostacktrace
92 - `--notify`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#notify
93 - `--onlyChanged`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#onlychanged
94 - `--passWithNoTests`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#passwithnotests
95 - `--reporters`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#reporters
96 - `--showConfig`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#showconfig
97 - `--silent`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#silent
98 - `--testLocationInResults`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#testlocationinresults
99 - `--useStderr`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#usestderr
100 - `--version`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#version
101 - `--watch`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#watch
102 - `--watchAll`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#watchall
103 - `--watchman`: Jest CLI argument. See: https://jestjs.io/docs/en/cli.html#watchman
104
105- `fusion profile`
106 Generates a graph diagram of dependencies
107
108### Webpack stats.json file
109
110Building an app generates a `.fusion/stats.json` file, which can be used with [`webpack-bundle-analyzer`](https://www.npmjs.com/package/webpack-bundle-analyzer)
111