This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: hook up remaining functionality
- Loading branch information
1 parent
3ff4c3e
commit 6f6df8e
Showing
18 changed files
with
766 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Vuetify CLI | ||
Coming soon... |
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,10 @@ | ||
module.exports = api => { | ||
api.extendPackage({ | ||
scripts: { | ||
'create:component': 'node ./node_modules/vue-cli-plugin-vuetify-cli' | ||
'make:component': 'vue-cli-service make:component', | ||
'make:directive': 'vue-cli-service make:directive', | ||
'make:mixin': 'vue-cli-service make:mixin', | ||
'make:view': 'vue-cli-service make:view', | ||
} | ||
}) | ||
} |
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,21 @@ | ||
// Component | ||
import { Component } from './index' | ||
|
||
// Utilities | ||
import { shallow, createLocalVue } from '@vue/test-utils' | ||
|
||
// Bootstrap | ||
const localVue = createLocalVue() | ||
|
||
describe('Component', () => { | ||
function mountFunction(options = {}) { | ||
return shallow(Component, { | ||
localVue, | ||
...options, | ||
}) | ||
} | ||
|
||
it('should work', () => { | ||
const wrapper = mountFunction() | ||
}) | ||
}) |
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,15 @@ | ||
<template> | ||
<div> | ||
<!-- --> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'Component', | ||
} | ||
</script> | ||
|
||
<style lang="sass"> | ||
// | ||
</style> |
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 @@ | ||
export { Component } from './Component' |
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,35 @@ | ||
// Directive | ||
import { directive } from './index' | ||
|
||
// Utilities | ||
import { shallow, createLocalVue } from '@vue/test-utils' | ||
|
||
// Variables | ||
const Mock = { | ||
directives: { directive }, | ||
|
||
render (h) { | ||
return h('div', { | ||
directives: [{ | ||
name: 'directive', | ||
value: false, | ||
}], | ||
}) | ||
}, | ||
} | ||
|
||
// Bootstrap | ||
function mountFunction(options = {}) { | ||
return shallow(Mock, { | ||
localVue, | ||
...options, | ||
}) | ||
} | ||
|
||
const localVue = createLocalVue() | ||
|
||
describe('directive', () => { | ||
it('should work', () => { | ||
const wrapper = mountFunction() | ||
}) | ||
}) |
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,27 @@ | ||
function bind (el, binding, vnode, oldVnode) { | ||
// | ||
} | ||
|
||
function inserted (el) { | ||
// | ||
} | ||
|
||
function update (el, binding, vnode, oldVnode) { | ||
// | ||
} | ||
|
||
function componentUpdated (el, binding, vnode, oldVnode) { | ||
// | ||
} | ||
|
||
function unbind (el, binding, vnode, oldVnode) { | ||
// | ||
} | ||
|
||
export default { | ||
bind, | ||
inserted, | ||
update, | ||
componentUpdated, | ||
unbind | ||
} |
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 @@ | ||
export const Mixin = { | ||
name: 'Mixin' | ||
} |
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,27 @@ | ||
// Mixin | ||
import { mixin } from './index' | ||
|
||
// Utilities | ||
import { shallow, createLocalVue } from '@vue/test-utils' | ||
|
||
// Variables | ||
const Mock = { | ||
mixins: [mixin], | ||
render: h => h('div'), | ||
} | ||
|
||
// Bootstrap | ||
function mountFunction(options = {}) { | ||
return shallow(Mock, { | ||
localVue, | ||
...options, | ||
}) | ||
} | ||
|
||
const localVue = createLocalVue() | ||
|
||
describe('mixin', () => { | ||
it('should work', () => { | ||
const wrapper = mountFunction() | ||
}) | ||
}) |
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 @@ | ||
<template> | ||
<section id="view"> | ||
<!-- --> | ||
</section> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'View', | ||
} | ||
</script> |
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,12 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
const resolve = dir => path.resolve(__dirname, dir) | ||
|
||
module.exports = api => { | ||
const commands = resolve('./lib/commands') | ||
|
||
// Import and register all commands | ||
fs.readdirSync(commands).forEach(command => { | ||
require(`${commands}/${command}`)(api) | ||
}) | ||
} |
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,74 @@ | ||
// Imports | ||
const camelCase = require('lodash/camelCase') | ||
const fs = require('fs') | ||
const inquire = require('inquirer') | ||
const upperFirst = require('lodash/upperFirst') | ||
const { writeFiles } = require('../../util/helpers.js') | ||
|
||
// Variables | ||
const views = [] | ||
const types = [ | ||
{ name: 'Regular', value: '' }, | ||
{ name: 'Base', value: 'base/' }, | ||
{ name: 'Core', value: 'core/' }, | ||
] | ||
|
||
if (fs.existsSync('src/views')) { | ||
fs.readdirSync('src/views').forEach(dir => { | ||
views.push(`${dir}/`) | ||
}) | ||
} | ||
|
||
if (views.length > 0) { | ||
types.push({ | ||
name: 'View', | ||
value: 'view' | ||
}) | ||
} | ||
|
||
const questions = [ | ||
{ | ||
type: 'list', | ||
message: 'Component type:', | ||
name: 'type', | ||
choices: types | ||
}, | ||
{ | ||
type: 'list', | ||
message: 'Select the view', | ||
name: 'view', | ||
choices: views, | ||
when: options => options.type === 'view', | ||
}, | ||
{ | ||
type: 'input', | ||
message: 'Component name:', | ||
name: 'name', | ||
filter: val => upperFirst(camelCase(val)) | ||
} | ||
] | ||
|
||
async function command (api) { | ||
const make = options => { | ||
if (options.view) { | ||
options.type = `../views/${options.view}/components/` | ||
} | ||
|
||
writeFiles('component', options, api) | ||
} | ||
|
||
inquire | ||
.prompt(questions) | ||
.then(make) | ||
} | ||
|
||
module.exports = api => { | ||
api.registerCommand('make:component', { | ||
description: 'scaffold a new vue component', | ||
usage: 'vue-cli-service make:component [options]', | ||
options: { | ||
'--name': 'specify component name', | ||
'--type': 'specify component type', | ||
} | ||
}, () => command(api)) | ||
} |
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,32 @@ | ||
// Imports | ||
const inquire = require('inquirer') | ||
const kebabcase = require('lodash/kebabcase') | ||
const { writeFiles } = require('../../util/helpers.js') | ||
|
||
// Variables | ||
const questions = [ | ||
{ | ||
type: 'input', | ||
message: 'Directive name:', | ||
name: 'name', | ||
filter: kebabcase | ||
} | ||
] | ||
|
||
async function command (api) { | ||
const make = options => writeFiles('directive', options, api) | ||
|
||
inquire | ||
.prompt(questions) | ||
.then(make) | ||
} | ||
|
||
module.exports = api => { | ||
api.registerCommand('make:directive', { | ||
description: 'scaffold a new vue directive', | ||
usage: 'vue-cli-service make:directive [options]', | ||
options: { | ||
'--name': 'specify directive name' | ||
} | ||
}, () => command(api)) | ||
} |
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,32 @@ | ||
// Imports | ||
const inquire = require('inquirer') | ||
const kebabcase = require('lodash/kebabcase') | ||
const { writeFiles } = require('../../util/helpers.js') | ||
|
||
// Variables | ||
const questions = [ | ||
{ | ||
type: 'input', | ||
message: 'Mixin name:', | ||
name: 'name', | ||
filter: kebabcase | ||
} | ||
] | ||
|
||
async function command (api) { | ||
const make = options => writeFiles('mixin', options, api) | ||
|
||
inquire | ||
.prompt(questions) | ||
.then(make) | ||
} | ||
|
||
module.exports = api => { | ||
api.registerCommand('make:mixin', { | ||
description: 'scaffold a new vue mixin', | ||
usage: 'vue-cli-service make:mixin [options]', | ||
options: { | ||
'--name': 'specify mixin name' | ||
} | ||
}, () => command(api)) | ||
} |
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,32 @@ | ||
// Imports | ||
const inquire = require('inquirer') | ||
const kebabcase = require('lodash/kebabcase') | ||
const { writeFiles } = require('../../util/helpers.js') | ||
|
||
// Variables | ||
const questions = [ | ||
{ | ||
type: 'input', | ||
message: 'View name:', | ||
name: 'name', | ||
filter: kebabcase | ||
} | ||
] | ||
|
||
async function command (api) { | ||
const make = options => writeFiles('view', options, api) | ||
|
||
inquire | ||
.prompt(questions) | ||
.then(make) | ||
} | ||
|
||
module.exports = api => { | ||
api.registerCommand('make:view', { | ||
description: 'scaffold a new vue view', | ||
usage: 'vue-cli-service make:view [options]', | ||
options: { | ||
'--name': 'specify view name' | ||
} | ||
}, () => command(api)) | ||
} |
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,8 +1,14 @@ | ||
{ | ||
"name": "vuetify-cli", | ||
"name": "vue-cli-plugin-vuetify-cli", | ||
"version": "0.0.0", | ||
"description": "A Scaffolding Tool for Vue / Vuetify", | ||
"main": "index.js", | ||
"author": "John Leider", | ||
"license": "MIT" | ||
"license": "MIT", | ||
"devDependencies": { | ||
"inquirer": "^7.0.0", | ||
"lodash": "^4.17.15", | ||
"pluralize": "^8.0.0", | ||
"shelljs": "^0.8.3" | ||
} | ||
} |
Oops, something went wrong.