Skip to content

Commit dae0c77

Browse files
committed
🆕 Basic demo for configuration example
1 parent 291f319 commit dae0c77

File tree

8 files changed

+152
-10
lines changed

8 files changed

+152
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ node_modules/
55
dist/
66
docs/api/
77
docs/demo/
8+
output/

composer.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,23 @@
1919
"phpdocumentor/phpdocumentor": "^2.9",
2020
"jms/serializer": "1.7.*"
2121
},
22+
"autoload-dev": {
23+
"psr-4": {
24+
"NelsonMartell\\VuePress\\Demo\\": "demo"
25+
},
26+
"files": [
27+
"demo/constants.php",
28+
"demo/functions.php"
29+
]
30+
},
31+
"scripts": {
32+
"build:api": [
33+
"phpdoc"
34+
]
35+
},
2236
"extra": {
2337
"branch-alias": {
24-
"dev-master": "v1.0.x-dev"
38+
"dev-master": "1.0.x-dev"
2539
}
2640
}
2741
}

demo/Example.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace NelsonMartell\VuePress\Demo;
4+
5+
/**
6+
* Example class.
7+
*
8+
* @since 1.0.0
9+
* @author Nelson Martell <nelson6e65@gmail.com>
10+
*/
11+
class Example implements IDemo
12+
{
13+
/**
14+
*
15+
* @var string
16+
*/
17+
protected $example = null;
18+
19+
public function __construct($example = 'demo')
20+
{
21+
$this->example = $example;
22+
}
23+
24+
public function isReady()
25+
{
26+
return $this->example !== null;
27+
}
28+
29+
protected function isDemo()
30+
{
31+
return $this->example === 'demo';
32+
}
33+
}

demo/IDemo.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace NelsonMartell\VuePress\Demo;
4+
5+
/**
6+
* Example interface.
7+
*
8+
* @since 1.0.0
9+
* @author Nelson Martell <nelson6e65@gmail.com>
10+
*/
11+
interface IDemo
12+
{
13+
/**
14+
* Example class constant.
15+
*
16+
* @var boolean
17+
*/
18+
const EXAMPLE = true;
19+
20+
/**
21+
* Is the example ready?
22+
*
23+
* @return bool
24+
*/
25+
public function isReady();
26+
}

demo/constants.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
4+
/**
5+
* An example constant.
6+
*
7+
* @var string
8+
*
9+
* @return string
10+
*
11+
* @author Nelson Martell <nelson6e65@gmail.com>
12+
* @since 1.0.0
13+
*/
14+
define('PV_DEMO_VERSION', '1.0.0');

demo/functions.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace NelsonMartell\VuePress\Demo;
4+
5+
/**
6+
* An example function.
7+
*
8+
* @param int $index Index.
9+
* @param string|null $name Name.
10+
*
11+
* @return string
12+
*
13+
* @author Nelson Martell <nelson6e65@gmail.com>
14+
* @since 1.0.0
15+
*/
16+
function example($index, $title = null)
17+
{
18+
$r = 'Example '.$index;
19+
20+
if ($title) {
21+
$r .= ' '.$title;
22+
}
23+
24+
return $r.': ';
25+
}

docs/.vuepress/config.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = {
1515
themeConfig: {
1616
nav: [
1717
{ text: 'Guide', link: '/guide/' },
18+
{ text: 'Demo', link: '/api/' },
1819
],
1920

2021
sidebar: {
@@ -28,6 +29,20 @@ module.exports = {
2829
]
2930
}
3031
],
32+
'/api/': [
33+
{
34+
title: 'Demo',
35+
collapsable: false,
36+
children: [
37+
'',
38+
'classes',
39+
'interfaces',
40+
'traits',
41+
'functions',
42+
'constants'
43+
]
44+
}
45+
],
3146
'/': [
3247
''
3348
]
@@ -36,17 +51,9 @@ module.exports = {
3651

3752
lastUpdated: true,
3853

39-
4054
// Repo
4155
repo: 'nelson6e65/phpdoc-vuepress',
4256
docsDir: 'docs',
43-
editLinks: true,
44-
},
45-
46-
configureWebpack: {
47-
output: {
48-
filename: '[name].js',
49-
chunkFilename: 'assets/js/[name].js' + '?id=[chunkhash]'
50-
}
57+
editLinks: true
5158
}
5259
}

phpdoc.dist.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<phpdoc>
3+
<title>Demo for `phpdoc-vuepress`</title>
4+
5+
<parser>
6+
<visibility>public,protected</visibility>
7+
<target>output/phpdoc/api</target>
8+
</parser>
9+
10+
<transformer>
11+
<target>docs/api</target>
12+
</transformer>
13+
14+
<transformations>
15+
<template name="data/templates/vuepress" />
16+
</transformations>
17+
18+
<files>
19+
<directory>demo</directory>
20+
</files>
21+
22+
</phpdoc>

0 commit comments

Comments
 (0)