Skip to content

Commit

Permalink
初步功能ok
Browse files Browse the repository at this point in the history
  • Loading branch information
imingyu committed Feb 24, 2024
1 parent fd4bda7 commit 71a85ac
Show file tree
Hide file tree
Showing 26 changed files with 6,740 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
test-dist
50 changes: 50 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module.exports = {
root: true,
extends: ['standard', 'alloy', 'alloy/typescript'],
parserOptions: {
project: './tsconfig-eslint.json'
},
rules: {
indent: [
'error',
4,
{
SwitchCase: 1
}
],
quotes: ['error', 'single'],
semi: 0,
radix: ['error', 'as-needed'],
'max-params': ['error', 5],
'func-name-matching': [0, 'always'],
'no-param-reassign': [0],
'no-lone-blocks': [0],
'space-before-function-paren': [0],
'@typescript-eslint/no-this-alias': ['off'],
'no-return-assign': 0
},
overrides: [
{
extends: ['plugin:@typescript-eslint/disable-type-checked'],
files: ['*.js', '*.mjs']
},
{
extends: ['plugin:@typescript-eslint/recommended-requiring-type-checking'],
files: ['*.ts'],
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-unused-vars': ['error'],
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off'
}
}
]
};
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,7 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*


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

pnpm lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
'*.js': ['eslint'],
'*.ts': ['eslint', 'tsc --noEmit']
};
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# registry=https://registry.npmjs.org/
auto-install-peers=true
strict-peer-dependencies=false
16 changes: 16 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
extends: 'eslint-config-alloy/.prettierrc.js',
// 一行最多 120 字符
printWidth: 120,
// 使用 4 个空格缩进
tabWidth: 4,
// 不使用缩进符,而使用空格
useTabs: false,
// 行尾需要有分号
semi: true,
// 使用单引号
singleQuote: true,
// 对象的 key 仅在必要时用引号
quoteProps: 'as-needed',
trailingComma: 'none'
};
25 changes: 25 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"editor.formatOnSave": true,
"eslint.validate": ["javascript", "typescript"],
"files.associations": {
"*.wxss": "css",
"*.wxs": "javascript",
"*.wxml": "html"
},
"[javascript]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit"
}
},
"[typescript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
},
"editor.tabSize": 4
}
67 changes: 67 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"name": "cross-mp-power",
"version": "0.1.0",
"description": "跨平台小程序能力封装",
"main": "esm/index.js",
"module": "esm/index.js",
"types": "src/index.ts",
"sideEffects": false,
"scripts": {
"prepare": "husky install",
"lint:es": "eslint \"./src\" \"./scripts\" \"./test\"",
"fix:es": "eslint --fix \"./src\" \"./scripts\" \"./test\"",
"lint": "lint-staged",
"test": "rimraf ./test-dist && tsc -p ./test/tsconfig.json && mocha ./test-dist/test/*.js ./test-dist/test/**/*.js",
"build:main": "rollup -c rollup.config.js",
"build:dts": "rollup -c rollup.config.dts.js",
"build": "rimraf ./dist && pnpm build:main && pnpm build:dts",
"pub": "cd ./dist && npm publish"
},
"author": {
"name": "imingyu",
"email": "[email protected]"
},
"devDependencies": {
"typescript": "^5.2.2",
"@babel/core": "^7.22.9",
"@babel/preset-env": "^7.22.9",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-replace": "^5.0.2",
"@types/chai": "^4.3.5",
"@types/inquirer": "8",
"@types/mocha": "^10.0.6",
"@types/node": "^20.4.2",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"chai": "^4.3.7",
"chalk": "4",
"chokidar": "^3.5.3",
"eslint": "^8.44.0",
"eslint-config-alloy": "^5.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^16.0.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"husky": "^8.0.3",
"lint-staged": "^13.2.3",
"mocha": "^10.2.0",
"npm-check-updates": "^16.10.15",
"prettier": "^3.0.0",
"rimraf": "^5.0.1",
"rollup": "^3.26.2",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-dts": "^6.1.0",
"unplugin-swc": "^1.3.2"
},
"repository": {
"type": "git",
"url": "git+https://github.com/imingyu/cross-mp-power.git"
},
"keywords": [],
"license": "MIT",
"bugs": {
"url": "https://github.com/imingyu/cross-mp-power/issues"
},
"homepage": "https://github.com/imingyu/cross-mp-power#readme"
}
Loading

0 comments on commit 71a85ac

Please sign in to comment.