Skip to content
Merged
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
26 changes: 14 additions & 12 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: npm package

on:
release:
types: [created]

permissions:
id-token: write # Required for OIDC
contents: read

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: echo "PACKAGE_JSON=$(jq -c . < package.json)" >> $GITHUB_ENV
- uses: pnpm/action-setup@v4
with:
version: 10.7.0
- uses: actions/setup-node@v3
version: ${{ fromJson(env.PACKAGE_JSON).volta.pnpm }}
- uses: actions/setup-node@v4
with:
node-version: 22.14.0
registry-url: https://registry.npmjs.org/
- run: pnpm i --frozen-lockfile
node-version: ${{ fromJson(env.PACKAGE_JSON).volta.node }}
registry-url: https://registry.npmjs.org/
- name: Upgrade npm for OCID support
run: npm i -g npm@latest
- run: pnpm install --frozen-lockfile
- run: pnpm clean
- run: pnpm build
- run: pnpm -r publish --no-git-checks --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: pnpm -r publish --provenance --no-git-checks
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"devDependencies": {
"@biomejs/biome": "1.9.4",
"rimraf": "^6.0.1",
"syncpack": "^13.0.2",
"typescript": "5.5.4"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/scraper-strategies/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@qnaplus/scraper-strategies",
"version": "3.1.1",
"version": "3.1.2",
"description": "Request stategies for @qnaplus/scraper",
"main": "dist/index.js",
"repository": {
"url": "git+ssh://git@github.com/qnaplus/scraper.git"
},
"author": "Battlesquid <25509915+Battlesquid@users.noreply.github.com>",
"author": "battlesquid <25509915+battlesquid@users.noreply.github.com>",
"license": "GPL-3.0",
"scripts": {
"build": "tsc",
Expand Down
2 changes: 1 addition & 1 deletion packages/scraper/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# scraper

A set of utilities focused on scraping the [VEX Robotics Q&A](https://www.robotevents.com/V5RC/2024-2025/QA/).
A set of utilities focused on scraping the [VEX Robotics Q&A](https://events.vex.com/V5RC/2024-2025/QA/).

## Usage

Expand Down
4 changes: 2 additions & 2 deletions packages/scraper/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@qnaplus/scraper",
"version": "3.1.1",
"version": "3.1.2",
"description": "Utility package to scrape questions from the VEX Robotics Q&A.",
"main": "dist/index.js",
"repository": {
"url": "git+ssh://git@github.com/qnaplus/scraper.git"
},
"author": "Battlesquid <25509915+Battlesquid@users.noreply.github.com>",
"author": "battlesquid <25509915+battlesquid@users.noreply.github.com>",
"license": "GPL-3.0",
"scripts": {
"build": "tsc",
Expand Down
10 changes: 5 additions & 5 deletions packages/scraper/src/modules/parsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ interface QnaUrlPageParams extends BaseQnaUrlParams {
page: number;
}

export type QnaHomeUrl = `https://www.robotevents.com/${string}/${string}/QA`;
export type QnaHomeUrl = `https://events.vex.com/${string}/${string}/QA`;
export type QnaPageUrl = `${QnaHomeUrl}?page=${string}`;
export type QnaIdUrl = `${QnaHomeUrl}/${string}`;

export const validateQnaUrl = (url: string): Record<string, string> => {
const regex =
/^https:\/\/www\.robotevents\.com\/(?<program>\w+)\/(?<season>\d{4}-\d{4})\/QA(?:\/(?<id>\d+))?(?:\?page=(?<page>\d+))?$/;
/^https:\/\/events\.vex\.com\/(?<program>\w+)\/(?<season>\d{4}-\d{4})\/QA(?:\/(?<id>\d+))?(?:\?page=(?<page>\d+))?$/;
const match = url.match(regex);
if (!match?.groups) {
throw Error(`${url} in unrecognized format.`);
Expand Down Expand Up @@ -45,15 +45,15 @@ export const parseQnaUrlWithPage = (url: QnaPageUrl): QnaUrlPageParams => {

export const buildHomeQnaUrl = (params: BaseQnaUrlParams): QnaHomeUrl => {
const { program, season } = params;
return `https://www.robotevents.com/${program}/${season}/QA`;
return `https://events.vex.com/${program}/${season}/QA`;
};

export const buildQnaUrlWithId = (params: QnaUrlIdParams): QnaIdUrl => {
const { program, season, id } = params;
return `https://www.robotevents.com/${program}/${season}/QA/${id}`;
return `https://events.vex.com/${program}/${season}/QA/${id}`;
};

export const buildQnaUrlWithPage = (params: QnaUrlPageParams): QnaPageUrl => {
const { program, season, page } = params;
return `https://www.robotevents.com/${program}/${season}/QA?page=${page}`;
return `https://events.vex.com/${program}/${season}/QA?page=${page}`;
};
Loading
Loading