Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript Additions #9

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"root": true,
"env": {
"node": true,
"es2022": true
},
"extends": [
"airbnb-base"
],
"plugins": [
"@typescript-eslint/eslint-plugin"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "script",
"ecmaVersion": 2022
},
"rules": {
// This enforces strict checks on .js files, it's not necessary for .ts files
// https://www.w3schools.com/js/js_strict.asp
"strict": [2, "global"],
// Removes () around single parameter arrow functions
"arrow-parens": [2, "as-needed"],
// This is a personal preference to enforce good code
"@typescript-eslint/no-non-null-assertion": "warn",
// Enforce max line length of 120
"max-len": ["warn", { "code": 120 }],
// Allow allow any on objects, require definition of types
"@typescript-eslint/no-explicit-any": "warn"
},
"overrides": [
{
"files": ["**/*.ts","**/*.tsx","**/*.*.ts,**/*.*.json"],
"extends": [
"airbnb-base",
"airbnb-typescript/base"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
// This enforces strict checks on .js files, it's not necessary for .ts files
// https://www.w3schools.com/js/js_strict.asp
"strict": [2, "global"],
// Removes () around single parameter arrow functions
"arrow-parens": [2, "as-needed"],
// This is a personal preference to enforce good code
"@typescript-eslint/no-non-null-assertion": "warn",
// Enforce max line length of 120
"max-len": ["warn", { "code": 120 }],
// Allow allow any on objects, require definition of types
"@typescript-eslint/no-explicit-any": "warn"
}
}
]
}
4 changes: 3 additions & 1 deletion .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
env/
venv/
*.json
node_modules/
output/
substances*.json
2 changes: 1 addition & 1 deletion LICENSE
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Noah Saso
Copyright (c) 2021-2023 Noah Saso, TripSit

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
30 changes: 28 additions & 2 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Script to merge data from PsychonautWiki API + pages and TripSit factsheets into one standardized format

Now with Typescript!

# Python - Developed by Noah Saso
## Installation

1. Install virtualenv
Expand All @@ -23,7 +26,7 @@ Script to merge data from PsychonautWiki API + pages and TripSit factsheets into

## Usage
```
python scrape.py [-h] [output]
python ./src/scrape.py [-h] [output]

Scrape PsychonautWiki and TripSit data into unified dataset

Expand All @@ -34,7 +37,30 @@ optional arguments:
-h, --help show this help message and exit
```

## Output Schema
# NodeJS - Developed by Moonbear

The NodeJS version utilizes eslint for linting and prettier for formatting. It also uses typescript for type checking.
Types have been checked but could be improved!

## Installation
1. Install packages
```
npm install
```

## Usage
```
npm run start
```
This will run the program and output the data to `./output/combinedDb.json`

## Development
```
npm run dev
```
Nodemon will watch for changes and restart the script when changes are detected, making development easier.

# Output Schema

| Property | Type | Description | Source |
| ------------------------- | ------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------- |
Expand Down
5 changes: 5 additions & 0 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"watch": ["src"],
"ext": ".ts",
"exec": "ts-node src/scrape.ts"
}
Loading