Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
pionxzh committed Dec 5, 2022
0 parents commit c75b0f2
Show file tree
Hide file tree
Showing 26 changed files with 4,056 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

[*.{diff,md}]
trim_trailing_whitespace = false
11 changes: 11 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
root: true,
extends: [
'@pionxzh/eslint-config-ts',
],
rules: {
'no-console': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': 'off',
},
}
63 changes: 63 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Release

on:
push:
branches:
- '**'

jobs:
release:
if: "contains(github.event.head_commit.message, 'chore: release')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Use Node.js v16
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: https://registry.npmjs.org/
cache: pnpm

- run: pnpm install

- name: Build
run: pnpm run build

- name: Lint
run: pnpm run lint

- name: Test
run: pnpm run test

- name: Release
run: |
pnpm run clean
pnpm run release:ci
- name: Git commit
id: commit
run: |
git config --local user.email github-actions[bot]@users.noreply.github.com
git config --local user.name github-actions[bot]
git config --global core.autocrlf true
git config --global core.safecrlf false
git add .
git commit -m "CI build" -a
continue-on-error: true

- name: Git push
uses: ad-m/github-push-action@master
if: ${{ steps.commit.outcome == 'success' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}

- name: Log
if: ${{ steps.commit.outcome != 'success' }}
run: echo Nothing to commit.
39 changes: 39 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Check

on:
push:
branches:
- '**'
pull_request:
branches:
- main

jobs:
check:
if: "!contains(github.event.head_commit.message, 'chore: release')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Use Node.js v16
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: https://registry.npmjs.org/
cache: pnpm

- run: pnpm install

- name: Build
run: pnpm run build

- name: Lint
run: pnpm run lint

- name: Test
run: pnpm run test
16 changes: 16 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: release-please

on:
push:
branches:
- main

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: node
command: manifest
monorepo-tags: true
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
packages/**/dist
shared/**/dist
*.local
.turbo

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

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

pnpm exec lint-staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm run test
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) 2022-Present Pionxzh

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.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ChatGPT Exporter
==========================

![license](https://img.shields.io/github/license/pionxzh/chatgpt-exporter?color=red)
[![](https://img.shields.io/static/v1?label=%20&message=GreasyFork&style=flat-square&labelColor=7B0000&color=960000&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3ggEBCQHM3fXsAAAAVdJREFUOMudkz2qwkAUhc/goBaGJBgUtBCZyj0ILkpwAW7Bws4yO3AHLiCtEFD8KVREkoiFxZzX5A2KGfN4F04zMN+ce+5c4LMUgDmANYBnrnV+plBSi+FwyHq9TgA2LQpvCiEiABwMBtzv95RSfoNEHy8DYBzHrNVqVEr9BWKcqNFoxF6vx3a7zc1mYyC73a4MogBg7vs+z+czO50OW60Wt9stK5UKp9Mpj8cjq9WqDTBHnjAdxzGQZrPJw+HA31oulzbAWgLoA0CWZVBKIY5jzGYzdLtdE9DlcrFNrY98zobqOA6TJKHW2jg4nU5sNBpFDp6mhVe5rsvVasUwDHm9Xqm15u12o+/7Hy0gD8KatOd5vN/v1FozTVN6nkchxFuI6hsAAIMg4OPxMJCXdtTbR7JJCMEgCJhlGUlyPB4XfumozInrupxMJpRSRtZlKoNYl+m/6/wDuWAjtPfsQuwAAAAASUVORK5CYII=)](https://greasyfork.org/scripts/456055-chatgpt-exporter)

A GreasyFork script to export the chat history of [ChatGPT](https://chatgpt.com/).

Supported Formats:
- Text
- Html
- JSON (TODO)
- GIF (TODO)

# Prerequisites

Install **Tampermonkey** **[Chrome](https://www.tampermonkey.net/)** / **[Firefox](https://addons.mozilla.org/firefox/addon/tampermonkey/)** / **[Edge](https://microsoftedge.microsoft.com/addons/detail/tampermonkey/iikmkjmpaadaobahmlepeloendndfphd?hl=zh-CN)**


# UserScript

| Greasyfork | GitHub |
| ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| [Insatall](https://greasyfork.org/scripts/456055-chatgpt-exporter) | [Insatall](https://raw.githubusercontent.com/pionxzh/chatgpt-exporter/main/dist/chatgpt.user.js) |
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + TS</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
37 changes: 37 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@pionxzh/chatgpt-exporter",
"type": "module",
"version": "1.0.0",
"private": true,
"packageManager": "[email protected]",
"author": "pionxzh",
"license": "MIT",
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev",
"test": "turbo run test",
"lint": "turbo run lint",
"lint:fix": "turbo run lint:fix",
"clean": "rimraf ./dist",
"release:ci": "cpy packages/**/dist/*.user.js dist --flat",
"prepare": "husky install"
},
"devDependencies": {
"@pionxzh/eslint-config-ts": "^0.1.1",
"@types/node": "^18.11.10",
"cpy-cli": "^4.2.0",
"eslint": "^8.29.0",
"husky": "^8.0.2",
"lint-staged": "^13.1.0",
"rimraf": "^3.0.2",
"sass": "^1.56.1",
"turbo": "^1.6.3",
"typescript": "^4.9.3"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "pnpm exec eslint"
}
}
25 changes: 25 additions & 0 deletions packages/userscript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@pionxzh/chatgpt-userscript",
"type": "module",
"version": "1.0.0",
"private": true,
"title": "ChatGPT Exporter",
"description": "Easily export the whole ChatGPT conversation history for further analysis or sharing.",
"author": "pionxzh",
"license": "MIT",
"scripts": {
"dev": "vite",
"build": "vite build",
"test:type": "tsc --noEmit",
"test": "pnpm run test:type",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"dependencies": {
"sentinel-js": "^0.0.5",
"vite-plugin-monkey": "^2.7.3"
},
"devDependencies": {
"vite": "^3.1.4"
}
}
Loading

0 comments on commit c75b0f2

Please sign in to comment.