-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: cleanup and migrate to new build system
- Loading branch information
1 parent
1556ee6
commit 5cd4fdc
Showing
17 changed files
with
2,364 additions
and
4,969 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,36 @@ | ||
name: CI | ||
on: [push] | ||
|
||
on: | ||
push: | ||
branches: [main, develop] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
name: lint, and test with Node ${{ matrix.node }} on ubuntu-latest | ||
|
||
runs-on: ubuntu-latest | ||
environment: actions | ||
|
||
strategy: | ||
matrix: | ||
node: ['10.x', '12.x', '14.x'] | ||
node-version: [16.x, 18.x, 19.x, 20.x] | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Node ${{ matrix.node }} | ||
uses: actions/setup-node@v1 | ||
- name: Install Node ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install deps and build (with cache) | ||
uses: bahmutov/npm-install@v1 | ||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
- name: Lint | ||
run: yarn lint | ||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Test | ||
run: yarn test --ci --coverage --maxWorkers=2 | ||
- name: Run the tests | ||
run: pnpm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# meta-fetcher | ||
|
||
![npm](https://img.shields.io/npm/v/meta-fetcher?style=flat&color=success&logo=npm) | ||
|
||
Simple metadata scrapper. | ||
|
||
## Installation | ||
|
||
```sh | ||
yarn add meta-fetcher | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
import metaFetcher from 'meta-fetcher'; | ||
|
||
const result = await metaFetcher('https://hoppscotch.io/'); | ||
|
||
console.log(result); | ||
``` | ||
|
||
Output: | ||
|
||
```json | ||
{ | ||
"title": "Hoppscotch - Open source API development ecosystem", | ||
"description": "Helps you create requests faster, saving precious time on development.", | ||
"image": "https://hoppscotch.io/og.png", | ||
"url": "https://hoppscotch.io/", | ||
"siteName": "Hoppscotch", | ||
"type": "website" | ||
} | ||
``` | ||
|
||
## API | ||
|
||
### metaFetcher(input) | ||
|
||
Takes one url string as a parameter and returns an object containing the meta-information. | ||
|
||
#### input | ||
|
||
type: `string` \ | ||
default: `'none'` | ||
|
||
The url string to be scrapped. | ||
|
||
## Related | ||
|
||
[**page-scrapper**](https://github.com/rocktimsaikia/page-scrapper): Node.js scrapper that pulls out all links and images of a given site. | ||
|
||
## License | ||
|
||
2024 [MIT](https://choosealicense.com/licenses/mit/) © [Rocktim Saikia](https://rocktimsaikia.dev) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,55 @@ | ||
{ | ||
"name": "meta-fetcher", | ||
"version": "3.1.1", | ||
"description": "simple metadata scrapper for node.js", | ||
"keywords": [ | ||
"meta-fetcher", | ||
"url-metadata", | ||
"url-metadata-scrapper", | ||
"metadata-scrapper", | ||
"website-metadata", | ||
"website-metadata-scrapper", | ||
"metadata", | ||
"scrapper" | ||
], | ||
"repository": "rocktimsaikia/meta-fetcher", | ||
"funding": "https://www.buymeacoffee.com/rocktimcodes", | ||
"license": "MIT", | ||
"author": { | ||
"name": "Rocktim Saikia", | ||
"email": "[email protected]", | ||
"url": "https://rocktimcodes.site" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.esm.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"scripts": { | ||
"prebuild": "rm -rf dist", | ||
"build": "rollup --config", | ||
"lint": "eslint .", | ||
"test": "jest", | ||
"postversion": "git push && git push --tags", | ||
"prepublishOnly": "npm run lint && yarn test && yarn build" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "npm run lint && npm run test" | ||
} | ||
}, | ||
"prettier": { | ||
"printWidth": 80, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
}, | ||
"jest": { | ||
"preset": "ts-jest", | ||
"testEnvironment": "node" | ||
}, | ||
"dependencies": { | ||
"cheerio": "^1.0.0-rc.6", | ||
"isomorphic-unfetch": "^3.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^26.0.23", | ||
"@types/node": "^15.0.1", | ||
"@typescript-eslint/eslint-plugin": "^4.22.0", | ||
"@typescript-eslint/parser": "^4.22.0", | ||
"eslint": "^7.25.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"husky": "4", | ||
"jest": "^26.6.3", | ||
"prettier": "^2.2.1", | ||
"rollup": "^2.46.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.30.0", | ||
"ts-jest": "^26.5.5", | ||
"tslib": "^2.2.0", | ||
"typescript": "^4.2.4" | ||
} | ||
"name": "my-npm-package", | ||
"description": "Get country information via currency code", | ||
"version": "0.0.0", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"type": "module", | ||
"files": [ | ||
"dist" | ||
], | ||
"license": "MIT", | ||
"author": { | ||
"email": "[email protected]", | ||
"name": "Rocktim Saikia", | ||
"url": "https://rocktimsaikia.dev" | ||
}, | ||
"funding": "https://github.com/sponsors/rocktimsaikia", | ||
"repository": "rocktimsaikia/my-npm-package", | ||
"scripts": { | ||
"build": "tsup", | ||
"test": "pnpm build && ava", | ||
"release": "pnpm test && np --no-tests" | ||
}, | ||
"dependencies": { | ||
"cheerio": "1.0.0-rc.12", | ||
"node-fetch": "^3.3.2" | ||
}, | ||
"devDependencies": { | ||
"@rocktimsaikia/prettier-config": "^1.0.4", | ||
"@types/node": "^17.0.23", | ||
"ava": "^4.2.0", | ||
"tsup": "^5.12.4", | ||
"tsx": "^4.7.0", | ||
"typescript": "^4.6.3" | ||
}, | ||
"np": { | ||
"contents": "dist" | ||
}, | ||
"keywords": [ | ||
"my-npm-package" | ||
], | ||
"prettier": "@rocktimsaikia/prettier-config", | ||
"tsup": { | ||
"entry": [ | ||
"src/index.ts" | ||
], | ||
"format": [ | ||
"cjs", | ||
"esm" | ||
], | ||
"minify": true, | ||
"clean": true, | ||
"dts": true | ||
} | ||
} |
Oops, something went wrong.