Skip to content

Commit 3570a9e

Browse files
committed
First commit
1 parent afc6a32 commit 3570a9e

File tree

8 files changed

+1824
-60
lines changed

8 files changed

+1824
-60
lines changed

LICENCE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024-2025 ALEC LLOYD PROBERT
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Vue Data UI CLI
2+
3+
A CLI tool to generate Vue Data UI chart component boilerplates.
4+
5+
## Installation
6+
7+
```bash
8+
npm i -g vue-data-ui-cli
9+
```
10+
11+
## Usage
12+
13+
Run the CLI command:
14+
15+
```bash
16+
vdui-cli
17+
```
18+
19+
You will be prompted for the following:
20+
21+
- Select a Vue Data UI component
22+
- Use computed or ref for the dataset
23+
- Use computed or ref for the config
24+
- Use TypeScript or not
25+
- The name of your Vue component
26+
- The directory to create the component
27+
28+
The tool will then create a Vue file containing the boilerplate chart component, with a sample dataset for immediate testing.

boilerplate.js

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export default ({
99
datasetType,
1010
isDatasetArray,
1111
componentSlots,
12-
componentLink
12+
componentLink,
13+
emits
1314
}) => {
1415

1516
const dsType = useTypescript ? `<${`${datasetType}${isDatasetArray ? '[]' : ''}`}>` : '';
@@ -24,14 +25,28 @@ export default ({
2425
</template>-->
2526
`;
2627

28+
// let emitFuncs = '';
29+
// let emitDefs = '';
30+
31+
// if (emits && emits.length) {
32+
// emitFuncs = emits.map(emit => {
33+
// return `${useTypescript ? emit.funcTs : emit.func}`
34+
// }).toString().replaceAll(',', '\n\n');
35+
36+
// emitDefs = emits.map(emit => {
37+
// return `@${emit.name}="${emit.name}"`;
38+
// }).toString().replaceAll(',', '');
39+
// }
40+
41+
2742
return `
2843
<script setup${useTypescript ? ' lang="ts"' : ''}>
2944
import { ${[useComputedConfig, useComputedDataset].includes(false) ? 'ref, ' : ''}${useComputedConfig || useComputedDataset ? 'computed ' : ''}} from "vue";
30-
import { VueDataUi${useTypescript ? `, type ${datasetType}, type ${configType} }` : '}'} from "vue-data-ui";
45+
import { VueDataUi${useTypescript ? `,${['number', 'Array<Array<string | number>>', ''].includes(datasetType) ? '' : `type ${datasetType},`} type ${configType} }` : '}'} from "vue-data-ui";
3146
32-
const dataset = ${useComputedDataset ? `computed${dsType}(() => {
47+
${!datasetType ? '' : `const dataset = ${useComputedDataset ? `computed${dsType}(() => {
3348
return ${ds};
34-
})` : `ref${dsType}(${ds})`};
49+
})` : `ref${dsType}(${ds})`};`}
3550
3651
/**
3752
* This is the default config.
@@ -48,13 +63,13 @@ const config = ${useComputedConfig ? `computed${confType}(() => {
4863
<div :style="{ width: '600px' }">
4964
<VueDataUi
5065
component="${component}"
51-
:dataset="dataset"
66+
${!datasetType ? '' : `:dataset="dataset"`}
5267
:config="config"
53-
>
54-
<!-- Include slots here -->
55-
<!-- For more info on slots, check the slots tab at https://vue-data-ui.graphieros.com/docs#${componentLink} -->
68+
${componentSlots.length ? '>' : '/>'}
69+
${ componentSlots.length ? '<!-- Use slots here in template tags. Official Vue slots documentation https://vuejs.org/guide/components/slots -->' : '' }
70+
${ componentSlots.length ? `<!-- Documentation on Vue Data UI slots, check the slots tab at https://vue-data-ui.graphieros.com/docs#${componentLink} -->` : '' }
5671
${ componentSlots.includes('source') ? sourceSlot : ''}
57-
</VueDataUi>
72+
${componentSlots.length ? '</VueDataUi>' : ''}
5873
</div>
5974
</template>
6075
`;

0 commit comments

Comments
 (0)