first commit
This commit is contained in:
13
ui/generators/new/util/prompt.js
Normal file
13
ui/generators/new/util/prompt.js
Normal file
@@ -0,0 +1,13 @@
|
||||
module.exports = [
|
||||
{
|
||||
type: 'input',
|
||||
name: 'name',
|
||||
message: 'Name:',
|
||||
validate(value) {
|
||||
if (!value.length) {
|
||||
return 'Utility functions must have a name.'
|
||||
}
|
||||
return true
|
||||
},
|
||||
},
|
||||
]
|
||||
14
ui/generators/new/util/unit.ejs.t
Normal file
14
ui/generators/new/util/unit.ejs.t
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
to: "src/utils/<%= h.changeCase.kebab(name) %>.unit.js"
|
||||
---
|
||||
<%
|
||||
const fileName = h.changeCase.kebab(name)
|
||||
const importName = h.changeCase.camel(fileName)
|
||||
%>import <%= importName %> from './<%= fileName %>'
|
||||
|
||||
describe('@utils/<%= fileName %>', () => {
|
||||
it('says hello', () => {
|
||||
const result = <%= importName %>()
|
||||
expect(result).toEqual('hello')
|
||||
})
|
||||
})
|
||||
9
ui/generators/new/util/util.ejs.t
Normal file
9
ui/generators/new/util/util.ejs.t
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
to: "src/utils/<%= h.changeCase.kebab(name) %>.js"
|
||||
---
|
||||
<%
|
||||
const fileName = h.changeCase.kebab(name)
|
||||
const importName = h.changeCase.camel(fileName)
|
||||
%>export default function <%= importName %>() {
|
||||
return 'hello'
|
||||
}
|
||||
Reference in New Issue
Block a user