first commit

This commit is contained in:
Akhil Gupta
2021-05-29 15:20:50 +05:30
commit d25c30a7b2
194 changed files with 49873 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
---
to: "src/components/<%= h.changeCase.kebab(name).toLowerCase().slice(0, 5) === 'base-' ? '_' : '' %><%= h.changeCase.kebab(name) %>.vue"
---
<%
if (blocks.indexOf('script') !== -1) {
%><script>
export default {
<% if (blocks.indexOf('template') === -1) {
%>render(h) {
return <div/>
}<% } %>
}
</script>
<%
}
if (blocks.indexOf('template') !== -1) {
%>
<template>
<div/>
</template>
<%
}
if (blocks.indexOf('style') !== -1) {
%>
<style lang="scss" module>
@import '@design';
</style><%
}
%>

View File

@@ -0,0 +1,45 @@
const _ = require('lodash')
module.exports = [
{
type: 'input',
name: 'name',
message: 'Name:',
validate(value) {
if (!value.length) {
return 'Components must have a name.'
}
const fileName = _.kebabCase(value)
if (fileName.indexOf('-') === -1) {
return 'Component names should contain at least two words to avoid conflicts with existing and future HTML elements.'
}
return true
},
},
{
type: 'multiselect',
name: 'blocks',
message: 'Blocks:',
initial: ['script', 'template', 'style'],
choices: [
{
name: 'script',
message: '<script>',
},
{
name: 'template',
message: '<template>',
},
{
name: 'style',
message: '<style>',
},
],
validate(value) {
if (value.indexOf('script') === -1 && value.indexOf('template') === -1) {
return 'Components require at least a <script> or <template> tag.'
}
return true
},
},
]

View File

@@ -0,0 +1,16 @@
---
to: "src/components/<%= h.changeCase.kebab(name).toLowerCase().slice(0, 5) === 'base-' ? '_' : '' %><%= h.changeCase.kebab(name) %>.unit.js"
---
<%
let fileName = h.changeCase.kebab(name).toLowerCase()
const importName = h.changeCase.pascal(fileName)
if (fileName.slice(0, 5) === 'base-') {
fileName = '_' + fileName
}
%>import <%= importName %> from './<%= fileName %>'
describe('@components/<%= fileName %>', () => {
it('exports a valid component', () => {
expect(<%= importName %>).toBeAComponent()
})
})