Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ErrorErrorError committed Nov 17, 2023
0 parents commit 9100136
Show file tree
Hide file tree
Showing 12 changed files with 1,697 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 18,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"root": true,
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"]
}
}
41 changes: 41 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: cd

on:
release:
types: [published]

env:
HUSKY: 0
TAG_NAME: ${{ github.event.release.tag_name }}

jobs:
publish:
if: ${{ !github.event.release.draft }}
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
packages: write

steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: https://registry.npmjs.org/

- run: corepack enable
- run: corepack prepare pnpm@latest --activate

- name: Install
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- run: pnpm publish --provenance --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_MOCHI_TOKEN}}
NPM_TOKEN: ${{secrets.NPM_MOCHI_TOKEN}}
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: lint

on:
push:
branches:
- '*'
pull_request:
types: [review_requested]

env:
HUSKY: 0

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
- run: corepack enable
- run: corepack prepare pnpm@latest --activate
- run: pnpm install --frozen-lockfile
- run: pnpm lint -f github-annotations
continue-on-error: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
dist/
node_modules/
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
PATH="/usr/local/bin:$PATH"
. "$(dirname -- "$0")/_/husky.sh"

pnpm exec lint-staged
9 changes: 9 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"tabWidth": 2,
"useTabs": false,
"printWidth": 80,
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"endOfLine": "lf"
}
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# @mochiapp/runner
> A test runner used for Mochi modules.
## Installation
Using pnpm:
```bash
pnpm add -D @mochiapp/runner
```

Using npm:
```bash
npm install --save-dev @mochiapp/runner
```

Using yarn:
```bash
yarn add -D @mochiapp/runner
```

## Example
In a test file:
```js
import Source from '../src/source';
import runner from '@mochiapp/runner';

const source = runner(Source);

test('fetch filters', () => {
return source.searchFilters()
.then(r => {
assert.equal(r.length, 1);
});
});

// Rest of the tests...
```

50 changes: 50 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "@mochiapp/runner",
"version": "0.0.1",
"description": "A test runner used for Mochi modules.",
"keywords": [
"mochi",
"runner"
],
"author": "errorerrorerror",
"repository": "https://github.com/Mochi-Team/runner",
"license": "MIT",
"private": false,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"./dist"
],
"dependencies": {
"@types/got": "^9.6.12",
"axios": "^1.6.2"
},
"devDependencies": {
"@mochiapp/js": "^0.0.1",
"@types/node": "^20.9.1",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"eslint": "^8.54.0",
"husky": "^8.0.0",
"lint-staged": "^15.1.0",
"prettier": "^3.1.0",
"typescript": "^5.2.2"
},
"peerDependencies": {
"@mochiapp/js": "^0.0.1"
},
"lint-staged": {
"*.ts": [
"pnpm lint:fix",
"pnpm format"
]
},
"scripts": {
"prepare": "husky install",
"lint": "eslint",
"lint:fix": "eslint --fix",
"format": "prettier -w src",
"format:check": "prettier --check src",
"build": "rm -rf dist/ && tsc"
}
}
Loading

0 comments on commit 9100136

Please sign in to comment.