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

Upgrade #70

Merged
merged 6 commits into from
Mar 3, 2024
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
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "jacoblincool/LeetCode-Query" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/tasty-poets-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"leetcode-query": major
---

Remove dependency on node built-in module
3 changes: 3 additions & 0 deletions .codacy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
exclude_paths:
- ".changeset/*.md"
6 changes: 5 additions & 1 deletion .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// eslint-disable-next-line no-undef
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
rules: {
"@typescript-eslint/explicit-module-boundary-types": ["error", { allowArgumentsExplicitlyTypedAsAny: true }],
"@typescript-eslint/explicit-module-boundary-types": [
"error",
{ allowArgumentsExplicitlyTypedAsAny: true },
],
},
};
5 changes: 2 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v3
with:
version: latest
run_install: true

- name: TypeDoc Build
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/pr_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v3
with:
version: latest
run_install: true

- name: Lint
run: pnpm lint

- name: Jest
uses: ArtiomTr/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test
run: pnpm test

- name: Build
run: pnpm build
72 changes: 26 additions & 46 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,40 @@ name: Release

on:
push:
tags:
- "v*"
workflow_dispatch:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release-npm:
name: Release to NPM (${{ github.ref }})
release:
name: Release
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Check if Tag on Main
run: |
git checkout main
branch=$(git branch main --contains ${{ github.ref }})
git checkout ${{ github.ref }}
if [ -z $branch ]; then
echo "Tag ${{ github.ref }} is not contained in the main branch."
exit 1
fi
- name: Checkout Repo
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v3
with:
version: latest
run_install: true

- name: Test
run: pnpm test

- name: Publish
run: |
pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
pnpm publish --verbose --access public --no-git-checks

release-note:
name: Release Note (${{ github.ref }})
runs-on: ubuntu-latest
needs:
- release-npm
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build
run: pnpm build

- name: Publish Release
uses: "marvinpinto/action-automatic-releases@latest"
- name: Create Release Pull Request or Publish to NPM
id: changesets
uses: changesets/action@v1
with:
repo_token: "${{ secrets.GH_TOKEN }}"
prerelease: false
files: |
README.md
LICENSE
publish: pnpm changeset publish
version: pnpm changeset version
title: Release Packages
commit: bump versions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm i
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pnpm i --frozen-lockfile
pnpm build
pnpm lint-staged
10 changes: 1 addition & 9 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,4 @@ overrides:
options:
tabWidth: 2
plugins:
- "./node_modules/@trivago/prettier-plugin-sort-imports/lib/src/index.js"

# sort-imports plugin
importOrder:
- "^node:"
- "^[^@.]"
- "^@"
- "^\\."
importOrderSortSpecifiers: true
- prettier-plugin-organize-imports
16 changes: 0 additions & 16 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const credential = new Credential();
await credential.init("YOUR-LEETCODE-SESSION-COOKIE");

const leetcode = new LeetCode(credential);
console.log((await leetcode.submissions(100, 0)));
console.log(await leetcode.submissions(100, 0));
```

## Documentation
Expand Down
8 changes: 7 additions & 1 deletion docs.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.hl-1, .hl-2, .hl-3, .hl-4, .hl-5, .hl-6, .hl-7 {
.hl-1,
.hl-2,
.hl-3,
.hl-4,
.hl-5,
.hl-6,
.hl-7 {
line-height: 1.4;
}
4 changes: 0 additions & 4 deletions jest.config.js

This file was deleted.

70 changes: 45 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,56 @@
"name": "leetcode-query",
"version": "0.2.7",
"description": "Get user profiles, submissions, and problems on LeetCode.",
"main": "lib/index.js",
"module": "lib/index.mjs",
"type": "module",
"types": "lib/index.d.ts",
"exports": {
"import": "./lib/index.js",
"require": "./lib/index.cjs",
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"files": [
"lib"
],
"scripts": {
"prepare": "npm run build && npm run docs",
"prepare": "husky",
"dev": "tsup --watch",
"build": "npm run format && tsup",
"build": "tsup",
"docs": "typedoc ./src/ --name \"LeetCode Query\" --customCss \"./docs.css\"",
"format": "prettier --write \"src/**/*.ts\"",
"format": "prettier --write . --ignore-path .gitignore",
"lint": "eslint .",
"test": "jest --coverage"
"test": "vitest --coverage --coverage.include src",
"changeset": "changeset"
},
"keywords": [
"leetcode",
"api"
],
"author": "JacobLinCool <[email protected]> (https://github.com/JacobLinCool)",
"license": "MIT",
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "4.1.1",
"@types/jest": "27.5.2",
"@types/node": "18.11.18",
"@types/node-fetch": "2.6.2",
"@typescript-eslint/eslint-plugin": "5.50.0",
"@typescript-eslint/parser": "5.50.0",
"dotenv": "16.0.3",
"eslint": "8.32.0",
"eslint-config-prettier": "8.6.0",
"jest": "28.1.3",
"prettier": "2.8.3",
"ts-jest": "28.0.8",
"tsup": "5.12.9",
"typedoc": "0.23.24",
"typescript": "4.9.4"
},
"dependencies": {
"node-fetch": "2.6.8"
"cross-fetch": "^4.0.0",
"eventemitter3": "^5.0.1"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@types/node": "20.11.24",
"@typescript-eslint/eslint-plugin": "7.1.0",
"@typescript-eslint/parser": "7.1.0",
"@vitest/coverage-v8": "^1.3.1",
"dotenv": "16.4.5",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"rollup-plugin-string": "^3.0.0",
"tsup": "8.0.2",
"typedoc": "0.25.9",
"typescript": "5.3.3",
"vitest": "^1.3.1"
},
"bugs": {
"url": "https://github.com/JacobLinCool/LeetCode-Query/issues"
Expand All @@ -50,5 +60,15 @@
"repository": {
"type": "git",
"url": "git+https://github.com/JacobLinCool/LeetCode-Query.git"
}
},
"lint-staged": {
"*.ts": [
"prettier --write",
"eslint --fix"
],
"*.graphql": [
"prettier --write"
]
},
"packageManager": "[email protected]"
}
Loading