feat(permission): 添加权限判断是否有效
This commit is contained in:
parent
d024f074e1
commit
2fc19806b3
|
|
@ -0,0 +1,9 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
# indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
.husky/
|
||||||
|
Dockerfile
|
||||||
|
.hbuilderx/
|
||||||
|
.vite/
|
||||||
|
|
||||||
|
/dist/
|
||||||
|
/public/
|
||||||
|
/docs/
|
||||||
|
bin/
|
||||||
|
|
||||||
|
pnpm-lock.yaml
|
||||||
|
uni_modules/
|
||||||
|
|
||||||
|
*.md
|
||||||
|
libs/
|
||||||
|
|
||||||
|
src/libs/
|
||||||
|
src/static/
|
||||||
|
|
||||||
|
/patches/
|
||||||
|
wxcomponents/
|
||||||
|
lib/
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
// 配置参考:https://eslint.bootcss.com/docs/user-guide/configuring
|
||||||
|
// import { defineConfig } from 'eslint-define-config';
|
||||||
|
const { defineConfig } = require("eslint-define-config");
|
||||||
|
|
||||||
|
module.exports = defineConfig({
|
||||||
|
root: true,
|
||||||
|
env: {
|
||||||
|
node: true,
|
||||||
|
browser: true,
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
uni: true,
|
||||||
|
getCurrentPages: true,
|
||||||
|
plus: true,
|
||||||
|
wx: true,
|
||||||
|
__BASE_URL__: true,
|
||||||
|
},
|
||||||
|
extends: ["eslint:recommended"],
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: "latest",
|
||||||
|
sourceType: "module",
|
||||||
|
ecmaFeatures: {
|
||||||
|
impliedStrict: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
|
||||||
|
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: [
|
||||||
|
"**/__tests__/*.{j,t}s?(x)",
|
||||||
|
"**/tests/unit/**/*.spec.{j,t}s?(x)",
|
||||||
|
],
|
||||||
|
env: {
|
||||||
|
mocha: true,
|
||||||
|
jest: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
coverage
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"*.{js,jsx,ts,tsx,vue}": "npm run lint --"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
# https://prettier.io/docs/en/ignore.html
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
.husky/
|
||||||
|
Dockerfile
|
||||||
|
.hbuilderx/
|
||||||
|
.vite/
|
||||||
|
|
||||||
|
/dist/
|
||||||
|
/public/*
|
||||||
|
!/public/index.html
|
||||||
|
/docs/
|
||||||
|
/bin/
|
||||||
|
|
||||||
|
pnpm-lock.yaml
|
||||||
|
uni_modules/
|
||||||
|
|
||||||
|
*.md
|
||||||
|
wxcomponents/
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
module.exports = {
|
||||||
|
presets: [
|
||||||
|
["@babel/preset-env", { targets: { node: "current" } }],
|
||||||
|
"@babel/preset-typescript",
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,129 @@
|
||||||
|
/**
|
||||||
|
* feat:新增功能
|
||||||
|
* fix:bug 修复
|
||||||
|
* docs:文档更新
|
||||||
|
* style:不影响程序逻辑的代码修改(修改空白字符,格式缩进,补全缺失的分号等,没有改变代码逻辑)
|
||||||
|
* refactor:重构代码(既没有新增功能,也没有修复 bug)
|
||||||
|
* perf:性能, 体验优化
|
||||||
|
* test:新增测试用例或是更新现有测试
|
||||||
|
* build:主要目的是修改项目构建系统(例如 glup,webpack,rollup 的配置等)的提交
|
||||||
|
* ci:主要目的是修改项目继续集成流程(例如 Travis,Jenkins,GitLab CI,Circle等)的提交
|
||||||
|
* chore:不属于以上类型的其他类型,比如构建流程, 依赖管理
|
||||||
|
* revert:回滚某个更早之前的提交
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
extends: ["@commitlint/config-conventional"],
|
||||||
|
// rules: {
|
||||||
|
// "type-enum": [
|
||||||
|
// 2,
|
||||||
|
// "always",
|
||||||
|
// ["feat", "fix", "docs", "style", "refactor", "test", "chore", "revert"],
|
||||||
|
// ],
|
||||||
|
// "subject-full-stop": [0, "never"],
|
||||||
|
// "subject-case": [0, "never"],
|
||||||
|
// },
|
||||||
|
prompt: {
|
||||||
|
messages: {
|
||||||
|
skip: "跳过",
|
||||||
|
max: "最多 %d 个字符",
|
||||||
|
min: "最少 %d 个字符",
|
||||||
|
emptyWarning: "不能为空",
|
||||||
|
upperLimitWarning: "超出字数限制",
|
||||||
|
lowerLimitWarning: "低于字数限制",
|
||||||
|
},
|
||||||
|
questions: {
|
||||||
|
type: {
|
||||||
|
description: "选择提交类型",
|
||||||
|
enum: {
|
||||||
|
feat: {
|
||||||
|
description: "一个新特性",
|
||||||
|
title: "新特性",
|
||||||
|
emoji: "✨",
|
||||||
|
},
|
||||||
|
fix: {
|
||||||
|
description: "一个漏洞修复",
|
||||||
|
title: "漏洞修复",
|
||||||
|
emoji: "🐛",
|
||||||
|
},
|
||||||
|
docs: {
|
||||||
|
description: "仅更改文档",
|
||||||
|
title: "文档",
|
||||||
|
emoji: "📚",
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
description: "不影响代码含义的更改(空白符、格式化、缺少分号等)",
|
||||||
|
title: "样式",
|
||||||
|
emoji: "💎",
|
||||||
|
},
|
||||||
|
refactor: {
|
||||||
|
description: "既不修复错误也不添加功能的代码更改",
|
||||||
|
title: "重构",
|
||||||
|
emoji: "📦",
|
||||||
|
},
|
||||||
|
perf: {
|
||||||
|
description: "提高性能的代码更改",
|
||||||
|
title: "性能提升",
|
||||||
|
emoji: "🚀",
|
||||||
|
},
|
||||||
|
test: {
|
||||||
|
description: "添加缺失的测试或纠正现有的测试",
|
||||||
|
title: "测试",
|
||||||
|
emoji: "🚨",
|
||||||
|
},
|
||||||
|
build: {
|
||||||
|
description:
|
||||||
|
"影响构建系统或外部依赖项的更改(例如:gulp、broccoli、npm)",
|
||||||
|
title: "构建",
|
||||||
|
emoji: "🛠",
|
||||||
|
},
|
||||||
|
ci: {
|
||||||
|
description:
|
||||||
|
"更改我们的集成配置文件和脚本(例如:Travis、Circle、BrowserStack、SauceLabs)",
|
||||||
|
title: "集成",
|
||||||
|
emoji: "⚙️",
|
||||||
|
},
|
||||||
|
chore: {
|
||||||
|
description: "不修改源码或测试文件的其他更改",
|
||||||
|
title: "杂项",
|
||||||
|
emoji: "♻️",
|
||||||
|
},
|
||||||
|
revert: {
|
||||||
|
description: "恢复之前的提交",
|
||||||
|
title: "还原",
|
||||||
|
emoji: "🗑",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
scope: {
|
||||||
|
description: "更改的范围(scope)(例:组件 或 文件名)",
|
||||||
|
},
|
||||||
|
subject: {
|
||||||
|
description: "主题(subject)",
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
description: "主体(body)",
|
||||||
|
},
|
||||||
|
isBreaking: {
|
||||||
|
description: "是否有破坏性更改(BREAKING CHANGE)?",
|
||||||
|
},
|
||||||
|
breakingBody: {
|
||||||
|
description:
|
||||||
|
"破坏性更改(BREAKING CHANGE)需要一个主体(body),请输入详细描述",
|
||||||
|
},
|
||||||
|
breaking: {
|
||||||
|
description: "描述破坏性更改(BREAKING CHANGE)",
|
||||||
|
},
|
||||||
|
isIssueAffected: {
|
||||||
|
description: "此改变是否影响打开的问题(open ssues)",
|
||||||
|
},
|
||||||
|
issuesBody: {
|
||||||
|
description: "如果问题关闭,则需要提交一个主体(body),请输入详细描述",
|
||||||
|
},
|
||||||
|
issues: {
|
||||||
|
description:
|
||||||
|
'添加问题参考(issue references) (例: "fix #123"、"re #123")',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,200 @@
|
||||||
|
import { Config } from "jest";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For a detailed explanation regarding each configuration property and type check, visit:
|
||||||
|
* https://jestjs.io/docs/configuration
|
||||||
|
*/
|
||||||
|
export default <Config>{
|
||||||
|
// All imported modules in your tests should be mocked automatically
|
||||||
|
// automock: false,
|
||||||
|
|
||||||
|
// Stop running tests after `n` failures
|
||||||
|
// bail: 0,
|
||||||
|
|
||||||
|
// The directory where Jest should store its cached dependency information
|
||||||
|
// cacheDirectory: "C:\\Users\\Administrator\\AppData\\Local\\Temp\\jest",
|
||||||
|
|
||||||
|
// Automatically clear mock calls, instances, contexts and results before every test
|
||||||
|
clearMocks: true,
|
||||||
|
|
||||||
|
// Indicates whether the coverage information should be collected while executing the test
|
||||||
|
collectCoverage: true,
|
||||||
|
|
||||||
|
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
||||||
|
// collectCoverageFrom: undefined,
|
||||||
|
|
||||||
|
// The directory where Jest should output its coverage files
|
||||||
|
coverageDirectory: "coverage",
|
||||||
|
|
||||||
|
// An array of regexp pattern strings used to skip coverage collection
|
||||||
|
// coveragePathIgnorePatterns: [
|
||||||
|
// "\\\\node_modules\\\\"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// Indicates which provider should be used to instrument code for coverage
|
||||||
|
coverageProvider: "v8",
|
||||||
|
|
||||||
|
// A list of reporter names that Jest uses when writing coverage reports
|
||||||
|
// coverageReporters: [
|
||||||
|
// "json",
|
||||||
|
// "text",
|
||||||
|
// "lcov",
|
||||||
|
// "clover"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// An object that configures minimum threshold enforcement for coverage results
|
||||||
|
// coverageThreshold: undefined,
|
||||||
|
|
||||||
|
// A path to a custom dependency extractor
|
||||||
|
// dependencyExtractor: undefined,
|
||||||
|
|
||||||
|
// Make calling deprecated APIs throw helpful error messages
|
||||||
|
// errorOnDeprecated: false,
|
||||||
|
|
||||||
|
// The default configuration for fake timers
|
||||||
|
// fakeTimers: {
|
||||||
|
// "enableGlobally": false
|
||||||
|
// },
|
||||||
|
|
||||||
|
// Force coverage collection from ignored files using an array of glob patterns
|
||||||
|
// forceCoverageMatch: [],
|
||||||
|
|
||||||
|
// A path to a module which exports an async function that is triggered once before all test suites
|
||||||
|
// globalSetup: undefined,
|
||||||
|
|
||||||
|
// A path to a module which exports an async function that is triggered once after all test suites
|
||||||
|
// globalTeardown: undefined,
|
||||||
|
|
||||||
|
// A set of global variables that need to be available in all test environments
|
||||||
|
// globals: {},
|
||||||
|
|
||||||
|
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
||||||
|
// maxWorkers: "50%",
|
||||||
|
|
||||||
|
// An array of directory names to be searched recursively up from the requiring module's location
|
||||||
|
// moduleDirectories: [
|
||||||
|
// "node_modules"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// An array of file extensions your modules use
|
||||||
|
// moduleFileExtensions: [
|
||||||
|
// "js",
|
||||||
|
// "mjs",
|
||||||
|
// "cjs",
|
||||||
|
// "jsx",
|
||||||
|
// "ts",
|
||||||
|
// "tsx",
|
||||||
|
// "json",
|
||||||
|
// "node"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
||||||
|
// moduleNameMapper: {},
|
||||||
|
|
||||||
|
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
||||||
|
// modulePathIgnorePatterns: [],
|
||||||
|
|
||||||
|
// Activates notifications for test results
|
||||||
|
// notify: false,
|
||||||
|
|
||||||
|
// An enum that specifies notification mode. Requires { notify: true }
|
||||||
|
// notifyMode: "failure-change",
|
||||||
|
|
||||||
|
// A preset that is used as a base for Jest's configuration
|
||||||
|
// preset: undefined,
|
||||||
|
|
||||||
|
// Run tests from one or more projects
|
||||||
|
// projects: undefined,
|
||||||
|
|
||||||
|
// Use this configuration option to add custom reporters to Jest
|
||||||
|
// reporters: undefined,
|
||||||
|
|
||||||
|
// Automatically reset mock state before every test
|
||||||
|
// resetMocks: false,
|
||||||
|
|
||||||
|
// Reset the module registry before running each individual test
|
||||||
|
// resetModules: false,
|
||||||
|
|
||||||
|
// A path to a custom resolver
|
||||||
|
// resolver: undefined,
|
||||||
|
|
||||||
|
// Automatically restore mock state and implementation before every test
|
||||||
|
// restoreMocks: false,
|
||||||
|
|
||||||
|
// The root directory that Jest should scan for tests and modules within
|
||||||
|
// rootDir: undefined,
|
||||||
|
|
||||||
|
// A list of paths to directories that Jest should use to search for files in
|
||||||
|
// roots: [
|
||||||
|
// "<rootDir>"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// Allows you to use a custom runner instead of Jest's default test runner
|
||||||
|
// runner: "jest-runner",
|
||||||
|
|
||||||
|
// The paths to modules that run some code to configure or set up the testing environment before each test
|
||||||
|
// setupFiles: [],
|
||||||
|
|
||||||
|
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
||||||
|
// setupFilesAfterEnv: [],
|
||||||
|
|
||||||
|
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
||||||
|
// slowTestThreshold: 5,
|
||||||
|
|
||||||
|
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
||||||
|
// snapshotSerializers: [],
|
||||||
|
|
||||||
|
// The test environment that will be used for testing
|
||||||
|
// testEnvironment: "jest-environment-node",
|
||||||
|
|
||||||
|
// Options that will be passed to the testEnvironment
|
||||||
|
// testEnvironmentOptions: {},
|
||||||
|
|
||||||
|
// Adds a location field to test results
|
||||||
|
// testLocationInResults: false,
|
||||||
|
|
||||||
|
// The glob patterns Jest uses to detect test files
|
||||||
|
// testMatch: [
|
||||||
|
// "**/__tests__/**/*.[jt]s?(x)",
|
||||||
|
// "**/?(*.)+(spec|test).[tj]s?(x)"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
||||||
|
// testPathIgnorePatterns: [
|
||||||
|
// "\\\\node_modules\\\\"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// The regexp pattern or array of patterns that Jest uses to detect test files
|
||||||
|
// testRegex: [],
|
||||||
|
|
||||||
|
// This option allows the use of a custom results processor
|
||||||
|
// testResultsProcessor: undefined,
|
||||||
|
|
||||||
|
// This option allows use of a custom test runner
|
||||||
|
// testRunner: "jest-circus/runner",
|
||||||
|
|
||||||
|
// A map from regular expressions to paths to transformers
|
||||||
|
transform: {
|
||||||
|
'\\.[jt]sx?$': 'babel-jest',
|
||||||
|
},
|
||||||
|
|
||||||
|
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
||||||
|
transformIgnorePatterns: [
|
||||||
|
"\\\\node_modules\\\\",
|
||||||
|
"\\.pnp\\.[^\\\\]+$"
|
||||||
|
],
|
||||||
|
|
||||||
|
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
||||||
|
// unmockedModulePathPatterns: undefined,
|
||||||
|
|
||||||
|
// Indicates whether each individual test should be reported during the run
|
||||||
|
// verbose: undefined,
|
||||||
|
|
||||||
|
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
||||||
|
// watchPathIgnorePatterns: [],
|
||||||
|
|
||||||
|
// Whether to use watchman for file crawling
|
||||||
|
// watchman: true,
|
||||||
|
|
||||||
|
extensionsToTreatAsEsm: ['.ts']
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
"name": "r-util-js",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "webpack",
|
||||||
|
"watch": "webpack watch --mode development",
|
||||||
|
"start": "webpack --mode development && node ./dist/index.js",
|
||||||
|
"prepare": "husky install",
|
||||||
|
"lint": "eslint --ext .js,ts --fix src",
|
||||||
|
"release": "standard-version",
|
||||||
|
"commit": "cz",
|
||||||
|
"lint-staged": "lint-staged",
|
||||||
|
"test": "jest"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"webpack": "^5.80.0",
|
||||||
|
"webpack-cli": "^5.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.8.0",
|
||||||
|
"@babel/preset-env": "^7.12.0",
|
||||||
|
"@babel/preset-typescript": "^7.21.4",
|
||||||
|
"@commitlint/config-conventional": "^17.6.1",
|
||||||
|
"@commitlint/cz-commitlint": "^17.5.0",
|
||||||
|
"@jest/globals": "^29.5.0",
|
||||||
|
"babel-jest": "^29.5.0",
|
||||||
|
"commitizen": "^4.3.0",
|
||||||
|
"eslint": "^8.38.0",
|
||||||
|
"eslint-define-config": "^1.18.0",
|
||||||
|
"husky": "^8.0.3",
|
||||||
|
"inquirer": "^8.0.0",
|
||||||
|
"jest": "^29.5.0",
|
||||||
|
"lint-staged": "^13.2.1",
|
||||||
|
"standard-version": "^9.5.0",
|
||||||
|
"ts-loader": "^9.4.2",
|
||||||
|
"typescript": "^5.0.4"
|
||||||
|
},
|
||||||
|
"husky": {
|
||||||
|
"hooks": {
|
||||||
|
"pre-commit": "lint-staged",
|
||||||
|
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,18 @@
|
||||||
|
// https://prettier.io/docs/en/configuration.html
|
||||||
|
module.exports = {
|
||||||
|
tabWidth: 4,
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ["*.js", "*.ts", "*.vue", "*.json"],
|
||||||
|
options: {
|
||||||
|
tabWidth: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ["*.html"],
|
||||||
|
options: {
|
||||||
|
printWidth: 120,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
export * from "./utils/permission";
|
||||||
|
|
||||||
|
console.log("index")
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
export class Permission {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
list: string[];
|
||||||
|
separator: string;
|
||||||
|
level: number;
|
||||||
|
|
||||||
|
constructor(list: string[], level = 3, separator = ":") {
|
||||||
|
this.list = list;
|
||||||
|
this.level = level;
|
||||||
|
this.separator = separator;
|
||||||
|
}
|
||||||
|
|
||||||
|
isValid(str: string) {
|
||||||
|
const p = new Array(this.level).fill("\\w+?").join(":");
|
||||||
|
// ^\w+?:\w+?:\w+?$
|
||||||
|
const r = new RegExp(`^${p}$`);
|
||||||
|
return r.test(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
export * from "./Permission";
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import { test, expect } from "@jest/globals";
|
||||||
|
import { Permission } from "../src/utils/permission";
|
||||||
|
|
||||||
|
test("测试 Permission#isValid()", () => {
|
||||||
|
const permission = new Permission([]);
|
||||||
|
expect(permission.isValid("aaa:bbb:ccc")).toBe(true);
|
||||||
|
expect(permission.isValid("aaa:bbb:")).toBe(false);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"exclude": ["node_modules", "dist"],
|
||||||
|
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "esnext",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"strict": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"sourceMap": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"lib": ["esnext", "dom"],
|
||||||
|
// "types": ["@dcloudio/types"],
|
||||||
|
"baseUrl": "./",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["src/*"]
|
||||||
|
},
|
||||||
|
"allowJs": true,
|
||||||
|
"outDir": "./types"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: './src/index.ts',
|
||||||
|
output: {
|
||||||
|
filename: 'index.js',
|
||||||
|
path: path.resolve(__dirname, 'dist'),
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.tsx?$/,
|
||||||
|
use: 'ts-loader',
|
||||||
|
exclude: /node_modules/,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue