Compare commits
16 Commits
73a4f4e595
...
v1.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 8780245986 | |||
| 90f3fba45a | |||
| b1d244e34c | |||
| 01871f083b | |||
| 2020e76b3e | |||
| d5b0cd0730 | |||
| 5bdd35b74b | |||
| fa2db8d430 | |||
| a2bea32fb6 | |||
| bebd51b047 | |||
| 4539515bf7 | |||
| 81d41f74b4 | |||
| 7d70224bdf | |||
| 9c4641dd0a | |||
| 5e47f71f31 | |||
| 0414e1aae6 |
3
AUTHORS.md
Normal file
3
AUTHORS.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
### Authors
|
||||||
|
|
||||||
|
- joe fleming ([w33ble](https://github.com/w33ble))
|
||||||
24
CHANGELOG.md
Normal file
24
CHANGELOG.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
### Changelog
|
||||||
|
|
||||||
|
#### [v1.0.2](https://git.w33ble.com/w33ble/strain-tools/compare/v1.0.1...v1.0.2) (13 September 2018)
|
||||||
|
|
||||||
|
#### [v1.0.1](https://git.w33ble.com/w33ble/strain-tools/compare/v1.0.0...v1.0.1) (13 September 2018)
|
||||||
|
- fix: correct localstorage fallback [`d5b0cd0`](https://git.w33ble.com/w33ble/strain-tools/commit/d5b0cd07307dbf06d8d4530803a00c2b2ab8c4c5)
|
||||||
|
- docs: update readme with usable scripts [`5bdd35b`](https://git.w33ble.com/w33ble/strain-tools/commit/5bdd35b74b417706c76bd50d7162567b60dbdcb2)
|
||||||
|
- fix: scrape strains alphabetically [`fa2db8d`](https://git.w33ble.com/w33ble/strain-tools/commit/fa2db8d4304b0b0d91221b4ef942daa74ab3df94)
|
||||||
|
|
||||||
|
#### v1.0.0 (9 September 2018)
|
||||||
|
- fix: assign key to strain cards [`e3e95e7`](https://git.w33ble.com/w33ble/strain-tools/commit/e3e95e7c2b390ca52633e84604cf6a4a9b239d54)
|
||||||
|
- fix: remove listener on form unmount [`4591a47`](https://git.w33ble.com/w33ble/strain-tools/commit/4591a47dbaa62cbd330bbc9b96ace2be1ace8bd6)
|
||||||
|
- feat: add fav/unfav control [`50a3b1d`](https://git.w33ble.com/w33ble/strain-tools/commit/50a3b1db92a64fcd7e10e35ba045a3970a1440ba)
|
||||||
|
- feat: adjust card tag label by screen size [`5665bde`](https://git.w33ble.com/w33ble/strain-tools/commit/5665bdeaa99bcbf4fc5a9d13d98803b17a42404b)
|
||||||
|
- feat: sort by adjusted rating [`712c5c0`](https://git.w33ble.com/w33ble/strain-tools/commit/712c5c095c52269d7ffbd7f763cdf325b11369a4)
|
||||||
|
- feat: show errors, sort tags [`943c091`](https://git.w33ble.com/w33ble/strain-tools/commit/943c0917c71db1612aefd9f2fc8bde098000364c)
|
||||||
|
- feat: functional search on site [`d3b2110`](https://git.w33ble.com/w33ble/strain-tools/commit/d3b21103eb5227101f581fcc853714bc78ea9950)
|
||||||
|
- feat: even more site functionality [`9a1f2f9`](https://git.w33ble.com/w33ble/strain-tools/commit/9a1f2f9785e36bd2de2a3a1fbf46bbc9cfdb90d3)
|
||||||
|
- feat: add tags to scraper output [`804fac1`](https://git.w33ble.com/w33ble/strain-tools/commit/804fac1afb68dc52f482cbfa393856b14b64400a)
|
||||||
|
- feat: mocked up search form on site [`22a95c3`](https://git.w33ble.com/w33ble/strain-tools/commit/22a95c3fe827ec0651c44164f58950dcc283354b)
|
||||||
|
- feat: simple site build and dev server [`699a03c`](https://git.w33ble.com/w33ble/strain-tools/commit/699a03c7c06da011b64bdc358287f5d653c96c92)
|
||||||
|
- feat: add a search site package [`37dcabd`](https://git.w33ble.com/w33ble/strain-tools/commit/37dcabde5e20a6ecea803f40798ae43c72e3afe8)
|
||||||
|
- feat: working scraper [`cc5e15d`](https://git.w33ble.com/w33ble/strain-tools/commit/cc5e15dbb11f388ba260da6c196fe6827e947d3c)
|
||||||
|
- initial commit [`c81b30b`](https://git.w33ble.com/w33ble/strain-tools/commit/c81b30be896009b48e66005007f88e55fb159c9c)
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "strain-tools",
|
"name": "strain-tools",
|
||||||
"version": "0.0.0",
|
"version": "1.0.2",
|
||||||
"description": "strain tools",
|
"description": "strain tools",
|
||||||
"main": "index",
|
"main": "index",
|
||||||
"module": "index.mjs",
|
"module": "index.mjs",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint \"packages/**/*.{js,mjs,vue}\" \"packages/**/src/**/*.{js,mjs,vue}\"",
|
"lint": "eslint \"packages/*/*.{js,mjs,vue}\" \"packages/*/src/**/*.{js,mjs,vue}\"",
|
||||||
"precommit": "lint-staged",
|
"precommit": "lint-staged",
|
||||||
"version": "auto-changelog -p && auto-authors && git add CHANGELOG.md AUTHORS.md",
|
"prepush": "npm run lint",
|
||||||
|
"sync-versions": "node -r esm scripts/version-sync.mjs",
|
||||||
|
"version": "npm run sync-versions && auto-changelog -p && auto-authors && git add CHANGELOG.md AUTHORS.md packages",
|
||||||
"start": "node .",
|
"start": "node .",
|
||||||
"dev": "nodemon --ignore db.json ."
|
"dev": "nodemon --ignore db.json ."
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,5 +8,3 @@ Clone repo and run the command. Resulting data can be found in `db.json`.
|
|||||||
yarn install
|
yarn install
|
||||||
yarn start
|
yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
**NOTE**: You may need to run it multiple times (4 or 5 should do it), since some strains will get skipped the first few times. I don't know if it's leafly's endpoint or some weird race condition in the scraping code though.
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "leafly-scraper",
|
"name": "scraper",
|
||||||
"version": "0.0.0",
|
"version": "1.0.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "scrapes strain info, stores for later reference",
|
"description": "scrapes strain info, stores for later reference",
|
||||||
"main": "index",
|
"main": "index",
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.18.0",
|
"axios": "^0.18.0",
|
||||||
"esm": "^3.0.81",
|
"esm": "^3.0.82",
|
||||||
"lodash": "^4.17.10",
|
"lodash": "^4.17.10",
|
||||||
"lowdb": "^1.0.0"
|
"lowdb": "^1.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ const adapter = new FileAsync('db.json');
|
|||||||
const xhr = axios.create({
|
const xhr = axios.create({
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json, text/plain, */*',
|
Accept: 'application/json, text/plain, */*',
|
||||||
Referer: 'https://www.leafly.com/explore',
|
Referer: 'https://www.leafly.com/explore/sort-alpha',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const pSeries = tasks => tasks.reduce((c, task) => c.then(task), Promise.resolve());
|
const pSeries = tasks => tasks.reduce((c, task) => c.then(task), Promise.resolve());
|
||||||
|
|
||||||
const getPage = async num => {
|
const getPage = async num => {
|
||||||
const url = `https://www.leafly.com/explore/page-${num}`;
|
const url = `https://www.leafly.com/explore/page-${num}/sort-alpha`;
|
||||||
const response = await xhr.get(url, {
|
const response = await xhr.get(url, {
|
||||||
responseType: 'json',
|
responseType: 'json',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ Strain search static website. Use it to search for strains by name, effects, med
|
|||||||
|
|
||||||
Based on data from leafly. You'll need to run the scraper first since that's where the data comes from.
|
Based on data from leafly. You'll need to run the scraper first since that's where the data comes from.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
- `yarn start`: starts the dev server, with HMR
|
||||||
|
- `yarn build`: builds the static site into the `dist` path
|
||||||
|
- `yarn deploy`: builds and deploys the app onto firebase
|
||||||
|
|
||||||
#### License
|
#### License
|
||||||
|
|
||||||
MIT © [w33ble](https://github.com/w33ble)
|
MIT © [w33ble](https://github.com/w33ble)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "search-site",
|
"name": "search-site",
|
||||||
"version": "0.0.0",
|
"version": "1.0.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "index",
|
"main": "index",
|
||||||
"module": "index.mjs",
|
"module": "index.mjs",
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ejs": "^2.6.1",
|
"ejs": "^2.6.1",
|
||||||
"esm": "^3.0.81",
|
"esm": "^3.0.82",
|
||||||
"lunr": "^2.3.3",
|
"lunr": "^2.3.3",
|
||||||
"mitt": "^1.1.3",
|
"mitt": "^1.1.3",
|
||||||
"vue": "^2.5.17",
|
"vue": "^2.5.17",
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
/* eslint-env browser */
|
/* eslint-env browser */
|
||||||
|
|
||||||
const storage = (() => {
|
const storage = (() => {
|
||||||
// return localstorage in the browser env
|
try {
|
||||||
if (this && this.localStorage) return this.localStorage;
|
return window.localStorage;
|
||||||
|
} catch (err) {
|
||||||
// return a mock localstorage in the server env
|
// return a mock localstorage in the server env
|
||||||
return {
|
return {
|
||||||
getItem: () => null,
|
getItem: () => null,
|
||||||
setItem: () => null,
|
setItem: () => null,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
26
scripts/version-sync.mjs
Normal file
26
scripts/version-sync.mjs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import fs from 'fs';
|
||||||
|
import { promisify } from 'util';
|
||||||
|
import { join } from 'path';
|
||||||
|
import pkg from '../package.json';
|
||||||
|
|
||||||
|
const readDir = promisify(fs.readdir);
|
||||||
|
const readFile = promisify(fs.readFile);
|
||||||
|
const writeFile = promisify(fs.writeFile);
|
||||||
|
|
||||||
|
async function syncPackageVersions() {
|
||||||
|
const packagesPath = 'packages'; // path for all packages
|
||||||
|
const { version } = pkg;
|
||||||
|
|
||||||
|
const packages = await readDir(packagesPath);
|
||||||
|
|
||||||
|
packages.forEach(async pack => {
|
||||||
|
const packagePath = join(packagesPath, pack, 'package.json');
|
||||||
|
const p = JSON.parse(await readFile(packagePath, 'utf-8'));
|
||||||
|
p.version = version;
|
||||||
|
await writeFile(packagePath, `${JSON.stringify(p, null, 2)}\n`);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(`Versions with root: ${version}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
syncPackageVersions();
|
||||||
@@ -3156,9 +3156,9 @@ eslint@^4.9.0:
|
|||||||
table "4.0.2"
|
table "4.0.2"
|
||||||
text-table "~0.2.0"
|
text-table "~0.2.0"
|
||||||
|
|
||||||
esm@^3.0.81:
|
esm@^3.0.82:
|
||||||
version "3.0.81"
|
version "3.0.82"
|
||||||
resolved "https://registry.yarnpkg.com/esm/-/esm-3.0.81.tgz#3d78df013960b6d30bb5a5adfafe5d9da654b9d2"
|
resolved "https://registry.yarnpkg.com/esm/-/esm-3.0.82.tgz#e8c4363a14e30936bedf49a44bf962e2c91866ff"
|
||||||
|
|
||||||
espree@^3.5.2, espree@^3.5.4:
|
espree@^3.5.2, espree@^3.5.4:
|
||||||
version "3.5.4"
|
version "3.5.4"
|
||||||
|
|||||||
Reference in New Issue
Block a user