Skip to content

Commit

Permalink
Update README to give install and usage instructions.
Browse files Browse the repository at this point in the history
## Problem
This package is now on npm but we have instructions as if it is still private and can only be used locally.
## Solution
Give install and usage instructions.
## Testing
I'm following the guide here to use this on an internal npm package.

Please suggest any alternatives or additoins.
  • Loading branch information
cleve-fauna authored Dec 19, 2024
1 parent 2ac63a0 commit d7cb2c4
Showing 1 changed file with 49 additions and 3 deletions.
52 changes: 49 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,53 @@ A collection of lint, format, and build configs used at Fauna for TypeScript pro
- `eslint-formatter.js`, a custom eslint output formatter intended for estimating the cost of adding new rules to an eslint config. From a consumer of `@fauna/typescript`, run it like `npx eslint --format ./node_modules/@fauna/typescript/scripts/eslint-formatter.js .`.
- `version-bump.js`, a script intended for use in CI environments to automatically version bump a npm package. Useful for packages that should be versioned and deployed on every merge to `main`.

## Workflows
## Usage

### Development
Develop on this package by running `npm install && npm link`. Then, navigate to a package that depends on this project and run `npm link @fauna/typescript`. [npm link](https://docs.npmjs.com/cli/v10/commands/npm-link) builds a symlink from the node_modules directory of the dependent package to `@fauna/typescript`, allowing you to develop locally in real time. When done, run `npm unlink @fauna/typescript` from any directory.
### Install
#### I use npm
```
npm install --save-dev @fauna/typescript
```

#### I use yarn
```
yarn add -D @fauna/typescript
```

## Configure
### ES Lint Config
In `eslint.config.mjs` put:

```(javascript)
import { config as defaultConfig } from "@fauna/typescript/config/js/eslint.config.js";
export default [
...defaultConfig,
// ... any customizations you'd like
];
```
### Prettier Config

```(javascript)
import basePrettierConfig from "@fauna/typescript/config/prettierrc.js";
/**
* @type {import("prettier").Config}
*/
const config = {
...basePrettierConfig,
};
export default config;
```

## Script
You can then write scripts in your `package.json` such as:

```(json)
"scripts": {
"lint": "eslint . --fix",
"format": "prettier -w --log-level silent .",
"format:check": "prettier -c ."
}
```

0 comments on commit d7cb2c4

Please sign in to comment.