@widget-js/cli 1.1.10 → 1.2.1

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/.idea/misc.xml CHANGED
@@ -3,7 +3,4 @@
3
3
  <component name="ProjectRootManager">
4
4
  <output url="file://$PROJECT_DIR$/out" />
5
5
  </component>
6
- <component name="ProjectType">
7
- <option name="id" value="jpab" />
8
- </component>
9
6
  </project>
package/lib/index.js CHANGED
@@ -26,7 +26,7 @@ program.command("init").description("Initialize widget-js project").action(async
26
26
  var typeOption = new Option("-t, --type <type>").choices(["ftp", "oss"]);
27
27
  var fileOption = new Option("-f, --file <file>");
28
28
  program.command("release").description("\u901A\u8FC7FTP/OSS\u53D1\u5E03\u6587\u4EF6\uFF0C\u4EC5\u5185\u90E8\u4F7F\u7528").addOption(typeOption).addOption(fileOption).action(async (options, command) => {
29
- let release = await import("./release-HXCPKDIN.js");
29
+ let release = await import("./release-VEU3T5KK.js");
30
30
  await release.default(options);
31
31
  });
32
32
  program.parse(process.argv);
@@ -76,6 +76,7 @@ import consola from "consola";
76
76
  import inquirer from "inquirer";
77
77
  import ora from "ora";
78
78
  import * as process from "process";
79
+ import { minimatch } from "minimatch";
79
80
  async function checkParentDir(ftpClient, file, onMkdir) {
80
81
  let dir = path.dirname(file);
81
82
  const dirExists = await ftpClient.exists(dir);
@@ -86,7 +87,9 @@ async function checkParentDir(ftpClient, file, onMkdir) {
86
87
  }
87
88
  async function runSSH(sshConfig, releaseConfig) {
88
89
  consola.info("run ssh:", sshConfig);
89
- const answer = await inquirer.prompt([{ type: "password", name: "password", mask: "*", message: "Enter key pair password" }]);
90
+ const answer = await inquirer.prompt([
91
+ { type: "password", name: "password", mask: "*", message: "Enter key pair password" }
92
+ ]);
90
93
  let ftpClient = new Client();
91
94
  const port = sshConfig["Port"];
92
95
  const key = fs3.readFileSync(path.resolve(os.homedir(), ".ssh/id_rsa"));
@@ -122,10 +125,21 @@ async function runSSH(sshConfig, releaseConfig) {
122
125
  }
123
126
  if (fs3.lstatSync(localFile).isDirectory()) {
124
127
  spinner.info(`Uploading Dir: ${localFile} -> ${item.dest}`);
125
- await ftpClient.uploadDir(localFile, item.dest);
128
+ await ftpClient.uploadDir(localFile, item.dest, {
129
+ filter: (filePath, isDirectory) => {
130
+ if (item.ignorePattern && !isDirectory) {
131
+ let fileName = path.basename(filePath);
132
+ if (minimatch(fileName, item.ignorePattern)) {
133
+ spinner.warn(`Skip file:${filePath}`);
134
+ return false;
135
+ }
136
+ }
137
+ return true;
138
+ }
139
+ });
126
140
  } else {
127
141
  await checkParentDir(ftpClient, item.dest, (dir) => {
128
- spinner.warn(`Create Dir: ${dir}`);
142
+ spinner.succeed(`Create Dir: ${dir}`);
129
143
  });
130
144
  spinner.info(`Uploading File: ${localFile} -> ${item.dest}`);
131
145
  await ftpClient.put(localFile, item.dest);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widget-js/cli",
3
- "version": "1.1.10",
3
+ "version": "1.2.1",
4
4
  "main": "lib/index.js",
5
5
  "author": "Neo Fu",
6
6
  "license": "MIT",
@@ -31,11 +31,12 @@
31
31
  "figlet": "^1.5.2",
32
32
  "gradient-string": "^2.0.2",
33
33
  "inquirer": "^8.0.0",
34
+ "minimatch": "^9.0.3",
34
35
  "ora": "^6.2.0",
35
36
  "package-json": "^8.1.0",
36
37
  "semver": "^7.3.8",
37
38
  "shelljs": "^0.8.5",
38
- "ssh2-sftp-client": "^9.0.4",
39
+ "ssh2-sftp-client": "^9.1.0",
39
40
  "ws": "^8.11.0",
40
41
  "@widget-js/utils": "0.7.19"
41
42
  },
@@ -48,7 +49,7 @@
48
49
  "@types/node": "^18.11.13",
49
50
  "@types/semver": "^7.5.0",
50
51
  "@types/shelljs": "latest",
51
- "@types/ssh2-sftp-client": "^9.0.0",
52
+ "@types/ssh2-sftp-client": "^9.0.1",
52
53
  "jest": "^29.5.0",
53
54
  "pinst": "^3.0.0",
54
55
  "prettier": "^2.8.8",
@@ -57,16 +58,16 @@
57
58
  "ts-loader": "^9.4.1",
58
59
  "ts-node": "^10.9.1",
59
60
  "tsup": "^6.5.0",
60
- "typescript": "^4.9.4",
61
+ "typescript": "^5.2.2",
62
+ "vitest": "^0.34.6",
61
63
  "webpack": "^5.75.0",
62
64
  "webpack-cli": "^5.0.0",
63
- "@widget-js/core": "0.7.2"
65
+ "@widget-js/core": "0.10.14"
64
66
  },
65
67
  "scripts": {
66
68
  "build": "rimraf ./lib/ && tsup-node src/index.ts --format esm",
67
69
  "watch": "tsup src/index.ts --format esm --watch",
68
70
  "build:run": "npm run build && npm run widget",
69
- "prebuild": "",
70
71
  "widget": "node ./lib/index.js",
71
72
  "widget:ftp": "node ./lib/index.js release -t ftp",
72
73
  "widget:init": "node ./lib/index.js init",
@@ -1,123 +1,140 @@
1
- import path from "path";
2
- import fs from "fs";
3
- import SSHConfig from "@widget-js/ssh-config";
4
- import os from "os";
5
- import Client from "ssh2-sftp-client";
6
- import consola from "consola";
7
- import inquirer from "inquirer";
8
- import ora from "ora";
9
- import * as process from "process";
10
- import { Utils} from "../utils";
11
-
12
-
13
- interface PasswordAnswer {
14
- password: string
15
- }
16
-
17
- async function checkParentDir(ftpClient: Client, file: string, onMkdir: (dir: string) => void) {
18
- let dir = path.dirname(file)
19
- const dirExists = await ftpClient.exists(dir)
20
- if (!dirExists) {
21
- onMkdir(dir)
22
- await ftpClient.mkdir(dir, true)
23
- }
24
- }
25
-
26
- async function runSSH(sshConfig: Record<string, string | string[]>, releaseConfig: ReleaseConfig) {
27
- consola.info('run ssh:', sshConfig)
28
- const answer = await inquirer
29
- .prompt<PasswordAnswer>([{type: 'password', name: 'password', mask: '*', message: 'Enter key pair password'}])
30
-
31
- let ftpClient = new Client()
32
- const port = sshConfig['Port']
33
- const key = fs.readFileSync(path.resolve(os.homedir(), '.ssh/id_rsa'))
34
- const spinner = ora('Connecting')
35
- try {
36
- spinner.start()
37
- await ftpClient.connect({
38
- host: sshConfig['HostName'] as string,
39
- port: port ? parseInt(port as string) : 22,
40
- username: sshConfig['User'] as string,
41
- passphrase: answer.password,
42
- privateKey: key,
43
- })
44
- releaseConfig.fileMap.sort((it1, it2) => (it1.order ?? 0) - (it2.order ?? 0))
45
- // upload files
46
- for (let item of releaseConfig.fileMap) {
47
- if (typeof item.src == 'string') {
48
- if (item.remoteCopy) {
49
- await checkParentDir(ftpClient, item.dest, dir => {
50
- spinner.warn(`Create Dir: ${dir}`)
51
- })
52
- let destExists = await ftpClient.exists(item.dest)
53
- if (destExists) {
54
- spinner.warn(`Delete exists file:${item.dest}`)
55
- await ftpClient.delete(item.dest)
56
- }
57
- spinner.info(`Copying File: ${item.src} -> ${item.dest}`)
58
- await ftpClient.rcopy(item.src, item.dest)
59
- } else {
60
- const localFile = path.resolve(process.cwd(), item.src as string)
61
- if (!item.remoteCopy && !fs.existsSync(localFile)) {
62
- spinner.warn(`Skip not exists file:${localFile}`)
63
- continue
64
- }
65
- if (fs.lstatSync(localFile).isDirectory()) {
66
- spinner.info(`Uploading Dir: ${localFile} -> ${item.dest}`)
67
- await ftpClient.uploadDir(localFile, item.dest)
68
- } else {
69
- await checkParentDir(ftpClient, item.dest, dir => {
70
- spinner.warn(`Create Dir: ${dir}`)
71
- })
72
- spinner.info(`Uploading File: ${localFile} -> ${item.dest}`)
73
- await ftpClient.put(localFile, item.dest)
74
- }
75
- }
76
- } else {
77
- await ftpClient.put(Buffer.from(JSON.stringify(item.src), 'utf-8'), item.dest)
78
- }
79
- }
80
- spinner.succeed('Files uploaded!')
81
- await ftpClient.end()
82
- } catch (e) {
83
- spinner.fail(`Connection error:${e}`)
84
- await ftpClient.end()
85
- }
86
- }
87
-
88
- export async function ftpUpload(releaseFile: string = 'release.json') {
89
- // 读取
90
- const releaseJsonFilePath = path.join(process.cwd(), releaseFile)
91
- const packageVersion = Utils.getPackageVersion()
92
- consola.info('Package Version:', packageVersion)
93
-
94
- let releaseJson = fs.readFileSync(releaseJsonFilePath).toString().replaceAll('${version}', packageVersion);
95
- const releaseConfig = JSON.parse(releaseJson) as ReleaseConfig
96
- const sshConfigFile = path.resolve(os.homedir(), '.ssh/config')
97
- consola.info('SSH Config File Path:', sshConfigFile)
98
- const sshConfigs = SSHConfig.parse(fs.readFileSync(sshConfigFile).toString())
99
- for (let host of releaseConfig.ftpConfig.host) {
100
- let sshConfig = sshConfigs.compute(host)
101
- if (!sshConfig) {
102
- consola.error(`SSH config ${releaseConfig.ftpConfig.host} not found`)
103
- return
104
- }
105
- await runSSH(sshConfig, releaseConfig)
106
- }
107
-
108
- }
109
-
110
-
111
- export interface ReleaseConfig {
112
- fileMap: {
113
- src: string | object
114
- dest: string
115
- remoteCopy: boolean
116
- order: number
117
- }[]
118
- ftpConfig: FTPConfig
119
- }
120
-
121
- export interface FTPConfig {
122
- host: string[]
123
- }
1
+ import path from 'path'
2
+ import fs from 'fs'
3
+ import SSHConfig from '@widget-js/ssh-config'
4
+ import os from 'os'
5
+ import Client from 'ssh2-sftp-client'
6
+ import consola from 'consola'
7
+ import inquirer from 'inquirer'
8
+ import ora from 'ora'
9
+ import * as process from 'process'
10
+ import {Utils} from '../utils'
11
+ import {minimatch} from 'minimatch'
12
+
13
+ interface PasswordAnswer {
14
+ password: string
15
+ }
16
+
17
+ async function checkParentDir(ftpClient: Client, file: string, onMkdir: (dir: string) => void) {
18
+ let dir = path.dirname(file)
19
+ const dirExists = await ftpClient.exists(dir)
20
+ if (!dirExists) {
21
+ onMkdir(dir)
22
+ await ftpClient.mkdir(dir, true)
23
+ }
24
+ }
25
+
26
+ async function runSSH(sshConfig: Record<string, string | string[]>, releaseConfig: ReleaseConfig) {
27
+ consola.info('run ssh:', sshConfig)
28
+ const answer = await inquirer.prompt<PasswordAnswer>([
29
+ {type: 'password', name: 'password', mask: '*', message: 'Enter key pair password'},
30
+ ])
31
+
32
+ let ftpClient = new Client()
33
+ const port = sshConfig['Port']
34
+ const key = fs.readFileSync(path.resolve(os.homedir(), '.ssh/id_rsa'))
35
+ const spinner = ora('Connecting')
36
+ try {
37
+ spinner.start()
38
+ await ftpClient.connect({
39
+ host: sshConfig['HostName'] as string,
40
+ port: port ? parseInt(port as string) : 22,
41
+ username: sshConfig['User'] as string,
42
+ passphrase: answer.password,
43
+ privateKey: key,
44
+ })
45
+ releaseConfig.fileMap.sort((it1, it2) => (it1.order ?? 0) - (it2.order ?? 0))
46
+ // upload files
47
+ for (let item of releaseConfig.fileMap) {
48
+ if (typeof item.src == 'string') {
49
+ if (item.remoteCopy) {
50
+ await checkParentDir(ftpClient, item.dest, dir => {
51
+ spinner.warn(`Create Dir: ${dir}`)
52
+ })
53
+ let destExists = await ftpClient.exists(item.dest)
54
+ if (destExists) {
55
+ spinner.warn(`Delete exists file:${item.dest}`)
56
+ await ftpClient.delete(item.dest)
57
+ }
58
+ spinner.info(`Copying File: ${item.src} -> ${item.dest}`)
59
+ await ftpClient.rcopy(item.src, item.dest)
60
+ } else {
61
+ const localFile = path.resolve(process.cwd(), item.src as string)
62
+ if (!item.remoteCopy && !fs.existsSync(localFile)) {
63
+ spinner.warn(`Skip not exists file:${localFile}`)
64
+ continue
65
+ }
66
+ if (fs.lstatSync(localFile).isDirectory()) {
67
+ spinner.info(`Uploading Dir: ${localFile} -> ${item.dest}`)
68
+ await ftpClient.uploadDir(localFile, item.dest, {
69
+ filter: (filePath: string, isDirectory: boolean):boolean => {
70
+ if (item.ignorePattern && !isDirectory) {
71
+ let fileName = path.basename(filePath)
72
+ if (minimatch(fileName, item.ignorePattern)) {
73
+ spinner.warn(`Skip file:${filePath}`)
74
+ return false
75
+ }
76
+ }
77
+ return true;
78
+ },
79
+ })
80
+ } else {
81
+ await checkParentDir(ftpClient, item.dest, dir => {
82
+ spinner.succeed(`Create Dir: ${dir}`)
83
+ })
84
+
85
+ spinner.info(`Uploading File: ${localFile} -> ${item.dest}`)
86
+ await ftpClient.put(localFile, item.dest)
87
+ }
88
+ }
89
+ } else {
90
+ await ftpClient.put(Buffer.from(JSON.stringify(item.src), 'utf-8'), item.dest)
91
+ }
92
+ }
93
+ spinner.succeed('Files uploaded!')
94
+ await ftpClient.end()
95
+ } catch (e) {
96
+ spinner.fail(`Connection error:${e}`)
97
+ await ftpClient.end()
98
+ }
99
+ }
100
+
101
+ export async function ftpUpload(releaseFile: string = 'release.json') {
102
+ // 读取
103
+ const releaseJsonFilePath = path.join(process.cwd(), releaseFile)
104
+ const packageVersion = Utils.getPackageVersion()
105
+ consola.info('Package Version:', packageVersion)
106
+
107
+ let releaseJson = fs.readFileSync(releaseJsonFilePath).toString().replaceAll('${version}', packageVersion)
108
+ const releaseConfig = JSON.parse(releaseJson) as ReleaseConfig
109
+ const sshConfigFile = path.resolve(os.homedir(), '.ssh/config')
110
+ consola.info('SSH Config File Path:', sshConfigFile)
111
+ const sshConfigs = SSHConfig.parse(fs.readFileSync(sshConfigFile).toString())
112
+ for (let host of releaseConfig.ftpConfig.host) {
113
+ let sshConfig = sshConfigs.compute(host)
114
+ if (!sshConfig) {
115
+ consola.error(`SSH config ${releaseConfig.ftpConfig.host} not found`)
116
+ return
117
+ }
118
+ await runSSH(sshConfig, releaseConfig)
119
+ }
120
+ }
121
+
122
+ export interface FileMapConfig {
123
+ src: string | object
124
+ dest: string
125
+ remoteCopy: boolean
126
+ order: number
127
+ /**
128
+ * 支持glob、正则表达式
129
+ */
130
+ ignorePattern?: string
131
+ }
132
+
133
+ export interface ReleaseConfig {
134
+ fileMap: FileMapConfig[]
135
+ ftpConfig: FTPConfig
136
+ }
137
+
138
+ export interface FTPConfig {
139
+ host: string[]
140
+ }
@@ -8,9 +8,9 @@ const description = {"zh-CN": ""};
8
8
  //组件关键词
9
9
  const keywords = [WidgetKeyword.RECOMMEND];
10
10
  //组件路由地址
11
- const url = "/widget/<%= snakeCaseName %>";
11
+ const path = "/widget/<%= snakeCaseName %>";
12
12
  //配置页路由地址
13
- const configUrl = <% if (configurable) { %>"/widget/config/<%= snakeCaseName %>"<% } else { %>undefined<% } %>;
13
+ const configPagePath = <% if (configurable) { %>"/widget/config/<%= snakeCaseName %>"<% } else { %>undefined<% } %>;
14
14
  //组件关键词
15
15
  const <%= name %>WidgetDefine = new Widget({
16
16
  name: name,
@@ -24,17 +24,9 @@ minWidth: <%= minWidth %>,
24
24
  maxWidth: <%= maxWidth %>,
25
25
  minHeight: <%= minHeight %>,
26
26
  maxHeight: <%= maxHeight %>,
27
- routes: [
28
- {
29
- url: url,
30
- name: 'index'
31
- },
32
- <% if (configurable) { %> {
33
- url: configUrl,
34
- name: 'config'
35
- },
36
- <% } %>
37
- ]
27
+ previewImage: "修改为组件预览图地址",
28
+ path,
29
+ configPagePath
38
30
  })
39
31
 
40
32
  export default <%= name %>WidgetDefine;
@@ -1,18 +1,18 @@
1
1
  import <%= name %>WidgetDefine from "./<%= name %>.widget";
2
2
 
3
- const url = <%= name %>WidgetDefine.getIndexRoute().url;
3
+ const path = <%= name %>WidgetDefine.path;
4
4
  const name = <%= name %>WidgetDefine.name;
5
5
  <% if (configurable) { %>
6
- const configUrl = <%= name %>WidgetDefine.getConfigRoute()!.url;
6
+ const configPagePath = <%= name %>WidgetDefine.configPagePath;
7
7
 
8
8
  const <%= name %>WidgetRoutes = [
9
9
  {
10
- path: url,
10
+ path: path,
11
11
  name: `${name}`,
12
12
  component: () => import(/* webpackChunkName: "<%= widgetName %>" */ './<%= name %>WidgetView.vue')
13
13
  },
14
14
  {
15
- path: configUrl,
15
+ path: configPagePath,
16
16
  name: `${name}.config`,
17
17
  component: () => import(/* webpackChunkName: "<%= widgetName %>.config" */ './<%= name %>ConfigView.vue')
18
18
  }
@@ -20,7 +20,7 @@ const <%= name %>WidgetRoutes = [
20
20
  <% } else { %>
21
21
  const <%= name %>WidgetRoutes = [
22
22
  {
23
- path: url,
23
+ path: path,
24
24
  name: `${name}`,
25
25
  component: () => import(/* webpackChunkName: "<%= widgetName %>" */ './<%= name %>WidgetView.vue')
26
26
  }
@@ -0,0 +1,9 @@
1
+ import {expect, test} from "vitest";
2
+ import {minimatch} from "minimatch";
3
+ import path from "path";
4
+
5
+ test('minimatch',()=>{
6
+ let fileName = path.basename('C:\\Users\\rtuge\\Desktop\\github\\widgetjs\\packages\\@widget-js\\cli\\template\\Widget.ejs');
7
+ expect(minimatch(fileName,'*.ejs')).toBeTruthy()
8
+ expect(minimatch(fileName,'*.ts')).toBeFalsy()
9
+ })
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- </profile>
6
- </component>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JpaBuddyIdeaProjectConfig">
4
- <option name="renamerInitialized" value="true" />
5
- </component>
6
- </project>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="PrettierConfiguration">
4
- <option name="myConfigurationMode" value="AUTOMATIC" />
5
- </component>
6
- </project>
@@ -1,39 +0,0 @@
1
- import { Widget, WidgetKeyword } from '@widget-js/core';
2
- //TODO 修改组件信息,标题,描述,关键词
3
- const name = 'cn.widgetjs.widgets.hotspot.test';
4
- //组件标题
5
- const title = { 'zh-CN': '123' };
6
- //组件描述
7
- const description = { 'zh-CN': '' };
8
- //组件关键词
9
- const keywords = [WidgetKeyword.RECOMMEND];
10
- //组件路由地址
11
- const url = '/widget/test';
12
- //配置页路由地址
13
- const configUrl = '/widget/config/test';
14
- //组件关键词
15
- const TestWidgetDefine = new Widget({
16
- name: name,
17
- title: title,
18
- description: description,
19
- keywords: keywords,
20
- lang: 'zh-CN',
21
- width: 2,
22
- height: 3,
23
- minWidth: 1,
24
- maxWidth: 3,
25
- minHeight: 2,
26
- maxHeight: 3,
27
- routes: [
28
- {
29
- url: url,
30
- name: 'index',
31
- },
32
- {
33
- url: configUrl,
34
- name: 'config',
35
- },
36
- ],
37
- });
38
-
39
- export default TestWidgetDefine;
@@ -1,41 +0,0 @@
1
- <template>
2
- <widget-edit-dialog
3
- :widget-params="widgetParams"
4
- :option="widgetConfigOption"
5
- :widget-data="widgetData"
6
- @confirm="onSaveClick()"
7
- >
8
- <template v-slot:form>
9
- <!-- TODO 这里写自定义表单内容 -->
10
- </template>
11
- </widget-edit-dialog>
12
- </template>
13
-
14
- <script lang="ts" setup>
15
- import {
16
- useWidget,
17
- WidgetConfigOption,
18
- WidgetEditDialog,
19
- } from '@widget-js/vue3';
20
- import { WidgetData, WidgetDataApi } from '@widget-js/core';
21
- import { reactive } from 'vue';
22
-
23
- const { widgetData, widgetParams } = useWidget(WidgetData);
24
-
25
- //修改成需要设置组件参数配置
26
- const widgetConfigOption = reactive(
27
- new WidgetConfigOption({
28
- custom: true,
29
- backgroundColor: true,
30
- borderRadius: true,
31
- preview: false,
32
- })
33
- );
34
-
35
- const onSaveClick = async () => {
36
- await WidgetDataApi.save(widgetData);
37
- window.close();
38
- };
39
- </script>
40
-
41
- <style scoped></style>
@@ -1,7 +0,0 @@
1
- <template>
2
- <!-- TODO 这里只写组件内容,不做自定义数据、业务处理 -->
3
- </template>
4
-
5
- <script lang="ts" setup></script>
6
-
7
- <style scoped></style>
@@ -1,27 +0,0 @@
1
- import TestWidgetDefine from './Test.widget';
2
-
3
- const url = TestWidgetDefine.getIndexRoute().url;
4
- const name = TestWidgetDefine.name;
5
-
6
- const configUrl = TestWidgetDefine.getConfigRoute()!.url;
7
-
8
- const TestWidgetRoutes = [
9
- {
10
- path: url,
11
- name: `${name}`,
12
- component: () =>
13
- import(
14
- /* webpackChunkName: "cn.widgetjs.widgets.hotspot.test" */ './TestWidgetView.vue'
15
- ),
16
- },
17
- {
18
- path: configUrl,
19
- name: `${name}.config`,
20
- component: () =>
21
- import(
22
- /* webpackChunkName: "cn.widgetjs.widgets.hotspot.test.config" */ './TestConfigView.vue'
23
- ),
24
- },
25
- ];
26
-
27
- export default TestWidgetRoutes;
@@ -1,14 +0,0 @@
1
- <template>
2
- <!-- TODO:组件页面,这里编写组件业务逻辑-->
3
- <test-widget></test-widget>
4
- </template>
5
-
6
- <script lang="ts" setup>
7
- import { WidgetData } from '@widget-js/core';
8
- import TestWidget from './TestWidget.vue';
9
- import { useWidget } from '@widget-js/vue3';
10
-
11
- const { widgetData, widgetParams } = useWidget(WidgetData);
12
- </script>
13
-
14
- <style scoped></style>
@@ -1,8 +0,0 @@
1
- import TestWidgetRoutes from "./test/TestWidgetRoutes";
2
- //FBI WANING! IMPORT PLACE, DONT DELETE THIS LINE
3
-
4
- const WidgetRouter = [
5
- ...TestWidgetRoutes,
6
- //FBI WANING! ROUTE PLACE, DONT DELETE THIS LINE
7
- ];
8
- export default WidgetRouter