Initial commit.
This commit is contained in:
commit
8098464f58
11
packages/xo-server-usage-report/.babelrc
Normal file
11
packages/xo-server-usage-report/.babelrc
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"comments": false,
|
||||||
|
"compact": true,
|
||||||
|
"plugins": [
|
||||||
|
"transform-runtime"
|
||||||
|
],
|
||||||
|
"presets": [
|
||||||
|
"stage-0",
|
||||||
|
"es2015"
|
||||||
|
]
|
||||||
|
}
|
65
packages/xo-server-usage-report/.editorconfig
Normal file
65
packages/xo-server-usage-report/.editorconfig
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# http://EditorConfig.org
|
||||||
|
#
|
||||||
|
# Julien Fontanet's configuration
|
||||||
|
# https://gist.github.com/julien-f/8096213
|
||||||
|
|
||||||
|
# Top-most EditorConfig file.
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# Common config.
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespaces = true
|
||||||
|
|
||||||
|
# CoffeeScript
|
||||||
|
#
|
||||||
|
# https://github.com/polarmobile/coffeescript-style-guide/blob/master/README.md
|
||||||
|
[*.{,lit}coffee]
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
|
||||||
|
# Markdown
|
||||||
|
[*.{md,mdwn,mdown,markdown}]
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
|
||||||
|
# Package.json
|
||||||
|
#
|
||||||
|
# This indentation style is the one used by npm.
|
||||||
|
[/package.json]
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
|
||||||
|
# Jade
|
||||||
|
[*.jade]
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
|
||||||
|
# JavaScript
|
||||||
|
#
|
||||||
|
# Two spaces seems to be the standard most common style, at least in
|
||||||
|
# Node.js (http://nodeguide.com/style.html#tabs-vs-spaces).
|
||||||
|
[*.js]
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
|
||||||
|
# Less
|
||||||
|
[*.less]
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
|
||||||
|
# Sass
|
||||||
|
#
|
||||||
|
# Style used for http://libsass.com
|
||||||
|
[*.s[ac]ss]
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
|
||||||
|
# YAML
|
||||||
|
#
|
||||||
|
# Only spaces are allowed.
|
||||||
|
[*.yaml]
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
9
packages/xo-server-usage-report/.gitignore
vendored
Normal file
9
packages/xo-server-usage-report/.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/.nyc_output/
|
||||||
|
/bower_components/
|
||||||
|
/dist/
|
||||||
|
|
||||||
|
npm-debug.log
|
||||||
|
npm-debug.log.*
|
||||||
|
|
||||||
|
!node_modules/*
|
||||||
|
node_modules/*/
|
5
packages/xo-server-usage-report/.mocha.js
Normal file
5
packages/xo-server-usage-report/.mocha.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Error.stackTraceLimit = 100
|
||||||
|
|
||||||
|
try { require('trace') } catch (_) {}
|
||||||
|
try { require('clarify') } catch (_) {}
|
||||||
|
try { require('source-map-support/register') } catch (_) {}
|
1
packages/xo-server-usage-report/.mocha.opts
Normal file
1
packages/xo-server-usage-report/.mocha.opts
Normal file
@ -0,0 +1 @@
|
|||||||
|
--require ./.mocha.js
|
10
packages/xo-server-usage-report/.npmignore
Normal file
10
packages/xo-server-usage-report/.npmignore
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/examples/
|
||||||
|
example.js
|
||||||
|
example.js.map
|
||||||
|
*.example.js
|
||||||
|
*.example.js.map
|
||||||
|
|
||||||
|
/test/
|
||||||
|
/tests/
|
||||||
|
*.spec.js
|
||||||
|
*.spec.js.map
|
9
packages/xo-server-usage-report/.travis.yml
Normal file
9
packages/xo-server-usage-report/.travis.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- 'stable'
|
||||||
|
- '4'
|
||||||
|
- '0.12'
|
||||||
|
|
||||||
|
# Use containers.
|
||||||
|
# http://docs.travis-ci.com/user/workers/container-based-infrastructure/
|
||||||
|
sudo: false
|
52
packages/xo-server-usage-report/README.md
Normal file
52
packages/xo-server-usage-report/README.md
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# ${pkg.name} [](https://travis-ci.org/${pkg.shortGitHubPath})
|
||||||
|
|
||||||
|
> ${pkg.description}
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Installation of the [npm package](https://npmjs.org/package/${pkg.name}):
|
||||||
|
|
||||||
|
```
|
||||||
|
> npm install --save ${pkg.name}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
**TODO**
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
### Installing dependencies
|
||||||
|
|
||||||
|
```
|
||||||
|
> npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compilation
|
||||||
|
|
||||||
|
The sources files are watched and automatically recompiled on changes.
|
||||||
|
|
||||||
|
```
|
||||||
|
> npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Tests
|
||||||
|
|
||||||
|
```
|
||||||
|
> npm run test-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributions
|
||||||
|
|
||||||
|
Contributions are *very* welcomed, either on the documentation or on
|
||||||
|
the code.
|
||||||
|
|
||||||
|
You may:
|
||||||
|
|
||||||
|
- report any [issue](${pkg.bugs})
|
||||||
|
you've encountered;
|
||||||
|
- fork and create a pull request.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
${pkg.license} © [${pkg.author.name}](${pkg.author.url})
|
61
packages/xo-server-usage-report/package.json
Normal file
61
packages/xo-server-usage-report/package.json
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"name": "xo-server-usage-report",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"license": "ISC",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"homepage": "",
|
||||||
|
"bugs": "",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": ""
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"name": "Julien Fontanet",
|
||||||
|
"email": "julien.fontanet@isonoe.net"
|
||||||
|
},
|
||||||
|
"preferGlobal": false,
|
||||||
|
"main": "dist/",
|
||||||
|
"bin": {},
|
||||||
|
"files": [
|
||||||
|
"dist/"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.12"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"babel-runtime": "^6.3.19"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"babel-cli": "^6.3.17",
|
||||||
|
"babel-eslint": "^5.0.0-beta6",
|
||||||
|
"babel-plugin-transform-runtime": "^6.3.13",
|
||||||
|
"babel-preset-es2015": "^6.3.13",
|
||||||
|
"babel-preset-stage-0": "^6.3.13",
|
||||||
|
"clarify": "^1.0.5",
|
||||||
|
"dependency-check": "^2.5.1",
|
||||||
|
"mocha": "^2.3.4",
|
||||||
|
"must": "^0.13.1",
|
||||||
|
"nyc": "^5.2.0",
|
||||||
|
"source-map-support": "^0.4.0",
|
||||||
|
"standard": "^5.4.1",
|
||||||
|
"trace": "^2.0.2"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "babel --source-maps --out-dir=dist/ src/",
|
||||||
|
"depcheck": "dependency-check ./package.json",
|
||||||
|
"dev": "babel --watch --source-maps --out-dir=dist/ src/",
|
||||||
|
"dev-test": "mocha --opts .mocha.opts --watch --reporter=min \"dist/**/*.spec.js\"",
|
||||||
|
"lint": "standard",
|
||||||
|
"posttest": "npm run lint && npm run depcheck",
|
||||||
|
"prepublish": "npm run build",
|
||||||
|
"test": "nyc mocha --opts .mocha.opts \"dist/**/*.spec.js\""
|
||||||
|
},
|
||||||
|
"standard": {
|
||||||
|
"ignore": [
|
||||||
|
"dist/**"
|
||||||
|
],
|
||||||
|
"parser": "babel-eslint"
|
||||||
|
}
|
||||||
|
}
|
47
packages/xo-server-usage-report/src/index.js
Normal file
47
packages/xo-server-usage-report/src/index.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
export const configurationSchema = {
|
||||||
|
type: 'object',
|
||||||
|
|
||||||
|
properties: {
|
||||||
|
emails: {
|
||||||
|
type: 'array',
|
||||||
|
items: {
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
periodicity: {
|
||||||
|
enum: [ 'weekly', 'monthly' ]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
additionalProperties: false,
|
||||||
|
required: [ 'emails', 'periodicity' ]
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===================================================================
|
||||||
|
|
||||||
|
class UsageReportPlugin {
|
||||||
|
constructor (xo) {
|
||||||
|
this._xo = xo
|
||||||
|
this._unset = null
|
||||||
|
}
|
||||||
|
|
||||||
|
configure () {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
load () {
|
||||||
|
// TODO
|
||||||
|
this._unset = this._xo.api.addMethod('generateUsageReport', () => {
|
||||||
|
return 'toto'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
unload () {
|
||||||
|
this._unset()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===================================================================
|
||||||
|
|
||||||
|
export default ({ xo }) => new UsageReportPlugin(xo)
|
13
packages/xo-server-usage-report/src/index.spec.js
Normal file
13
packages/xo-server-usage-report/src/index.spec.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/* eslint-env mocha */
|
||||||
|
|
||||||
|
import expect from 'must'
|
||||||
|
|
||||||
|
// ===================================================================
|
||||||
|
|
||||||
|
import myLib from './'
|
||||||
|
|
||||||
|
// ===================================================================
|
||||||
|
|
||||||
|
describe('myLib', () => {
|
||||||
|
// TODO
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user