@xunlei-open/create-miniapp 0.1.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +106 -0
- package/dist/index.mjs +416 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +59 -0
- package/templates/react/.prettierignore +3 -0
- package/templates/react/.prettierrc.ejs +7 -0
- package/templates/react/_gitignore +24 -0
- package/templates/react/biome.json +41 -0
- package/templates/react/eslint.config.js.ejs +43 -0
- package/templates/react/index.html.ejs +12 -0
- package/templates/react/jsconfig.json +9 -0
- package/templates/react/manifest.json +16 -0
- package/templates/react/miniapp.config.js.ejs +16 -0
- package/templates/react/package.json.ejs +42 -0
- package/templates/react/src/App.jsx.ejs +53 -0
- package/templates/react/src/index.css +105 -0
- package/templates/react/src/main.jsx +10 -0
- package/templates/react/tests/App.spec.jsx.ejs +12 -0
- package/templates/react/vitest.config.js +11 -0
- package/templates/react-ts/.prettierignore +3 -0
- package/templates/react-ts/.prettierrc.ejs +7 -0
- package/templates/react-ts/_gitignore +25 -0
- package/templates/react-ts/biome.json +41 -0
- package/templates/react-ts/eslint.config.js.ejs +33 -0
- package/templates/react-ts/index.html.ejs +12 -0
- package/templates/react-ts/manifest.json +16 -0
- package/templates/react-ts/miniapp.config.ts.ejs +16 -0
- package/templates/react-ts/package.json.ejs +48 -0
- package/templates/react-ts/src/App.tsx.ejs +53 -0
- package/templates/react-ts/src/index.css +105 -0
- package/templates/react-ts/src/main.tsx +10 -0
- package/templates/react-ts/src/vite-env.d.ts +2 -0
- package/templates/react-ts/tests/App.spec.tsx.ejs +12 -0
- package/templates/react-ts/tsconfig.app.json +28 -0
- package/templates/react-ts/tsconfig.json +7 -0
- package/templates/react-ts/tsconfig.node.json +24 -0
- package/templates/react-ts/vitest.config.js +11 -0
- package/templates/vanilla/.prettierignore +3 -0
- package/templates/vanilla/.prettierrc.ejs +7 -0
- package/templates/vanilla/_gitignore +23 -0
- package/templates/vanilla/biome.json +40 -0
- package/templates/vanilla/eslint.config.js.ejs +25 -0
- package/templates/vanilla/index.html.ejs +12 -0
- package/templates/vanilla/jsconfig.json +8 -0
- package/templates/vanilla/manifest.json +16 -0
- package/templates/vanilla/miniapp.config.js.ejs +15 -0
- package/templates/vanilla/package.json.ejs +33 -0
- package/templates/vanilla/src/main.js.ejs +54 -0
- package/templates/vanilla/src/style.css +101 -0
- package/templates/vanilla/tests/example.spec.js +7 -0
- package/templates/vanilla-ts/.prettierignore +3 -0
- package/templates/vanilla-ts/.prettierrc.ejs +7 -0
- package/templates/vanilla-ts/_gitignore +23 -0
- package/templates/vanilla-ts/biome.json +40 -0
- package/templates/vanilla-ts/eslint.config.js.ejs +36 -0
- package/templates/vanilla-ts/index.html.ejs +12 -0
- package/templates/vanilla-ts/manifest.json +16 -0
- package/templates/vanilla-ts/miniapp.config.ts.ejs +15 -0
- package/templates/vanilla-ts/package.json.ejs +38 -0
- package/templates/vanilla-ts/src/main.ts.ejs +54 -0
- package/templates/vanilla-ts/src/style.css +101 -0
- package/templates/vanilla-ts/src/vite-env.d.ts +2 -0
- package/templates/vanilla-ts/tests/example.spec.ts +7 -0
- package/templates/vanilla-ts/tsconfig.json +26 -0
- package/templates/vue/.prettierignore +3 -0
- package/templates/vue/.prettierrc.ejs +7 -0
- package/templates/vue/_gitignore +25 -0
- package/templates/vue/biome.json +46 -0
- package/templates/vue/eslint.config.js.ejs +26 -0
- package/templates/vue/index.html.ejs +12 -0
- package/templates/vue/jsconfig.json +8 -0
- package/templates/vue/manifest.json +16 -0
- package/templates/vue/miniapp.config.js.ejs +16 -0
- package/templates/vue/package.json.ejs +39 -0
- package/templates/vue/src/App.vue.ejs +51 -0
- package/templates/vue/src/assets/main.css +105 -0
- package/templates/vue/src/main.js +5 -0
- package/templates/vue/tests/App.spec.js.ejs +12 -0
- package/templates/vue/vitest.config.js +11 -0
- package/templates/vue-ts/.prettierignore +3 -0
- package/templates/vue-ts/.prettierrc.ejs +7 -0
- package/templates/vue-ts/_gitignore +25 -0
- package/templates/vue-ts/biome.json +46 -0
- package/templates/vue-ts/eslint.config.js.ejs +32 -0
- package/templates/vue-ts/index.html.ejs +12 -0
- package/templates/vue-ts/manifest.json +16 -0
- package/templates/vue-ts/miniapp.config.ts.ejs +16 -0
- package/templates/vue-ts/package.json.ejs +46 -0
- package/templates/vue-ts/src/App.vue.ejs +51 -0
- package/templates/vue-ts/src/assets/main.css +105 -0
- package/templates/vue-ts/src/main.ts +5 -0
- package/templates/vue-ts/src/vite-env.d.ts +2 -0
- package/templates/vue-ts/tests/App.spec.ts.ejs +12 -0
- package/templates/vue-ts/tsconfig.app.json +17 -0
- package/templates/vue-ts/tsconfig.json +7 -0
- package/templates/vue-ts/tsconfig.node.json +24 -0
- package/templates/vue-ts/vitest.config.js +11 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
pnpm-debug.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
|
|
10
|
+
node_modules
|
|
11
|
+
dist
|
|
12
|
+
dist-ssr
|
|
13
|
+
release
|
|
14
|
+
*.local
|
|
15
|
+
coverage
|
|
16
|
+
*.tsbuildinfo
|
|
17
|
+
|
|
18
|
+
# Editor directories and files
|
|
19
|
+
.idea
|
|
20
|
+
.DS_Store
|
|
21
|
+
*.suo
|
|
22
|
+
*.ntvs*
|
|
23
|
+
*.njsproj
|
|
24
|
+
*.sln
|
|
25
|
+
*.sw?
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.4.16/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": false
|
|
5
|
+
},
|
|
6
|
+
"files": {
|
|
7
|
+
"ignoreUnknown": false
|
|
8
|
+
},
|
|
9
|
+
"formatter": {
|
|
10
|
+
"enabled": true,
|
|
11
|
+
"indentStyle": "tab",
|
|
12
|
+
"indentWidth": 2,
|
|
13
|
+
"lineWidth": 120,
|
|
14
|
+
"lineEnding": "auto"
|
|
15
|
+
},
|
|
16
|
+
"linter": {
|
|
17
|
+
"enabled": true,
|
|
18
|
+
"rules": {
|
|
19
|
+
"recommended": true,
|
|
20
|
+
"correctness": {
|
|
21
|
+
"noUndeclaredVariables": "error"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"javascript": {
|
|
26
|
+
"formatter": {
|
|
27
|
+
"semicolons": "asNeeded",
|
|
28
|
+
"quoteStyle": "single",
|
|
29
|
+
"trailingCommas": "all"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"html": {
|
|
33
|
+
"experimentalFullSupportEnabled": true,
|
|
34
|
+
"formatter": {
|
|
35
|
+
"enabled": true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"assist": {
|
|
39
|
+
"enabled": true,
|
|
40
|
+
"actions": {
|
|
41
|
+
"source": {
|
|
42
|
+
"organizeImports": "on"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import pluginVue from 'eslint-plugin-vue'
|
|
3
|
+
import globals from 'globals'
|
|
4
|
+
import tseslint from 'typescript-eslint'
|
|
5
|
+
import eslintConfigPrettier from 'eslint-config-prettier'
|
|
6
|
+
import eslintPluginPrettier from 'eslint-plugin-prettier'
|
|
7
|
+
|
|
8
|
+
export default tseslint.config(
|
|
9
|
+
{ ignores: ['dist', 'node_modules'] },
|
|
10
|
+
js.configs.recommended,
|
|
11
|
+
...tseslint.configs.recommended,
|
|
12
|
+
...pluginVue.configs['flat/recommended'],
|
|
13
|
+
eslintConfigPrettier,
|
|
14
|
+
{
|
|
15
|
+
files: ['**/*.{ts,vue}'],
|
|
16
|
+
plugins: { prettier: eslintPluginPrettier },
|
|
17
|
+
rules: {
|
|
18
|
+
'prettier/prettier': 'error',
|
|
19
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
20
|
+
'no-fallthrough': 'off',
|
|
21
|
+
'no-undef': 'off',
|
|
22
|
+
},
|
|
23
|
+
languageOptions: {
|
|
24
|
+
ecmaVersion: 'latest',
|
|
25
|
+
sourceType: 'module',
|
|
26
|
+
globals: globals.browser,
|
|
27
|
+
parserOptions: {
|
|
28
|
+
parser: tseslint.parser,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title><%= projectName %></title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="app"></div>
|
|
10
|
+
<script type="module" src="/src/main.ts"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 1,
|
|
3
|
+
"name": "示例插件",
|
|
4
|
+
"title": "示例插件",
|
|
5
|
+
"description": "一个迅雷微应用示例",
|
|
6
|
+
"version": "1.0.0",
|
|
7
|
+
"entry": {
|
|
8
|
+
"type": "miniapp",
|
|
9
|
+
"url": "index.html"
|
|
10
|
+
},
|
|
11
|
+
"window": {
|
|
12
|
+
"width": 900,
|
|
13
|
+
"height": 700
|
|
14
|
+
},
|
|
15
|
+
"permissions": ["tasks.create"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { fileURLToPath, URL } from 'node:url'
|
|
2
|
+
import { defineConfig } from '@xunlei-open/miniapp'
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
modules: ['@xunlei-open/miniapp-module-vue'],
|
|
6
|
+
vite: {
|
|
7
|
+
resolve: {
|
|
8
|
+
alias: {
|
|
9
|
+
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
build: {
|
|
13
|
+
target: 'es2015',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
})
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= packageName %>",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=20.19.0"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "xunlei-miniapp",
|
|
11
|
+
"build": "xunlei-miniapp build",
|
|
12
|
+
"package": "xunlei-miniapp package",
|
|
13
|
+
"typecheck": "vue-tsc -b"<% if (features.includes('vitest')) { %>,
|
|
14
|
+
"test": "vitest run",
|
|
15
|
+
"test:watch": "vitest"<% } %><% if (features.includes('lint')) { %>,
|
|
16
|
+
"lint": "eslint .",
|
|
17
|
+
"format": "prettier --write ."<% } %><% if (features.includes('biome')) { %>,
|
|
18
|
+
"lint": "biome check .",
|
|
19
|
+
"format": "biome format --write ."<% } %>
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"vue": "^3.5.13"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^22.13.10",
|
|
26
|
+
"@xunlei-open/miniapp-module-vue": "^<%= devkitVersion %>",
|
|
27
|
+
"@vue/tsconfig": "^0.9.1",
|
|
28
|
+
"typescript": "~6.0.2",
|
|
29
|
+
"@xunlei-open/miniapp-types": "^<%= devkitVersion %>",
|
|
30
|
+
"@xunlei-open/miniapp": "^<%= devkitVersion %>",
|
|
31
|
+
"vite": "^8.0.12",
|
|
32
|
+
"vue-tsc": "^2.2.8"<% if (features.includes('vitest')) { %>,
|
|
33
|
+
"@vue/test-utils": "^2.4.6",
|
|
34
|
+
"jsdom": "^29.0.0",
|
|
35
|
+
"vitest": "^4.1.0"<% } %><% if (features.includes('lint')) { %>,
|
|
36
|
+
"@eslint/js": "^9.22.0",
|
|
37
|
+
"eslint": "^9.22.0",
|
|
38
|
+
"eslint-config-prettier": "^10.1.1",
|
|
39
|
+
"eslint-plugin-prettier": "^5.4.0",
|
|
40
|
+
"eslint-plugin-vue": "^10.0.0",
|
|
41
|
+
"globals": "^16.0.0",
|
|
42
|
+
"prettier": "^3.5.3",
|
|
43
|
+
"typescript-eslint": "^8.26.1"<% } %><% if (features.includes('biome')) { %>,
|
|
44
|
+
"@biomejs/biome": "2.4.16"<% } %>
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const url = ref('https://example.com/file.zip')
|
|
5
|
+
const result = ref('等待创建任务')
|
|
6
|
+
const submitting = ref(false)
|
|
7
|
+
|
|
8
|
+
async function createTask() {
|
|
9
|
+
if (typeof xunlei === 'undefined') {
|
|
10
|
+
result.value = '当前是普通浏览器预览,请在迅雷微应用宿主中创建任务。'
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
submitting.value = true
|
|
15
|
+
result.value = '正在创建任务…'
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
const task = await xunlei.tasks.create({
|
|
19
|
+
req: { url: url.value },
|
|
20
|
+
opts: { name: '<%= projectName %>' },
|
|
21
|
+
})
|
|
22
|
+
result.value = `任务已创建:${task.id}`
|
|
23
|
+
} catch (error) {
|
|
24
|
+
result.value = error instanceof Error ? error.message : String(error)
|
|
25
|
+
} finally {
|
|
26
|
+
submitting.value = false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<div class="app">
|
|
33
|
+
<main>
|
|
34
|
+
<p class="eyebrow">Xunlei Miniapp</p>
|
|
35
|
+
<h1><%= projectName %></h1>
|
|
36
|
+
<p class="intro">输入下载地址,通过迅雷微应用 API 创建下载任务。</p>
|
|
37
|
+
|
|
38
|
+
<form @submit.prevent="createTask">
|
|
39
|
+
<label for="task-url">下载地址</label>
|
|
40
|
+
<div class="row">
|
|
41
|
+
<input id="task-url" v-model="url" type="url" required />
|
|
42
|
+
<button type="submit" :disabled="submitting">
|
|
43
|
+
{{ submitting ? '正在创建…' : '创建任务' }}
|
|
44
|
+
</button>
|
|
45
|
+
</div>
|
|
46
|
+
</form>
|
|
47
|
+
|
|
48
|
+
<output>{{ result }}</output>
|
|
49
|
+
</main>
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family: Inter, ui-sans-serif, system-ui, sans-serif;
|
|
3
|
+
color: #172033;
|
|
4
|
+
background: #eef3ff;
|
|
5
|
+
font-synthesis: none;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
* {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
body {
|
|
13
|
+
min-width: 320px;
|
|
14
|
+
min-height: 100vh;
|
|
15
|
+
margin: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.app {
|
|
19
|
+
min-height: 100vh;
|
|
20
|
+
display: grid;
|
|
21
|
+
place-items: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
main {
|
|
25
|
+
width: min(680px, calc(100vw - 48px));
|
|
26
|
+
padding: 40px;
|
|
27
|
+
border: 1px solid #d5def2;
|
|
28
|
+
border-radius: 20px;
|
|
29
|
+
background: #fff;
|
|
30
|
+
box-shadow: 0 20px 60px rgb(36 65 120 / 12%);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.eyebrow {
|
|
34
|
+
margin: 0;
|
|
35
|
+
color: #176bff;
|
|
36
|
+
font-size: 12px;
|
|
37
|
+
font-weight: 700;
|
|
38
|
+
letter-spacing: 0.12em;
|
|
39
|
+
text-transform: uppercase;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
h1 {
|
|
43
|
+
margin: 8px 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.intro {
|
|
47
|
+
margin: 0 0 28px;
|
|
48
|
+
color: #596780;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
label {
|
|
52
|
+
display: block;
|
|
53
|
+
margin-bottom: 8px;
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
font-weight: 600;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.row {
|
|
59
|
+
display: flex;
|
|
60
|
+
gap: 10px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
input,
|
|
64
|
+
button {
|
|
65
|
+
min-height: 44px;
|
|
66
|
+
border-radius: 10px;
|
|
67
|
+
font: inherit;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
input {
|
|
71
|
+
flex: 1;
|
|
72
|
+
min-width: 0;
|
|
73
|
+
padding: 0 12px;
|
|
74
|
+
border: 1px solid #b9c6df;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
button {
|
|
78
|
+
padding: 0 18px;
|
|
79
|
+
border: 0;
|
|
80
|
+
color: #fff;
|
|
81
|
+
background: #176bff;
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
button:disabled {
|
|
86
|
+
cursor: wait;
|
|
87
|
+
opacity: 0.65;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
output {
|
|
91
|
+
display: block;
|
|
92
|
+
margin-top: 18px;
|
|
93
|
+
color: #596780;
|
|
94
|
+
font-size: 14px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@media (max-width: 560px) {
|
|
98
|
+
main {
|
|
99
|
+
padding: 28px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.row {
|
|
103
|
+
flex-direction: column;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
|
|
3
|
+
import { mount } from '@vue/test-utils'
|
|
4
|
+
import { describe, expect, it } from 'vitest'
|
|
5
|
+
import App from '../src/App.vue'
|
|
6
|
+
|
|
7
|
+
describe('App', () => {
|
|
8
|
+
it('renders project title', () => {
|
|
9
|
+
const wrapper = mount(App)
|
|
10
|
+
expect(wrapper.text()).toContain('<%= projectName %>')
|
|
11
|
+
})
|
|
12
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
5
|
+
"types": ["vite/client"],
|
|
6
|
+
"paths": {
|
|
7
|
+
"@/*": ["./src/*"]
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
/* Linting */
|
|
11
|
+
"noUnusedLocals": true,
|
|
12
|
+
"noUnusedParameters": true,
|
|
13
|
+
"erasableSyntaxOnly": true,
|
|
14
|
+
"noFallthroughCasesInSwitch": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "tests/**/*.ts"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "es2023",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "esnext",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"erasableSyntaxOnly": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["miniapp.config.ts"]
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url'
|
|
2
|
+
import { defineConfig } from 'vitest/config'
|
|
3
|
+
import { loadMiniappConfig } from '@xunlei-open/miniapp'
|
|
4
|
+
|
|
5
|
+
export default defineConfig(async () => {
|
|
6
|
+
const config = await loadMiniappConfig(fileURLToPath(new URL('.', import.meta.url)), {
|
|
7
|
+
command: 'serve',
|
|
8
|
+
mode: 'test',
|
|
9
|
+
})
|
|
10
|
+
return config.vite
|
|
11
|
+
})
|