Better install
This commit is contained in:
parent
2babfbdc6a
commit
98bfdbaa06
|
@ -5,9 +5,7 @@ _Helps locating elements in simple HTML pages_
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://gitea.tforgione.fr/tforgione/locator
|
npm install --global git+https://gitea.tforgione.fr/tforgione/locator.git
|
||||||
cd locator
|
|
||||||
npm install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
6
index.js
6
index.js
|
@ -6,6 +6,12 @@ const puppeteer = require('puppeteer');
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
|
|
||||||
|
if (process.argv[2] === undefined) {
|
||||||
|
console.error("This program expects an argument.");
|
||||||
|
console.error("USAGE: locator <path-to-HTML-file>");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// Path to the HTML file to analyse (given as relative path from current directory)
|
// Path to the HTML file to analyse (given as relative path from current directory)
|
||||||
// We need the full path so that puppeteer is able to access it
|
// We need the full path so that puppeteer is able to access it
|
||||||
const path = process.argv[2].startsWith('/') ? process.argv[2] : process.cwd() + '/' + process.argv[2];
|
const path = process.argv[2].startsWith('/') ? process.argv[2] : process.cwd() + '/' + process.argv[2];
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"puppeteer": "^19.7.1"
|
"puppeteer": "^19.7.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"locator": "index.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/code-frame": {
|
"node_modules/@babel/code-frame": {
|
||||||
|
|
Loading…
Reference in New Issue