Skip to content

Commit

Permalink
Update README to give install and usage instructions. (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
cleve-fauna authored and github-actions[bot] committed Dec 19, 2024
1 parent 2ac63a0 commit 5b1cd6a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 6 deletions.
53 changes: 50 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,54 @@ 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.js` put:

```(javascript)
import { config as defaultConfig } from "@fauna/typescript/config/js/eslint.config.js";
export default [
...defaultConfig,
// ...any customizations you'd like
];
```
### Prettier Config
In `prettier.config.js`
```(javascript)
import basePrettierConfig from "@fauna/typescript/config/prettierrc.js";
/**
* @type {import("prettier").Config}
*/
const config = {
...basePrettierConfig,
// ...any customizations you'd like
};
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 ."
}
```
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fauna/typescript",
"version": "0.0.12",
"version": "0.0.13",
"description": "A collection of lint, format, and build configs used at Fauna for TypeScript projects.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 5b1cd6a

Please sign in to comment.