Better install

This commit is contained in:
Thomas Forgione 2023-02-17 06:50:27 +01:00
parent 2babfbdc6a
commit 98bfdbaa06
3 changed files with 10 additions and 3 deletions

View File

@ -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

View File

@ -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];

3
package-lock.json generated
View File

@ -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": {