kai 1 year ago
parent
commit
cdc2ad6101
  1. 4
      .eslintignore
  2. 28
      .eslintrc
  3. 2
      .gitignore
  4. 10
      .prettierrc
  5. 11
      buildConfig/webpack.config.js
  6. 7134
      package-lock.json
  7. 68
      package.json
  8. 15
      src/base.ts
  9. 10
      src/index.ts
  10. 2
      types/console.d.ts
  11. 72
      types/dpa.ts
  12. 1
      types/widget-operation.d.ts

4
.eslintignore

@ -0,0 +1,4 @@
node_modules
buildConfig
.vscode
.github

28
.eslintrc

@ -0,0 +1,28 @@
{
"root": true,
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"extends": ["prettier", "plugin:@typescript-eslint/recommended"],
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": ["@typescript-eslint/eslint-plugin"],
"rules": {
"@typescript-eslint/no-unused-vars": 0,
"react/display-name": 0,
"react/prop-types": 0,
"@typescript-eslint/adjacent-overload-signatures": 0,
"@typescript-eslint/ban-types": 0,
"@typescript-eslint/no-empty-interface": 0
}
}

2
.gitignore

@ -4,4 +4,4 @@ build
regex.md regex.md
index.dts index.dts
*.code-workspace *.code-workspace
pnpm-lock.yaml

10
.prettierrc

@ -0,0 +1,10 @@
{
"printWidth": 140,
"semi": true,
"useTabs": true,
"tabWidth": 4,
"arrowParens": "always",
"singleQuote": true,
"trailingComma": "none",
"endOfLine": "auto"
}

11
buildConfig/webpack.config.js

@ -1,14 +1,3 @@
/*
* @Author: BATU1579
* @CreateDate: 2022-05-24 16:55:58
* @LastEditor: BATU1579
* @LastTime: 2022-09-06 14:30:21
* @FilePath: \\buildConfig\\webpack.config.js
* @Description: 默认设置
*
* https://blog.csdn.net/Zong_0915/article/details/115831373
*/
const path = require('path')
const { CleanWebpackPlugin } = require('clean-webpack-plugin') const { CleanWebpackPlugin } = require('clean-webpack-plugin')
module.exports = { module.exports = {

7134
package-lock.json

File diff suppressed because it is too large

68
package.json

@ -1,34 +1,38 @@
{ {
"name": "dpa-andriod-starter", "name": "dpa-andriod-starter",
"version": "2.5.3", "version": "1.0.0",
"description": "一个用来快速开始编写 dpa-andriod 脚本的模板", "description": "一个用来快速开始编写 dpa-andriod 脚本的模板",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "webpack --config ./buildConfig/webpack.dev.js" "build": "webpack --config ./buildConfig/webpack.dev.js"
}, },
"keywords": [ "keywords": [
"dpa-andriod", "dpa-andriod",
"autojs" "autojs"
], ],
"author": "batu1579", "devDependencies": {
"license": "MPL-2.0", "@babel/core": "^7.18.0",
"devDependencies": { "@babel/plugin-proposal-object-rest-spread": "^7.18.9",
"@babel/core": "^7.18.0", "@babel/plugin-transform-runtime": "^7.18.10",
"@babel/plugin-proposal-object-rest-spread": "^7.18.9", "@babel/preset-env": "^7.18.10",
"@babel/plugin-transform-runtime": "^7.18.10", "@typescript-eslint/eslint-plugin": "^5.4.0",
"@babel/preset-env": "^7.18.10", "@typescript-eslint/parser": "^5.4.0",
"babel-loader": "^8.2.5", "babel-loader": "^8.2.5",
"clean-webpack-plugin": "^4.0.0", "clean-webpack-plugin": "^4.0.0",
"core-js": "^3.22.6", "core-js": "^3.22.6",
"ts-loader": "^9.3.0", "eslint": "8",
"typescript": "^4.6.4", "eslint-config-prettier": "^8.3.0",
"webpack": "^5.72.1", "eslint-plugin-prettier": "^4.0.0",
"webpack-cli": "^4.9.2", "prettier": "^2.4.1",
"webpack-merge": "^5.8.0" "ts-loader": "^9.3.0",
}, "typescript": "^4.6.4",
"dependencies": { "webpack": "^5.72.1",
"@babel/preset-react": "^7.18.6", "webpack-cli": "^4.9.2",
"@babel/runtime": "^7.18.9", "webpack-merge": "^5.8.0"
"babel-preset-mobx": "^2.0.0" },
} "dependencies": {
"@babel/preset-react": "^7.18.6",
"@babel/runtime": "^7.18.9",
"babel-preset-mobx": "^2.0.0"
}
} }

15
src/base.ts

@ -0,0 +1,15 @@
import { Events } from 'events';
export class DPBase extends Events {
constructor() {
super();
}
init() {
console.log('init');
}
start() {
console.log('start');
}
}

10
src/index.ts

@ -1 +1,9 @@
id('res').bounds(0, 0, 100, 100).visibleToUser() import { DPBase } from './base';
class Hongguo extends DPBase {
constructor() {
super();
}
}
const hongguo = new Hongguo().start();

2
types/console.d.ts

@ -13,7 +13,7 @@ declare module 'console' {
/** /**
* @description: Web console 使 `log` , `print` * @description: Web console 使 `log` , `print`
*/ */
var console: Console const console: Console
interface Console { interface Console {
/** /**

72
types/dpa.ts

@ -30,21 +30,83 @@ declare module "dpa" {
* @param {string} action input * @param {string} action input
* @example * @example
* ```typescript * ```typescript
* dpa.getOutParam('输出内容'); * dpa.setOutParam('输出内容');
* ``` * ```
*/ */
setOutParam(content: any, action?: string): void; setOutParam(content: any, action?: string): void;
/** /**
* @description: * @description:
* @param {+} content * @param {string} type "find" | "select" | "delete"
* @param {string} action input * @param {string} content where查询条件
* @example
* ```typescript
* dpa.optDataTable("find", { name: '名字', age: 18 });
* ```
*/
optDataTable(
type: "find" | "select" | "delete",
content?: Record<string, string | number>
): void;
/**
* @description:
* @param {string} type add
* @param {string} content
* @example
* ```typescript
* dpa.optDataTable("add", { name: '名字', age: 18 });
* ```
*/
optDataTable(type: "add", content?: Record<string, string | number>): void;
/**
* @description:
* @param {string} type add
* @param {string} content
* @example
* ```typescript
* dpa.optDataTable("add", [{ name: '名字1', age: 18 }, { name: '名字2', age: 19 }]);
* ```
*/
optDataTable(
type: "add",
content?: Record<string, string | number>[]
): void;
/**
* @description:
* @param {string} type "find" | "select" | "delete"
* @param {string} content where查询条件, data更新数据
* @example
* ```typescript
* dpa.optDataTable("find", { name: '名字', age: 18 });
* ```
*/
optDataTable(
type: "update",
content?: {
where: Record<string, string | number>;
data: Record<string, string | number>;
}
): void;
/**
* @description: where
* @param {string} type "thenUpdate"
* @param {string} content where查询条件, data更新数据
* @example * @example
* ```typescript * ```typescript
* dpa.getOutParam('输出内容'); * dpa.optDataTable("find", { name: '名字', age: 18 });
* ``` * ```
*/ */
optDataTable(type, action?: string): void; optDataTable(
type: "thenUpdate",
content?: {
where: Record<string, string | number>;
data: Record<string, string | number>;
}
): void;
} }
interface DPAEnv { interface DPAEnv {

1
types/widget-operation.d.ts

@ -1132,7 +1132,6 @@ declare module 'widget-operation' {
* let clickableNames = names.find(clickable()); * let clickableNames = names.find(clickable());
* ``` * ```
*/ */
// @ts-ignore
find(selector: UiSelector): UiCollection; find(selector: UiSelector): UiCollection;
/** /**

Loading…
Cancel
Save