@tomjs/create-app 5.4.0 → 5.6.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.
Files changed (77) hide show
  1. package/README.md +2 -0
  2. package/README.zh_CN.md +2 -0
  3. package/dist/index.mjs +1 -1
  4. package/package.json +13 -13
  5. package/templates/config/base/package.json +2 -2
  6. package/templates/config/package.json +27 -27
  7. package/templates/config/react/pnpm-workspace.yaml +5 -0
  8. package/templates/config/vscode/_.gitignore +4 -0
  9. package/templates/config/vue/_.gitignore +63 -0
  10. package/templates/config/vue/package.json +1 -1
  11. package/templates/config/vue/pnpm-workspace.yaml +4 -0
  12. package/templates/config/vue/tsconfig.app.json +0 -1
  13. package/templates/config/vue/uno.config.ts +2 -2
  14. package/templates/crx-react/manifest.config.ts +28 -0
  15. package/templates/crx-react/package.json +14 -0
  16. package/templates/crx-react/public/logo.png +0 -0
  17. package/templates/crx-react/src/assets/crx.svg +4 -0
  18. package/templates/crx-react/src/assets/react.svg +1 -0
  19. package/templates/crx-react/src/assets/vite.svg +1 -0
  20. package/templates/crx-react/src/components/HelloWorld.tsx +35 -0
  21. package/templates/crx-react/src/content/main.tsx +14 -0
  22. package/templates/crx-react/src/content/views/App.css +56 -0
  23. package/templates/crx-react/src/content/views/App.tsx +23 -0
  24. package/templates/crx-react/src/popup/App.css +49 -0
  25. package/templates/crx-react/src/popup/App.tsx +22 -0
  26. package/templates/crx-react/src/popup/index.css +84 -0
  27. package/templates/crx-react/src/popup/index.html +10 -0
  28. package/templates/crx-react/src/popup/main.tsx +10 -0
  29. package/templates/crx-react/src/sidepanel/App.css +49 -0
  30. package/templates/crx-react/src/sidepanel/App.tsx +22 -0
  31. package/templates/crx-react/src/sidepanel/index.css +83 -0
  32. package/templates/crx-react/src/sidepanel/index.html +10 -0
  33. package/templates/crx-react/src/sidepanel/main.tsx +10 -0
  34. package/templates/crx-react/vite.config.ts +28 -0
  35. package/templates/crx-vue/README.md +1 -0
  36. package/templates/crx-vue/manifest.config.ts +28 -0
  37. package/templates/crx-vue/package.json +14 -0
  38. package/templates/crx-vue/pnpm-workspace.yaml +4 -0
  39. package/templates/crx-vue/public/logo.png +0 -0
  40. package/templates/crx-vue/src/assets/crx.svg +4 -0
  41. package/templates/crx-vue/src/assets/vite.svg +1 -0
  42. package/templates/crx-vue/src/assets/vue.svg +1 -0
  43. package/templates/crx-vue/src/components/HelloWorld.vue +38 -0
  44. package/templates/crx-vue/src/content/main.ts +17 -0
  45. package/templates/crx-vue/src/content/views/App.vue +76 -0
  46. package/templates/crx-vue/src/env.d.ts +3 -0
  47. package/templates/crx-vue/src/popup/App.vue +39 -0
  48. package/templates/crx-vue/src/popup/index.html +10 -0
  49. package/templates/crx-vue/src/popup/main.ts +5 -0
  50. package/templates/crx-vue/src/popup/style.css +84 -0
  51. package/templates/crx-vue/src/sidepanel/App.vue +39 -0
  52. package/templates/crx-vue/src/sidepanel/index.html +10 -0
  53. package/templates/crx-vue/src/sidepanel/main.ts +5 -0
  54. package/templates/crx-vue/src/sidepanel/style.css +83 -0
  55. package/templates/crx-vue/vite.config.ts +38 -0
  56. package/templates/electron-vue/package.json +1 -1
  57. package/templates/electron-vue/src/components/HelloWorld.vue +0 -1
  58. package/templates/electron-vue/src/main.ts +2 -2
  59. package/templates/electron-vue/tsconfig.app.json +5 -8
  60. package/templates/electron-vue/tsconfig.node.json +1 -1
  61. package/templates/electron-vue/vite.config.ts +5 -2
  62. package/templates/hbuilderx-vue/src/components/HelloWorld.vue +0 -2
  63. package/templates/hbuilderx-vue/src/main.ts +3 -2
  64. package/templates/hbuilderx-vue/tsconfig.app.json +0 -1
  65. package/templates/hbuilderx-vue/vite.config.ts +5 -2
  66. package/templates/vscode-vue/src/App.vue +0 -1
  67. package/templates/vscode-vue/src/main.ts +3 -1
  68. package/templates/vscode-vue/src/style.scss +0 -0
  69. package/templates/vscode-vue/vite.config.ts +5 -2
  70. package/templates/web-vue/README.md +1 -1
  71. package/templates/web-vue/src/components/HelloWorld.vue +0 -2
  72. package/templates/web-vue/src/main.ts +2 -1
  73. package/templates/web-vue/vite.config.ts +5 -2
  74. package/templates/electron-vue/src/vite-env.d.ts +0 -1
  75. /package/templates/config/vue/{env.d.ts → src/env.d.ts} +0 -0
  76. /package/templates/electron-vue/src/{style.css → style.scss} +0 -0
  77. /package/templates/hbuilderx-vue/src/{style.css → style.scss} +0 -0
@@ -0,0 +1,39 @@
1
+ <script setup lang="ts">
2
+ import HelloWorld from '@/components/HelloWorld.vue';
3
+ </script>
4
+
5
+ <template>
6
+ <div>
7
+ <a href="https://vite.dev" target="_blank">
8
+ <img src="@/assets/vite.svg" class="logo" alt="Vite logo">
9
+ </a>
10
+ <a href="https://vuejs.org/" target="_blank">
11
+ <img src="@/assets/vue.svg" class="logo vue" alt="Vue logo">
12
+ </a>
13
+ <a href="https://crxjs.dev/vite-plugin" target="_blank">
14
+ <img src="@/assets/crx.svg" class="logo crx" alt="crx logo">
15
+ </a>
16
+ </div>
17
+ <HelloWorld msg="Vite + Vue + CRXJS" />
18
+ </template>
19
+
20
+ <style scoped>
21
+ .logo {
22
+ height: 6em;
23
+ padding: 1.5em;
24
+ transition: filter 300ms;
25
+ will-change: filter;
26
+ }
27
+
28
+ .logo:hover {
29
+ filter: drop-shadow(0 0 2em #646cffaa);
30
+ }
31
+
32
+ .logo.vue:hover {
33
+ filter: drop-shadow(0 0 2em #42b883aa);
34
+ }
35
+
36
+ .logo.crx:hover {
37
+ filter: drop-shadow(0 0 2em #f2bae4aa);
38
+ }
39
+ </style>
@@ -0,0 +1,10 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ </head>
6
+ <body>
7
+ <div id="app"></div>
8
+ <script type="module" src="./main.ts"></script>
9
+ </body>
10
+ </html>
@@ -0,0 +1,5 @@
1
+ import { createApp } from 'vue';
2
+ import App from './App.vue';
3
+ import './style.css';
4
+
5
+ createApp(App).mount('#app');
@@ -0,0 +1,83 @@
1
+ :root {
2
+ font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
3
+ font-weight: 400;
4
+
5
+ font-synthesis: none;
6
+ line-height: 1.5;
7
+ color: rgba(255, 255, 255, 0.87);
8
+
9
+ color-scheme: light dark;
10
+ background-color: #242424;
11
+ text-rendering: optimizeLegibility;
12
+ -webkit-font-smoothing: antialiased;
13
+ -moz-osx-font-smoothing: grayscale;
14
+ }
15
+
16
+ a {
17
+ font-weight: 500;
18
+ color: #646cff;
19
+ text-decoration: inherit;
20
+ }
21
+
22
+ a:hover {
23
+ color: #535bf2;
24
+ }
25
+
26
+ body {
27
+ display: flex;
28
+ place-items: center;
29
+ min-height: 100vh;
30
+ margin: 0;
31
+ }
32
+
33
+ h1 {
34
+ font-size: 3.2em;
35
+ line-height: 1.1;
36
+ }
37
+
38
+ button {
39
+ padding: 0.6em 1.2em;
40
+ font-family: inherit;
41
+ font-size: 1em;
42
+ font-weight: 500;
43
+ cursor: pointer;
44
+ background-color: #1a1a1a;
45
+ border: 1px solid transparent;
46
+ border-radius: 8px;
47
+ transition: border-color 0.25s;
48
+ }
49
+
50
+ button:hover {
51
+ border-color: #646cff;
52
+ }
53
+
54
+ button:focus,
55
+ button:focus-visible {
56
+ outline: 4px auto -webkit-focus-ring-color;
57
+ }
58
+
59
+ .card {
60
+ padding: 2em;
61
+ }
62
+
63
+ #app {
64
+ max-width: 1280px;
65
+ padding: 2rem;
66
+ margin: 0 auto;
67
+ text-align: center;
68
+ }
69
+
70
+ @media (prefers-color-scheme: light) {
71
+ :root {
72
+ color: #213547;
73
+ background-color: #ffffff;
74
+ }
75
+
76
+ a:hover {
77
+ color: #747bff;
78
+ }
79
+
80
+ button {
81
+ background-color: #f9f9f9;
82
+ }
83
+ }
@@ -0,0 +1,38 @@
1
+ import { fileURLToPath, URL } from 'node:url';
2
+ import { crx } from '@crxjs/vite-plugin';
3
+ import vue from '@vitejs/plugin-vue';
4
+ import UnoCSS from 'unocss/vite';
5
+ import AutoImport from 'unplugin-auto-import/vite';
6
+ import Components from 'unplugin-vue-components/vite';
7
+ import { defineConfig } from 'vite';
8
+ import devtools from 'vite-plugin-vue-devtools';
9
+ import manifest from './manifest.config.ts';
10
+
11
+ // https://vite.dev/config/
12
+ export default defineConfig({
13
+ resolve: {
14
+ alias: {
15
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
16
+ },
17
+ },
18
+ server: {
19
+ cors: {
20
+ origin: [
21
+ /chrome-extension:\/\//,
22
+ ],
23
+ },
24
+ },
25
+ plugins: [
26
+ vue(),
27
+ AutoImport({
28
+ dts: './src/auto-imports.d.ts',
29
+ imports: ['vue', 'vue-router', '@vueuse/core'],
30
+ }),
31
+ Components({
32
+ dts: './src/components.d.ts',
33
+ }),
34
+ crx({ manifest }),
35
+ UnoCSS(),
36
+ devtools(),
37
+ ],
38
+ });
@@ -13,6 +13,6 @@
13
13
  "release": "vue-tsc --noEmit && cross-env VITE_ELECTRON_BUILDER=1 vite build"
14
14
  },
15
15
  "dependencies": {
16
- "vue-router": "^4.6.4"
16
+ "vue-router": "^5.0.1"
17
17
  }
18
18
  }
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
2
  import os from 'node:os';
3
- import { ref } from 'vue';
4
3
 
5
4
  defineProps<{ msg: string }>();
6
5
 
@@ -1,6 +1,6 @@
1
- import { createApp } from 'vue';
2
1
  import App from './App.vue';
3
2
 
4
- import './style.css';
3
+ import 'virtual:uno.css';
4
+ import './style.scss';
5
5
 
6
6
  createApp(App).mount('#app');
@@ -2,15 +2,12 @@
2
2
  "extends": "@tomjs/tsconfig/vue.json",
3
3
  "compilerOptions": {
4
4
  "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
- "types": [
6
- "vite/client",
7
- "node"
8
- ]
5
+ "paths": {
6
+ "@/*": ["./src/*"]
7
+ }
9
8
  },
10
9
  "include": [
11
- "src/**/*.ts",
12
- "src/**/*.tsx",
13
- "src/**/*.vue",
14
- "src/**/*.d.ts"
10
+ "src/**/*",
11
+ "src/**/*.vue"
15
12
  ]
16
13
  }
@@ -5,7 +5,7 @@
5
5
  },
6
6
  "include": [
7
7
  "@tomjs/vite-plugin-electron/env",
8
- "../config/electron/electron",
8
+ "electron",
9
9
  "*.config.ts"
10
10
  ]
11
11
  }
@@ -17,9 +17,12 @@ export default defineConfig({
17
17
  plugins: [
18
18
  vue(),
19
19
  AutoImport({
20
- imports: ['vue', 'vue-router'],
20
+ dts: './src/auto-imports.d.ts',
21
+ imports: ['vue', 'vue-router', '@vueuse/core'],
22
+ }),
23
+ Components({
24
+ dts: './src/components.d.ts',
21
25
  }),
22
- Components(),
23
26
  UnoCSS(),
24
27
  renderer(),
25
28
  electron({ builder: true }),
@@ -1,6 +1,4 @@
1
1
  <script setup lang="ts">
2
- import { ref } from 'vue';
3
-
4
2
  defineProps<{ msg: string }>();
5
3
 
6
4
  const count = ref(0);
@@ -1,5 +1,6 @@
1
- import { createApp } from 'vue';
2
1
  import App from './App.vue';
3
- import './style.css';
2
+
3
+ import 'virtual:uno.css';
4
+ import './style.scss';
4
5
 
5
6
  createApp(App).mount('#app');
@@ -11,7 +11,6 @@
11
11
  ]
12
12
  },
13
13
  "include": [
14
- "env.d.ts",
15
14
  "src/**/*",
16
15
  "src/**/*.vue"
17
16
  ]
@@ -21,9 +21,12 @@ export default defineConfig({
21
21
  plugins: [
22
22
  vue(),
23
23
  AutoImport({
24
- imports: ['vue'],
24
+ dts: './src/auto-imports.d.ts',
25
+ imports: ['vue', '@vueuse/core'],
26
+ }),
27
+ Components({
28
+ dts: './src/components.d.ts',
25
29
  }),
26
- Components(),
27
30
  hbuilderx(),
28
31
  UnoCSS(),
29
32
  devtools(),
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
2
  import { allComponents, provideVSCodeDesignSystem } from '@vscode/webview-ui-toolkit';
3
- import { ref } from 'vue';
4
3
  import { vscode } from './utils';
5
4
 
6
5
  provideVSCodeDesignSystem().register(allComponents);
@@ -1,4 +1,6 @@
1
- import { createApp } from 'vue';
2
1
  import App from './App.vue';
3
2
 
3
+ import 'virtual:uno.css';
4
+ import './style.scss';
5
+
4
6
  createApp(App).mount('#app');
File without changes
@@ -28,9 +28,12 @@ export default defineConfig(() => {
28
28
  },
29
29
  }),
30
30
  AutoImport({
31
- imports: ['vue'],
31
+ dts: './src/auto-imports.d.ts',
32
+ imports: ['vue', '@vueuse/core'],
33
+ }),
34
+ Components({
35
+ dts: './src/components.d.ts',
32
36
  }),
33
- Components(),
34
37
  UnoCSS(),
35
38
  vscode(),
36
39
  devtools(),
@@ -1 +1 @@
1
- # vue example
1
+ # crx vue example
@@ -1,6 +1,4 @@
1
1
  <script setup lang="ts">
2
- import { ref } from 'vue';
3
-
4
2
  defineProps<{ msg: string }>();
5
3
 
6
4
  const count = ref(0);
@@ -1,5 +1,6 @@
1
- import { createApp } from 'vue';
2
1
  import App from './App.vue';
2
+
3
+ import 'virtual:uno.css';
3
4
  import './style.scss';
4
5
 
5
6
  createApp(App).mount('#app');
@@ -16,9 +16,12 @@ export default defineConfig({
16
16
  plugins: [
17
17
  vue(),
18
18
  AutoImport({
19
- imports: ['vue', 'vue-router'],
19
+ dts: './src/auto-imports.d.ts',
20
+ imports: ['vue', 'vue-router', '@vueuse/core'],
21
+ }),
22
+ Components({
23
+ dts: './src/components.d.ts',
20
24
  }),
21
- Components(),
22
25
  UnoCSS(),
23
26
  devtools(),
24
27
  ],
@@ -1 +0,0 @@
1
- /// <reference types="vite/client" />
File without changes