create-widget 0.0.9 → 24.1.1-beta.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/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "create-widget",
3
- "version": "0.0.9",
4
- "main": "lib/index.js",
3
+ "version": "24.1.1-beta.1",
4
+ "private": false,
5
5
  "description": "An easy way to start a Widget project",
6
6
  "author": "Neo Fu <rtugeek@gmail.com>",
7
7
  "license": "MIT",
8
- "private": false,
8
+ "main": "lib/index.js",
9
9
  "bin": {
10
10
  "create-widget": "index.cjs"
11
11
  },
@@ -13,12 +13,12 @@
13
13
  "index.cjs",
14
14
  "template"
15
15
  ],
16
- "publishConfig": {
17
- "access": "public"
18
- },
19
16
  "engines": {
20
17
  "node": ">=v16.20.0"
21
18
  },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
22
  "dependencies": {
23
23
  "chalk": "^4.1.2",
24
24
  "consola": "^2.15.3",
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@tsconfig/node18": "^18.2.2",
33
- "@types/gradient-string": "^1.1.2",
34
33
  "@types/ejs": "latest",
35
34
  "@types/fs-extra": "^11.0.4",
35
+ "@types/gradient-string": "^1.1.2",
36
36
  "@types/minimist": "^1.2.5",
37
37
  "@types/node": "^18.11.13",
38
38
  "@types/prompts": "^2.4.9",
@@ -40,7 +40,8 @@
40
40
  "ts-node": "^10.9.1",
41
41
  "tsup": "^6.5.0",
42
42
  "typescript": "^5.2.2",
43
- "vitest": "^0.34.6"
43
+ "vitest": "^0.34.6",
44
+ "zx": "^7.2.3"
44
45
  },
45
46
  "scripts": {
46
47
  "build": "zx ./scripts/build.mjs",
package/template/env.d.ts CHANGED
@@ -1 +1 @@
1
- /// <reference types="vite/client" />
1
+ // / <reference types="vite/client" />
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "hello-widget",
3
+ "type": "module",
3
4
  "version": "0.0.0",
4
5
  "private": true,
5
- "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
8
8
  "build": "run-p type-check \"build-only {@}\" --",
@@ -11,21 +11,21 @@
11
11
  "type-check": "vue-tsc --build --force"
12
12
  },
13
13
  "dependencies": {
14
+ "@widget-js/core": "0.11.20",
14
15
  "@widget-js/vite-plugin-widget": "^1.2.8",
16
+ "@widget-js/vue3": "0.11.21-rc.2",
15
17
  "vue": "^3.3.11",
16
- "vue-router": "^4.2.5",
17
- "@widget-js/core": "0.11.20",
18
- "@widget-js/vue3": "0.11.21-rc.2"
18
+ "vue-router": "^4.2.5"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@tsconfig/node18": "^18.2.2",
22
22
  "@types/node": "^18.19.3",
23
23
  "@vitejs/plugin-vue": "^4.5.2",
24
24
  "@vue/tsconfig": "^0.5.0",
25
+ "@widget-js/vite-plugin-widget": "^1.2.8",
25
26
  "npm-run-all2": "^6.1.1",
26
27
  "typescript": "~5.3.0",
27
28
  "vite": "^5.0.10",
28
- "vue-tsc": "^1.8.25",
29
- "@widget-js/vite-plugin-widget": "^1.2.8"
29
+ "vue-tsc": "^1.8.25"
30
30
  }
31
31
  }
@@ -47,4 +47,4 @@
47
47
  }
48
48
  ],
49
49
  "pages": []
50
- }
50
+ }
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import {RouterView } from 'vue-router'
2
+ import { RouterView } from 'vue-router'
3
3
  </script>
4
4
 
5
5
  <template>
@@ -1,11 +1,11 @@
1
- import WidgetRouter from '../widgets/widget-router';
2
- import {createRouter, createWebHashHistory} from 'vue-router';
1
+ import { createRouter, createWebHashHistory } from 'vue-router'
2
+ import WidgetRouter from '../widgets/widget-router'
3
3
 
4
4
  const router = createRouter({
5
5
  history: createWebHashHistory(import.meta.env.BASE_URL),
6
6
  routes: [
7
7
  ...WidgetRouter,
8
8
  ],
9
- });
9
+ })
10
10
 
11
- export default router;
11
+ export default router
@@ -1,22 +1,23 @@
1
- import { Widget, WidgetKeyword } from '@widget-js/core';
2
- //TODO 修改组件信息,标题,描述,关键词
3
- const name = 'cn.example.widget.clock';
4
- //组件标题
5
- const title = { 'zh-CN': '时钟' };
6
- //组件描述
7
- const description = { 'zh-CN': 'Hello world!' };
8
- //组件关键词
9
- const keywords = [WidgetKeyword.RECOMMEND];
10
- //组件路由地址
11
- const path = '/widget/clock';
12
- //配置页路由地址
13
- const configPagePath = '/widget/config/clock';
14
- //组件关键词
1
+ import { Widget, WidgetKeyword } from '@widget-js/core'
2
+
3
+ // TODO 修改组件信息,标题,描述,关键词
4
+ const name = 'cn.example.widget.clock'
5
+ // 组件标题
6
+ const title = { 'zh-CN': '时钟' }
7
+ // 组件描述
8
+ const description = { 'zh-CN': 'Hello world!' }
9
+ // 组件关键词
10
+ const keywords = [WidgetKeyword.RECOMMEND]
11
+ // 组件路由地址
12
+ const path = '/widget/clock'
13
+ // 配置页路由地址
14
+ const configPagePath = '/widget/config/clock'
15
+ // 组件关键词
15
16
  const ClockWidget = new Widget({
16
- name: name,
17
- title: title,
18
- description: description,
19
- keywords: keywords,
17
+ name,
18
+ title,
19
+ description,
20
+ keywords,
20
21
  lang: 'zh-CN',
21
22
  width: 2,
22
23
  height: 2,
@@ -27,6 +28,6 @@ const ClockWidget = new Widget({
27
28
  previewImage: '/preview_clock.png',
28
29
  path,
29
30
  configPagePath,
30
- });
31
+ })
31
32
 
32
- export default ClockWidget;
33
+ export default ClockWidget
@@ -1,38 +1,38 @@
1
- <template>
2
- <widget-edit-dialog
3
- :widget-params="widgetParams"
4
- :option="widgetConfigOption"
5
- v-model="widgetData"
6
- @apply="save()"
7
- @confirm="save({ closeWindow: true })"
8
- >
9
- <template #custom>
10
- 标题 <input v-model="widgetData.title"/>
11
- </template>
12
- </widget-edit-dialog>
13
- </template>
14
-
15
1
  <script lang="ts" setup>
16
2
  import {
17
- useWidget,
18
3
  WidgetConfigOption,
19
4
  WidgetEditDialog,
20
- } from '@widget-js/vue3';
21
- import {BrowserWindowApi} from '@widget-js/core';
22
- import {ClockModel} from "@/widgets/clock/model/ClockModel";
5
+ useWidget,
6
+ } from '@widget-js/vue3'
7
+ import { BrowserWindowApi } from '@widget-js/core'
8
+ import { ClockModel } from '@/widgets/clock/model/ClockModel'
23
9
 
24
- const {widgetData, widgetParams, save} = useWidget(ClockModel);
25
- BrowserWindowApi.setup({width: 600, height: 400});
26
- //修改成需要设置组件参数配置
10
+ const { widgetData, widgetParams, save } = useWidget(ClockModel)
11
+ BrowserWindowApi.setup({ width: 600, height: 400 })
12
+ // 修改成需要设置组件参数配置
27
13
  const widgetConfigOption = new WidgetConfigOption({
28
- title:'时钟设置',
14
+ title: '时钟设置',
29
15
  theme: {
30
16
  backgroundColor: true,
31
17
  borderRadius: true,
32
- }
33
- });
18
+ },
19
+ })
34
20
  </script>
35
21
 
22
+ <template>
23
+ <WidgetEditDialog
24
+ v-model="widgetData"
25
+ :widget-params="widgetParams"
26
+ :option="widgetConfigOption"
27
+ @apply="save()"
28
+ @confirm="save({ closeWindow: true })"
29
+ >
30
+ <template #custom>
31
+ 标题 <input v-model="widgetData.title">
32
+ </template>
33
+ </WidgetEditDialog>
34
+ </template>
35
+
36
36
  <style scoped>
37
37
 
38
38
  </style>
@@ -1,14 +1,14 @@
1
- import type { RouteRecordRaw } from 'vue-router';
2
- import ClockWidget from './Clock.widget';
1
+ import type { RouteRecordRaw } from 'vue-router'
2
+ import ClockWidget from './Clock.widget'
3
3
 
4
- const path = ClockWidget.path;
5
- const name = ClockWidget.name;
4
+ const path = ClockWidget.path
5
+ const name = ClockWidget.name
6
6
 
7
- const configPagePath = ClockWidget.configPagePath!;
7
+ const configPagePath = ClockWidget.configPagePath!
8
8
 
9
9
  const ClockWidgetRoutes: RouteRecordRaw[] = [
10
10
  {
11
- path: path,
11
+ path,
12
12
  name: `${name}`,
13
13
  component: () =>
14
14
  import(
@@ -23,6 +23,6 @@ const ClockWidgetRoutes: RouteRecordRaw[] = [
23
23
  /* webpackChunkName: "cn.test.widget.clock.config" */ './ClockConfigView.vue'
24
24
  ),
25
25
  },
26
- ];
26
+ ]
27
27
 
28
- export default ClockWidgetRoutes;
28
+ export default ClockWidgetRoutes
@@ -1,17 +1,9 @@
1
- <template>
2
- <widget-wrapper>
3
- <div class="clock">
4
- <span>{{ widgetData.title }}</span>
5
- <span>{{ time }}</span>
6
- </div>
7
- </widget-wrapper>
8
- </template>
9
1
  <script lang="ts" setup>
10
- import {useWidget} from '@widget-js/vue3';
11
- import {ref} from "vue";
12
- import {ClockModel} from "@/widgets/clock/model/ClockModel";
2
+ import { useWidget } from '@widget-js/vue3'
3
+ import { ref } from 'vue'
4
+ import { ClockModel } from '@/widgets/clock/model/ClockModel'
13
5
 
14
- const {widgetData} = useWidget(ClockModel);
6
+ const { widgetData } = useWidget(ClockModel)
15
7
 
16
8
  const time = ref(new Date().toLocaleTimeString())
17
9
  setInterval(() => {
@@ -19,6 +11,15 @@ setInterval(() => {
19
11
  }, 1000)
20
12
  </script>
21
13
 
14
+ <template>
15
+ <widget-wrapper>
16
+ <div class="clock">
17
+ <span>{{ widgetData.title }}</span>
18
+ <span>{{ time }}</span>
19
+ </div>
20
+ </widget-wrapper>
21
+ </template>
22
+
22
23
  <style scoped>
23
24
  .clock {
24
25
  font-size: 16px;
@@ -1,5 +1,5 @@
1
- import {WidgetData} from "@widget-js/core";
1
+ import { WidgetData } from '@widget-js/core'
2
2
 
3
3
  export class ClockModel extends WidgetData {
4
- title: string = 'Hello world!';
4
+ title: string = 'Hello world!'
5
5
  }
@@ -1,8 +1,9 @@
1
1
  import type { RouteRecordRaw } from 'vue-router'
2
- import ClockWidgetRoutes from "./clock/ClockWidgetRoutes";
3
- //FBI WANING! IMPORT PLACE, DONT DELETE THIS LINE
2
+ import ClockWidgetRoutes from './clock/ClockWidgetRoutes'
3
+
4
+ // FBI WANING! IMPORT PLACE, DONT DELETE THIS LINE
4
5
  const WidgetRouter: RouteRecordRaw[] = [
5
- ...ClockWidgetRoutes,
6
- //FBI WANING! ROUTE PLACE, DONT DELETE THIS LINE
7
- ];
6
+ ...ClockWidgetRoutes,
7
+ // FBI WANING! ROUTE PLACE, DONT DELETE THIS LINE
8
+ ]
8
9
  export default WidgetRouter
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "extends": "@vue/tsconfig/tsconfig.dom.json",
3
- "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
4
- "exclude": ["src/**/__tests__/*"],
5
3
  "compilerOptions": {
6
4
  "composite": true,
7
- "noEmit": true,
8
5
  "baseUrl": ".",
9
6
  "paths": {
10
7
  "@/*": ["./src/*"]
11
- }
12
- }
8
+ },
9
+ "noEmit": true
10
+ },
11
+ "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
12
+ "exclude": ["src/**/__tests__/*"]
13
13
  }
@@ -1,5 +1,4 @@
1
1
  {
2
- "files": [],
3
2
  "references": [
4
3
  {
5
4
  "path": "./tsconfig.node.json"
@@ -7,5 +6,6 @@
7
6
  {
8
7
  "path": "./tsconfig.app.json"
9
8
  }
10
- ]
9
+ ],
10
+ "files": []
11
11
  }
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "extends": "@tsconfig/node18/tsconfig.json",
3
+ "compilerOptions": {
4
+ "composite": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "Bundler",
7
+ "types": ["node"],
8
+ "noEmit": true
9
+ },
3
10
  "include": [
4
11
  "vite.config.*",
5
12
  "vitest.config.*",
6
13
  "cypress.config.*",
7
14
  "nightwatch.conf.*",
8
15
  "playwright.config.*"
9
- ],
10
- "compilerOptions": {
11
- "composite": true,
12
- "noEmit": true,
13
- "module": "ESNext",
14
- "moduleResolution": "Bundler",
15
- "types": ["node"]
16
- }
16
+ ]
17
17
  }
@@ -1,8 +1,9 @@
1
- import widget from '@widget-js/vite-plugin-widget';
2
- import { fileURLToPath, URL } from 'node:url';
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'
3
6
 
4
- import { defineConfig } from 'vite';
5
- import vue from '@vitejs/plugin-vue';
6
7
  // https://vitejs.dev/config/
7
8
  export default defineConfig({
8
9
  plugins: [vue(), widget()],
@@ -11,4 +12,4 @@ export default defineConfig({
11
12
  '@': fileURLToPath(new URL('./src', import.meta.url)),
12
13
  },
13
14
  },
14
- });
15
+ })
@@ -1,6 +1,6 @@
1
- import { WidgetPackage } from '@widget-js/core';
1
+ import { WidgetPackage } from '@widget-js/core'
2
2
 
3
- //TODO 完善组件包信息
3
+ // TODO 完善组件包信息
4
4
  export default new WidgetPackage({
5
5
  author: '修改成你的信息',
6
6
  description: {
@@ -17,4 +17,4 @@ export default new WidgetPackage({
17
17
  devOptions: {
18
18
  folder: './src/widgets/',
19
19
  },
20
- });
20
+ })