Skip to content

Commit

Permalink
chore: first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-lsn committed Dec 25, 2023
0 parents commit 0c2eb3d
Show file tree
Hide file tree
Showing 24 changed files with 1,056 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Ubuntu Dev Container",
"image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu",
"features": {
"ghcr.io/shyim/devcontainers-features/bun:0": "0.0.1",
"ghcr.io/devcontainers-contrib/features/act:1": "1.0.14"
},
"customizations": {
"vscode": {
"extensions": ["biomejs.biome"]
}
},
"remoteUser": "vscode"
}
30 changes: 30 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Code quality

on:
push:
pull_request:

jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Biome
uses: biomejs/setup-biome@v1
with:
version: 1.4.1
- name: Run Biome
run: biome ci .
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.19
- run: bun install
- run: bun run test
env:
PIKPAK_USERNAME: ${{secrets.PIKPAK_USERNAME}}
PIKPAK_PASSWORD: ${{secrets.PIKPAK_PASSWORD}}
179 changes: 179 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore

build/

# Logs

logs
_.log
npm-debug.log_
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Caches

.cache

# Diagnostic reports (https://nodejs.org/api/report.html)

report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# Runtime data

pids
_.pid
_.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover

lib-cov

# Coverage directory used by tools like istanbul

coverage
*.lcov

# nyc test coverage

.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)

.grunt

# Bower dependency directory (https://bower.io/)

bower_components

# node-waf configuration

.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)

build/Release

# Dependency directories

node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)

web_modules/

# TypeScript cache

*.tsbuildinfo

# Optional npm cache directory

.npm

# Optional eslint cache

.eslintcache

# Optional stylelint cache

.stylelintcache

# Microbundle cache

.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history

.node_repl_history

# Output of 'npm pack'

*.tgz

# Yarn Integrity file

.yarn-integrity

# dotenv environment variable files

.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)

.parcel-cache

# Next.js build output

.next
out

# Nuxt.js build / generate output

.nuxt
dist

# Gatsby files

# Comment in the public line in if your project uses Gatsby and not Next.js

# https://nextjs.org/blog/next-9-1#public-directory-support

# public

# vuepress build output

.vuepress/dist

# vuepress v2.x temp and cache directory

.temp

# Docusaurus cache and generated files

.docusaurus

# Serverless directories

.serverless/

# FuseBox cache

.fusebox/

# DynamoDB Local files

.dynamodb/

# TernJS port file

.tern-port

# Stores VSCode versions used for testing VSCode extensions

.vscode-test

# yarn v2

.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store

.act.secrets
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
Empty file added .npmignore
Empty file.
21 changes: 21 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"git": {
"commitMessage": "chore: release v${version}"
},
"npm": {
"publish": true
},
"github": {
"release": true
},
"hooks": {
"before:init": ["git pull", "bun run test", "bun run build"],
"after:bump": "echo Version update successfully"
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": "angular",
"infile": "CHANGELOG.md"
}
}
}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## [1.1.2](https://github.com/chris-lsn/pikpak-js-sdk/compare/1.1.1...1.1.2) (2023-12-24)

### Features

- change the args of parentFolderId, name in createTask to be optional ([3fc9a91](https://github.com/chris-lsn/pikpak-js-sdk/commit/3fc9a91dedcb8c4db5f5a9742b09d0ca005dfe5a))

## [1.1.1](https://github.com/chris-lsn/pikpak-js-sdk/compare/1.1.0...1.1.1) (2023-12-24)

### Features

- add build.ts for generating d.ts while build ([3d2c04c](https://github.com/chris-lsn/pikpak-js-sdk/commit/3d2c04c3203e4dbeabf22d604a6a90047b5fc438))
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Chris

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# pikpak-js-sdk (unofficial)

This is a simple javascript SDK for the PikPak API.

## Installation

```bash
npm install pikpak-js
```

## Supported Functions

- [x] Get Tasks
- [x] Create Task
- [x] Delete Task
- [x] Get Folder
- [x] Create Folder
- [x] Delete Folders
- [x] Get File
- [x] Get Quota

> Currently, it only supports the functions mentioned above, but it covers more frequently used features. If you require additional functionality, please [open an issue](https://github.com/chris-lsn/pikpak-js-sdk/issues/new).
## Usage

```javascript
const pikpak = new PikPak("username", "password");
const tasks = await pikpak.getTasks();
```

## Development

This project is based on the js runtime of [Bun](https://github.com/oven-sh/bun). Please make sure you have installed the bun cli before running the project.

To run the project in development mode, run the following command:

```bash
bun run dev
```

## License

[MIT](https://choosealicense.com/licenses/mit/)
15 changes: 15 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.1/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noNonNullAssertion": "off"
}
}
}
}
7 changes: 7 additions & 0 deletions build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import dts from "bun-plugin-dts";

await Bun.build({
entrypoints: ["./src/index.ts"],
outdir: "./build",
plugins: [dts()],
});
Binary file added bun.lockb
Binary file not shown.
3 changes: 3 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
};
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "pikpak-js",
"version": "1.1.2",
"author": {
"name": "chris-lsn",
"email": "[email protected]"
},
"files": [
"build/index.js",
"build/index.d.ts"
],
"module": "index.ts",
"type": "module",
"main": "build/index.js",
"scripts": {
"dev": "bun run --watch ./src/index.ts",
"test": "bun test ./src/tests/*.ts",
"build": "bun run build.ts",
"check": "bunx @biomejs/biome check --apply .",
"release": "bunx release-it",
"prepare": "husky install"
},
"devDependencies": {
"@biomejs/biome": "1.4.1",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@release-it/conventional-changelog": "^8.0.1",
"bun-plugin-dts": "^0.2.1",
"bun-types": "latest",
"husky": "^8.0.3",
"release-it": "^17.0.1"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"jwt-decode": "^4.0.0"
}
}
Loading

0 comments on commit 0c2eb3d

Please sign in to comment.