Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@calidae/vue-generate-component

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@calidae/vue-generate-component

Vue js component generator

  • 1.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-72.22%
Maintainers
2
Weekly downloads
 
Created
Source

Vue js component generator

Developed upon the work of vue-generate-component.

CLI util for easy generate Vue js component

Installation

npm install -g @calidae/vue-generate-component

Usage

vgc --help

Create new component

vgc Footer

Will generate a folder called Footer in your current directory with three files :

index.js

import Footer from './Footer'

export default Footer

Footer.vue

<template>
  <div class="c-footer">

  </div>
</template>

<script>
export default {
  name: 'Footer',
  data() {
    return {}
  }
}
</script>

Footer.spec.js

import Vue from 'vue'
import Footer from './index.js'
import { mount, shallow } from '@vue/test-utils'

describe('Footer.vue', () => {
  it('is a component', () => {
    const wrapper = mount(Footer)
    expect(wrapper.isVueInstance()).toBeTruthy()
  })

  it('renders an snapshot', () => {
    const wrapper = shallow(Footer)
    expect(wrapper.html()).toMatchSnapshot('default')
  })
})

Creating a container component

If you want to replicate the structure outlined above but adding a Container component, just add the container flag:

vgc Footer --container

Will modify the index.js file and create a new container component and test file:

index.js

import FooterContainer from './FooterContainer'

export default FooterContainer

FooterContainer.vue

<template>
  <div>
    <Footer />
  </div>
</template>

<script>
import Footer from './Footer'

export default {
  name: 'FooterContainer',
  components: {
    Footer
  },
  data() {
    return {}
  }
}
</script>

FooterContainer.spec.js

import Vue from 'vue'
import FooterContainer from './FooterContainer'
import { mount, shallow } from '@vue/test-utils'

describe('FooterContainer.vue', () => {
  it('is a component', () => {
    const wrapper = mount(FooterContainer)
    expect(wrapper.isVueInstance()).toBeTruthy()
  })

  it('renders an snapshot', () => {
    const wrapper = shallow(FooterContainer)
    expect(wrapper.html()).toMatchSnapshot('default')
  })
})

Keywords

FAQs

Package last updated on 02 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc