-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from KemingHe/fix-jsdombundlingissue-keminghe
Fixed issue where node-only jsdom code fails to load if import package to edge env
- Loading branch information
Showing
17 changed files
with
222 additions
and
81 deletions.
There are no files selected for viewing
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 +1 @@ | ||
18 | ||
22 |
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
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 |
---|---|---|
|
@@ -26,8 +26,8 @@ | |
<span> </span> | ||
<a href="https://nodejs.org/en" > | ||
<img | ||
src="https://img.shields.io/badge/Supports-node18+-blue" | ||
alt="supports node18+ (link to nodejs.org)" | ||
src="https://img.shields.io/badge/Supports-node 8.1+-blue" | ||
alt="supports node8.1+ (link to nodejs.org)" | ||
/> | ||
</a> | ||
<span> </span> | ||
|
@@ -42,20 +42,20 @@ | |
|
||
> [!IMPORTANT] | ||
> | ||
> **Now requires Node 18 and up!** Please upgrade your node version. | ||
> **Async** accessors depend on [`jsdom`](https://github.com/jsdom/jsdom) and are `node`-only. For example: `import { getResearchPostingsAsync } from "@keminghe/osu/async";` | ||
> | ||
> **Versions 1.1.0 and below are DEPRECATED!** Please upgrade to the latest version. | ||
> Use import from the **synchronous** `@keminghe/osu` if you are working in a browswer environment. | ||
> [!NOTE] | ||
> | ||
> Build by students, for students, with :heart:. **NOT** affiliated nor endorsed by official OSU. | ||
> Build by students, for students, with :heart:. **NOT** affiliated by *official* OSU. | ||
> | ||
> * Publicly-available data about OSU undergrad majors [here](https://undergrad.osu.edu/majors-and-academics/majors). | ||
> * Publicly-available data about OSU student organizations [here](https://activities.osu.edu/involvement/student_organizations). | ||
> * Publicly-available *official* data about OSU undergrad majors [here](https://undergrad.osu.edu/majors-and-academics/majors). | ||
> * Publicly-available *official* data about OSU student orgs [here](https://activities.osu.edu/involvement/student_organizations). | ||
## :gear: Installation | ||
|
||
Requires [Node.js](https://nodejs.org/en/download/package-manager) >= **18** | ||
Requires [Node.js](https://nodejs.org/en/download/package-manager) >= **8.1.0** (es2017) | ||
|
||
```bash | ||
# Using npm: | ||
|
@@ -105,28 +105,42 @@ BUCKEYEMAIL_PATTERN.test("[email protected]"); // true | |
### Accessing All Undergrad Majors | ||
|
||
```typescript | ||
import { getUndergradMajors, type UndergradMajor } from "@keminghe/osu"; | ||
import { | ||
getUndergradMajors, | ||
type UndergradMajor, | ||
UndergradMajorSchema, | ||
} from "@keminghe/osu"; | ||
|
||
const majors: UndergradMajor[] = getUndergradMajors(); | ||
UndergradMajorSchema.array().parse(majors); | ||
console.log(majors); | ||
``` | ||
|
||
### Accessing All Student Organizations | ||
|
||
```typescript | ||
import { getStudentOrgs, type StudentOrg } from "@keminghe/osu"; | ||
import { | ||
getStudentOrgs, | ||
type StudentOrg, | ||
StudentOrgSchema, | ||
} from "@keminghe/osu"; | ||
|
||
const orgs: StudentOrg[] = getStudentOrgs(); | ||
StudentOrgSchema.array().parse(orgs); | ||
console.log(orgs); | ||
``` | ||
|
||
### Accessing All Undergrad Research Postings | ||
### Accessing All Undergrad Research Postings (Async!) | ||
|
||
```typescript | ||
import { getResearchPostingsAsync } from "@keminghe/osu"; | ||
import { ResearchPostingSchema, type ResearchPosting } from "@keminghe/osu"; | ||
|
||
// IMPORTANT: note the different async import path. | ||
import { getResearchPostingsAsync } from "@keminghe/osu/async"; | ||
|
||
getResearchPostingsAsync() | ||
.then((researchPostings) => { | ||
ResearchPostingSchema.array().parse(researchPostings); | ||
console.log(researchPostings); | ||
}) | ||
.catch((error) => { | ||
|
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,6 +1,6 @@ | ||
{ | ||
"name": "@keminghe/osu", | ||
"version": "3.1.1", | ||
"version": "4.0.0", | ||
"description": "Unofficial, publicly available data about The Ohio State University.", | ||
"keywords": [ | ||
"data", | ||
|
@@ -15,7 +15,25 @@ | |
], | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"./async": { | ||
"import": "./dist/index.async.mjs", | ||
"require": "./dist/index.async.js" | ||
} | ||
}, | ||
"types": "dist/index.d.ts", | ||
"typesVersions": { | ||
"*": { | ||
"async": [ | ||
"./dist/index.async.d.ts" | ||
] | ||
} | ||
}, | ||
"sideEffects": false, | ||
"files": [ | ||
"dist", | ||
"README.md", | ||
|
@@ -50,8 +68,9 @@ | |
"build": "tsup", | ||
"postbuild": "echo 'Build complete: src/ -> dist/'" | ||
}, | ||
"packageManager": "[email protected]+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b", | ||
"dependencies": { | ||
"jsdom": "^25.0.0", | ||
"jsdom": "^25.0.1", | ||
"zod": "^3.23.8" | ||
}, | ||
"devDependencies": { | ||
|
@@ -76,7 +95,7 @@ | |
"vitest": "^2.1.1" | ||
}, | ||
"engines": { | ||
"node": ">=14" | ||
"node": ">=8.10.0" | ||
}, | ||
"os": [ | ||
"linux", | ||
|
@@ -86,6 +105,5 @@ | |
"cpu": [ | ||
"x64", | ||
"arm64" | ||
], | ||
"packageManager": "[email protected]+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b" | ||
] | ||
} |
Oops, something went wrong.