Skip to content

Commit

Permalink
Initial commit with library structure, demo and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cristijora committed Jul 1, 2019
1 parent 3ea88a9 commit 93a2a80
Show file tree
Hide file tree
Showing 20 changed files with 1,717 additions and 271 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ module.exports = {
node: true,
},
extends: [
'plugin:vue/essential',
'@vue/airbnb',
'plugin:vue/essential'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
Expand Down
19 changes: 12 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
.DS_Store
node_modules
/dist
public
dist/*.gz
dist/*.map
coverage
docs/.vuepress/dist

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# related test files
/tests/e2e/reports
/tests/e2e/videos
/tests/e2e/screenshots

# Editor directories and files
# editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.sw*

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// TODO: release log here ...
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2019

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 7 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module.exports = {
presets: [
'@vue/app',
[
'@vue/app',
{
polyfills: false,
useBuiltIns: false
},
]
],
};
File renamed without changes.
17 changes: 17 additions & 0 deletions demo/Demo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<div class="demo">
<h1>Plugin Demo</h1>
<p>add: {{ a }} + {{ b }} = {{ $add(a, b) }}</p>
</div>
</template>

<script>
export default {
name: 'demo',
data: () => ({ a: 1, b: 1 })
}
</script>

<style>
</style>
File renamed without changes
File renamed without changes.
10 changes: 10 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Vue Plugin Demo</title>
</head>
<body>
<div id="app"></div>
</body>
</html>
13 changes: 13 additions & 0 deletions demo/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Vue from 'vue'
import App from '~entry'
import plugin from '../src/index'

Vue.use(plugin)

Vue.config.productionTip = false

new Vue({
// NOTE: if you need to inject as option, you can set here!
// plugin,
render: h => h(App)
}).$mount('#app')
31 changes: 31 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
plugins: [
require('./plugin.js')
],
locales: {
'/': {
lang: 'en-US',
title: 'VoicenterEventsSdk',
description: 'VoicenterEventsSdk for Vue.js'
}
},
themeConfig: {
repo: '/voicenter-events-sdk',
docsDir: 'docs',
locales: {
'/': {
label: 'English',
selectText: 'Languages',
editLinkText: 'Edit this page on GitHub',
nav: [{
text: 'Release Notes',
link: 'https://github.com//voicenter-events-sdk/releases'
}],
sidebar: [
'/installation.md',
'/started.md',
]
}
}
}
}
19 changes: 19 additions & 0 deletions docs/.vuepress/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const { version } = require('../../package.json')

module.exports = (/*options, ctx*/) => ({
async enhanceAppFiles () {
const code = `export default ({ Vue }) => {
Vue.mixin({
computed: {
$version () {
return '${version}'
}
}
})
}`
return [{
name: 'vuepress-plugin-vue-cli-plugin-p11n',
content: code
}]
}
})
5 changes: 5 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Introduction

`VoicenterEventsSdk`

[Get started](./started/) or play with the [demo](https://github.com//voicenter-events-sdk/tree/dev/demo) (see [`README.md`](https://github.com//voicenter-events-sdk/) to run them).
44 changes: 44 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Installation

## Direct Download / CDN

https://unpkg.com/voicenter-events-sdk/dist/voicenter-events-sdk

[unpkg.com](https://unpkg.com) provides NPM-based CDN links. The above link will always point to the latest release on NPM. You can also use a specific version/tag via URLs like https://unpkg.com/voicenter-events-sdk@{{ $version }}/dist/voicenter-events-sdk.js

Include voicenter-events-sdk after Vue and it will install itself automatically:

```html
<script src="https://unpkg.com/voicenter-events-sdk/dist/voicenter-events-sdk.js"></script>
```

## NPM

```sh
$ npm install voicenter-events-sdk
```

## Yarn

```sh
$ yarn add voicenter-events-sdk
```

```javascript
import VoicenterEventsSDK from 'voicenter-events-sdk'
```

You don't need to do this when using global script tags.

## Dev Build

You will have to clone directly from GitHub and build `voicenter-events-sdk` yourself if
you want to use the latest dev build.

```sh
$ git clone https://github.com//voicenter-events-sdk.git node_modules/voicenter-events-sdk
$ cd node_modules/voicenter-events-sdk
$ npm install
$ npm run build
```

10 changes: 10 additions & 0 deletions docs/started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Getting Started

> We will be using [ES2015](https://github.com/lukehoban/es6features) in the code samples in the guide.

## HTML

```html
<script src="https://unpkg.com/voicenter-events-sdk/dist/voicenter-events-sdk.js"></script>
```
37 changes: 27 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
{
"name": "voicenter-sdk",
"name": "voicenter-events-sdk",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
"serve": "vue-cli-service serve ./demo/main.js",
"build": "vue-cli-service build --target lib --name voicenter-events-sdk src/index.js",
"build:demo": "vue-cli-service build ./demo/main.js",
"lint": "vue-cli-service lint",
"docs": "npm run docs:serve",
"docs:build": "vue-cli-service docs --mode build",
"docs:serve": "vue-cli-service docs --mode serve",
"prepublish": "vue-cli-service lint && vue-cli-service docs --mode build && vue-cli-service build",
"start": "vue-cli-service serve"
},
"dependencies": {
"core-js": "^2.6.5",
"vue": "^2.6.10"
"core-js": "^2.6.5"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.8.0",
"@vue/cli-plugin-eslint": "^3.8.0",
"@vue/cli-service": "^3.8.0",
"@vue/eslint-config-airbnb": "^4.0.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"vue-template-compiler": "^2.6.10"
}
"vue-cli-plugin-p11n": "^0.3.0",
"vue-template-compiler": "^2.6.10",
"vue": "^2.6.10"
},
"files": [
"dist/voicenter-events-sdk.common.js",
"dist/voicenter-events-sdk.umd.min.js",
"dist/voicenter-events-sdk.umd.js",
"dist/voicenter-events-sdk.esm.js",
"src"
],
"jsdelivr": "dist/voicenter-events-sdk.umd.min.js",
"main": "dist/voicenter-events-sdk.common.js",
"module": "dist/voicenter-events-sdk.esm.js",
"sideeffects": false,
"unpkg": "dist/voicenter-events-sdk.umd.min.js"
}
11 changes: 11 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const version = '__VERSION__'
const sdk = {
msg: 'hello'
}

export default sdk

if (typeof window !== 'undefined') {
// Make it available on window
window.voicenteEventsSDK = sdk
}
8 changes: 0 additions & 8 deletions src/main.js

This file was deleted.

Loading

0 comments on commit 93a2a80

Please sign in to comment.