create-component-template-cli 1.0.0 → 1.0.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.
Files changed (75) hide show
  1. package/.changeset/config.json +1 -1
  2. package/AGENTS.md +114 -0
  3. package/CHANGELOG.md +6 -0
  4. package/CLAUDE.md +19 -7
  5. package/README.md +40 -20
  6. package/bin/cli.mjs +38 -29
  7. package/docs/2026-05-11T10-04-44-/344/270/211/345/245/227/346/250/241/346/235/277/351/207/215/346/236/204/2026-05-11T10-04-44-/344/270/211/345/245/227/346/250/241/346/235/277/351/207/215/346/236/204-/346/200/235/350/267/257/346/226/207/346/241/243.md +167 -0
  8. package/docs/2026-05-11T10-04-44-/344/270/211/345/245/227/346/250/241/346/235/277/351/207/215/346/236/204/2026-05-11T10-04-44-/344/270/211/345/245/227/346/250/241/346/235/277/351/207/215/346/236/204-/346/200/273/347/273/223/346/226/207/346/241/243.md +80 -0
  9. package/docs/2026-05-11T10-04-44-/344/270/211/345/245/227/346/250/241/346/235/277/351/207/215/346/236/204/2026-05-11T10-04-44-/344/270/211/345/245/227/346/250/241/346/235/277/351/207/215/346/236/204-/350/256/276/350/256/241/346/226/271/346/241/210.md +477 -0
  10. package/package.json +1 -1
  11. package/plop-templates/general/data.ts.hbs +16 -0
  12. package/plop-templates/general/hook.ts.hbs +11 -0
  13. package/plop-templates/general/index.normal.vue.hbs +28 -0
  14. package/plop-templates/general/index.scss.hbs +5 -0
  15. package/plop-templates/general/index.setup.vue.hbs +20 -0
  16. package/plop-templates/{index.ts.hbs → general/index.ts.hbs} +2 -1
  17. package/plop-templates/general/typing.ts.hbs +13 -0
  18. package/plop-templates/multiple-pick/data.ts.hbs +20 -0
  19. package/plop-templates/multiple-pick/hook.ts.hbs +11 -0
  20. package/plop-templates/multiple-pick/index.normal.vue.hbs +37 -0
  21. package/plop-templates/multiple-pick/index.scss.hbs +5 -0
  22. package/plop-templates/multiple-pick/index.setup.vue.hbs +22 -0
  23. package/plop-templates/multiple-pick/index.ts.hbs +4 -0
  24. package/plop-templates/multiple-pick/typing.ts.hbs +13 -0
  25. package/plop-templates/single-pick/data.ts.hbs +16 -0
  26. package/plop-templates/single-pick/hook.ts.hbs +11 -0
  27. package/plop-templates/single-pick/index.normal.vue.hbs +36 -0
  28. package/plop-templates/single-pick/index.scss.hbs +5 -0
  29. package/plop-templates/single-pick/index.setup.vue.hbs +23 -0
  30. package/plop-templates/single-pick/index.ts.hbs +4 -0
  31. package/plop-templates/single-pick/typing.ts.hbs +13 -0
  32. package/plopfile.mjs +68 -59
  33. package/src/generate.mjs +101 -31
  34. package/tmp-output/GeneralNormalDemo/index.ts +4 -0
  35. package/tmp-output/GeneralNormalDemo/src/data.ts +16 -0
  36. package/tmp-output/GeneralNormalDemo/src/hook.ts +11 -0
  37. package/tmp-output/GeneralNormalDemo/src/index.scss +5 -0
  38. package/tmp-output/GeneralNormalDemo/src/index.vue +28 -0
  39. package/tmp-output/GeneralNormalDemo/src/typing.ts +13 -0
  40. package/tmp-output/GeneralSetupDemo/index.ts +4 -0
  41. package/tmp-output/GeneralSetupDemo/src/data.ts +16 -0
  42. package/tmp-output/GeneralSetupDemo/src/hook.ts +11 -0
  43. package/tmp-output/GeneralSetupDemo/src/index.scss +5 -0
  44. package/tmp-output/GeneralSetupDemo/src/index.vue +20 -0
  45. package/tmp-output/GeneralSetupDemo/src/typing.ts +13 -0
  46. package/tmp-output/MultiplePickNormalDemo/index.ts +4 -0
  47. package/tmp-output/MultiplePickNormalDemo/src/data.ts +20 -0
  48. package/tmp-output/MultiplePickNormalDemo/src/hook.ts +11 -0
  49. package/tmp-output/MultiplePickNormalDemo/src/index.scss +5 -0
  50. package/tmp-output/MultiplePickNormalDemo/src/index.vue +37 -0
  51. package/tmp-output/MultiplePickNormalDemo/src/typing.ts +13 -0
  52. package/tmp-output/MultiplePickSetupDemo/index.ts +4 -0
  53. package/tmp-output/MultiplePickSetupDemo/src/data.ts +20 -0
  54. package/tmp-output/MultiplePickSetupDemo/src/hook.ts +11 -0
  55. package/tmp-output/MultiplePickSetupDemo/src/index.scss +5 -0
  56. package/tmp-output/MultiplePickSetupDemo/src/index.vue +22 -0
  57. package/tmp-output/MultiplePickSetupDemo/src/typing.ts +13 -0
  58. package/tmp-output/SinglePickNormalDemo/index.ts +4 -0
  59. package/tmp-output/SinglePickNormalDemo/src/data.ts +16 -0
  60. package/tmp-output/SinglePickNormalDemo/src/hook.ts +11 -0
  61. package/tmp-output/SinglePickNormalDemo/src/index.scss +5 -0
  62. package/tmp-output/SinglePickNormalDemo/src/index.vue +36 -0
  63. package/tmp-output/SinglePickNormalDemo/src/typing.ts +13 -0
  64. package/tmp-output/SinglePickSetupDemo/index.ts +4 -0
  65. package/tmp-output/SinglePickSetupDemo/src/data.ts +16 -0
  66. package/tmp-output/SinglePickSetupDemo/src/hook.ts +11 -0
  67. package/tmp-output/SinglePickSetupDemo/src/index.scss +5 -0
  68. package/tmp-output/SinglePickSetupDemo/src/index.vue +23 -0
  69. package/tmp-output/SinglePickSetupDemo/src/typing.ts +13 -0
  70. package/plop-templates/data.ts.hbs +0 -7
  71. package/plop-templates/hook.ts.hbs +0 -29
  72. package/plop-templates/index.scss.hbs +0 -1
  73. package/plop-templates/index.setup.vue.hbs +0 -25
  74. package/plop-templates/index.vue.hbs +0 -38
  75. package/plop-templates/typing.ts.hbs +0 -14
@@ -0,0 +1,4 @@
1
+ import MultiplePickNormalDemo from './src/index.vue'
2
+
3
+ export default MultiplePickNormalDemo
4
+ export * from './src/typing'
@@ -0,0 +1,20 @@
1
+ import type { DataType } from './typing'
2
+
3
+ const data: Array<DataType> = [
4
+ {
5
+ label: '多选项1',
6
+ value: 'multiple-1',
7
+ },
8
+ {
9
+ label: '多选项2',
10
+ value: 'multiple-2',
11
+ },
12
+ {
13
+ label: '多选项3',
14
+ value: 'multiple-3',
15
+ },
16
+ ]
17
+
18
+ export {
19
+ data,
20
+ }
@@ -0,0 +1,11 @@
1
+ import { ref } from 'vue'
2
+ import { data } from './data'
3
+ import type { MultiplePickNormalDemoProps } from './typing'
4
+
5
+ export const useMultiplePickNormalDemo = (props: MultiplePickNormalDemoProps) => {
6
+ const selectedValues = ref(props.modelValue ?? data.slice(0, 2).map((item) => item.value))
7
+
8
+ return {
9
+ selectedValues,
10
+ }
11
+ }
@@ -0,0 +1,5 @@
1
+ .multiple-pick-normal-demo {
2
+ position: absolute;
3
+ top: 0;
4
+ left: 0;
5
+ }
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <div class="multiple-pick-normal-demo">
3
+ <div v-for="item in selectedValues" :key="item">{{ item }}</div>
4
+ </div>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ import { defineComponent, PropType } from 'vue'
9
+ import { MultiplePickNormalDemoProps } from './typing'
10
+ import { useMultiplePickNormalDemo } from './hook'
11
+
12
+ export default defineComponent({
13
+ name: 'MultiplePickNormalDemo',
14
+ props: {
15
+ user: {
16
+ type: Object as PropType<MultiplePickNormalDemoProps['user']>,
17
+ required: false,
18
+ },
19
+ modelValue: {
20
+ type: Array as PropType<MultiplePickNormalDemoProps['modelValue']>,
21
+ required: false,
22
+ default: () => [],
23
+ },
24
+ },
25
+ setup(props) {
26
+ const { selectedValues } = useMultiplePickNormalDemo(props as MultiplePickNormalDemoProps)
27
+
28
+ return {
29
+ selectedValues,
30
+ }
31
+ },
32
+ })
33
+ </script>
34
+
35
+ <style lang="scss" scoped>
36
+ @import './index.scss';
37
+ </style>
@@ -0,0 +1,13 @@
1
+ export enum MultiplePickNormalDemoEnum {
2
+ DEFAULT = 'default',
3
+ }
4
+
5
+ export interface MultiplePickNormalDemoProps {
6
+ user?: Record<string, any>
7
+ modelValue?: string[]
8
+ }
9
+
10
+ export interface DataType {
11
+ label: string
12
+ value: string
13
+ }
@@ -0,0 +1,4 @@
1
+ import MultiplePickSetupDemo from './src/index.vue'
2
+
3
+ export default MultiplePickSetupDemo
4
+ export * from './src/typing'
@@ -0,0 +1,20 @@
1
+ import type { DataType } from './typing'
2
+
3
+ const data: Array<DataType> = [
4
+ {
5
+ label: '多选项1',
6
+ value: 'multiple-1',
7
+ },
8
+ {
9
+ label: '多选项2',
10
+ value: 'multiple-2',
11
+ },
12
+ {
13
+ label: '多选项3',
14
+ value: 'multiple-3',
15
+ },
16
+ ]
17
+
18
+ export {
19
+ data,
20
+ }
@@ -0,0 +1,11 @@
1
+ import { ref } from 'vue'
2
+ import { data } from './data'
3
+ import type { MultiplePickSetupDemoProps } from './typing'
4
+
5
+ export const useMultiplePickSetupDemo = (props: MultiplePickSetupDemoProps) => {
6
+ const selectedValues = ref(props.modelValue ?? data.slice(0, 2).map((item) => item.value))
7
+
8
+ return {
9
+ selectedValues,
10
+ }
11
+ }
@@ -0,0 +1,5 @@
1
+ .multiple-pick-setup-demo {
2
+ position: absolute;
3
+ top: 0;
4
+ left: 0;
5
+ }
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <div class="multiple-pick-setup-demo">
3
+ <div v-for="item in selectedValues" :key="item">{{ item }}</div>
4
+ </div>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { MultiplePickSetupDemoProps } from './typing'
9
+ import { useMultiplePickSetupDemo } from './hook'
10
+
11
+ defineOptions({
12
+ name: 'MultiplePickSetupDemo',
13
+ })
14
+
15
+ const props = defineProps<MultiplePickSetupDemoProps>()
16
+
17
+ const { selectedValues } = useMultiplePickSetupDemo(props)
18
+ </script>
19
+
20
+ <style lang="scss" scoped>
21
+ @import './index.scss';
22
+ </style>
@@ -0,0 +1,13 @@
1
+ export enum MultiplePickSetupDemoEnum {
2
+ DEFAULT = 'default',
3
+ }
4
+
5
+ export interface MultiplePickSetupDemoProps {
6
+ user?: Record<string, any>
7
+ modelValue?: string[]
8
+ }
9
+
10
+ export interface DataType {
11
+ label: string
12
+ value: string
13
+ }
@@ -0,0 +1,4 @@
1
+ import SinglePickNormalDemo from './src/index.vue'
2
+
3
+ export default SinglePickNormalDemo
4
+ export * from './src/typing'
@@ -0,0 +1,16 @@
1
+ import type { DataType } from './typing'
2
+
3
+ const data: Array<DataType> = [
4
+ {
5
+ label: '单选项1',
6
+ value: 'single-1',
7
+ },
8
+ {
9
+ label: '单选项2',
10
+ value: 'single-2',
11
+ },
12
+ ]
13
+
14
+ export {
15
+ data,
16
+ }
@@ -0,0 +1,11 @@
1
+ import { ref } from 'vue'
2
+ import { data } from './data'
3
+ import type { SinglePickNormalDemoProps } from './typing'
4
+
5
+ export const useSinglePickNormalDemo = (props: SinglePickNormalDemoProps) => {
6
+ const selectedValue = ref(props.modelValue ?? data[0]?.value ?? '')
7
+
8
+ return {
9
+ selectedValue,
10
+ }
11
+ }
@@ -0,0 +1,5 @@
1
+ .single-pick-normal-demo {
2
+ position: absolute;
3
+ top: 0;
4
+ left: 0;
5
+ }
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <div class="single-pick-normal-demo">
3
+ <SinglePickButtonGroup />
4
+ </div>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ import { defineComponent, PropType } from 'vue'
9
+ import SinglePickButtonGroup from '@/components/common/SinglePickButtonGroup'
10
+ import { SinglePickNormalDemoProps } from './typing'
11
+ import { useSinglePickNormalDemo } from './hook'
12
+
13
+ export default defineComponent({
14
+ name: 'SinglePickNormalDemo',
15
+ components: {
16
+ SinglePickButtonGroup,
17
+ },
18
+ props: {
19
+ user: {
20
+ type: Object as PropType<SinglePickNormalDemoProps['user']>,
21
+ required: false,
22
+ },
23
+ },
24
+ setup(props) {
25
+ const { selectedValue } = useSinglePickNormalDemo(props as SinglePickNormalDemoProps)
26
+
27
+ return {
28
+ selectedValue,
29
+ }
30
+ },
31
+ })
32
+ </script>
33
+
34
+ <style lang="scss" scoped>
35
+ @import './index.scss';
36
+ </style>
@@ -0,0 +1,13 @@
1
+ export enum SinglePickNormalDemoEnum {
2
+ DEFAULT = 'default',
3
+ }
4
+
5
+ export interface SinglePickNormalDemoProps {
6
+ user?: Record<string, any>
7
+ modelValue?: string
8
+ }
9
+
10
+ export interface DataType {
11
+ label: string
12
+ value: string
13
+ }
@@ -0,0 +1,4 @@
1
+ import SinglePickSetupDemo from './src/index.vue'
2
+
3
+ export default SinglePickSetupDemo
4
+ export * from './src/typing'
@@ -0,0 +1,16 @@
1
+ import type { DataType } from './typing'
2
+
3
+ const data: Array<DataType> = [
4
+ {
5
+ label: '单选项1',
6
+ value: 'single-1',
7
+ },
8
+ {
9
+ label: '单选项2',
10
+ value: 'single-2',
11
+ },
12
+ ]
13
+
14
+ export {
15
+ data,
16
+ }
@@ -0,0 +1,11 @@
1
+ import { ref } from 'vue'
2
+ import { data } from './data'
3
+ import type { SinglePickSetupDemoProps } from './typing'
4
+
5
+ export const useSinglePickSetupDemo = (props: SinglePickSetupDemoProps) => {
6
+ const selectedValue = ref(props.modelValue ?? data[0]?.value ?? '')
7
+
8
+ return {
9
+ selectedValue,
10
+ }
11
+ }
@@ -0,0 +1,5 @@
1
+ .single-pick-setup-demo {
2
+ position: absolute;
3
+ top: 0;
4
+ left: 0;
5
+ }
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <div class="single-pick-setup-demo">
3
+ <SinglePickButtonGroup />
4
+ </div>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import SinglePickButtonGroup from '@/components/common/SinglePickButtonGroup'
9
+ import { SinglePickSetupDemoProps } from './typing'
10
+ import { useSinglePickSetupDemo } from './hook'
11
+
12
+ defineOptions({
13
+ name: 'SinglePickSetupDemo',
14
+ })
15
+
16
+ const props = defineProps<SinglePickSetupDemoProps>()
17
+
18
+ const { selectedValue } = useSinglePickSetupDemo(props)
19
+ </script>
20
+
21
+ <style lang="scss" scoped>
22
+ @import './index.scss';
23
+ </style>
@@ -0,0 +1,13 @@
1
+ export enum SinglePickSetupDemoEnum {
2
+ DEFAULT = 'default',
3
+ }
4
+
5
+ export interface SinglePickSetupDemoProps {
6
+ user?: Record<string, any>
7
+ modelValue?: string
8
+ }
9
+
10
+ export interface DataType {
11
+ label: string
12
+ value: string
13
+ }
@@ -1,7 +0,0 @@
1
- import type { DataType } from "./typing"
2
-
3
- const data:Array<DataType> = []
4
-
5
- export {
6
- data
7
- }
@@ -1,29 +0,0 @@
1
- import { ref } from 'vue';
2
- import { data } from './data'
3
- import { useTimeline } from '@/hooks';
4
- import { {{ componentName }}Props } from './typing'
5
- import emitter, { useEmitter } from '@/base/toolkit';
6
- import { usePlatformStore, useProductStore, useGlobalStore } from '@/store';
7
- import { ButtonGroupItem } from '@/components/common/SinglePickButtonGroup';
8
- export const use{{componentName}} = (props: {{componentName}}Props) => {
9
- const model = ref<string>('')
10
- const platformStore = usePlatformStore();
11
- const productStore = useProductStore();
12
- const globalStore = useGlobalStore();
13
-
14
- useTimeline(model,({currentTime,productTypes})=>{
15
- // TODO 产品绑定时间轴,时间轴变化请求数据
16
- })
17
- useEmitter([
18
- {
19
- eventName:'test',
20
- callback:()=> {
21
- // TODO
22
- }
23
- }
24
- ])
25
-
26
- return {
27
- model
28
- }
29
- }
@@ -1 +0,0 @@
1
- .{{class}} { position:absolute;z-index:999;width:500px;height:500px;top:0;left:0;background-color:#327ccb52}
@@ -1,25 +0,0 @@
1
- <template>
2
- <div class="{{ class }}"></div>
3
- </template>
4
-
5
- <script setup lang="ts">
6
- import { {{ componentName }}Props, {{ componentName }}Enum } from './typing'
7
- import { use{{componentName}} } from './hook'
8
- import SinglePickButtonGroup from '@/components/common/SinglePickButtonGroup';
9
-
10
- defineOptions({
11
- name: `{{ componentName }}`
12
- });
13
-
14
- const props = defineProps<{{ componentName }}Props>();
15
-
16
- // withDefaults(defineProps<{{ componentName }}Props>(), {});
17
-
18
- const { } = use{{componentName}}(props);
19
-
20
- </script>
21
-
22
- <style lang="scss" scoped>
23
- @import './index.scss';
24
- // 如果有用到v-bind(),它在index.scss中定义会不生效,请在该文件内写入对应的样式。
25
- </style>
@@ -1,38 +0,0 @@
1
-
2
-
3
- <template>
4
- <div class="{{ class }}"></div>
5
- </template>
6
-
7
- <script lang="ts">
8
- import {
9
- defineComponent,
10
- PropType
11
- } from 'vue';
12
- import { {{ componentName }}Props, {{ componentName }}Enum } from './typing'
13
- import { use{{componentName}} } from './hook'
14
- import SinglePickButtonGroup, { ButtonGroupItem } from '@/components/common/SinglePickButtonGroup';
15
- export default defineComponent({
16
- name: `{{ componentName }}`,
17
- components: { },
18
- props:{
19
- // 示例,使用 PropType 强制指定接口类型
20
- user: {
21
- type: Object as PropType<{{ componentName }}Props['user']>,
22
- required: false,
23
- },
24
- },
25
- setup(props, { emit }) {
26
-
27
- const { } = use{{componentName}}(props)
28
-
29
-
30
- return {};
31
- },
32
- });
33
- </script>
34
-
35
- <style lang="scss" scoped>
36
- @import './index.scss';
37
- // 如果有用到v-bind(),它在index.scss中定义会不生效,请在该文件内写入对应的样式。
38
- </style>
@@ -1,14 +0,0 @@
1
-
2
- export enum {{interfaceName}}Enum {
3
- 'ENUM_KEY1',
4
- 'ENUM_KEY2'
5
- }
6
-
7
- export interface {{interfaceName}}Props {
8
- user: Record<string, any>
9
- }
10
-
11
- export interface DataType {
12
- lon: string;
13
- lat: string;
14
- }