-
Notifications
You must be signed in to change notification settings - Fork 656
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47edf7b
commit fa54a17
Showing
10 changed files
with
882 additions
and
920 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
import { useDesign } from '@/hooks/web/useDesign' | ||
const { getPrefixCls } = useDesign() | ||
const prefixCls = getPrefixCls('{{ name }}') | ||
</script> | ||
|
||
<template> | ||
<div :class="`${prefixCls}-{{ name }}`">{{ upperFirstName }}</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import {{ upperFirstName }} from './src/{{ upperFirstName }}.vue' | ||
|
||
export { {{ upperFirstName }} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const toUpperCase = (str) => str.charAt(0).toUpperCase() + str.slice(1) | ||
|
||
module.exports = { | ||
description: 'Create vue component', | ||
prompts: [ | ||
{ | ||
type: 'input', | ||
name: 'name', | ||
message: '请输入组件名称(Please enter the component name)' | ||
} | ||
], | ||
actions: (data) => { | ||
const { name } = data | ||
const upperFirstName = toUpperCase(name) | ||
|
||
const actions = [] | ||
if (name) { | ||
actions.push({ | ||
type: 'add', | ||
path: `./src/components/${upperFirstName}/src/${upperFirstName}.vue`, | ||
templateFile: './plop/component/component.hbs', | ||
data: { | ||
name, | ||
upperFirstName | ||
} | ||
}, { | ||
type: 'add', | ||
path: `./src/components/${upperFirstName}/index.ts`, | ||
templateFile: './plop/component/index.hbs', | ||
data: { | ||
upperFirstName | ||
} | ||
}) | ||
} | ||
|
||
return actions | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const toUpperCase = (str) => str.charAt(0).toUpperCase() + str.slice(1) | ||
|
||
module.exports = { | ||
description: 'Create vue view', | ||
prompts: [ | ||
{ | ||
type: 'input', | ||
name: 'path', | ||
message: '请输入路径(Please enter a path)', | ||
default: 'views' | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'name', | ||
message: '请输入模块名称(Please enter module name)' | ||
} | ||
], | ||
actions: (data) => { | ||
const { name, path } = data | ||
const upperFirstName = toUpperCase(name) | ||
|
||
const actions = [] | ||
if (name) { | ||
actions.push({ | ||
type: 'add', | ||
path: `./src/${path}/${upperFirstName}.vue`, | ||
templateFile: './plop/view/view.hbs', | ||
data: { | ||
name, | ||
upperFirstName | ||
} | ||
}) | ||
} | ||
|
||
return actions | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script setup lang="ts"> | ||
import { ContentWrap } from '@/components/ContentWrap' | ||
</script> | ||
|
||
<template> | ||
<ContentWrap title="{{ upperFirstName }}"> {{ name }} </ContentWrap> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
const createNewModule = require('./plop/generator/newModule') | ||
const viewGenerator = require('./plop/view/prompt.js') | ||
const componentGenerator = require('./plop/component/prompt.js') | ||
|
||
function Cli(plop) { | ||
plop.setGenerator('newModule', createNewModule) | ||
module.exports = function (plop) { | ||
plop.setGenerator('view', viewGenerator) | ||
plop.setGenerator('component', componentGenerator) | ||
} | ||
|
||
module.exports = Cli |
Oops, something went wrong.