@varlet/cli 1.27.11-alpha.1653991536765 → 1.27.12

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 (24) hide show
  1. package/generators/config/default/base/package.json +1 -1
  2. package/generators/config/default/base/varlet.config.js +1 -0
  3. package/generators/config/default/sfc/src/button/example/BasicUse.vue +5 -12
  4. package/generators/config/default/sfc/src/button/example/ModifyColor.vue +5 -12
  5. package/generators/config/default/sfc/src/button/example/index.vue +6 -16
  6. package/generators/config/default/tsx/src/button/example/BasicUse.vue +5 -12
  7. package/generators/config/default/tsx/src/button/example/ModifyColor.vue +5 -12
  8. package/generators/config/default/tsx/src/button/example/index.vue +6 -16
  9. package/generators/config/i18n/base/package.json +1 -1
  10. package/generators/config/i18n/base/varlet.config.js +9 -2
  11. package/generators/config/i18n/sfc/src/button/docs/en-US.md +0 -4
  12. package/generators/config/i18n/sfc/src/button/docs/zh-CN.md +0 -4
  13. package/generators/config/i18n/sfc/src/button/example/BasicUse.vue +1 -1
  14. package/generators/config/i18n/sfc/src/button/example/ModifyColor.vue +2 -2
  15. package/generators/config/i18n/sfc/src/button/example/index.vue +0 -4
  16. package/generators/config/i18n/tsx/src/button/Button.tsx +1 -1
  17. package/generators/config/i18n/tsx/src/button/docs/en-US.md +0 -4
  18. package/generators/config/i18n/tsx/src/button/docs/zh-CN.md +0 -4
  19. package/generators/config/i18n/tsx/src/button/example/BasicUse.vue +1 -1
  20. package/generators/config/i18n/tsx/src/button/example/ModifyColor.vue +2 -2
  21. package/generators/config/i18n/tsx/src/button/example/index.vue +0 -4
  22. package/lib/commands/create.js +9 -10
  23. package/lib/commands/gen.js +0 -4
  24. package/package.json +5 -5
@@ -48,7 +48,7 @@
48
48
  "simple-git-hooks": "^2.7.0",
49
49
  "stylelint": "^13.13.1",
50
50
  "typescript": "^4.4.4",
51
- "vue": "3.2.16",
51
+ "vue": "3.2.25",
52
52
  "vue-router": "4.0.12"
53
53
  },
54
54
  "lint-staged": {
@@ -103,6 +103,7 @@ module.exports = {
103
103
  },
104
104
  header: {
105
105
  i18n: null,
106
+ darkMode: null,
106
107
  github: 'https://github.com/varletjs/varlet',
107
108
  },
108
109
  },
@@ -1,14 +1,7 @@
1
+ <script setup>
2
+ import BButton from '../Button'
3
+ </script>
4
+
1
5
  <template>
2
- <b-button>组件库从我开始</b-button>
6
+ <b-button>起步</b-button>
3
7
  </template>
4
-
5
- <script>
6
- import Button from '../Button'
7
-
8
- export default {
9
- name: 'BasicUse',
10
- components: {
11
- [Button.name]: Button
12
- }
13
- }
14
- </script>
@@ -1,14 +1,7 @@
1
+ <script setup>
2
+ import BButton from '../Button'
3
+ </script>
4
+
1
5
  <template>
2
- <b-button color="#03A9F4">组件库从我开始</b-button>
6
+ <b-button color="#03A9F4">起步</b-button>
3
7
  </template>
4
-
5
- <script>
6
- import Button from '../Button'
7
-
8
- export default {
9
- name: 'ModifyColor',
10
- components: {
11
- [Button.name]: Button
12
- }
13
- }
14
- </script>
@@ -1,3 +1,9 @@
1
+ <script setup>
2
+ import AppType from '@varlet/cli/site/mobile/components/AppType'
3
+ import BasicUse from './BasicUse'
4
+ import ModifyColor from './ModifyColor'
5
+ </script>
6
+
1
7
  <template>
2
8
  <app-type>基本使用</app-type>
3
9
  <basic-use/>
@@ -5,19 +11,3 @@
5
11
  <app-type>修改颜色</app-type>
6
12
  <modify-color/>
7
13
  </template>
8
-
9
- <script>
10
- import Button from '../Button'
11
- import AppType from '@varlet/cli/site/mobile/components/AppType'
12
- import BasicUse from './BasicUse'
13
- import ModifyColor from './ModifyColor'
14
-
15
- export default {
16
- components: {
17
- [Button.name]: Button,
18
- AppType,
19
- BasicUse,
20
- ModifyColor
21
- },
22
- }
23
- </script>
@@ -1,14 +1,7 @@
1
+ <script setup>
2
+ import BButton from '../Button'
3
+ </script>
4
+
1
5
  <template>
2
- <b-button>组件库从我开始</b-button>
6
+ <b-button>起步</b-button>
3
7
  </template>
4
-
5
- <script>
6
- import Button from '../Button'
7
-
8
- export default {
9
- name: 'BasicUse',
10
- components: {
11
- [Button.name]: Button
12
- }
13
- }
14
- </script>
@@ -1,14 +1,7 @@
1
+ <script setup>
2
+ import BButton from '../Button'
3
+ </script>
4
+
1
5
  <template>
2
- <b-button color="#03A9F4">组件库从我开始</b-button>
6
+ <b-button color="#03A9F4">起步</b-button>
3
7
  </template>
4
-
5
- <script>
6
- import Button from '../Button'
7
-
8
- export default {
9
- name: 'ModifyColor',
10
- components: {
11
- [Button.name]: Button
12
- }
13
- }
14
- </script>
@@ -1,3 +1,9 @@
1
+ <script setup>
2
+ import AppType from '@varlet/cli/site/mobile/components/AppType'
3
+ import BasicUse from './BasicUse'
4
+ import ModifyColor from './ModifyColor'
5
+ </script>
6
+
1
7
  <template>
2
8
  <app-type>基本使用</app-type>
3
9
  <basic-use/>
@@ -5,19 +11,3 @@
5
11
  <app-type>修改颜色</app-type>
6
12
  <modify-color/>
7
13
  </template>
8
-
9
- <script>
10
- import Button from '../Button'
11
- import AppType from '@varlet/cli/site/mobile/components/AppType'
12
- import BasicUse from './BasicUse'
13
- import ModifyColor from './ModifyColor'
14
-
15
- export default {
16
- components: {
17
- [Button.name]: Button,
18
- AppType,
19
- BasicUse,
20
- ModifyColor
21
- },
22
- }
23
- </script>
@@ -48,7 +48,7 @@
48
48
  "simple-git-hooks": "^2.7.0",
49
49
  "stylelint": "^13.13.1",
50
50
  "typescript": "^4.4.4",
51
- "vue": "3.2.16",
51
+ "vue": "3.2.25",
52
52
  "vue-router": "4.0.12"
53
53
  },
54
54
  "lint-staged": {
@@ -64,7 +64,10 @@ module.exports = {
64
64
  header: {
65
65
  darkMode: null,
66
66
  versions: null,
67
- i18n: null,
67
+ i18n: {
68
+ 'zh-CN': '中文',
69
+ 'en-US': 'English',
70
+ },
68
71
  playground: null,
69
72
  github: 'https://github.com/varletjs/varlet',
70
73
  },
@@ -108,7 +111,11 @@ module.exports = {
108
111
  'en-US': 'Components Library'
109
112
  },
110
113
  header: {
111
- i18n: null,
114
+ i18n: {
115
+ 'zh-CN': '中文',
116
+ 'en-US': 'English',
117
+ },
118
+ darkMode: null,
112
119
  github: 'https://github.com/varletjs/varlet',
113
120
  },
114
121
  },
@@ -5,10 +5,6 @@
5
5
  <b-button>start</b-button>
6
6
  ```
7
7
 
8
- ```vue
9
- import BasicUse from '../example/BasicUse'
10
- ```
11
-
12
8
  ### Theme Color Button
13
9
  ```html
14
10
  <b-button color="#009688">start</b-button>
@@ -5,10 +5,6 @@
5
5
  <b-button>组件库从我开始</b-button>
6
6
  ```
7
7
 
8
- ```vue
9
- import BasicUse from '../example/BasicUse'
10
- ```
11
-
12
8
  ### 主题色按钮
13
9
  ```html
14
10
  <b-button color="#009688">组件库从我开始</b-button>
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { watchLang } from '@varlet/cli/site/utils'
3
- import Button from '../Button'
3
+ import BButton from '../Button'
4
4
  import { pack, use } from './locale'
5
5
 
6
6
  watchLang(use)
@@ -1,9 +1,9 @@
1
1
  <script setup>
2
2
  import { watchLang } from '@varlet/cli/site/utils'
3
- import Button from '../Button'
3
+ import BButton from '../Button'
4
4
  import { pack, use } from './locale'
5
5
 
6
- watchLang(use)
6
+ watchLang(use, 'pc')
7
7
  </script>
8
8
 
9
9
  <template>
@@ -2,7 +2,6 @@
2
2
  import AppType from '@varlet/cli/site/mobile/components/AppType'
3
3
  import { watchLang } from '@varlet/cli/site/utils'
4
4
  import BasicUse from './BasicUse'
5
- import ModifyColor from './ModifyColor'
6
5
  import { pack, use } from './locale'
7
6
 
8
7
  watchLang(use)
@@ -11,7 +10,4 @@ watchLang(use)
11
10
  <template>
12
11
  <app-type>{{ pack.basicUse }}</app-type>
13
12
  <basic-use/>
14
-
15
- <app-type>{{ pack.modifyColor }}</app-type>
16
- <modify-color/>
17
13
  </template>
@@ -26,7 +26,7 @@ export default defineComponent({
26
26
  style={{ background: color }}
27
27
  onClick={ handleClick }
28
28
  >
29
- {/*{ pack.value.button }*/}
29
+ {/* { pack.value.button } */}
30
30
  { slots.default?.() }
31
31
  </button>
32
32
  </>
@@ -5,10 +5,6 @@
5
5
  <b-button>start</b-button>
6
6
  ```
7
7
 
8
- ```vue
9
- import BasicUse from '../example/BasicUse'
10
- ```
11
-
12
8
  ### Theme Color Button
13
9
  ```html
14
10
  <b-button color="#009688">start</b-button>
@@ -5,10 +5,6 @@
5
5
  <b-button>组件库从我开始</b-button>
6
6
  ```
7
7
 
8
- ```vue
9
- import BasicUse from '../example/BasicUse'
10
- ```
11
-
12
8
  ### 主题色按钮
13
9
  ```html
14
10
  <b-button color="#009688">组件库从我开始</b-button>
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { watchLang } from '@varlet/cli/site/utils'
3
- import Button from '../Button'
3
+ import BButton from '../Button'
4
4
  import { pack, use } from './locale'
5
5
 
6
6
  watchLang(use)
@@ -1,9 +1,9 @@
1
1
  <script setup>
2
2
  import { watchLang } from '@varlet/cli/site/utils'
3
- import Button from '../Button'
3
+ import BButton from '../Button'
4
4
  import { pack, use } from './locale'
5
5
 
6
- watchLang(use)
6
+ watchLang(use, 'pc')
7
7
  </script>
8
8
 
9
9
  <template>
@@ -2,7 +2,6 @@
2
2
  import AppType from '@varlet/cli/site/mobile/components/AppType'
3
3
  import { watchLang } from '@varlet/cli/site/utils'
4
4
  import BasicUse from './BasicUse'
5
- import ModifyColor from './ModifyColor'
6
5
  import { pack, use } from './locale'
7
6
 
8
7
  watchLang(use)
@@ -11,7 +10,4 @@ watchLang(use)
11
10
  <template>
12
11
  <app-type>{{ pack.basicUse }}</app-type>
13
12
  <basic-use/>
14
-
15
- <app-type>{{ pack.modifyColor }}</app-type>
16
- <modify-color/>
17
13
  </template>
@@ -84,7 +84,7 @@ function create(name, cmd) {
84
84
  vueTemplate = "<template>\n <div class=\"".concat(namespace, "-").concat(name, "\"></div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\n\nexport default defineComponent({\n name: '").concat((0, fsUtils_1.bigCamelize)(namespace)).concat(bigCamelizeName, "'\n})\n</script>\n\n<style lang=\"less\">\n.").concat(namespace, "-").concat(name, " {\n display: flex;\n}\n</style>\n");
85
85
  indexTemplate = "import ".concat(bigCamelizeName, " from './").concat(bigCamelizeName, ".vue'\nimport type { App } from 'vue'\n\n").concat(bigCamelizeName, ".install = function(app: App) {\n app.component(").concat(bigCamelizeName, ".name, ").concat(bigCamelizeName, ")\n}\n\nexport const _").concat(bigCamelizeName, "Component = ").concat(bigCamelizeName, "\n\nexport default ").concat(bigCamelizeName, "\n");
86
86
  testsTemplate = "import ".concat(bigCamelizeName, " from '..'\nimport { createApp } from 'vue'\nimport { mount } from '@vue/test-utils'\n\ntest('test ").concat(name, " use', () => {\n const app = createApp({}).use(").concat(bigCamelizeName, ")\n expect(app.component(").concat(bigCamelizeName, ".name)).toBeTruthy()\n})\n");
87
- exampleTemplate = "<script setup>\nimport ".concat(bigCamelizeName, " from '..'\nimport AppType from '@varlet/cli/site/mobile/components/AppType'\nimport { watchLang } from '@varlet/cli/site/utils'\nimport { use, pack } from './locale'\n\nwatchLang(use)\n</script>\n\n<template>\n <app-type></app-type>\n <").concat(namespace, "-").concat(name, "/>\n</template>\n");
87
+ exampleTemplate = "<script setup>\nimport ".concat(bigCamelizeName, " from '..'\nimport AppType from '@varlet/cli/site/mobile/components/AppType'\n</script>\n\n<template>\n <app-type></app-type>\n <").concat(namespace, "-").concat(name, "/>\n</template>\n");
88
88
  localeIndexTemplate = "// lib\nimport _zhCN from '../../../locale/zh-CN'\nimport _enCN from '../../../locale/en-US'\n// mobile example doc\nimport zhCN from './zh-CN'\nimport enUS from './en-US'\nimport { useLocale, add as _add, use as _use } from '../../../locale'\n\nconst { add, use: exampleUse, pack, packs, merge } = useLocale()\n\nconst use = (lang: string) => {\n _use(lang)\n exampleUse(lang)\n}\n\nexport { add, pack, packs, merge, use }\n\n// lib\n_add('zh-CN', _zhCN)\n_add('en-US', _enCN)\n// mobile example doc\nadd('zh-CN', zhCN as any)\nadd('en-US', enUS as any)\n";
89
89
  localTemplate = "export default {\n\n}\n";
90
90
  componentDir = (0, path_1.resolve)(constant_1.SRC_DIR, name);
@@ -96,15 +96,14 @@ function create(name, cmd) {
96
96
  logger_1.default.error('component directory is existed');
97
97
  return [2 /*return*/];
98
98
  }
99
- i18nFiles = [
100
- (0, fs_extra_1.outputFile)((0, path_1.resolve)(exampleLocalDir, 'index.ts'), localeIndexTemplate),
101
- (0, fs_extra_1.outputFile)((0, path_1.resolve)(exampleLocalDir, 'en-US.ts'), localTemplate),
102
- (0, fs_extra_1.outputFile)((0, path_1.resolve)(exampleLocalDir, 'zh-CN.ts'), localTemplate),
103
- (0, fs_extra_1.outputFile)((0, path_1.resolve)(docsDir, 'en-US.md'), ''),
104
- ];
105
- if (cmd.disableI18n) {
106
- exampleTemplate = "<script setup>\nimport ".concat(bigCamelizeName, " from '..'\nimport AppType from '@varlet/cli/site/mobile/components/AppType'\n</script>\n\n<template>\n <app-type></app-type>\n <").concat(namespace, "-").concat(name, "/>\n</template>\n");
107
- i18nFiles = [];
99
+ if (!cmd.disableI18n) {
100
+ exampleTemplate = "<script setup>\nimport ".concat(bigCamelizeName, " from '..'\nimport AppType from '@varlet/cli/site/mobile/components/AppType'\nimport { watchLang } from '@varlet/cli/site/utils'\nimport { use, pack } from './locale'\n\nwatchLang(use)\n</script>\n\n<template>\n <app-type></app-type>\n <").concat(namespace, "-").concat(name, "/>\n</template>\n ");
101
+ i18nFiles = [
102
+ (0, fs_extra_1.outputFile)((0, path_1.resolve)(exampleLocalDir, 'index.ts'), localeIndexTemplate),
103
+ (0, fs_extra_1.outputFile)((0, path_1.resolve)(exampleLocalDir, 'en-US.ts'), localTemplate),
104
+ (0, fs_extra_1.outputFile)((0, path_1.resolve)(exampleLocalDir, 'zh-CN.ts'), localTemplate),
105
+ (0, fs_extra_1.outputFile)((0, path_1.resolve)(docsDir, 'en-US.md'), ''),
106
+ ];
108
107
  }
109
108
  return [4 /*yield*/, Promise.all(__spreadArray(__spreadArray([
110
109
  (0, fs_extra_1.outputFile)((0, path_1.resolve)(componentDir, "".concat(bigCamelizeName, ".vue")), vueTemplate),
@@ -45,10 +45,6 @@ var inquirer_1 = __importDefault(require("inquirer"));
45
45
  var path_1 = require("path");
46
46
  var fs_extra_1 = require("fs-extra");
47
47
  var constant_1 = require("../shared/constant");
48
- function removeFiles(dest) {
49
- var files = ['es', 'lib', 'umd', 'highlight', 'types/index.d.ts', '.varlet', 'node_modules'];
50
- files.forEach(function (filename) { return (0, fs_extra_1.removeSync)((0, path_1.resolve)(dest, filename)); });
51
- }
52
48
  function generateGitIgnore(name) {
53
49
  (0, fs_extra_1.writeFileSync)((0, path_1.resolve)(constant_1.CWD, name, '.gitignore'), "node_modules\n\n.varlet\n.idea\n.vscode\n*.log\n.DS_Store\n\nsite\nlib\nes\numd\ncoverage\nhighlight");
54
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/cli",
3
- "version": "1.27.11-alpha.1653991536765",
3
+ "version": "1.27.12",
4
4
  "description": "cli of varlet",
5
5
  "bin": {
6
6
  "varlet-cli": "./lib/index.js"
@@ -33,9 +33,9 @@
33
33
  "@babel/helper-plugin-utils": "^7.14.5",
34
34
  "@babel/preset-env": "^7.14.8",
35
35
  "@babel/preset-typescript": "^7.14.5",
36
- "@varlet/icons": "1.27.11-alpha.1653991536765",
37
- "@varlet/markdown-vite-plugin": "1.27.11-alpha.1653991536765",
38
- "@varlet/touch-emulator": "1.27.11-alpha.1653991536765",
36
+ "@varlet/icons": "1.27.12",
37
+ "@varlet/markdown-vite-plugin": "1.27.12",
38
+ "@varlet/touch-emulator": "1.27.12",
39
39
  "@vitejs/plugin-vue": "2.2.0",
40
40
  "@vitejs/plugin-vue-jsx": "1.3.5",
41
41
  "@vue/babel-plugin-jsx": "1.1.1",
@@ -76,7 +76,7 @@
76
76
  "@types/semver": "^7.3.9"
77
77
  },
78
78
  "peerDependencies": {
79
- "@varlet/touch-emulator": "1.27.11-alpha.1653991536765",
79
+ "@varlet/touch-emulator": "1.27.12",
80
80
  "@vue/test-utils": "^2.0.0-rc.6",
81
81
  "clipboard": "^2.0.6",
82
82
  "live-server": "^1.2.1",