Skip to content

Commit 3209914

Browse files
committed
add basic functionality (partly stub)
1 parent ad66db1 commit 3209914

File tree

5 files changed

+121
-0
lines changed

5 files changed

+121
-0
lines changed

generator/index.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = (api) => {
2+
api.extendPackage({
3+
dependencies: {
4+
'vue-extensionpoints': '^0.1.0',
5+
},
6+
})
7+
const appPath = api.resolve('src/App.vue')
8+
if (fs.existsSync(appPath)) {
9+
let content = fs.readFileSync(appPath, { encoding: 'utf8' })
10+
content = content.replace(/HelloWorld/gi, 'ExtensionpointExample')
11+
fs.writeFileSync(appPath, content, { encoding: 'utf8' })
12+
}
13+
api.render('./template')
14+
15+
// add import
16+
api.injectImports(api.entryFile,
17+
`import VueExtensionpoints from 'vue-extensionpoints'`)
18+
}
19+
20+
// module.exports.hooks = (api) => {
21+
// api.afterInvoke(() => {
22+
// const fs = require('fs')
23+
// const contentMain = fs.readFileSync(api.entryFile, { encoding: 'utf-8' })
24+
// const lines = contentMain.split(/\r?\n/g)
25+
// })
26+
// }
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<template>
2+
<div class="hello">
3+
<h1>{{ msg }}</h1>
4+
<h3>Installed Plugins</h3>
5+
<ul>
6+
<extensionpoint hook="plugins"/>
7+
</ul>
8+
<h3>Essential Links</h3>
9+
<ul>
10+
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
11+
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
12+
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
13+
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
14+
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
15+
</ul>
16+
<h3>Ecosystem</h3>
17+
<ul>
18+
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
19+
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
20+
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
21+
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
22+
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
23+
</ul>
24+
</div>
25+
</template>
26+
27+
<script>
28+
export default {
29+
name: 'HelloWorld',
30+
props: {
31+
msg: String
32+
}
33+
}
34+
</script>
35+
36+
<!-- Add "scoped" attribute to limit CSS to this component only -->
37+
<style scoped>
38+
h3 {
39+
margin: 40px 0 0;
40+
}
41+
ul {
42+
list-style-type: none;
43+
padding: 0;
44+
}
45+
li {
46+
display: inline-block;
47+
margin: 0 10px;
48+
}
49+
a {
50+
color: #42b983;
51+
}
52+
</style>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// plugins.js
2+
3+
// this file should be generated automatically by your plugin system
4+
// it should export a default object which just refers to vue
5+
// components:
6+
7+
// import foo from '@/plugins/foo'
8+
// var bar = {
9+
// hooks: {
10+
// "baz-hook": MyComponent,
11+
// "bar-hook": [BarComponent, BeezComponent]
12+
// }
13+
// }
14+
15+
export default {
16+
// foo,
17+
// bar
18+
}

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = () => {}

package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "vue-cli-plugin-extensionpoints",
3+
"version": "0.1.0",
4+
"description": "Vue CLI plugin for adding extensionpoints",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/nerdocs/vue-cli-plugin-extensionpoints.git"
12+
},
13+
"keywords": [
14+
"vue",
15+
"plugins",
16+
"extensions"
17+
],
18+
"author": "Christian González <[email protected]>",
19+
"license": "MIT",
20+
"bugs": {
21+
"url": "https://github.com/nerdocs/vue-cli-plugin-extensionpoints/issues"
22+
},
23+
"homepage": "https://github.com/nerdocs/vue-cli-plugin-extensionpoints#readme"
24+
}

0 commit comments

Comments
 (0)