Skip to content

Commit

Permalink
chore: add gh-pages docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyingchun committed Aug 4, 2024
1 parent 8d9d073 commit 9e85667
Show file tree
Hide file tree
Showing 67 changed files with 16,586 additions and 5,072 deletions.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Something not working as it should
title: ""
labels: "type: bug \U0001F41B"
assignees: tianyingchun
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Environment (please complete the following information):**

- @hyperse/track version:
- Nodejs version

**Additional context**
Add any other context about the problem here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
48 changes: 48 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: github pages

on:
push:
branches:
- main # Set a branch name to trigger deployment
paths:
- '.github/workflows/gh-pages.yml'
- 'website/**'
pull_request:

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
defaults:
run:
working-directory: website
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: 📥 Install Dependencies
run: yarn --frozen-lockfile

- name: Build
run: |
yarn build
- name: Unit tests
run: |
yarn test
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./website/build
434 changes: 217 additions & 217 deletions .yarn/releases/yarn-4.3.0.cjs → .yarn/releases/yarn-4.3.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.3.0.cjs
yarnPath: .yarn/releases/yarn-4.3.1.cjs
30 changes: 17 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
"./dist/",
"./index.js"
],
"workspaces": [
"website",
"./"
],
"scripts": {
"build": "tsup",
"lint": "eslint .",
Expand All @@ -50,33 +54,33 @@
},
"devDependencies": {
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.6",
"@changesets/cli": "2.27.7",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@hyperse/eslint-config-hyperse": "^1.0.10",
"@hyperse/exec-program": "^1.0.6",
"@types/node": "^20.14.9",
"@hyperse/eslint-config-hyperse": "^1.0.12",
"@hyperse/exec-program": "^1.0.10",
"@types/node": "^22.1.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"commitizen": "4.3.0",
"cz-conventional-changelog": "3.3.0",
"eslint": "^9.6.0",
"husky": "9.0.11",
"lint-staged": "15.2.7",
"next": "14.2.4",
"eslint": "^9.8.0",
"husky": "9.1.4",
"lint-staged": "15.2.8",
"next": "14.2.5",
"npm-run-all": "^4.1.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tsup": "^8.1.0",
"typescript": "^5.5.2",
"vite": "^5.3.2",
"vitest": "^1.6.0"
"tsup": "^8.2.4",
"typescript": "^5.5.4",
"vite": "^5.3.5",
"vitest": "^2.0.5"
},
"engines": {
"node": ">=18"
},
"publishConfig": {
"access": "public"
},
"packageManager": "yarn@4.3.0"
"packageManager": "yarn@4.3.1"
}
46 changes: 46 additions & 0 deletions tests/ctx.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { pipe } from '../src/index.js';

type TrackerOptions<T> = {
createCtx: () => Promise<T> | T;
};

class Tracker<Ctx, Result> {
constructor(private options: TrackerOptions<Ctx>) {}
private hooks: Array<(data: { ctx: Ctx; input: Result }) => Promise<Result>> =
[];
get ctx() {
const fn = pipe(this.options.createCtx, (ctx) => {
return ctx;
});
return fn();
}

get pipe() {
return pipe;
}

async transform(fn: (data: { ctx: Ctx; input: Result }) => Promise<Result>) {
this.hooks.push(fn);
}
}

const tracker = new Tracker<{ env: string }, { name: string; pwd: number }>({
createCtx: () => {
return {
env: 'env',
};
},
});

tracker.transform(async (data) => {
const result = await pipe(
({ ctx, input }: typeof data) => {
return { name: ctx.env };
},
(ctx) => {
return { name: '1', pwd: 1 };
}
)(data);

return result;
});
9 changes: 8 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
"noImplicitThis": false,
"jsx": "preserve"
},
"exclude": ["**/node_modules", "**/.*/", "dist", "build"],
"exclude": [
"**/node_modules",
"**/.*/",
"dist",
"build",
"**/website/**/*.ts",
"**/website/**/*.tsx"
],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}
5 changes: 2 additions & 3 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { fileURLToPath } from 'url';
import { configDefaults, defineConfig } from 'vitest/config';

export default defineConfig({
test: {
globals: true,
testTimeout: 100000000,
testTimeout: 100000,
exclude: [...configDefaults.exclude],
alias: {
'~/': fileURLToPath(new URL('./src/', import.meta.url)),
'@/': new URL('./src/', import.meta.url).pathname,
},
include: ['**/?(*.){test,spec}.?(c|m)[jt]s?(x)'],
},
Expand Down
135 changes: 135 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# 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/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# 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
.cache

# 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.*

.netrc
.env
.env.*
build
1 change: 1 addition & 0 deletions website/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @hyperse/track-docs
Loading

0 comments on commit 9e85667

Please sign in to comment.