Browse Source

feat: 初次提交

xbx 2 năm trước cách đây
commit
256d7e4ff8
23 tập tin đã thay đổi với 278 bổ sung0 xóa
  1. 7 0
      .eslintignore
  2. 20 0
      .eslintrc
  3. 30 0
      .gitignore
  4. 1 0
      .husky/_/.gitignore
  5. 36 0
      .husky/_/husky.sh
  6. 4 0
      .husky/commit-msg
  7. 4 0
      .husky/pre-commit
  8. 7 0
      .prettierignore
  9. 41 0
      .prettierrc.js
  10. 1 0
      commitlint.config.cjs
  11. 1 0
      index.d.ts
  12. 2 0
      lib/main.d.ts
  13. 8 0
      lib/main.js
  14. 1 0
      lib/main.js.map
  15. 5 0
      lib/main.ts
  16. 66 0
      package.json
  17. 1 0
      src/main.d.ts
  18. 5 0
      src/main.js
  19. 1 0
      src/main.js.map
  20. 3 0
      src/main.ts
  21. 2 0
      src/vite-env.d.ts
  22. 21 0
      tsconfig.json
  23. 11 0
      vite.config.ts

+ 7 - 0
.eslintignore

@@ -0,0 +1,7 @@
+dist
+errorJson.js
+browser.js
+node_modules
+test
+.gitignore
+.prettierignore

+ 20 - 0
.eslintrc

@@ -0,0 +1,20 @@
+{
+	"root": true,
+	"parser": "@typescript-eslint/parser",
+	"plugins": ["@typescript-eslint", "prettier"],
+	"extends": [
+	  "eslint:recommended",
+	  "plugin:@typescript-eslint/eslint-recommended",
+	  "plugin:@typescript-eslint/recommended"
+	],
+	"rules": {
+	  "prettier/prettier": "error",
+	  "no-useless-escape": "off",
+	  "@typescript-eslint/interface-name-prefix": "off",
+	  "@typescript-eslint/explicit-function-return-type": "off",
+	  "@typescript-eslint/explicit-module-boundary-types": "off",
+	  "@typescript-eslint/no-explicit-any": "off",
+	  "@typescript-eslint/no-empty-function": "off"
+	}
+  }
+  

+ 30 - 0
.gitignore

@@ -0,0 +1,30 @@
+.DS_Store
+node_modules
+vue.config
+/dist
+/testtemplate.txt
+.jsbeautifyrc
+# local env files
+.env.local
+.env.*.local
+
+# Log files
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+
+# lock
+*-lock.json
+*-lock.yaml
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
+ZJS-FT.zip
+/node_modules/

+ 1 - 0
.husky/_/.gitignore

@@ -0,0 +1 @@
+*

+ 36 - 0
.husky/_/husky.sh

@@ -0,0 +1,36 @@
+#!/usr/bin/env sh
+if [ -z "$husky_skip_init" ]; then
+  debug () {
+    if [ "$HUSKY_DEBUG" = "1" ]; then
+      echo "husky (debug) - $1"
+    fi
+  }
+
+  readonly hook_name="$(basename -- "$0")"
+  debug "starting $hook_name..."
+
+  if [ "$HUSKY" = "0" ]; then
+    debug "HUSKY env variable is set to 0, skipping hook"
+    exit 0
+  fi
+
+  if [ -f ~/.huskyrc ]; then
+    debug "sourcing ~/.huskyrc"
+    . ~/.huskyrc
+  fi
+
+  readonly husky_skip_init=1
+  export husky_skip_init
+  sh -e "$0" "$@"
+  exitCode="$?"
+
+  if [ $exitCode != 0 ]; then
+    echo "husky - $hook_name hook exited with code $exitCode (error)"
+  fi
+
+  if [ $exitCode = 127 ]; then
+    echo "husky - command not found in PATH=$PATH"
+  fi
+
+  exit $exitCode
+fi

+ 4 - 0
.husky/commit-msg

@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+
+npx --no-install commitlint --edit "$1"

+ 4 - 0
.husky/pre-commit

@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+
+npx lint-staged

+ 7 - 0
.prettierignore

@@ -0,0 +1,7 @@
+# Ignore artifacts:
+dist
+.husky
+node_modules
+.gitignore
+.eslintignore
+.prettierignore

+ 41 - 0
.prettierrc.js

@@ -0,0 +1,41 @@
+module.exports = {
+	// 一行最多多少个字符
+	printWidth: 150,
+	// 指定每个缩进级别的空格数
+	tabWidth: 2,
+	// 使用制表符而不是空格缩进行
+	useTabs: true,
+	// 在语句末尾是否需要分号
+	semi: true,
+	// 是否使用单引号
+	singleQuote: true,
+	// 更改引用对象属性的时间 可选值"<as-needed|consistent|preserve>"
+	quoteProps: 'as-needed',
+	// 在JSX中使用单引号而不是双引号
+	jsxSingleQuote: false,
+	// 多行时尽可能打印尾随逗号。(例如,单行数组永远不会出现逗号结尾。) 可选值"<none|es5|all>",默认none
+	trailingComma: 'es5',
+	// 在对象文字中的括号之间打印空格
+	bracketSpacing: true,
+	// jsx 标签的反尖括号需要换行
+	jsxBracketSameLine: false,
+	// 在单独的箭头函数参数周围包括括号 always:(x) => x \ avoid:x => x
+	arrowParens: 'always',
+	// 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码
+	rangeStart: 0,
+	rangeEnd: Infinity,
+	// 指定要使用的解析器,不需要写文件开头的 @prettier
+	requirePragma: false,
+	// 不需要自动在文件开头插入 @prettier
+	insertPragma: false,
+	// 使用默认的折行标准 always\never\preserve
+	proseWrap: 'preserve',
+	// 指定HTML文件的全局空格敏感度 css\strict\ignore
+	htmlWhitespaceSensitivity: 'css',
+
+	//在 windows 操作系统中换行符通常是回车 (CR) 加换行分隔符 (LF),也就是回车换行(CRLF),
+	//然而在 Linux 和 Unix 中只使用简单的换行分隔符 (LF)。
+	//对应的控制字符为 "\n" (LF) 和 "\r\n"(CRLF)。auto意为保持现有的行尾
+	// 换行符使用 lf 结尾是 可选值"<auto|lf|crlf|cr>"
+	endOfLine: 'auto',
+}; 

+ 1 - 0
commitlint.config.cjs

@@ -0,0 +1 @@
+module.exports = { extends: ['@commitlint/config-conventional'] };

+ 1 - 0
index.d.ts

@@ -0,0 +1 @@
+

+ 2 - 0
lib/main.d.ts

@@ -0,0 +1,2 @@
+declare const aaa: (cc: string) => void;
+export { aaa };

+ 8 - 0
lib/main.js

@@ -0,0 +1,8 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.aaa = void 0;
+var aaa = function (cc) {
+    console.log(cc);
+};
+exports.aaa = aaa;
+//# sourceMappingURL=main.js.map

+ 1 - 0
lib/main.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";;;AAAA,IAAM,GAAG,GAAG,UAAC,EAAS;IACpB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC,CAAC;AAEO,kBAAG"}

+ 5 - 0
lib/main.ts

@@ -0,0 +1,5 @@
+const aaa = (cc:string) => {
+  console.log(cc);
+};
+
+export { aaa };

+ 66 - 0
package.json

@@ -0,0 +1,66 @@
+{
+  "name": "zw_monitor",
+  "private": true,
+  "version": "0.0.0",
+  "type": "module",
+  "files": [
+    "dist",
+    "index.d.ts"
+  ],
+  "main": "./dist/index.umd.cjs",
+  "module": "./dist/index.js",
+  "types": "./index.d.ts",
+  "exports": {
+    "types": "./index.d.ts",
+    "import": "./dist/index.js",
+    "require": "./dist/index.umd.cjs"
+  },
+  "scripts": {
+    "dev": "vite",
+    "build": "tsc && vite build",
+    "prepare": "husky install",
+    "commit": "git-cz",
+    "lint": "prettier --write"
+  },
+  "dependencies": {
+    "core-js": "^3.19.1",
+    "error-stack-parser": "^2.1.4",
+    "js-base64": "^3.7.3",
+    "pako": "^2.1.0",
+    "path-to-regexp": "^6.2.0",
+    "rrweb": "^1.1.3",
+    "tslib": "^2.4.1",
+    "ua-parser-js": "^1.0.32",
+    "web-vitals": "^3.1.0"
+  },
+  "devDependencies": {
+    "@commitlint/cli": "^17.3.0",
+    "@commitlint/config-conventional": "^17.3.0",
+    "@typescript-eslint/eslint-plugin": "^5.46.1",
+    "@typescript-eslint/parser": "^5.46.1",
+    "commitizen": "^4.2.6",
+    "cz-conventional-changelog": "^3.3.0",
+    "eslint": "^8.29.0",
+    "eslint-plugin-prettier": "^4.2.1",
+    "husky": "^8.0.2",
+    "lint-staged": "^13.1.0",
+    "prettier": "^2.8.0",
+    "typescript": "^4.9.4",
+    "vite": "^4.0.4"
+  },
+  "lint-staged": {
+    "**/*.{ts,tsx,json}": [
+      "prettier --write",
+      "eslint --fix"
+    ]
+  },
+  "repository": {
+    "type": "git",
+    "url": "git@github.com:xy-sea/web-see.git"
+  },
+  "config": {
+    "commitizen": {
+      "path": "./node_modules/cz-conventional-changelog"
+    }
+  }
+}

+ 1 - 0
src/main.d.ts

@@ -0,0 +1 @@
+export {};

+ 5 - 0
src/main.js

@@ -0,0 +1,5 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var main_1 = require("../lib/main");
+(0, main_1.aaa)("cc");
+//# sourceMappingURL=main.js.map

+ 1 - 0
src/main.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";;AAAA,oCAAkC;AAElC,IAAA,UAAG,EAAC,IAAI,CAAC,CAAC"}

+ 3 - 0
src/main.ts

@@ -0,0 +1,3 @@
+import { aaa } from "../lib/main";
+
+aaa("cc");

+ 2 - 0
src/vite-env.d.ts

@@ -0,0 +1,2 @@
+/// <reference types="vite/client" />
+

+ 21 - 0
tsconfig.json

@@ -0,0 +1,21 @@
+{
+  "compilerOptions": {
+    "target": "ESNext",
+    "useDefineForClassFields": true,
+    "module": "ESNext",
+    "lib": ["ESNext", "DOM"],
+    "moduleResolution": "Node",
+    "strict": true,
+    "sourceMap": true,
+    "resolveJsonModule": true,
+    "isolatedModules": true,
+    "esModuleInterop": true,
+    "noEmit": true,
+    "noUnusedLocals": true,
+    "noUnusedParameters": true,
+    "noImplicitReturns": true,
+    "skipLibCheck": true
+  },
+  "include": ["src"],
+  "exclude": ["node_modules", "test", "dist"]
+}

+ 11 - 0
vite.config.ts

@@ -0,0 +1,11 @@
+import { defineConfig } from 'vite'
+
+export default defineConfig({
+  build: {
+    lib: {
+      entry: './lib/main.ts',
+      name: 'index',
+      fileName: 'index'
+    }
+  }
+})