@widget-js/cli 1.1.2 → 1.1.4

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/lib/index.cjs CHANGED
@@ -496,7 +496,65 @@ async function checkParentDir(ftpClient, file, onMkdir) {
496
496
  await ftpClient.mkdir(dir, true);
497
497
  }
498
498
  }
499
- function ftpUpload() {
499
+ async function runSSH(sshConfig, releaseConfig) {
500
+ import_consola3.default.info("run ssh:", sshConfig);
501
+ const answer = await import_inquirer3.default.prompt([{ type: "password", name: "password", mask: "*", message: "Enter key pair password" }]);
502
+ let ftpClient = new import_ssh2_sftp_client.default();
503
+ const port = sshConfig["Port"];
504
+ const key = import_fs7.default.readFileSync(import_path3.default.resolve(import_os.default.homedir(), ".ssh/id_rsa"));
505
+ const spinner3 = (0, import_ora4.default)("Connecting");
506
+ try {
507
+ spinner3.start();
508
+ await ftpClient.connect({
509
+ host: sshConfig["HostName"],
510
+ port: port ? parseInt(port) : 22,
511
+ username: sshConfig["User"],
512
+ passphrase: answer.password,
513
+ privateKey: key
514
+ });
515
+ releaseConfig.fileMap.sort((it1, it2) => (it1.order ?? 0) - (it2.order ?? 0));
516
+ for (let item of releaseConfig.fileMap) {
517
+ if (typeof item.src == "string") {
518
+ if (item.remoteCopy) {
519
+ await checkParentDir(ftpClient, item.dest, (dir) => {
520
+ spinner3.warn(`Create Dir: ${dir}`);
521
+ });
522
+ let destExists = await ftpClient.exists(item.dest);
523
+ if (destExists) {
524
+ spinner3.warn(`Delete exists file:${item.dest}`);
525
+ await ftpClient.delete(item.dest);
526
+ }
527
+ spinner3.info(`Copying File: ${item.src} -> ${item.dest}`);
528
+ await ftpClient.rcopy(item.src, item.dest);
529
+ } else {
530
+ const localFile = import_path3.default.resolve(process3.cwd(), item.src);
531
+ if (!item.remoteCopy && !import_fs7.default.existsSync(localFile)) {
532
+ spinner3.warn(`Skip not exists file:${localFile}`);
533
+ continue;
534
+ }
535
+ if (import_fs7.default.lstatSync(localFile).isDirectory()) {
536
+ spinner3.info(`Uploading Dir: ${localFile} -> ${item.dest}`);
537
+ await ftpClient.uploadDir(localFile, item.dest);
538
+ } else {
539
+ await checkParentDir(ftpClient, item.dest, (dir) => {
540
+ spinner3.warn(`Create Dir: ${dir}`);
541
+ });
542
+ spinner3.info(`Uploading File: ${localFile} -> ${item.dest}`);
543
+ await ftpClient.put(localFile, item.dest);
544
+ }
545
+ }
546
+ } else {
547
+ await ftpClient.put(Buffer.from(JSON.stringify(item.src), "utf-8"), item.dest);
548
+ }
549
+ }
550
+ spinner3.succeed("Files uploaded!");
551
+ await ftpClient.end();
552
+ } catch (e) {
553
+ spinner3.fail(`Connection error:${e}`);
554
+ await ftpClient.end();
555
+ }
556
+ }
557
+ async function ftpUpload() {
500
558
  const releaseJsonFilePath = import_path3.default.join(process3.cwd(), "release.json");
501
559
  const packageVersion = getPackageVersion();
502
560
  import_consola3.default.info("Package Version:", packageVersion);
@@ -505,68 +563,14 @@ function ftpUpload() {
505
563
  const sshConfigFile = import_path3.default.resolve(import_os.default.homedir(), ".ssh/config");
506
564
  import_consola3.default.info("SSH Config File Path:", sshConfigFile);
507
565
  const sshConfigs = import_ssh_config.default.parse(import_fs7.default.readFileSync(sshConfigFile).toString());
508
- let sshConfig = sshConfigs.compute(releaseConfig.ftpConfig.host);
509
- if (!sshConfig) {
510
- import_consola3.default.error(`SSH config ${releaseConfig.ftpConfig.host} not found`);
511
- return;
512
- }
513
- import_consola3.default.info(sshConfig);
514
- import_inquirer3.default.prompt([{ type: "password", name: "password", mask: "*", message: "Enter key pair password" }]).then(async (answer) => {
515
- let ftpClient = new import_ssh2_sftp_client.default();
516
- const port = sshConfig["Port"];
517
- const key = import_fs7.default.readFileSync(import_path3.default.resolve(import_os.default.homedir(), ".ssh/id_rsa"));
518
- const spinner3 = (0, import_ora4.default)("Connecting");
519
- try {
520
- spinner3.start();
521
- await ftpClient.connect({
522
- host: sshConfig["HostName"],
523
- port: port ? parseInt(port) : 22,
524
- username: sshConfig["User"],
525
- passphrase: answer.password,
526
- privateKey: key
527
- });
528
- releaseConfig.fileMap.sort((it1, it2) => (it1.order ?? 0) - (it2.order ?? 0));
529
- for (let item of releaseConfig.fileMap) {
530
- if (typeof item.src == "string") {
531
- if (item.remoteCopy) {
532
- await checkParentDir(ftpClient, item.dest, (dir) => {
533
- spinner3.warn(`Create Dir: ${dir}`);
534
- });
535
- let destExists = await ftpClient.exists(item.dest);
536
- if (destExists) {
537
- spinner3.warn(`Delete exists file:${item.dest}`);
538
- await ftpClient.delete(item.dest);
539
- }
540
- spinner3.info(`Copying File: ${item.src} -> ${item.dest}`);
541
- await ftpClient.rcopy(item.src, item.dest);
542
- } else {
543
- const localFile = import_path3.default.resolve(process3.cwd(), item.src);
544
- if (!item.remoteCopy && !import_fs7.default.existsSync(localFile)) {
545
- spinner3.warn(`Skip not exists file:${localFile}`);
546
- continue;
547
- }
548
- if (import_fs7.default.lstatSync(localFile).isDirectory()) {
549
- spinner3.info(`Uploading Dir: ${localFile} -> ${item.dest}`);
550
- await ftpClient.uploadDir(localFile, item.dest);
551
- } else {
552
- await checkParentDir(ftpClient, item.dest, (dir) => {
553
- spinner3.warn(`Create Dir: ${dir}`);
554
- });
555
- spinner3.info(`Uploading File: ${localFile} -> ${item.dest}`);
556
- await ftpClient.put(localFile, item.dest);
557
- }
558
- }
559
- } else {
560
- await ftpClient.put(Buffer.from(JSON.stringify(item.src), "utf-8"), item.dest);
561
- }
562
- }
563
- spinner3.succeed("Files uploaded!");
564
- await ftpClient.end();
565
- } catch (e) {
566
- spinner3.fail(`Connection error:${e}`);
567
- await ftpClient.end();
566
+ for (let host of releaseConfig.ftpConfig.host) {
567
+ let sshConfig = sshConfigs.compute(host);
568
+ if (!sshConfig) {
569
+ import_consola3.default.error(`SSH config ${releaseConfig.ftpConfig.host} not found`);
570
+ return;
568
571
  }
569
- });
572
+ await runSSH(sshConfig, releaseConfig);
573
+ }
570
574
  }
571
575
  var import_path3, import_fs7, import_ssh_config, import_os, import_ssh2_sftp_client, import_consola3, import_inquirer3, import_ora4, process3;
572
576
  var init_ftp = __esm({
package/lib/index.js CHANGED
@@ -27,7 +27,7 @@ program.command("build").description("\u6267\u884C\u7F16\u8BD1\u4EFB\u52A1").act
27
27
  });
28
28
  var typeOption = new Option("-t, --type <type>").choices(["ftp", "oss"]);
29
29
  program.command("release").description("\u901A\u8FC7FTP/OSS\u53D1\u5E03\u6587\u4EF6\uFF0C\u4EC5\u5185\u90E8\u4F7F\u7528").addOption(typeOption).action(async (options, command) => {
30
- let release = await import("./release-U3O2EENP.js");
30
+ let release = await import("./release-MNILEHXP.js");
31
31
  await release.default(options);
32
32
  });
33
33
  program.parse(process.argv);
@@ -84,7 +84,65 @@ async function checkParentDir(ftpClient, file, onMkdir) {
84
84
  await ftpClient.mkdir(dir, true);
85
85
  }
86
86
  }
87
- function ftpUpload() {
87
+ async function runSSH(sshConfig, releaseConfig) {
88
+ consola.info("run ssh:", sshConfig);
89
+ const answer = await inquirer.prompt([{ type: "password", name: "password", mask: "*", message: "Enter key pair password" }]);
90
+ let ftpClient = new Client();
91
+ const port = sshConfig["Port"];
92
+ const key = fs3.readFileSync(path.resolve(os.homedir(), ".ssh/id_rsa"));
93
+ const spinner = ora("Connecting");
94
+ try {
95
+ spinner.start();
96
+ await ftpClient.connect({
97
+ host: sshConfig["HostName"],
98
+ port: port ? parseInt(port) : 22,
99
+ username: sshConfig["User"],
100
+ passphrase: answer.password,
101
+ privateKey: key
102
+ });
103
+ releaseConfig.fileMap.sort((it1, it2) => (it1.order ?? 0) - (it2.order ?? 0));
104
+ for (let item of releaseConfig.fileMap) {
105
+ if (typeof item.src == "string") {
106
+ if (item.remoteCopy) {
107
+ await checkParentDir(ftpClient, item.dest, (dir) => {
108
+ spinner.warn(`Create Dir: ${dir}`);
109
+ });
110
+ let destExists = await ftpClient.exists(item.dest);
111
+ if (destExists) {
112
+ spinner.warn(`Delete exists file:${item.dest}`);
113
+ await ftpClient.delete(item.dest);
114
+ }
115
+ spinner.info(`Copying File: ${item.src} -> ${item.dest}`);
116
+ await ftpClient.rcopy(item.src, item.dest);
117
+ } else {
118
+ const localFile = path.resolve(process.cwd(), item.src);
119
+ if (!item.remoteCopy && !fs3.existsSync(localFile)) {
120
+ spinner.warn(`Skip not exists file:${localFile}`);
121
+ continue;
122
+ }
123
+ if (fs3.lstatSync(localFile).isDirectory()) {
124
+ spinner.info(`Uploading Dir: ${localFile} -> ${item.dest}`);
125
+ await ftpClient.uploadDir(localFile, item.dest);
126
+ } else {
127
+ await checkParentDir(ftpClient, item.dest, (dir) => {
128
+ spinner.warn(`Create Dir: ${dir}`);
129
+ });
130
+ spinner.info(`Uploading File: ${localFile} -> ${item.dest}`);
131
+ await ftpClient.put(localFile, item.dest);
132
+ }
133
+ }
134
+ } else {
135
+ await ftpClient.put(Buffer.from(JSON.stringify(item.src), "utf-8"), item.dest);
136
+ }
137
+ }
138
+ spinner.succeed("Files uploaded!");
139
+ await ftpClient.end();
140
+ } catch (e) {
141
+ spinner.fail(`Connection error:${e}`);
142
+ await ftpClient.end();
143
+ }
144
+ }
145
+ async function ftpUpload() {
88
146
  const releaseJsonFilePath = path.join(process.cwd(), "release.json");
89
147
  const packageVersion = getPackageVersion();
90
148
  consola.info("Package Version:", packageVersion);
@@ -93,68 +151,14 @@ function ftpUpload() {
93
151
  const sshConfigFile = path.resolve(os.homedir(), ".ssh/config");
94
152
  consola.info("SSH Config File Path:", sshConfigFile);
95
153
  const sshConfigs = SSHConfig.parse(fs3.readFileSync(sshConfigFile).toString());
96
- let sshConfig = sshConfigs.compute(releaseConfig.ftpConfig.host);
97
- if (!sshConfig) {
98
- consola.error(`SSH config ${releaseConfig.ftpConfig.host} not found`);
99
- return;
100
- }
101
- consola.info(sshConfig);
102
- inquirer.prompt([{ type: "password", name: "password", mask: "*", message: "Enter key pair password" }]).then(async (answer) => {
103
- let ftpClient = new Client();
104
- const port = sshConfig["Port"];
105
- const key = fs3.readFileSync(path.resolve(os.homedir(), ".ssh/id_rsa"));
106
- const spinner = ora("Connecting");
107
- try {
108
- spinner.start();
109
- await ftpClient.connect({
110
- host: sshConfig["HostName"],
111
- port: port ? parseInt(port) : 22,
112
- username: sshConfig["User"],
113
- passphrase: answer.password,
114
- privateKey: key
115
- });
116
- releaseConfig.fileMap.sort((it1, it2) => (it1.order ?? 0) - (it2.order ?? 0));
117
- for (let item of releaseConfig.fileMap) {
118
- if (typeof item.src == "string") {
119
- if (item.remoteCopy) {
120
- await checkParentDir(ftpClient, item.dest, (dir) => {
121
- spinner.warn(`Create Dir: ${dir}`);
122
- });
123
- let destExists = await ftpClient.exists(item.dest);
124
- if (destExists) {
125
- spinner.warn(`Delete exists file:${item.dest}`);
126
- await ftpClient.delete(item.dest);
127
- }
128
- spinner.info(`Copying File: ${item.src} -> ${item.dest}`);
129
- await ftpClient.rcopy(item.src, item.dest);
130
- } else {
131
- const localFile = path.resolve(process.cwd(), item.src);
132
- if (!item.remoteCopy && !fs3.existsSync(localFile)) {
133
- spinner.warn(`Skip not exists file:${localFile}`);
134
- continue;
135
- }
136
- if (fs3.lstatSync(localFile).isDirectory()) {
137
- spinner.info(`Uploading Dir: ${localFile} -> ${item.dest}`);
138
- await ftpClient.uploadDir(localFile, item.dest);
139
- } else {
140
- await checkParentDir(ftpClient, item.dest, (dir) => {
141
- spinner.warn(`Create Dir: ${dir}`);
142
- });
143
- spinner.info(`Uploading File: ${localFile} -> ${item.dest}`);
144
- await ftpClient.put(localFile, item.dest);
145
- }
146
- }
147
- } else {
148
- await ftpClient.put(Buffer.from(JSON.stringify(item.src), "utf-8"), item.dest);
149
- }
150
- }
151
- spinner.succeed("Files uploaded!");
152
- await ftpClient.end();
153
- } catch (e) {
154
- spinner.fail(`Connection error:${e}`);
155
- await ftpClient.end();
154
+ for (let host of releaseConfig.ftpConfig.host) {
155
+ let sshConfig = sshConfigs.compute(host);
156
+ if (!sshConfig) {
157
+ consola.error(`SSH config ${releaseConfig.ftpConfig.host} not found`);
158
+ return;
156
159
  }
157
- });
160
+ await runSSH(sshConfig, releaseConfig);
161
+ }
158
162
  }
159
163
 
160
164
  // src/release/release.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widget-js/cli",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "main": "lib/index.js",
5
5
  "author": "Neo Fu",
6
6
  "license": "MIT",
@@ -65,6 +65,7 @@
65
65
  "build:run": "npm run build && npm run widget",
66
66
  "prebuild": "",
67
67
  "widget": "node ./lib/index.js",
68
+ "widget:ftp": "node ./lib/index.js release -t ftp",
68
69
  "pnpm:publish": "pnpm publish --no-git-checks"
69
70
  }
70
71
  }
package/release.json CHANGED
@@ -1,21 +1,7 @@
1
1
  {
2
2
  "fileMap": [
3
- {
4
- "src": "./dist/youlu-${version}-setup-win-ia32.exe",
5
- "dest": "/www/wwwroot/download.tool-vip.com/youlu/youlu.exe",
6
- "order": 0
7
- },
8
- {
9
- "src": ".gitignore",
10
- "dest": "/www/wwwroot/template/aa/.gitignore"
11
- },
12
- {
13
- "src": "/www/wwwroot/template/aa/.gitignore",
14
- "dest": "/www/wwwroot/template/bbb/.gitignorexxx",
15
- "remoteCopy": true
16
- }
17
3
  ],
18
4
  "ftpConfig": {
19
- "host": "youlu"
5
+ "host": ["youlu","itime"]
20
6
  }
21
7
  }
@@ -7,7 +7,7 @@ import consola from "consola";
7
7
  import inquirer from "inquirer";
8
8
  import ora from "ora";
9
9
  import * as process from "process";
10
- import { getPackageVersion } from "../utils";
10
+ import {getPackageVersion} from "../utils";
11
11
 
12
12
 
13
13
  interface PasswordAnswer {
@@ -23,7 +23,69 @@ async function checkParentDir(ftpClient: Client, file: string, onMkdir: (dir: st
23
23
  }
24
24
  }
25
25
 
26
- export function ftpUpload() {
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() {
27
89
  // 读取
28
90
  const releaseJsonFilePath = path.join(process.cwd(), 'release.json')
29
91
  const packageVersion = getPackageVersion()
@@ -34,73 +96,18 @@ export function ftpUpload() {
34
96
  const sshConfigFile = path.resolve(os.homedir(), '.ssh/config')
35
97
  consola.info('SSH Config File Path:', sshConfigFile)
36
98
  const sshConfigs = SSHConfig.parse(fs.readFileSync(sshConfigFile).toString())
37
- let sshConfig = sshConfigs.compute(releaseConfig.ftpConfig.host)
38
- if (!sshConfig) {
39
- consola.error(`SSH config ${releaseConfig.ftpConfig.host} not found`)
40
- return
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)
41
106
  }
42
- consola.info(sshConfig)
43
- inquirer
44
- .prompt<PasswordAnswer>([{type: 'password', name: 'password', mask: '*', message: 'Enter key pair password'}])
45
- .then(async (answer: PasswordAnswer) => {
46
- let ftpClient = new Client()
47
- const port = sshConfig['Port']
48
- const key = fs.readFileSync(path.resolve(os.homedir(), '.ssh/id_rsa'))
49
- const spinner = ora('Connecting')
50
- try {
51
- spinner.start()
52
- await ftpClient.connect({
53
- host: sshConfig['HostName'] as string,
54
- port: port ? parseInt(port as string) : 22,
55
- username: sshConfig['User'] as string,
56
- passphrase: answer.password,
57
- privateKey: key,
58
- })
59
- releaseConfig.fileMap.sort((it1, it2) => (it1.order ?? 0) - (it2.order ?? 0))
60
- // upload files
61
- for (let item of releaseConfig.fileMap) {
62
- if (typeof item.src == 'string') {
63
- if (item.remoteCopy) {
64
- await checkParentDir(ftpClient, item.dest, dir => {
65
- spinner.warn(`Create Dir: ${dir}`)
66
- })
67
- let destExists = await ftpClient.exists(item.dest)
68
- if (destExists) {
69
- spinner.warn(`Delete exists file:${item.dest}`)
70
- await ftpClient.delete(item.dest)
71
- }
72
- spinner.info(`Copying File: ${item.src} -> ${item.dest}`)
73
- await ftpClient.rcopy(item.src, item.dest)
74
- } else {
75
- const localFile = path.resolve(process.cwd(), item.src as string)
76
- if (!item.remoteCopy && !fs.existsSync(localFile)) {
77
- spinner.warn(`Skip not exists file:${localFile}`)
78
- continue
79
- }
80
- if (fs.lstatSync(localFile).isDirectory()) {
81
- spinner.info(`Uploading Dir: ${localFile} -> ${item.dest}`)
82
- await ftpClient.uploadDir(localFile, item.dest)
83
- } else {
84
- await checkParentDir(ftpClient, item.dest, dir => {
85
- spinner.warn(`Create Dir: ${dir}`)
86
- })
87
- spinner.info(`Uploading File: ${localFile} -> ${item.dest}`)
88
- await ftpClient.put(localFile, item.dest)
89
- }
90
- }
91
- } else {
92
- await ftpClient.put(Buffer.from(JSON.stringify(item.src), 'utf-8'), item.dest)
93
- }
94
- }
95
- spinner.succeed('Files uploaded!')
96
- await ftpClient.end()
97
- } catch (e) {
98
- spinner.fail(`Connection error:${e}`)
99
- await ftpClient.end()
100
- }
101
- })
107
+
102
108
  }
103
109
 
110
+
104
111
  export interface ReleaseConfig {
105
112
  fileMap: {
106
113
  src: string | object
@@ -112,5 +119,5 @@ export interface ReleaseConfig {
112
119
  }
113
120
 
114
121
  export interface FTPConfig {
115
- host: string
122
+ host: string[]
116
123
  }
@@ -2,9 +2,9 @@ import {Widget, WidgetKeyword} from "@widget-js/core";
2
2
  //TODO 修改组件信息,标题,描述,关键词
3
3
  const name = "cn.widgetjs.widgets.<%= snakeCaseName%>";
4
4
  //组件标题
5
- const title = {"zh": "<%= title%>"};
5
+ const title = {"zh-CN": "<%= title%>"};
6
6
  //组件描述
7
- const description = {"zh": ""};
7
+ const description = {"zh-CN": ""};
8
8
  //组件关键词
9
9
  const keywords = [WidgetKeyword.RECOMMEND];
10
10
  //组件路由地址
@@ -13,29 +13,29 @@ const url = "/widget/<%= snakeCaseName%>";
13
13
  const configUrl = <% if (configurable) { %>"/widget/config/<%= snakeCaseName%>"<% } else { %>undefined<% } %>;
14
14
  //组件关键词
15
15
  const <%= name %>WidgetDefine = new Widget({
16
- name: name,
17
- title: title,
18
- description: description,
19
- keywords: keywords,
20
- lang: "zh",
21
- width: <%= width %>,
22
- height: <%= height %>,
23
- minWidth: <%= minWidth %>,
24
- maxWidth: <%= maxWidth %>,
25
- minHeight: <%= minHeight %>,
26
- maxHeight: <%= maxHeight %>,
27
- routes: [
28
- {
29
- url: url,
30
- name: 'index'
31
- },
16
+ name: name,
17
+ title: title,
18
+ description: description,
19
+ keywords: keywords,
20
+ lang: "zh-CN",
21
+ width: <%= width %>,
22
+ height: <%= height %>,
23
+ minWidth: <%= minWidth %>,
24
+ maxWidth: <%= maxWidth %>,
25
+ minHeight: <%= minHeight %>,
26
+ maxHeight: <%= maxHeight %>,
27
+ routes: [
28
+ {
29
+ url: url,
30
+ name: 'index'
31
+ },
32
32
  <% if (configurable) { %>
33
- {
34
- url: configUrl,
35
- name: 'config'
36
- },
33
+ {
34
+ url: configUrl,
35
+ name: 'config'
36
+ },
37
37
  <% } %>
38
- ]
38
+ ]
39
39
  })
40
40
 
41
41
  export default <%= name %>WidgetDefine;