Skip to content

Commit 7ef703d

Browse files
committed
Update README
1 parent 6ac41d1 commit 7ef703d

File tree

1 file changed

+42
-13
lines changed

1 file changed

+42
-13
lines changed

packages/cli/README.md

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,31 @@ npm i -g @arethetypeswrong/cli
1818

1919
The `attw` command acts very similarly to [arethetypeswrong.github.io](https://arethetypeswrong.github.io/), with some additional features that are useful for command line usage.
2020

21-
The usage is:
21+
The CLI can check an `npm pack`ed tarball:
2222

2323
```shell
2424
npm pack
25-
attw [options] <file-name>
25+
attw cool-package-1.0.0.tgz
26+
# or
27+
attw $(npm pack)
2628
```
2729

28-
Where `<file-name>` is a required positional argument (the path to a local `.tar.gz` file from `npm pack`).
30+
or pack one in-place by specifying `--pack` and a directory:
31+
32+
```shell
33+
attw --pack .
34+
```
35+
36+
or check a package from npm:
37+
38+
```shell
39+
attw --from-npm @arethetypeswrong/cli
40+
```
2941

3042
## Configuration
3143

3244
`attw` supports a JSON config file (by default named `.attw.json`) which allows you to pre-set the command line arguments. The options are a one-to-one mapping of the command line flags, changed to camelCase, and are all documented in their relevant `Options` section below.
3345

34-
Note that the `--config-path` option cannot be set from the config file :upside_down_face:
35-
3646
### Options
3747

3848
#### Help
@@ -55,11 +65,32 @@ In the CLI: `--version`, `-v`
5565
attw --version
5666
```
5767

68+
### Pack
69+
70+
Specify a directory to run `npm pack` in (instead of specifying a tarball filename), analyze the resulting tarball, and delete it afterwards.
71+
72+
```shell
73+
attw --pack .
74+
```
75+
76+
#### From NPM
77+
78+
Specify the name (and, optionally, version range) of a package from the NPM registry instead of a local tarball filename.
79+
80+
In the CLI: `--from-npm`, `-p`
81+
82+
```shell
83+
attw --from-npm <package-name>
84+
```
85+
86+
In the config file, `fromNpm` can be a boolean value.
87+
5888
#### Format
5989

6090
The format to print the output in. Defaults to `table`.
6191

6292
The available values are:
93+
6394
- `table`
6495
- `table-flipped`, where the resolution kinds are the table's head, and the entry points label the table's rows
6596
- `ascii`, for large tables where the output is clunky
@@ -73,23 +104,22 @@ attw --format <format> <file-name>
73104

74105
In the config file, `format` can be a string value.
75106

76-
#### From NPM
77-
78-
Treat `<file-name>` as the name (and, optionally, version) of a package from the NPM registry.
107+
#### Entrypoints
79108

80-
In the CLI: `--from-npm`, `-p`
109+
`attw` automatically discovers package entrypoints by looking at package.json `exports` and subdirectories with additional package.json files. This automatic discovery process can be overridden with the `--entrypoints` option, or altered with the `--include-entrypoints` and `--exclude-entrypoints` options:
81110

82111
```shell
83-
attw --from-npm <package-name>
112+
attw --pack . --entrypoints . one two three # Just ".", "./one", "./two", "./three"
113+
attw --pack . --include-entrypoints added # Auto-discovered entyrpoints plus "./added"
114+
attw --pack . --exclude-entrypoints styles.css # Auto-discovered entrypoints except "./styles.css"
84115
```
85116

86-
In the config file, `fromNpm` can be a boolean value.
87-
88117
#### Ignore Rules
89118

90119
Specifies rules/problems to ignore (i.e. not raise an error for).
91120

92121
The available values are:
122+
93123
- `wildcard`
94124
- `no-resolution`
95125
- `untyped-resolution`
@@ -171,4 +201,3 @@ attw --config-path <path> <file-name>
171201
```
172202

173203
Cannot be set from within the config file itself.
174-

0 commit comments

Comments
 (0)