Skip to content

Commit

Permalink
fix(cli): published package on NPM (#96)
Browse files Browse the repository at this point in the history
* Amend README and package.json for installation from the npm registry

* increment version
  • Loading branch information
argl authored Sep 17, 2024
1 parent bf3232c commit 276f84c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,29 @@
If you just want to scan a host, please head over to <https://developer.mozilla.org/en-US/observatory/>. If you want to
run the code locally or on your premises, continue reading.

### Installation
### Running a simple scan from the command line

Install dependencies by running this from the root of the repository:
Using npx to install the package, simply run

```sh
npm i
npx @mdn/mdn-http-observatory mdn.dev
```

### Running a local scan
If you want to install the package first, use npm to install it globally

To run a scan on a host, a command line script is available. It returns the a JSON of the form described below. For example, to scan `mdn.dev`:
```sh
npm install --global @mdn/mdn-http-observatory
```

After that, the `mdn-http-observatory-scan` command should be available in your shell. To scan a host, run

```sh
npx mdn-http-observatory-scan mdn.dev
mdn-http-observatory-scan mdn.dev
```

Both methods return a JSON response of the following form:

```json
{
"scan": {
"algorithmVersion": 4,
Expand Down Expand Up @@ -49,8 +57,6 @@ npx mdn-http-observatory-scan mdn.dev
}
```

To install the CLI script globally on your machine, run `npm install -g .` from the project root. `mdn-http-observatory-scan` is then available in your shell.

### Running a local API server

This needs a [postgres](https://www.postgresql.org/) database for the API to use as a persistence layer. All scans and results initiated via the API are stored in the database.
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "@mdn/mdn-http-observatory",
"version": "1.3.2",
"description": "",
"version": "1.3.3",
"author": "Mozilla Developer Network",
"description": "The MDN HTTP Observatory is a set of tools to analyze your website and inform you if you are utilizing the many available methods to secure it.",
"main": "src/index.js",
"engines": {
"node": ">=20.0.0",
Expand All @@ -21,7 +22,6 @@
"mdn-http-observatory-scan": "bin/scan.js"
},
"type": "module",
"author": "",
"license": "MPL-2.0",
"devDependencies": {
"@faker-js/faker": "^9.0.1",
Expand Down

0 comments on commit 276f84c

Please sign in to comment.