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

vue-component-tree

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-component-tree - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

src/classes/Main/DemoFileCollection.js

4

package.json
{
"name": "vue-component-tree",
"version": "1.2.1",
"version": "1.3.0",
"description": "Tree view for your demo components",

@@ -10,3 +10,3 @@ "main": "index.js",

"demo": "cross-env NODE_ENV=production webpack --progress --hide-modules --config webpack.config.demo.js",
"dev": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --open --config webpack.config.dev.js",
"dev": "cross-env NODE_ENV=development webpack-dev-server --hot --open --config webpack.config.dev.js",
"test": "karma start --single-run",

@@ -13,0 +13,0 @@ "test-dev": "karma start"

@@ -9,6 +9,6 @@ [![Build status][circleci-badge]][circleci-url]

## Install
```
npm install vue-component-tree
```
* **npm**: `npm install -D vue-component-tree`
* **yarn**: `yarn add -D vue-component-tree`
## Features

@@ -15,0 +15,0 @@ * Display your components as a tree or flat list.

import DemoFolder from './DemoFolder'
import DemoFileOptions from './DemoFileOptions'

@@ -7,2 +8,5 @@ export default class DemoFile {

folder: DemoFolder = null
options: DemoFileOptions = null
dependsOn: DemoFile[] = []
dependedBy: DemoFile[] = []

@@ -13,2 +17,7 @@ constructor (data) {

hydrateOptions () {
this.options = DemoFileOptions.createFromDemoFile(this)
return this
}
openFolder () {

@@ -18,2 +27,3 @@ this.folder.open()

// returns `ComponentDemo.vue`
getFilename (): String {

@@ -23,2 +33,39 @@ return this.path.split('/').pop()

// returns `VmComponent`
guessComponentName (): String {
let name = this.getFilename()
// remove extension
if (/.vue$/.test(name)) {
name = name.slice(0, -4)
}
// remove Demo part
if (/Demo$/.test(name)) {
name = name.slice(0, -4)
}
return 'Vm' + name
}
/**
* Guess component on which demo operates from registered ones.
*/
guessComponent (): ?Object {
const registeredComponents = this.component.components
if (!registeredComponents) {
return null
}
const name = this.guessComponentName()
return Object.values(registeredComponents)
.find(component => {
return component.name === name
}) || null
}
getMainComponentDependencies (): Object[] {
const dependentComponents = this.options.component.components
if (!dependentComponents) {
return []
}
return Object.values(dependentComponents)
}
getParentFolderPath (): String {

@@ -25,0 +72,0 @@ return this.path.split('/').slice(0, -1).join('/')

@@ -1,19 +0,26 @@

import DemoNode from './DemoFile.js'
import DemoFile from './DemoFile.js'
import vmDemoPage from './../../components/DemoPage.vue'
import DemoFileCollection from './DemoFileCollection'
/**
* Creates route for vue-router with all necessary boilerplate.
*/
export default class DemoPage {
static create (requireContext, path) {
const files = requireContext.keys().map(key => {
return new DemoNode({
path: path + key.substr(1),
component: requireContext(key),
const demoFilesCollection = new DemoFileCollection({
demoFiles: requireContext.keys().map(key => {
return new DemoFile({
path: path + key.substr(1),
component: requireContext(key),
}).hydrateOptions()
})
})
}).attachRelations()
return {
path: path + '*',
component: vmDemoPage,
meta: { files },
meta: { demoFilesCollection },
}
}
}

@@ -58,6 +58,8 @@ var path = require('path')

exclude: path.resolve('./src/assets/svg'),
}
},
]
},
devServer: {
port: 4265,
inline: true,
historyApiFallback: {

@@ -64,0 +66,0 @@ disableDotRule: true,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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