You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/cli/README.md
+42-13Lines changed: 42 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -18,21 +18,31 @@ npm i -g @arethetypeswrong/cli
18
18
19
19
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.
20
20
21
-
The usage is:
21
+
The CLI can check an `npm pack`ed tarball:
22
22
23
23
```shell
24
24
npm pack
25
-
attw [options] <file-name>
25
+
attw cool-package-1.0.0.tgz
26
+
# or
27
+
attw $(npm pack)
26
28
```
27
29
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
+
```
29
41
30
42
## Configuration
31
43
32
44
`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.
33
45
34
-
Note that the `--config-path` option cannot be set from the config file :upside_down_face:
35
-
36
46
### Options
37
47
38
48
#### Help
@@ -55,11 +65,32 @@ In the CLI: `--version`, `-v`
55
65
attw --version
56
66
```
57
67
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
+
58
88
#### Format
59
89
60
90
The format to print the output in. Defaults to `table`.
61
91
62
92
The available values are:
93
+
63
94
-`table`
64
95
-`table-flipped`, where the resolution kinds are the table's head, and the entry points label the table's rows
65
96
-`ascii`, for large tables where the output is clunky
In the config file, `format` can be a string value.
75
106
76
-
#### From NPM
77
-
78
-
Treat `<file-name>` as the name (and, optionally, version) of a package from the NPM registry.
107
+
#### Entrypoints
79
108
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:
81
110
82
111
```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"
0 commit comments