Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaoboy committed May 21, 2024
0 parents commit 530292d
Show file tree
Hide file tree
Showing 9 changed files with 243 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Releases

on:
push:
tags:
- "v*"

jobs:
release:
name: release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: "build ts"
run: |
npm i pnpm -g
pnpm i
pnpm run build
- uses: ncipollo/release-action@v1
with:
artifacts: "./es5/*.js"
86 changes: 86 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Logs
dist
es5
.parcel-cache
fish.exe.stackdump

target

*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
bundle
pnpm-lock.yaml

# Runtime data
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://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/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# OS X temporary files
.DS_Store

# IntelliJ IDEA project files; if you want to commit IntelliJ settings, this recipe may be helpful:
# https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
.idea/
*.iml

# Rush temporary files
common/deploy/
common/temp/
common/autoinstallers/*/.npmrc
**/.rush/temp/

# Heft temporary files
.heft

/apps/*/dist

/html
19 changes: 19 additions & 0 deletions babel/hack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const fnVar = (t) =>
t.variableDeclaration("var", [
t.variableDeclarator(
t.identifier("__"),
t.functionExpression(null, [], t.blockStatement([])),
),
]);
module.exports = function ({ types: t }) {
return {
visitor: {
FunctionDeclaration(path) {
path.node.body?.body?.unshift?.(fnVar(t));
},
ArrowFunctionExpression(path) {
// path.node.body?.body?.unshift?.(fnVar(t))
},
},
};
};
45 changes: 45 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "@mpv-easy/mpsm-scripts",
"private": true,
"version": "0.1.0",
"files": [
"bin",
"dist",
"es5",
"bundle",
"readme.md",
"package.json"
],
"description": "@mpv-easy/mpsm-scripts",
"main": "./dist/index.js",
"bin": "./bin/cli",
"types": "./dist/index.d.ts",
"scripts": {
"bundle": "esbuild ./src/*.ts --bundle --outdir=./bundle --platform=node",
"build": "pnpm run bundle && pnpm run es5",
"es5": "babel --presets @babel/preset-env ./bundle -d es5 --plugins ./babel/hack.js",
"lint": "biome check --apply-unsafe ./",
"format": "biome format --write ./"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@mpv-easy/tool": "^0.1.5",
"esbuild": "^0.21.3",
"typescript": "^5.3.3",
"@babel/cli": "^7.23.9",
"@babel/core": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@babel/preset-typescript": "^7.23.3",
"@biomejs/biome": "^1.5.3",
"@types/node": "^20.11.17"
},
"browserslist": [
"iOS >= 9",
"Android >= 4.4",
"last 2 versions",
"> 0.2%",
"not dead"
]
}
5 changes: 5 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## @mpv-easy/mpsm-scripts

```bash
mpsm install speed
```
3 changes: 3 additions & 0 deletions scripts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"speed": "https://github.com/mpv-easy/mpsm-scripts/releases/download/v0.1.0/speed.js"
}
27 changes: 27 additions & 0 deletions src/speed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { PropertyNumber, addKeyBinding } from "@mpv-easy/tool";

const speed = new PropertyNumber("speed");
addKeyBinding(
"MOUSE_BTN0",
"MPV_EASY_SPEED",
({ event }) => {
switch (event) {
case "down": {
speed.value = 2;
break;
}
case "up": {
speed.value = 1;
break;
}
case "press": {
break;
}
}
},
{
complex: true,
repeatable: true,
forced: false,
},
);
7 changes: 7 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../tsconfig.build.json",
"compilerOptions": {
"outDir": "./dist/"
},
"include": ["src"]
}
25 changes: 25 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"outDir": "./dist",
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ESNext", "ES2022", "es2021", "DOM"],
"allowJs": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"noEmit": false,
"noEmitOnError": false,
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"declaration": true,
"declarationMap": false,
"sourceMap": false
},
"include": ["src"]
}

0 comments on commit 530292d

Please sign in to comment.