@widget-js/cli 24.1.1-beta.1 → 24.1.1-beta.10

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/src/init/init.ts CHANGED
@@ -1,121 +1,121 @@
1
- import path from 'node:path'
2
- import process from 'node:process'
3
- import fs from 'node:fs'
4
- import { fileURLToPath } from 'node:url'
5
- import consola from 'consola'
6
- import chalk from 'chalk'
7
- import ora from 'ora'
8
- import { scanWidgetPackage } from '@widget-js/utils'
9
- import { Utils } from '../utils'
10
- import promptChecker from '../promts/promptChecker'
11
- import { EJSUtils } from '../utils/EJSUtils'
12
- import { PrettierUtils } from '../utils/PrettierUtils'
13
- import { WidgetPackageUtils } from '../utils/WidgetPackageUtils'
14
-
15
- const __filename = fileURLToPath(import.meta.url)
16
- const __dirname = path.dirname(__filename)
17
- const spinner = ora('Loading')
18
-
19
- export async function init() {
20
- await addDependencies()
21
- await addWidgetTs()
22
- }
23
-
24
- async function addWidgetTs() {
25
- const name = await promptChecker(
26
- {
27
- type: 'input',
28
- name: 'name',
29
- message: chalk.blue('组件包 包名 (示例 cn.widget.countdown):'),
30
- },
31
- (answer) => {
32
- const name = answer.name
33
- if (name == null || name === '') {
34
- consola.log(chalk.red(`包名不能为空`))
35
- return false
36
- }
37
- return true
38
- },
39
- )
40
-
41
- const widgetPackageTs = path.join(process.cwd(), 'widget.package.ts')
42
- if (fs.existsSync(widgetPackageTs)) {
43
- spinner.info('widget.package.ts已存在,跳过')
44
- }
45
- else {
46
- spinner.info('创建 widget.package.ts')
47
- await EJSUtils.renderToFile('WidgetPackage.ejs', widgetPackageTs, 'typescript', { name })
48
- }
49
-
50
- await addVitePlugin()
51
- await createRouter()
52
-
53
- spinner.succeed('初始化完成,请运行 npm install')
54
- }
55
-
56
- /**
57
- * 增加widget-js依赖
58
- */
59
- async function addDependencies() {
60
- const packageJson = Utils.getPackageJson()
61
- let dependencies = packageJson.dependencies
62
- const devDependencies = packageJson.devDependencies
63
- if (!dependencies) {
64
- dependencies = {}
65
- }
66
- if (!devDependencies) {
67
- packageJson.devDependencies = {}
68
- }
69
-
70
- await addDependency('@widget-js/core', dependencies)
71
- await addDependency('@widget-js/vue3', dependencies)
72
- await addDependency('@widget-js/vite-plugin-widget', devDependencies)
73
-
74
- packageJson.dependencies = dependencies
75
- packageJson.devDependencies = devDependencies
76
-
77
- fs.writeFileSync(Utils.getPackagePath(), JSON.stringify(packageJson, null, 2))
78
- }
79
-
80
- async function addVitePlugin() {
81
- spinner.info('添加 vite-plugin-widget 到 vite plugin')
82
- const viteConfigPath = path.join(process.cwd(), 'vite.config.ts')
83
- if (!fs.existsSync(viteConfigPath)) {
84
- spinner.warn('vite.config.ts not exists')
85
- return
86
- }
87
- let viteConfig = fs.readFileSync(viteConfigPath).toString()
88
- viteConfig = `import widget from '@widget-js/vite-plugin-widget'\n${viteConfig}`
89
- viteConfig = viteConfig.replace('vue()', `vue(),widget()`)
90
- fs.writeFileSync(viteConfigPath, await PrettierUtils.format(viteConfig, 'typescript'))
91
- }
92
-
93
- async function createRouter() {
94
- const widgetPackage = await scanWidgetPackage()
95
- if (widgetPackage) {
96
- spinner.info('创建 widget-router.ts')
97
- const rootDir = WidgetPackageUtils.getRootDir(widgetPackage)
98
- const widgetRouterPath = path.join(rootDir, 'widget-router.ts')
99
- const routerContent = fs.readFileSync(path.join(__dirname, '../template/widget-router.ts'), 'utf8')
100
- fs.writeFileSync(widgetRouterPath, routerContent)
101
-
102
- const vueRouterPath = path.join(process.cwd(), './src/router/index.ts')
103
- spinner.info('修改VueRouter配置')
104
- if (fs.existsSync(vueRouterPath)) {
105
- let vueRouterContent = fs.readFileSync(vueRouterPath, 'utf8')
106
- const importStr = `import WidgetRouter from "../widgets/widget-router";`
107
- vueRouterContent = `${importStr}\n${vueRouterContent}`
108
- vueRouterContent = vueRouterContent.replace('routes: [', `routes: [\n...WidgetRouter,`)
109
- fs.writeFileSync(vueRouterPath, await PrettierUtils.format(vueRouterContent, 'typescript'))
110
- }
111
- }
112
- }
113
-
114
- async function addDependency(packageName: string, dependencies: any) {
115
- spinner.info(`Adding dependencies ${packageName}`)
116
- if (dependencies[packageName]) {
117
- return
118
- }
119
- const remoteVersion = await Utils.getRemoteVersion(packageName)
120
- dependencies[packageName] = `^${remoteVersion}`
121
- }
1
+ import path from 'node:path'
2
+ import process from 'node:process'
3
+ import fs from 'node:fs'
4
+ import { fileURLToPath } from 'node:url'
5
+ import consola from 'consola'
6
+ import chalk from 'chalk'
7
+ import ora from 'ora'
8
+ import { scanWidgetPackage } from '@widget-js/utils'
9
+ import { Utils } from '../utils'
10
+ import promptChecker from '../promts/promptChecker'
11
+ import { EJSUtils } from '../utils/EJSUtils'
12
+ import { PrettierUtils } from '../utils/PrettierUtils'
13
+ import { WidgetPackageUtils } from '../utils/WidgetPackageUtils'
14
+
15
+ const __filename = fileURLToPath(import.meta.url)
16
+ const __dirname = path.dirname(__filename)
17
+ const spinner = ora('Loading')
18
+
19
+ export async function init() {
20
+ await addDependencies()
21
+ await addWidgetTs()
22
+ }
23
+
24
+ async function addWidgetTs() {
25
+ const name = await promptChecker(
26
+ {
27
+ type: 'input',
28
+ name: 'name',
29
+ message: chalk.blue('组件包 包名 (示例 cn.widget.countdown):'),
30
+ },
31
+ (answer) => {
32
+ const name = answer.name
33
+ if (name == null || name === '') {
34
+ consola.log(chalk.red(`包名不能为空`))
35
+ return false
36
+ }
37
+ return true
38
+ },
39
+ )
40
+
41
+ const widgetPackageTs = path.join(process.cwd(), 'widget.package.ts')
42
+ if (fs.existsSync(widgetPackageTs)) {
43
+ spinner.info('widget.package.ts已存在,跳过')
44
+ }
45
+ else {
46
+ spinner.info('创建 widget.package.ts')
47
+ await EJSUtils.renderToFile('WidgetPackage.ejs', widgetPackageTs, 'typescript', { name })
48
+ }
49
+
50
+ await addVitePlugin()
51
+ await createRouter()
52
+
53
+ spinner.succeed('初始化完成,请运行 npm install')
54
+ }
55
+
56
+ /**
57
+ * 增加widget-js依赖
58
+ */
59
+ async function addDependencies() {
60
+ const packageJson = Utils.getPackageJson()
61
+ let dependencies = packageJson.dependencies
62
+ const devDependencies = packageJson.devDependencies
63
+ if (!dependencies) {
64
+ dependencies = {}
65
+ }
66
+ if (!devDependencies) {
67
+ packageJson.devDependencies = {}
68
+ }
69
+
70
+ await addDependency('@widget-js/core', dependencies)
71
+ await addDependency('@widget-js/vue3', dependencies)
72
+ await addDependency('@widget-js/vite-plugin-widget', devDependencies)
73
+
74
+ packageJson.dependencies = dependencies
75
+ packageJson.devDependencies = devDependencies
76
+
77
+ fs.writeFileSync(Utils.getPackagePath(), JSON.stringify(packageJson, null, 2))
78
+ }
79
+
80
+ async function addVitePlugin() {
81
+ spinner.info('添加 vite-plugin-widget 到 vite plugin')
82
+ const viteConfigPath = path.join(process.cwd(), 'vite.config.ts')
83
+ if (!fs.existsSync(viteConfigPath)) {
84
+ spinner.warn('vite.config.ts not exists')
85
+ return
86
+ }
87
+ let viteConfig = fs.readFileSync(viteConfigPath).toString()
88
+ viteConfig = `import widget from '@widget-js/vite-plugin-widget'\n${viteConfig}`
89
+ viteConfig = viteConfig.replace('vue()', `vue(),widget()`)
90
+ fs.writeFileSync(viteConfigPath, await PrettierUtils.format(viteConfig, 'typescript'))
91
+ }
92
+
93
+ async function createRouter() {
94
+ const widgetPackage = await scanWidgetPackage()
95
+ if (widgetPackage) {
96
+ spinner.info('创建 widget-router.ts')
97
+ const rootDir = WidgetPackageUtils.getRootDir(widgetPackage)
98
+ const widgetRouterPath = path.join(rootDir, 'widget-router.ts')
99
+ const routerContent = fs.readFileSync(path.join(__dirname, '../template/widget-router.ts'), 'utf8')
100
+ fs.writeFileSync(widgetRouterPath, routerContent)
101
+
102
+ const vueRouterPath = path.join(process.cwd(), './src/router/index.ts')
103
+ spinner.info('修改VueRouter配置')
104
+ if (fs.existsSync(vueRouterPath)) {
105
+ let vueRouterContent = fs.readFileSync(vueRouterPath, 'utf8')
106
+ const importStr = `import WidgetRouter from "../widgets/widget-router";`
107
+ vueRouterContent = `${importStr}\n${vueRouterContent}`
108
+ vueRouterContent = vueRouterContent.replace('routes: [', `routes: [\n...WidgetRouter,`)
109
+ fs.writeFileSync(vueRouterPath, await PrettierUtils.format(vueRouterContent, 'typescript'))
110
+ }
111
+ }
112
+ }
113
+
114
+ async function addDependency(packageName: string, dependencies: any) {
115
+ spinner.info(`Adding dependencies ${packageName}`)
116
+ if (dependencies[packageName]) {
117
+ return
118
+ }
119
+ const remoteVersion = await Utils.getRemoteVersion(packageName)
120
+ dependencies[packageName] = `^${remoteVersion}`
121
+ }
@@ -1,4 +1,4 @@
1
- import type { Answers, Question } from 'inquirer'
1
+ import type { Answers, Question } from 'inquirer'
2
2
  import inquirer from 'inquirer'
3
3
 
4
4
  async function promptChecker<T extends Question>(prompt: T, checker?: (answer: any) => boolean): Promise<any> {
@@ -6,7 +6,7 @@ async function promptChecker<T extends Question>(prompt: T, checker?: (answer: a
6
6
  if (checker) {
7
7
  if (checker(answer)) {
8
8
  return answer[prompt.name!]
9
- }
9
+ }
10
10
  else {
11
11
  return promptChecker(prompt, checker)
12
12
  }
@@ -0,0 +1,60 @@
1
+ import fs from 'node:fs'
2
+ import fastGlob from 'fast-glob'
3
+ import axios from 'axios'
4
+ import consola from 'consola'
5
+ import ora from 'ora'
6
+ /**
7
+ * 用fast-glob扫描运行目录下第一个 widget.json 文件
8
+ * 然后用axios发送post请求到 https://widgetjs.cn/api/widget/package,把key加到请求头中,把 widget.json 文件内容作为请求体
9
+ */
10
+ export async function publish(options: { key: string }): Promise<void> {
11
+ if (!options.key) {
12
+ consola.error('Please provide a developer key with -k or --key option.')
13
+ return
14
+ }
15
+ const spinner = ora('Search widget.json').start()
16
+ try {
17
+ // Scan the current directory for the first widget.json file, ignore node_modules
18
+ const files = await fastGlob('**/widget.json', { onlyFiles: true, ignore: ['node_modules/**'], absolute: true })
19
+ if (files.length === 0) {
20
+ spinner.fail('No widget.json file found.')
21
+ return
22
+ }
23
+
24
+ spinner.succeed(`Widget.json found: ${files[0]}`)
25
+
26
+ const widgetPath = files[0]
27
+ const widgetContent = fs.readFileSync(widgetPath, 'utf-8')
28
+
29
+ const json = JSON.parse(widgetContent)
30
+ consola.info(`Package name:${json.name}`)
31
+ const widgets = json.widgets
32
+ consola.info(`Widget size:${widgets?.length ?? 0}`)
33
+
34
+ spinner.start('Publishing widget package...')
35
+ // Send a POST request to the specified URL with the widget content
36
+ const response = await axios.post('https://widgetjs.cn/api/v1/widget/package', json, {
37
+ headers: {
38
+ 'Content-Type': 'application/json',
39
+ 'Key': options.key,
40
+ },
41
+ })
42
+
43
+ if (response.data) {
44
+ if (response.data.code == 200) {
45
+ spinner.succeed('Widget published successfully.')
46
+ }
47
+ else {
48
+ spinner.fail('Failed to publish widget.')
49
+ consola.error(response.data.msg)
50
+ }
51
+ }
52
+ else {
53
+ spinner.fail('Empty Response')
54
+ }
55
+ }
56
+ catch (error) {
57
+ spinner.fail('Failed to publish widget.')
58
+ consola.error(error)
59
+ }
60
+ }
@@ -57,7 +57,7 @@ async function runSSH(sshConfig: Record<string, string | string[]>, releaseConfi
57
57
  }
58
58
  spinner.info(`Copying File: ${item.src} -> ${item.dest}`)
59
59
  await ftpClient.rcopy(item.src, item.dest)
60
- }
60
+ }
61
61
  else {
62
62
  const localFile = path.resolve(process.cwd(), item.src as string)
63
63
  if (!item.remoteCopy && !fs.existsSync(localFile)) {
@@ -78,7 +78,7 @@ async function runSSH(sshConfig: Record<string, string | string[]>, releaseConfi
78
78
  return true
79
79
  },
80
80
  })
81
- }
81
+ }
82
82
  else {
83
83
  await checkParentDir(ftpClient, item.dest, (dir) => {
84
84
  spinner.succeed(`Create Dir: ${dir}`)
@@ -88,14 +88,14 @@ async function runSSH(sshConfig: Record<string, string | string[]>, releaseConfi
88
88
  await ftpClient.put(localFile, item.dest)
89
89
  }
90
90
  }
91
- }
91
+ }
92
92
  else {
93
93
  await ftpClient.put(Buffer.from(JSON.stringify(item.src), 'utf-8'), item.dest)
94
94
  }
95
95
  }
96
96
  spinner.succeed('Files uploaded!')
97
97
  await ftpClient.end()
98
- }
98
+ }
99
99
  catch (e) {
100
100
  spinner.fail(`Connection error:${e}`)
101
101
  await ftpClient.end()
@@ -1,6 +1,7 @@
1
1
  import fs from 'node:fs'
2
2
  import OSS from 'ali-oss'
3
3
  import chalk from 'chalk'
4
+ import consola from 'consola'
4
5
 
5
6
  const packageData = JSON.parse(fs.readFileSync('./package.json').toString())
6
7
  export const AccessKeyID = packageData.oss?.id ?? 'default'
@@ -28,11 +29,11 @@ export async function put(ossPath: string, file: any) {
28
29
  try {
29
30
  // 填写OSS文件完整路径和本地文件的完整路径。OSS文件完整路径中不能包含Bucket名称。
30
31
  // 如果本地文件的完整路径中未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。
31
- const result = await clinet.put(ossPath, file, { headers })
32
- console.log(chalk.green(`上传成功:${file}->${ossPath}`))
33
- }
32
+ await clinet.put(ossPath, file, { headers })
33
+ consola.log(chalk.green(`上传成功:${file}->${ossPath}`))
34
+ }
34
35
  catch (e) {
35
- console.log(e)
36
+ consola.log(e)
36
37
  }
37
38
  }
38
39
 
@@ -40,9 +41,9 @@ export async function copy(dist: string, src: string) {
40
41
  try {
41
42
  // 填写OSS文件完整路径和本地文件的完整路径。OSS文件完整路径中不能包含Bucket名称。
42
43
  // 如果本地文件的完整路径中未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。
43
- const result = await clinet.copy(dist, src, { headers })
44
- console.log(chalk.green(`复制成功:${src}->${dist}`))
45
- }
44
+ await clinet.copy(dist, src, { headers })
45
+ consola.log(chalk.green(`复制成功:${src}->${dist}`))
46
+ }
46
47
  catch (e) {
47
48
  console.error(e)
48
49
  }
@@ -6,8 +6,12 @@ function zipDirectory(sourceDir: string, outPath: string, ignoreDir?: string[])
6
6
  const stream = fs.createWriteStream(outPath)
7
7
 
8
8
  return new Promise<void>((resolve, reject) => {
9
+ const ignore: string[] = ['node_modules/**']
10
+ if (ignoreDir) {
11
+ ignore.push(...ignoreDir)
12
+ }
9
13
  archive
10
- .glob('**/*', { cwd: sourceDir, ignore: ['node_modules/**'] })
14
+ .glob('**/*', { cwd: sourceDir, ignore })
11
15
  .on('error', err => reject(err))
12
16
  .pipe(stream)
13
17
 
@@ -1,18 +1,18 @@
1
- import path from 'node:path'
2
- import fs from 'node:fs'
3
- import type { Data } from 'ejs'
4
- import ejs from 'ejs'
5
- import type { BuiltInParserName } from 'prettier'
6
- import { dirname } from 'dirname-filename-esm'
7
- import { PrettierUtils } from './PrettierUtils'
8
-
9
- export class EJSUtils {
10
- static async renderToFile(templateFile: string, outputFile: string, parser: BuiltInParserName, renderOptions: Data) {
11
- const defineTemplatePath = path.join(dirname(import.meta), '../template', templateFile)
12
- const defineTemplate = fs.readFileSync(defineTemplatePath, 'utf8')
13
- // Format the EJS code using Prettier
14
- const code = ejs.render(defineTemplate, renderOptions)
15
- const formattedEJSCode = await PrettierUtils.format(code, parser)
16
- fs.writeFileSync(outputFile, formattedEJSCode)
17
- }
18
- }
1
+ import path from 'node:path'
2
+ import fs from 'node:fs'
3
+ import type { Data } from 'ejs'
4
+ import ejs from 'ejs'
5
+ import type { BuiltInParserName } from 'prettier'
6
+ import { dirname } from 'dirname-filename-esm'
7
+ import { PrettierUtils } from './PrettierUtils'
8
+
9
+ export class EJSUtils {
10
+ static async renderToFile(templateFile: string, outputFile: string, parser: BuiltInParserName, renderOptions: Data) {
11
+ const defineTemplatePath = path.join(dirname(import.meta), '../template', templateFile)
12
+ const defineTemplate = fs.readFileSync(defineTemplatePath, 'utf8')
13
+ // Format the EJS code using Prettier
14
+ const code = ejs.render(defineTemplate, renderOptions)
15
+ const formattedEJSCode = await PrettierUtils.format(code, parser)
16
+ fs.writeFileSync(outputFile, formattedEJSCode)
17
+ }
18
+ }
@@ -1,12 +1,12 @@
1
- import type { BuiltInParserName } from 'prettier'
2
- import { format } from 'prettier'
3
-
4
- export class PrettierUtils {
5
- static async format(code: string, parser: BuiltInParserName) {
6
- return format(code, {
7
- parser,
8
- tabWidth: 2,
9
- singleQuote: true,
10
- })
11
- }
12
- }
1
+ import type { BuiltInParserName } from 'prettier'
2
+ import { format } from 'prettier'
3
+
4
+ export class PrettierUtils {
5
+ static async format(code: string, parser: BuiltInParserName) {
6
+ return format(code, {
7
+ parser,
8
+ tabWidth: 2,
9
+ singleQuote: true,
10
+ })
11
+ }
12
+ }
@@ -1,13 +1,13 @@
1
- import path from 'node:path'
2
- import fs from 'node:fs'
3
- import type { WidgetPackage } from '@widget-js/core'
4
-
5
- export class WidgetPackageUtils {
6
- static getRootDir(widgetPackage: WidgetPackage) {
7
- const widgetRootDir = path.join(process.cwd(), widgetPackage.devOptions?.folder ?? './src/widgets')
8
- if (!fs.existsSync(widgetRootDir)) {
9
- fs.mkdirSync(widgetRootDir, { recursive: true })
10
- }
11
- return widgetRootDir
12
- }
13
- }
1
+ import path from 'node:path'
2
+ import fs from 'node:fs'
3
+ import type { WidgetPackage } from '@widget-js/core'
4
+
5
+ export class WidgetPackageUtils {
6
+ static getRootDir(widgetPackage: WidgetPackage) {
7
+ const widgetRootDir = path.join(process.cwd(), widgetPackage.devOptions?.folder ?? './src/widgets')
8
+ if (!fs.existsSync(widgetRootDir)) {
9
+ fs.mkdirSync(widgetRootDir, { recursive: true })
10
+ }
11
+ return widgetRootDir
12
+ }
13
+ }
package/src/utils.ts CHANGED
@@ -4,16 +4,16 @@ import fs from 'node:fs'
4
4
  import packageJson from 'package-json'
5
5
 
6
6
  export const widgetPackages: { [key: string]: string } = {
7
- '@widget-js/core': '',
8
- '@widget-js/vue3': '',
9
- '@widget-js/cli': '',
10
- '@widget-js/utils': '',
7
+ '@widget-js/core': '',
8
+ '@widget-js/vue3': '',
9
+ '@widget-js/cli': '',
10
+ '@widget-js/utils': '',
11
11
  '@widget-js/vite-plugin-widget': '',
12
12
  }
13
13
  export default function exit(code: number = 0) {
14
14
  if (exports.exitProcess) {
15
15
  process.exit(code)
16
- }
16
+ }
17
17
  else if (code > 0) {
18
18
  throw new Error(`Process exited with code ${code}`)
19
19
  }
@@ -1,22 +1,10 @@
1
1
  import {Widget, WidgetKeyword} from "@widget-js/core";
2
2
  //TODO 修改组件信息,标题,描述,关键词
3
- const name = "<%= widgetName %>";
4
- //组件标题
5
- const title = {"zh-CN": "<%= title %>"};
6
- //组件描述
7
- const description = {"zh-CN": ""};
8
- //组件关键词
9
- const keywords = [WidgetKeyword.RECOMMEND];
10
- //组件路由地址
11
- const path = "/widget/<%= snakeCaseName %>";
12
- //配置页路由地址
13
- const configPagePath = <% if (configurable) { %>"/widget/config/<%= snakeCaseName %>"<% } else { %>undefined<% } %>;
14
- //组件关键词
15
3
  const <%= name %>Widget = new Widget({
16
- name: name,
17
- title: title,
18
- description: description,
19
- keywords: keywords,
4
+ name: "<%= widgetName %>",
5
+ title: {"zh-CN": "<%= title %>"},
6
+ description: {"zh-CN": ""},
7
+ keywords: [WidgetKeyword.RECOMMEND],
20
8
  lang: "zh-CN",
21
9
  width: <%= width %>,
22
10
  height: <%= height %>,
@@ -25,8 +13,8 @@ maxWidth: <%= maxWidth %>,
25
13
  minHeight: <%= minHeight %>,
26
14
  maxHeight: <%= maxHeight %>,
27
15
  previewImage: "修改为组件预览图地址",
28
- path,
29
- configPagePath
16
+ path: "/widget/<%= snakeCaseName %>",
17
+ configPagePath: <% if (configurable) { %>"/widget/config/<%= snakeCaseName %>"<% } else { %>undefined<% } %>
30
18
  })
31
19
 
32
20
  export default <%= name %>Widget;
@@ -1,4 +1,4 @@
1
- import type { RouteRecordRaw } from 'vue-router'
1
+ import type { RouteRecordRaw } from 'vue-router'
2
2
 
3
3
  // FBI WANING! IMPORT PLACE, DONT DELETE THIS LINE
4
4
  const WidgetRouter: RouteRecordRaw[] = [
package/vite.config.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { URL, fileURLToPath } from 'node:url'
2
- import widget from '@widget-js/vite-plugin-widget'
3
-
4
- import { defineConfig } from 'vite'
5
- import vue from '@vitejs/plugin-vue'
6
-
7
- // https://vitejs.dev/config/
8
- export default defineConfig({
9
- plugins: [vue(), widget()],
10
- resolve: {
11
- alias: {
12
- '@': fileURLToPath(new URL('./src', import.meta.url)),
13
- },
14
- },
15
- })
1
+ import { URL, fileURLToPath } from 'node:url'
2
+ import widget from '@widget-js/vite-plugin-widget'
3
+
4
+ import { defineConfig } from 'vite'
5
+ import vue from '@vitejs/plugin-vue'
6
+
7
+ // https://vitejs.dev/config/
8
+ export default defineConfig({
9
+ plugins: [vue(), widget()],
10
+ resolve: {
11
+ alias: {
12
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
13
+ },
14
+ },
15
+ })
package/.editorconfig DELETED
@@ -1,16 +0,0 @@
1
- [*]
2
- charset = utf-8
3
- end_of_line = crlf
4
- indent_size = 2
5
- indent_style = space
6
- insert_final_newline = true
7
- max_line_length = 120
8
- tab_width = 2
9
- trim_trailing_whitespace = true
10
- ij_continuation_indent_size = 2
11
- ij_formatter_off_tag = @formatter:off
12
- ij_formatter_on_tag = @formatter:on
13
- ij_formatter_tags_enabled = false
14
- ij_smart_tabs = false
15
- ij_visual_guides = none
16
- ij_wrap_on_typing = false
@@ -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>