From 08b9d41aab75bf762b29aad6e304d805db735030 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Thu, 27 Feb 2020 12:50:41 -0800 Subject: [PATCH] Add basic instructions to setup a Rome project --- .github/CONTRIBUTING.md | 2 ++ README.md | 16 ++++++++++++ docs/getting-started.md | 55 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 docs/getting-started.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f358d06d5f6..3836f228625 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -16,6 +16,8 @@ $ scripts/dev-rome --help No dependency installation step is required as we check in our `node_modules` folder that contains only a copy of TypeScript and some definitions. +Refer to [Getting Started](../docs/getting-started.md) for more usage documentation. + ## Testing You can run the test suite with the following command: diff --git a/README.md b/README.md index 6efb5653efb..f8a50425773 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,20 @@ See [CONTRIBUTING](.github/CONTRIBUTING.md) for more information. The current area of focus is **linting**. See the umbrella task [#20](https://github.com/facebookexperimental/rome/issues/20) for tracking. +## Getting Started + +To setup Rome in a project, all you need is a `rome.json` file. + +```bash +$ mkdir hello-world +$ cd hello-world +$ echo '{}' >rome.json +``` + +This file is used to configure Rome and indicates the boundaries of your project. + +See [Getting Started](docs/getting-started.md) for more usage instructions. + ## Philosophy This list includes general ethos the project should abide by. This list is not comprehensive. Some of these are obvious but are stated for completeness. @@ -62,4 +76,6 @@ This list includes general ethos the project should abide by. This list is not c ## Community +Contribution and development instructions can be found in [CONTRIBUTING](.github/CONTRIBUTING.md). + Additional project coordination and realtime discussion happens on our [Discord server](https://discord.gg/9WxHa5d). Remember that all activity on the Discord is still moderated and will be strictly enforced under the project's [Code of Conduct](.github/CODE_OF_CONDUCT.md). diff --git a/docs/getting-started.md b/docs/getting-started.md new file mode 100644 index 00000000000..1308a79e8f9 --- /dev/null +++ b/docs/getting-started.md @@ -0,0 +1,55 @@ +# Getting Started + +Rome requires a project configuration in order to operate. This can take three possible forms. + +- A `rome.json` file +- A `rome.rjson` file (What is RJSON? See [#13](https://github.com/facebookexperimental/rome/issues/13)) +- A `rome` field on `package.json` + +This can just be an empty file. It's required in order for Rome to determine all the files in a project. This is important as when running the CLI, we build an in-memory file system listing in order to perform operations like module resolution. + +```bash +$ mkdir hello-world +$ cd hello-world +$ echo '{}' >rome.json +``` + +## Commands + +Rome has a dozen different commands. Documented below are some more useful ones when testing functionality. + +### `lint` + +This command will lint a file with a set of default lints and display the produced diagnostics. + +When ran with no arguments, all JavaScript files in a project are linted. + +``` +$ rome lint file.js +``` + +### `compile` + +This command will compile a file with a set of default transforms. There is currently no options for this command to specify a subset of transforms. + +``` +$ rome compile file.js +``` + +### `parse` + +This command will parse a file and output a pretty formatted AST. + +``` +$ rome parse file.js +``` + +## Daemon + +Rome has an optional daemon. When starting the CLI, we'll check if there's a server running, and if there is, we'll connect to and that's where the request will be processed. + +You can run the daemon with `rome start`, and stop it with `rome stop`. + +The daemon allows Rome to maintain long lived memory caches which can drastically speed up operations. We intend to utilize this server for any LSP integration. + +When the CLI is ran without a running server, then we initialize a server inside the CLI process that's only used for the lifetime of the command.